双重预防项目-国泰新华二开定制版
马宇豪
2024-06-12 851c8de2af1ee28ef148d0acf132ed4b03071a54
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改定时任务')"/>
    <th:block th:include="include :: datetimepicker-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-job-edit" th:object="${hiddenDangerCheckJob}">
        <input id="jobId" name="jobId" type="hidden" th:field="*{jobId}"/>
 
 
        <input id="createUserId" name="createUserId" type="hidden" th:field="*{createUserId}"/>
        <input id="createUserName" name="createUserName" type="hidden" th:field="*{createUserName}"/>
 
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">排查类型:</label>
            <div class="col-sm-8">
                <select name="troubleshootTypeId" th:field="*{troubleshootTypeId}" class="form-control m-b" required
                        id="troubleshootTypeId">
                    <option value="">请选择</option>
                    <option th:each="troubleshootType : ${troubleshootTypeList}" th:text="${troubleshootType.typeName}"
                            th:value="${troubleshootType.typeId}"
                            th:attr="data-typecyclenum=${troubleshootType.typeCycleNum},data-typecycletype=${troubleshootType.typeCycleType}"></option>
                </select>
            </div>
        </div>
 
 
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">排查周期:</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" id="troubleshootCycleInfo" required readonly="readonly">
            </div>
        </div>
 
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">任务名称:</label>
            <div class="col-sm-8">
                <input class="form-control" th:field="*{jobName}" type="text" name="jobName" id="jobName" required>
            </div>
        </div>
 
 
        <div class="form-group">
            <label class="col-sm-3 control-label  is-required">排查方式:</label>
            <div class="col-sm-8">
                <select name="checkType"   th:field="*{checkType}"    class="form-control m-b" required  id="checkType">
                    <option value="1">基础清单排查</option>
                    <option value="2">选择风险单元清单排查</option>
                </select>
            </div>
        </div>
 
 
 
        <div class="form-group"  style="display:block;" id="basicRiskListInfo">
            <label class="col-sm-3 control-label is-required">基础清单:</label>
            <div class="col-sm-8">
                <select  class="form-control m-b"   th:value="*{riskId}"  id="basicRiskList">
                    <option th:each="basic : ${basicRiskList}"
                            th:text="${basic.riskListName}"
                            th:value="${basic.riskListId}"
                            th:selected="${basic.riskListId+''==hiddenDangerCheckJob.riskId+''}"></option>
                </select>
            </div>
        </div>
 
 
 
        <div class="form-group"  id="riskInfo" >
            <label class="col-sm-3 control-label is-required">风险单元:</label>
            <div class="col-sm-8">
                <input id="riskName" th:value="*{riskName}"  placeholder="选择风险单元"
                       class="form-control" type="text"
                       onclick="selectRiskList()" maxlength="30" readonly="true" required>
                <input id="riskId" th:value="*{riskId}" type="hidden">
                <input id="riskDeptId" th:value="*{riskDeptId}" type="hidden">
                <input id="riskDeptName" th:value="*{riskDeptName}"  type="hidden">
                <input id="riskPlaceId" th:value="*{riskPlaceId}"  type="hidden">
                <input id="riskPlaceName" th:value="*{riskPlaceName}"  type="hidden">
                <input id="riskType" th:value="*{riskType}" type="hidden">
            </div>
        </div>
 
 
 
 
 
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">执行人:</label>
            <div class="col-sm-8">
                <input id="executeUserName"  name="executeUserName"  th:field="*{executeUserName}"  placeholder="选择执行人" class="form-control" type="text"  onclick="selectExecuteUser()" maxlength="30" readonly="true" required>
                <input id="executeUserId" name="executeUserId"  th:field="*{executeUserId}"  type="hidden">
            </div>
        </div>
 
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">执行时间:</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input name="startTime"
                           th:value="${#dates.format(hiddenDangerCheckJob.startTime, 'yyyy-MM-dd HH:mm:ss')}"
                           class="form-control" type="text" readonly="readonly" required>
                </div>
            </div>
        </div>
 
        <input id="jobGroup" name="jobGroup" type="hidden" value="HiddenDangerCheckJobLog"/>
 
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<script th:inline="javascript">
 
 
    /*执行人  选择 start*/
    function selectExecuteUser() {
        var url = ctx + "system/user/selectUserListByParentSonCompany";
        var options = {
            title: '用户选择',
            width: "800",
            url: url,
        };
        $.modal.openOptionsByCallback(options, function (layero, index) {
            var body = layer.getChildFrame('body', index);
            body.on("click", ".selectUser", function () {
                var userId = $(this).data("userid");
                var userName = $(this).data("username");
                $("#executeUserId").val(userId);
                $("#executeUserName").val(userName);
                layer.close(index);
            });
        });
    }
    /*执行人  选择 end*/
 
 
    //切换排查类型
    $("#checkType").on("change", function () {
        var $thisValue = $(this).val();
        if($thisValue == "1"){
            $("#riskInfo").find(":input").attr("disabled", true);
            $("#riskInfo").hide();
            $("#basicRiskListInfo").attr("disabled", false);;//基础清单信息
            $("#basicRiskListInfo").show();
 
        }else if($thisValue == "2"){
            $("#basicRiskListInfo").attr("disabled",true);
            $("#basicRiskListInfo").hide();
            $("#riskInfo").find(":input").attr("disabled", false);
            $("#riskInfo").show();
        }
    });
 
 
 
    $(function () {
        $("#checkType").change();
    });
 
 
    $(function () {
        var hiddenDangerCheckJob = [[${hiddenDangerCheckJob}]];
        var typeCycleNum = hiddenDangerCheckJob.troubleshootTypeCycleNum;
        var typeCycleType = hiddenDangerCheckJob.troubleshootTypeCycleType;
 
        var typeCycleTypeLabel = "";
        if (typeCycleType == "1") {
            typeCycleTypeLabel = "小时";
        } else if (typeCycleType == "2") {
            typeCycleTypeLabel = "日";
        } else if (typeCycleType == "3") {
            typeCycleTypeLabel = "周";
        } else if (typeCycleType == "4") {
            typeCycleTypeLabel = "月";
        } else if (typeCycleType == "5") {
            typeCycleTypeLabel = "年";
        }
 
        var troubleshootCycleInfo = typeCycleNum + typeCycleTypeLabel + "1次";
        $("#troubleshootCycleInfo").val(troubleshootCycleInfo);
    });
 
    $("input[name='startTime']").datetimepicker({
        format: "yyyy-mm-dd hh:ii:ss",
        autoclose: true
    });
 
 
    /*选择风险单元 选择 start*/
    function selectRiskList() {
        var url = ctx + "tr/riskList/selectRiskListByDangerReportMultiple";
        var options = {
            title: '选择风险单元',
            width: "700",
            height: "500",
            url: url,
            callBack: doSubmitSelectRiskList
        };
        $.modal.openOptions(options);
    }
 
    function doSubmitSelectRiskList(index, layero) {
        var rows = layero.find("iframe")[0].contentWindow.$("#bootstrap-table").bootstrapTable('getSelections');
        if (rows.length > 0) {
            var riskId = "";
            var riskName = "";
            var riskDeptId = "";
            var riskDeptName = "";
            var riskPlaceId = "";
            var riskPlaceName = "";
            var riskType = "";
 
            $.each(rows, function (i, row) {
                riskId = riskId!=""  ? riskId + "," + row.riskListId : row.riskListId;
                riskName = riskName!=""  ? riskName + "," + row.riskListName : row.riskListName;
                riskDeptId = riskDeptId!=""  ? riskDeptId + "," + row.deptId : row.deptId;
                riskDeptName = riskDeptName!=""  ? riskDeptName + "," + row.deptName : row.deptName;
                riskPlaceId = riskPlaceId!=""  ? riskPlaceId + "," + row.regionId : row.regionId;
                riskPlaceName = riskPlaceName!=""  ? riskPlaceName + "," + row.regionName : row.regionName;
                riskType = riskType!=""  ? riskType + "," + row.riskType : row.riskType;
            });
 
            $("#riskId").val(riskId);
            $("#riskName").val(riskName);
            $("#riskDeptId").val(riskDeptId);
            $("#riskDeptName").val(riskDeptName);
            $("#riskPlaceId").val(riskPlaceId);
            $("#riskPlaceName").val(riskPlaceName);
            $("#riskType").val(riskType);
            layer.close(index);
        } else {
            $.modal.alertWarning("请至少选择一个风险单元");
        }
    }
    /*选择风险单元 选择 end*/
 
    //切换排查类型显示排查周期
    $("#troubleshootTypeId").on("change", function () {
        var $thisValue = $(this).val();
        if ($thisValue) {
            var typeCycleNum = $(this).find("option:selected").attr('data-typecyclenum');
            var typeCycleType = $(this).find("option:selected").attr('data-typecycletype');
            var typeCycleTypeLabel = "";
            if (typeCycleType == "1") {
                typeCycleTypeLabel = "小时";
            } else if (typeCycleType == "2") {
                typeCycleTypeLabel = "日";
            } else if (typeCycleType == "3") {
                typeCycleTypeLabel = "周";
            } else if (typeCycleType == "4") {
                typeCycleTypeLabel = "月";
            } else if (typeCycleType == "5") {
                typeCycleTypeLabel = "年";
            }
            var troubleshootCycleInfo = typeCycleNum + typeCycleTypeLabel + "1次";
            $("#troubleshootCycleInfo").val(troubleshootCycleInfo);
        } else {
            $("#troubleshootCycleInfo").val("");
        }
    });
 
    var prefix = ctx + "tr/hiddenDangerCheckJob";
 
    $("#form-job-edit").validate({
        onkeyup: false,
        focusCleanup: true
    });
 
    function submitHandler() {
        if ($.validate.form()) {
            var data = $('#form-job-edit').serializeArray();
 
            var troubleshootTypeName = $("select[name='troubleshootTypeId']").find("option:selected").text();//排查类型名称
            data.push({"name": "troubleshootTypeName", "value": troubleshootTypeName});
 
 
            var troubleshootTypeCycleNum = $("#troubleshootTypeId").find("option:selected").attr('data-typecyclenum');
            var troubleshootTypeCycleType = $("#troubleshootTypeId").find("option:selected").attr('data-typecycletype');
            data.push({"name": "troubleshootTypeCycleNum", "value": troubleshootTypeCycleNum});
            data.push({"name": "troubleshootTypeCycleType", "value": troubleshootTypeCycleType});
 
 
 
            var checkType = $("#checkType").val();//排查类型
            if(checkType == "1"){//基础清单排查
                $("#riskInfo").find(":input").attr("disabled", true);
                $("#riskInfo").hide();
                var riskId = $("#basicRiskList").find("option:selected").val();//基础清单文件risk_id
                var riskName = $("#basicRiskList").find("option:selected").text();//基础清单文件risk_name
                data.push({"name": "riskId", "value": riskId});
                data.push({"name": "riskName", "value": riskName});
            }else if(checkType == "2"){//选择风险单元清单排查
                $("#basicRiskListInfo").attr("disabled",true);
                $("#basicRiskListInfo").hide();
 
                var riskId = $("#riskId").val();
                var riskName = $("#riskName").val();
                var riskDeptId = $("#riskDeptId").val();
                var riskDeptName = $("#riskDeptName").val();
                var riskPlaceId = $("#riskPlaceId").val();
                var riskPlaceName = $("#riskPlaceName").val();
                var riskType = $("#riskType").val();
                data.push({"name": "riskId", "value": riskId});
                data.push({"name": "riskName", "value": riskName});
                data.push({"name": "riskDeptId", "value": riskDeptId});
                data.push({"name": "riskDeptName", "value": riskDeptName});
                data.push({"name": "riskPlaceId", "value": riskPlaceId});
                data.push({"name": "riskPlaceName", "value": riskPlaceName});
                data.push({"name": "riskType", "value": riskType});
            }
 
            $.operate.save(prefix + "/edit", data);
        }
    }
</script>
</body>
</html>