linzhijie
2021-04-12 c632636e2f5b4188b430f5efc9d9f68c8dbe3d6d
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
<!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-add">
        <div class="form-group">
            <label class="col-sm-3 control-label">[[#{jsp.exam.report.006}]]:</label>
            <div class="col-sm-8">
                <input name="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}"></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}"></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}"></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" type="hidden">
                    <input name="prodName" id="prodName" class="form-control" readonly type="text" required>
                    <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" 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">任务框架:</label>-->
<!--            <div class="col-sm-8">-->
<!--                <input name="frameTextContentId" class="form-control" type="text">-->
<!--            </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" class="form-control" placeholder="yyyy-MM-dd"
                           type="text">
                </div>
            </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:text="${template}" class="form-control" rows="10" cols="60"></textarea>
            </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">[[#{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']}" ></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">
            </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">
            </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">
            </div>
        </div>
 
        <div class="form-group">
            <label class="col-sm-3 control-label">[[#{jsp.exam.testPackage.autoSendReport}]]:</label>
            <div class="col-sm-8">
                <label class='check-box'><input th:type="checkbox" id="autoSendReport" name="autoSendReport"></label>
            </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:disabled="${role.paramStatus == '0'}" th:checked="${role.flag}">
                        </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"
    $("#form-test_package-add").validate({
        focusCleanup: true
    });
 
    function submitHandler() {
        if ($.validate.form()) {
            if (!$.validate.verifyEmails($('[name="testEmail"]').val())) {
                return;
            }
            if (!verifyCharacter($('[name="position"]').val())) {
                return;
            }
            $.operate.save(prefix + "/add", $('#form-test_package-add').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');
                    }
                }
        }
        })
    }
 
    $(function () {
        $.table.testPackDefault();
    });
</script>
</body>
</html>