cy
2022-06-21 129904537f66509f97b285e7eb4f42b3dc349dd0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8" />
<title>日常巡检配置</title>
    [#include "/business/pages/include/static.html" /]
    [#include "/component/cfgcateSelector.html" /]
</head>
<body>
    <div class="fs_main clearfix">
        <div class="event_fill list_common_select">
            <table>
                <tr>
                    <th width="85%">
                        <div class="fill_item">
                            <label>配置名称:</label><input class="general" type="text" id="ciName" />
                        </div>
                        <div class="fill_item"><label>配置分类:</label>[@cfgcate id="full_cate_id" name="full_cate_name" /]</div>
                        <div class="fill_item">
                            <label>${Constants.UNIT_CONSTANTS}:</label> <input class="general" type="text" name="sub_customer_name" id="sub_customer_name" value="" readOnly onclick="subCus();" /> <input type="hidden" name="sub_customer_id" id="sub_customer_id" />
                        </div>
                    </th>
                    <td width="15%">
                        <a class="retrievebtn focus" onclick="query();">查询</a> <a class="retrievebtn" id="reset" href="javascript:window.location.reload(true);">重置</a>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div class="fs_main clearfix">
        <div id="main"></div>
    </div>
    <script type="text/javascript">
        var nowPage = 1;
        var customerId = '${RequestParameters.customerId}';
        function query() {
            var ciName = $.trim($("#ciName").val());
            var cateId = $.trim($("#full_cate_id").val());
            if(cateId!=''){
                cateId = cateId.substring(cateId.lastIndexOf("-")+1);
            }
            var sub_customer_id = $.trim($("#sub_customer_id").val());
            var param = {
                "customerId" : customerId,
                "ciName" : ciName,
                "cateId" : cateId,
                "sub_customer_id" : sub_customer_id
            };
            
            pagination("${base}/business/pages/customerconfig/slacustomer/addDevicesData.html","${base}/business/pages/customerconfig/slacustomer/addDevicesCount.html","main","pagination",{cpage:nowPage,psize:10},param,function(data,page) {
                nowPage = page;
            });
            
        /*     $.post(
                "${base}/business/pages/customerconfig/slacustomer/addDevices.html",
                param, function(data, textStatus) {
                $("#main").html(data);
            }) */
        }
 
        function onDialogBtnClick(btnID, dialogID, config) {
            if (btnID == "btnSure") {
                var $checkCheckbox = $(":checkbox.device:checked");
                var len = $checkCheckbox.length;
                if (len == 0) {
                    popupTips("请至少选择一个配置");
                    return;
                }
 
                var ciAry = [];
                $checkCheckbox.each(function(index) {
                    if (index >= 0) {
                        var ci = {};
                        ci['id'] = $(this).val();
                        ci['cus_id'] = $(this).next().val();
                        ci['sub_cus_id'] = $(this).next().next().val();
                        ciAry.push(ci);
                    }
                });
 
                var ciAryStr = JSON.stringify(ciAry);
                $.post("${base}/business/pages/customerconfig/slacustomer/saveDailyDevice.html",
                                {
                                    "ciAryStr" : ciAryStr
                                }, function(data, textStatus) {
                                    if (data == 1) {
                                        window.top.popupTips("新增成功");
                                        window.parent.query(1);
                                        window.top.hideDialog('0');
                                    } else {
                                        popupTips("新增失败");
                                    }
                                }) 
 
            }
        }
 
        function selOrCancel() {
            if ($("#selOrCancel").attr("checked")) {
                $("input[name=device]").attr("checked", true);
            } else {
                $("input[name=device]").attr("checked", false);
            }
        }
 
        function subCus() {
 
            var sub_customer_id = $("#sub_customer_id").val();
 
            var url = "${base}/business/pages/servicelist/slaproject/subCus.html?type=3&customerId="
                    + customerId + "&subCustomerId=" + sub_customer_id;
            window.top.openDialog("selectSubCus", "操作", {}, {
                "width" : 80,
                "height" : 80
            }, [ {
                btnId : "btnSure",
                btnName : "确定",
                btnStyle : "bluebtn"
            } ], url);
        }
 
        function showCus(labelId, labelName) {
            $("#sub_customer_name").val(labelName);
            $("#sub_customer_id").val(labelId);
        }
 
        $(function() {
            query();
            $(":checkbox.selectItem")
                    .live(
                            "click",
                            function() {
                                var tableCheckboxLen = $(":checkbox.selectItem").length;
                                var tableCheckboxCheckedLen = $(":checkbox.selectItem:checked").length;
                                $("#selOrCancel")
                                        .attr(
                                                "checked",
                                                (tableCheckboxLen == tableCheckboxCheckedLen));
                            });
 
        })
    </script>
</body>
</html>