linzhijie
2021-04-12 3a8e1524dcf0eeb610d38123d5f0a3ef838379cd
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
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
<!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" />
    <th:block th:include="include :: select2-css" />
    <th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-test_package-edit" th:object="${entTestPackage}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">[[#{jsp.exam.report.006}]]:</label>
                <div class="col-sm-8">
                    <input name="testName" th:field="*{testName}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">[[#{basis.type}]]:</label>
                <div class="col-sm-8">
                    <select name="testType" class="form-control m-b" th:with="type=${@dict.getType('test_type')}" onchange="testTypeChange()">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{testType}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">[[#{basis.area}]]:</label>
                <div class="col-sm-8">
                    <select name="testArea" class="form-control m-b" th:with="type=${@dict.getType('test_area')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{testArea}"></option>
                    </select>
                </div>
            </div>
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">[[#{jsp.exam.test_package.001}]]:</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <select name="langType" class="form-control m-b" th:with="type=${@dict.getType('lang_type')}">-->
<!--                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{langType}"></option>-->
<!--                    </select>-->
<!--                </div>-->
<!--            </div>-->
            <div class="form-group">
                <label class="col-sm-3 control-label">[[#{jsp.exam.test_package.002}]]:</label>
                <div class="col-sm-8">
                    <div class='input-group'>
                        <input name="prodId" id="prodId" class="form-control" th:field="*{prodId}"  type="hidden">
                        <input name="prodName" id="prodName" class="form-control" th:field="*{prodName}" readonly type="text">
                        <span class='input-group-addon input-sm' onclick='selectProdTree()'><i class='fa fa-search'></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">[[#{jsp.exam.test_package.003}]]:</label>
                <div class="col-sm-8">
                    <input name="testEmail" th:field="*{testEmail}" class="form-control" type="text" th:placeholder="#{jsp.exam.distributor.hrEmail.warn}">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">[[#{jsp.exam.test_package.004}]]:</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="invalidTime" th:value="${#dates.format(entTestPackage.invalidTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">[[#{basis.state}]]:</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('test_status')}">
                        <input type="radio" th:id="${dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}" required>
                        <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
 
            <!--测试者邀请邮件模板 -->
            <input name="CNTemplate" id="CNTemplate" th:value="${eet.inviteCnTemplate}" class="form-control" type="hidden">
            <input name="USTemplate" id="USTemplate" th:value="${eet.inviteUsTemplate}" class="form-control" type="hidden">
            <input name="THTemplate" id="THTemplate" th:value="${eet.inviteThTemplate}" class="form-control" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label">[[#{jsp.exam.package.langtype}]]:</label>
                <div class="col-sm-8">
                    <select name="templateLangType" id="templateLangType" class="form-control noselect2 selectpicker" th:with="type=${@dict.getType('lang_type')}" multiple>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">[[#{jsp.exam.test_package.005}]]:</label>
                <div class="col-sm-8">
                    <textarea id="template" name="template" th:field="*{template}" class="form-control"  rows="10" cols="60"></textarea>
                </div>
            </div>
 
            <!--HR邮件模板 -->
            <input name="HrCNTemplate" id="HrCNTemplate" th:value="${eet.hrCnTemplate}" class="form-control" type="hidden">
            <input name="HrUSTemplate" id="HrUSTemplate" th:value="${eet.hrUsTemplate}" class="form-control" type="hidden">
            <input name="HrTHTemplate" id="HrTHTemplate" th:value="${eet.hrThTemplate}" class="form-control" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label">[[#{jsp.exam.package.langtype}]]:</label>
                <div class="col-sm-8">
                    <select name="hrTemplateLangType" id="hrTemplateLangType" class="form-control noselect2 selectpicker" th:with="type=${@dict.getType('lang_type')}" multiple>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">[[#{jsp.exam.test_package.hrinvitationEmailContent}]]:</label>
                <div class="col-sm-8">
                    <textarea id="hrTemplate" name="hrTemplate" th:text="*{hrTemplate}" class="form-control" rows="10" cols="60" ></textarea>
                </div>
            </div>
 
            <div class="form-group">
                <label class="col-sm-3 control-label">[[#{basis.remark}]]:</label>
                <div class="col-sm-8">
                    <textarea id="remark" name="remark" th:field="*{remark}" class="form-control" ></textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">[[#{jsp.exam.productReportTemplate}]]:</label>
                <div class="col-sm-8">
                    <select id="reportTemplateId" name="reportTemplateId" class="form-control noselect2 selectpicker" multiple required>
                        <option th:each="dict : ${templateList}" th:text="${dict['reportType']}"
                                th:value="${dict['id']}" th:field="*{reportTemplateId}"></option>
                    </select>
                </div>
            </div>
 
            <!--岗位-->
            <div class="form-group jaq-div" hidden>
                <label class="col-sm-3 control-label">[[#{jsp.exam.testPackage.position}]]:</label>
                <div class="col-sm-8">
                    <input name="position" class="form-control" type="text" th:field="*{position}">
                </div>
            </div>
 
            <div class="form-group jaq-div" hidden>
                <label class="col-sm-3 control-label">[[#{jsp.exam.testPackage.professionalCategory}]]:</label>
                <div class="col-sm-8">
                    <input name="professionalCategory" class="form-control" type="text" th:field="*{professionalCategory}">
                </div>
            </div>
 
            <div class="form-group jaq-div" hidden>
                <label class="col-sm-3 control-label">[[#{jsp.exam.testPackage.superiorPosition}]]:</label>
                <div class="col-sm-8">
                    <input name="superiorPosition" class="form-control" type="text" th:field="*{superiorPosition}">
                </div>
            </div>
 
            <!-- 测试者接收报告邮件 -->
            <input name="TesterCNTemplate" id="TesterCNTemplate" th:value="${eet.memberCnTemplate}" class="form-control" type="hidden">
            <input name="TesterUSTemplate" id="TesterUSTemplate" th:value="${eet.memberUsTemplate}" class="form-control" type="hidden">
            <input name="TesterTHTemplate" id="TesterTHTemplate" th:value="${eet.memberThTemplate}" class="form-control" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label">[[#{jsp.exam.testPackage.autoSendReport}]]:</label>
                <div class="col-sm-8">
                    <input th:type="checkbox" id="autoSendReport" name="autoSendReport" onchange="isSelectAutoSendReport()" th:checked="*{autoSendReport}" >
                </div>
            </div>
            <div class="form-group" id="memberTemplateLangTypeDiv" th:style="'display:' + @{(*{autoSendReport} ? 'block' : 'none')} + ''">
                <label class="col-sm-3 control-label">[[#{jsp.exam.package.langtype}]]:</label>
                <div class="col-sm-8">
                    <select name="memberTemplateLangType" id="memberTemplateLangType" class="form-control noselect2 selectpicker" th:with="type=${@dict.getType('lang_type')}" multiple>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group" id="memberTemplateDiv" th:style="'display:' + @{(*{autoSendReport} ? 'block' : 'none')} + ''">
                <label class="col-sm-3 control-label">[[#{jsp.exam.test_package.memberEmailContent}]]:</label>
                <div class="col-sm-8">
                    <textarea id="memberTemplate" name="memberTemplate" th:text="*{memberTemplate}" class="form-control" rows="10" cols="60"></textarea>
                </div>
            </div>
 
            <div class="row">
                <div class="col-sm-12">
                    <div class="form-group">
                        <label class="col-xs-2 control-label">[[#{jsp.exam.demographyParam.demographicname}]]:</label>
                        <div class="col-xs-10">
                            <label th:each="role:${roles}" class="check-box">
                                <input name="paramCodes" id="paramCodes" type="checkbox" th:value="${role.paramId}" th:text="${role.paramCode}" th:checked="${role.flag}" th:disabled="${role.paramStatus == '0'}">
                            </label>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: select2-js" />-->
    <th:block th:include="include :: bootstrap-select-js" />
    <script type="text/javascript">
        var prefix = ctx + "exam/test_package";
        var reportTemplateId = '[[${entTestPackage.reportTemplateId}]]';
 
        $('.check-box').click(function(){
            alert(1);
        })
 
        $(document).ready(function () {
            //回写select
            var arr=reportTemplateId.split(',');
            $('#reportTemplateId').selectpicker('val', arr);
            $.table.testPackDefault();
        });
 
        $("#form-test_package-edit").validate({
            focusCleanup: true
        });
 
        function submitHandler() {
            if ($.validate.form()) {
                if (!$.validate.verifyEmails($('[name="testEmail"]').val())) {
                    return;
                }
                if (!verifyCharacter($('[name="position"]').val())) {
                    return;
                }
                $.operate.save(prefix + "/edit", $('#form-test_package-edit').serialize());
            }
        }
 
        $("input[name='invalidTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
        function verifyCharacter (text) {
            if (text == null || text == undefined || text.trim() == "") {
                return true;
            }
            var regEn = /[`~!@#$%^&*()_+<>?:"{},.\/;'[\]]/im,
                regCn = /[·!#¥(——):;“”‘、,|《。》?、【】[\]]/im
            if(regEn.test(text) || regCn.test(text)) {
                $.modal.alertWarning('[[#{the.name.cannot.contain.special.characters}]]');
                return false;
            }
            return true;
        }
        // 选择字典处理函数
        function selectProdTree() {
            var url = ctx + "exam/product/getProdList?langType=" + $('[name="langType"]').val() + "&testType=" + $('[name="testType"]').val();
            var options = {
                title: 'select',
                width: "380",
                url: url,
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }
 
        function testTypeChange() {
            $('[name="prodId"]').val("")
            $('[name="prodName"]').val("")
        }
 
        function doSubmit(index, layero){
            var body = layer.getChildFrame('body', index);
            var dictType = body.find('#dictType').val();
            var prodName = body.find('#prodName').val();
            layer.close(index);
            $("#prodId").val(dictType);
            $("#prodName").val(prodName);
            $.ajax({
                url: prefix + "/prodTemplate",
                data: {"prodId":dictType},
                type: "post",
                success: function(result) {
                    if (result.code == 0) {
                        var modelList = result.data;
                        if (modelList && modelList.length != 0) {
                            $("#reportTemplateId").empty();
                            for (var i = 0; i < modelList.length; i++) {
                                var option = "<option value=\"" + modelList[i].id + "\"";
                                option += ">" + modelList[i].reportType + "</option>";  //动态添加数据
                                $('#reportTemplateId').append(option);
                            }
                            //使用refresh方法更新UI以匹配新状态。
                            $('#reportTemplateId').selectpicker('refresh');
                            //render方法强制重新渲染引导程序 - 选择ui。
                            $('#reportTemplateId').selectpicker('render');
                            var arr=reportTemplateId.split(',');
                            $('#reportTemplateId').selectpicker('val', arr);
                        }
                    }
                }
        })};
 
        function isSelectAutoSendReport() {
            if($("#autoSendReport").prop("checked") == true){
                $('#memberTemplateLangTypeDiv').attr("style","display:block;");
                $('#memberTemplateDiv').attr("style","display:block;");
            }else{
                $('#memberTemplateLangTypeDiv').attr("style","display:none;");
                $('#memberTemplateDiv').attr("style","display:none;");
            }
        }
 
        /**
         * 遍历邀请测试者通知模板
         */
        $("#templateLangType").change(function(){
            var opt = $("#templateLangType").val();
            //没有选中
            if (opt == null){
                $('[name="template"]').val("");
            }else{
                //选中后拼接语言赋值模板
                var template = "";
                $('[name="template"]').val(template);
                for(var i = 0;i < opt.length;i++){
                    if(opt[i] == 'Chinese'){
                        template += $("#CNTemplate").val()+"\n\n";
                    }else if(opt[i] == 'English'){
                        template += $("#USTemplate").val()+"\n\n";
                    }else if(opt[i] == 'Thai'){
                        template += $("#THTemplate").val()+"\n\n";
                    }
                }
                //去掉最后面的换行符\n
                template = template.slice(0,-2);
                $('[name="template"]').val(template);
            }
        });
 
        /**
         * HR通知模板
         */
        $("#hrTemplateLangType").change(function(){
            var opt = $("#hrTemplateLangType").val();
            //没有选中
            var isEdit;
            if (opt == null) {
                $('[name="hrTemplate"]').val("");
            } else {
                //选中后拼接语言赋值模板
                var hrTemplate = "";
                $('[name="hrTemplate"]').val(hrTemplate);
                for (var i = 0; i < opt.length; i++) {
                    if (opt[i] == 'Chinese') {
                        hrTemplate += $("#HrCNTemplate").val() +"\n\n";
                    } else if (opt[i] == 'English') {
                        hrTemplate += $("#HrUSTemplate").val() +"\n\n";
                    } else if (opt[i] == 'Thai') {
                        hrTemplate += $("#HrTHTemplate").val() +"\n\n";
                    }
                }
                //去掉最后面的换行符\n
                hrTemplate = hrTemplate.slice(0, -2);
                $('[name="hrTemplate"]').val(hrTemplate);
            }
        });
 
        /**
         * 测试者通知模板
         */
        $("#memberTemplateLangType").change(function(){
            var opt = $("#memberTemplateLangType").val();
            //没有选中
            var isEdit;
            if (opt == null) {
                $('[name="memberTemplate"]').val("");
            } else {
                //选中后拼接语言赋值模板
                var memberTemplate = "";
                $('[name="memberTemplate"]').val(memberTemplate);
                for (var i = 0; i < opt.length; i++) {
                    if (opt[i] == 'Chinese') {
                        memberTemplate += $("#TesterCNTemplate").val() +"\n\n";
                    } else if (opt[i] == 'English') {
                        memberTemplate += $("#TesterUSTemplate").val() +"\n\n";
                    } else if (opt[i] == 'Thai') {
                        memberTemplate += $("#TesterTHTemplate").val() +"\n\n";
                    }
                }
                //去掉最后面的换行符\n
                memberTemplate = memberTemplate.slice(0, -2);
                $('[name="memberTemplate"]').val(memberTemplate);
            }
        });
    </script>
</body>
</html>