|
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+var ns;
|
|
|
2
|
+var id = helper.request.queryString("id");
|
|
|
3
|
+var phone = helper.request.queryString("phone");
|
|
|
4
|
+var depName = helper.request.queryString("depName");
|
|
|
5
|
+var CusName = helper.request.queryString("CusName");
|
|
|
6
|
+var objs = {};
|
|
|
7
|
+$.ajax({
|
|
|
8
|
+ type: "get",
|
|
|
9
|
+ url: huayi.config.callcenter_url + "CallInScreen/GetCurrUserDep",
|
|
|
10
|
+ dataType: 'json',
|
|
|
11
|
+ async: true,
|
|
|
12
|
+ data: {
|
|
|
13
|
+ token: $.cookie("token")
|
|
|
14
|
+ },
|
|
|
15
|
+ success: function(data) {
|
|
|
16
|
+ if(data.state.toLowerCase() == 'success') {
|
|
|
17
|
+ if(data.data.groname == '客服组') {
|
|
|
18
|
+ //console.log(data.data.groname)
|
|
|
19
|
+ $('.customerService').show();
|
|
|
20
|
+ ns = 1;
|
|
|
21
|
+ } else {
|
|
|
22
|
+ $('.market').show();
|
|
|
23
|
+ ns = 2;
|
|
|
24
|
+ }
|
|
|
25
|
+ }
|
|
|
26
|
+ }
|
|
|
27
|
+});
|
|
|
28
|
+$(document).ready(function() {
|
|
|
29
|
+ //工单来源
|
|
|
30
|
+ getOrderSource();
|
|
|
31
|
+ //工单类型
|
|
|
32
|
+ getOrderType();
|
|
|
33
|
+ //工单状态
|
|
|
34
|
+ getOrderState();
|
|
|
35
|
+ //来电单位
|
|
|
36
|
+ $('#testInput1').comboSelect();
|
|
|
37
|
+ $('#testInput2').comboSelect();
|
|
|
38
|
+ $('#testInput3').comboSelect();
|
|
|
39
|
+ $('#testInput4').comboSelect();
|
|
|
40
|
+ //编辑器配置 客服部
|
|
|
41
|
+ KindEditor.ready(function(K) {
|
|
|
42
|
+ window.changeEditor = K.create('#feedBackCon'); //修改弹出框编辑器
|
|
|
43
|
+ })
|
|
|
44
|
+ //编辑器配置 市场部 备注
|
|
|
45
|
+ KindEditor.ready(function(K) {
|
|
|
46
|
+ window.marketEditor = K.create('#remark_market');
|
|
|
47
|
+ })
|
|
|
48
|
+ //保存
|
|
|
49
|
+ $('.customerSubmit').click(function() {
|
|
|
50
|
+ saveCustomer();
|
|
|
51
|
+ })
|
|
|
52
|
+ $('.marketSubmit').click(function() {
|
|
|
53
|
+ saveMarket();
|
|
|
54
|
+ })
|
|
|
55
|
+ if(id) {
|
|
|
56
|
+ $("#CallID").val(id);
|
|
|
57
|
+ $("#tel").val(phone);
|
|
|
58
|
+ $("#tel_market").val(phone); //CusName
|
|
|
59
|
+ if(unescape(decodeURI(CusName)) != 'null' && unescape(decodeURI(CusName)) != 'undefined') {
|
|
|
60
|
+ $("#name_market").val(unescape(decodeURI(CusName)));
|
|
|
61
|
+ $("#name").val(unescape(decodeURI(CusName)));
|
|
|
62
|
+ }
|
|
|
63
|
+ if(unescape(decodeURI(depName)) != 'null' && unescape(decodeURI(depName)) != 'undefined') {
|
|
|
64
|
+ $("#testInput1_input").val(unescape(decodeURI(depName)));
|
|
|
65
|
+ $("#testInput3_input").val(unescape(decodeURI(depName)));
|
|
|
66
|
+ BindLDdep($("#testInput1"),$("#testInput2"),$("#testInput3"),$("#testInput4"),unescape(decodeURI(depName)))
|
|
|
67
|
+ }else{
|
|
|
68
|
+ BindLDdep($("#testInput1"),$("#testInput2"),$("#testInput3"),$("#testInput4"),'')
|
|
|
69
|
+ }
|
|
|
70
|
+
|
|
|
71
|
+}else{
|
|
|
72
|
+ BindLDdep($("#testInput1"),$("#testInput2"),$("#testInput3"),$("#testInput4"),'');
|
|
|
73
|
+}
|
|
|
74
|
+})
|
|
|
75
|
+
|
|
|
76
|
+//工单类型
|
|
|
77
|
+function getOrderType() {
|
|
|
78
|
+ $.get(huayi.config.callcenter_url + 'WorkType/GetTreeList', {
|
|
|
79
|
+ "token": $.cookie("token"),
|
|
|
80
|
+ }, function(result) {
|
|
|
81
|
+ result = $.parseJSON(result);
|
|
|
82
|
+ $.fn.zTree.init($("#TreeDemo"), setting3, result.data); //实例化树形图
|
|
|
83
|
+ $.fn.zTree.init($("#TreeDemo_market"), setting3, result.data); //实例化树形图
|
|
|
84
|
+ });
|
|
|
85
|
+}
|
|
|
86
|
+var setting3 = {
|
|
|
87
|
+ data: {
|
|
|
88
|
+ key: {
|
|
|
89
|
+ name: "text"
|
|
|
90
|
+ },
|
|
|
91
|
+ simpleData: {
|
|
|
92
|
+ enable: true,
|
|
|
93
|
+ idKey: "id",
|
|
|
94
|
+ rootPId: 0
|
|
|
95
|
+ }
|
|
|
96
|
+ },
|
|
|
97
|
+ callback: {
|
|
|
98
|
+ onClick: changeTreeClick
|
|
|
99
|
+ }
|
|
|
100
|
+}
|
|
|
101
|
+
|
|
|
102
|
+function changeTreeClick(event, treeId, treeNode) {
|
|
|
103
|
+ if (treeNode.level == 2) {
|
|
|
104
|
+ var chanId = treeNode.id;
|
|
|
105
|
+ var changeName = treeNode.text;
|
|
|
106
|
+ $('#typeclass').val(changeName);
|
|
|
107
|
+ $('#typeclass_market ').val(changeName);
|
|
|
108
|
+ $('#typeclassId').val(chanId);
|
|
|
109
|
+ $('#typeclassId_market').val(chanId);
|
|
|
110
|
+ var pidnode = treeNode.getParentNode();
|
|
|
111
|
+ $('.addTree').hide();
|
|
|
112
|
+ }
|
|
|
113
|
+};
|
|
|
114
|
+
|
|
|
115
|
+$('.down').click(function() {
|
|
|
116
|
+ if($('.treeList').css('display') == 'block') {
|
|
|
117
|
+ $('.treeList').css('display', 'none')
|
|
|
118
|
+ } else {
|
|
|
119
|
+ $('.treeList').css('display', 'block')
|
|
|
120
|
+ }
|
|
|
121
|
+})
|
|
|
122
|
+$('#typeclass').click(function() {
|
|
|
123
|
+ $('.treeList').css('display', 'block')
|
|
|
124
|
+})
|
|
|
125
|
+$('.treeList').mouseleave(function() {
|
|
|
126
|
+ $(this).css('display', 'none')
|
|
|
127
|
+})
|
|
|
128
|
+$('#typeclass_market').click(function() {
|
|
|
129
|
+ $('.treeList_market').css('display', 'block')
|
|
|
130
|
+})
|
|
|
131
|
+$('.treeList_market').mouseleave(function() {
|
|
|
132
|
+ $(this).css('display', 'none')
|
|
|
133
|
+})
|
|
|
134
|
+//工单状态
|
|
|
135
|
+function getOrderState() {
|
|
|
136
|
+ $.ajax({
|
|
|
137
|
+ url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
|
|
|
138
|
+ type: 'get',
|
|
|
139
|
+ async: true,
|
|
|
140
|
+ data: {
|
|
|
141
|
+ flag: 'GDZT',
|
|
|
142
|
+ token: $.cookie("token")
|
|
|
143
|
+ },
|
|
|
144
|
+ dataType: "json",
|
|
|
145
|
+ success: function(res) {
|
|
|
146
|
+ if(res.state == "success") {
|
|
|
147
|
+ //console.log(res.data);
|
|
|
148
|
+ $('<option value="">全部</option>').appendTo($("#State"));
|
|
|
149
|
+ $(res.data).each(function(i, n) {
|
|
|
150
|
+ if(n.F_DictionaryValueId == '472') {
|
|
|
151
|
+ $('<option value="' + n.F_DictionaryValueId + '" selected="selected">' + n.F_Name + '</option>').appendTo($("#State"));
|
|
|
152
|
+ } else {
|
|
|
153
|
+ $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#State"));
|
|
|
154
|
+ }
|
|
|
155
|
+ })
|
|
|
156
|
+ //
|
|
|
157
|
+ }
|
|
|
158
|
+
|
|
|
159
|
+ }
|
|
|
160
|
+ })
|
|
|
161
|
+}
|
|
|
162
|
+//工单来源
|
|
|
163
|
+function getOrderSource(obj) {
|
|
|
164
|
+ $.ajax({
|
|
|
165
|
+ type: "get",
|
|
|
166
|
+ url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
|
|
|
167
|
+ dataType: 'json',
|
|
|
168
|
+ async: true,
|
|
|
169
|
+ data: {
|
|
|
170
|
+ token: $.cookie("token"),
|
|
|
171
|
+ flag: "GDLY"
|
|
|
172
|
+ },
|
|
|
173
|
+ success: function(data) {
|
|
|
174
|
+ var Count = data.data;
|
|
|
175
|
+ $('<option value="">全部</option>').appendTo($("#DicValueList"));
|
|
|
176
|
+ $(Count).each(function(i, n) {
|
|
|
177
|
+ if(n.F_DictionaryValueId == "468") {
|
|
|
178
|
+ $('<option value="' + n.F_DictionaryValueId + '" selected="selected">' + n.F_Name + '</option>').appendTo($("#DicValueList"));
|
|
|
179
|
+ $('<option value="' + n.F_DictionaryValueId + '" selected="selected">' + n.F_Name + '</option>').appendTo($("#DicValueList_market"));
|
|
|
180
|
+ } else {
|
|
|
181
|
+ $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#DicValueList"));
|
|
|
182
|
+ $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#DicValueList_market"));
|
|
|
183
|
+ }
|
|
|
184
|
+
|
|
|
185
|
+ })
|
|
|
186
|
+ }
|
|
|
187
|
+ });
|
|
|
188
|
+}
|
|
|
189
|
+
|
|
|
190
|
+function BindLDdep(obj1,obj2,obj3,obj4,res1) {
|
|
|
191
|
+ $.ajax({
|
|
|
192
|
+ type: "get",
|
|
|
193
|
+ url: huayi.config.callcenter_url + "Customer/BindLDdep",
|
|
|
194
|
+ dataType: 'json',
|
|
|
195
|
+ async: true,
|
|
|
196
|
+ data: {
|
|
|
197
|
+// keypara: str,
|
|
|
198
|
+ token: $.cookie("token")
|
|
|
199
|
+ },
|
|
|
200
|
+ success: function(data) {
|
|
|
201
|
+ var Count = data.data.dep;
|
|
|
202
|
+ var html = '',html2 = '';
|
|
|
203
|
+ if(res1){
|
|
|
204
|
+ $("<option value='" + res1 + "' selected>" + res1 + "</option>").appendTo(obj1);
|
|
|
205
|
+ $("<option value='" + res1 + "' selected>" + res1 + "</option>").appendTo(obj3);
|
|
|
206
|
+ }
|
|
|
207
|
+ $(Count).each(function(i, n) {
|
|
|
208
|
+ html = "<option value='" + n + "'>" + n + "</option>";
|
|
|
209
|
+ if(n!==res1){
|
|
|
210
|
+ html2 = "<option value='" + n + "'>" + n + "</option>";
|
|
|
211
|
+ }
|
|
|
212
|
+ $(html2).appendTo(obj1);
|
|
|
213
|
+ $(html2).appendTo(obj3);
|
|
|
214
|
+ $(html).appendTo(obj2);
|
|
|
215
|
+ $(html).appendTo(obj4);
|
|
|
216
|
+ });
|
|
|
217
|
+ obj1.comboSelect();
|
|
|
218
|
+ obj2.comboSelect();
|
|
|
219
|
+ obj3.comboSelect();
|
|
|
220
|
+ obj4.comboSelect();
|
|
|
221
|
+ }
|
|
|
222
|
+ });
|
|
|
223
|
+ };
|
|
|
224
|
+//客服部保存
|
|
|
225
|
+function saveCustomer() {
|
|
|
226
|
+ if($('#name').val() == '') {
|
|
|
227
|
+ layer.confirm('请输入姓名!', {
|
|
|
228
|
+ icon: 2,
|
|
|
229
|
+ btn: ['确定']
|
|
|
230
|
+ });
|
|
|
231
|
+ return;
|
|
|
232
|
+ }
|
|
|
233
|
+ if($('#tel').val() == '') {
|
|
|
234
|
+ layer.confirm('请输入电话!', {
|
|
|
235
|
+ icon: 2,
|
|
|
236
|
+ btn: ['确定']
|
|
|
237
|
+ });
|
|
|
238
|
+ return;
|
|
|
239
|
+ }
|
|
|
240
|
+ if($.trim($('#testInput1_input').val()) == '') {
|
|
|
241
|
+ layer.confirm('请选择来电单位!', {
|
|
|
242
|
+ icon: 2,
|
|
|
243
|
+ btn: ['确定']
|
|
|
244
|
+ });
|
|
|
245
|
+ return;
|
|
|
246
|
+ }
|
|
|
247
|
+ if($.trim($('#testInput2_input').val()) == '') {
|
|
|
248
|
+ layer.confirm('请选择反馈单位!', {
|
|
|
249
|
+ icon: 2,
|
|
|
250
|
+ btn: ['确定']
|
|
|
251
|
+ });
|
|
|
252
|
+ return;
|
|
|
253
|
+ }
|
|
|
254
|
+ if($('#DicValueList').val() == '') {
|
|
|
255
|
+ layer.confirm('请选择工单来源!', {
|
|
|
256
|
+ icon: 2,
|
|
|
257
|
+ btn: ['确定']
|
|
|
258
|
+ });
|
|
|
259
|
+ return;
|
|
|
260
|
+ }
|
|
|
261
|
+ if($('#State').val() == '') {
|
|
|
262
|
+ layer.confirm('请选择工单状态!', {
|
|
|
263
|
+ icon: 2,
|
|
|
264
|
+ btn: ['确定']
|
|
|
265
|
+ });
|
|
|
266
|
+ return;
|
|
|
267
|
+ }
|
|
|
268
|
+ if($('#typeclassId').val() == '') {
|
|
|
269
|
+ layer.confirm('请选择工单类型!', {
|
|
|
270
|
+ icon: 2,
|
|
|
271
|
+ btn: ['确定']
|
|
|
272
|
+ });
|
|
|
273
|
+ return;
|
|
|
274
|
+ }
|
|
|
275
|
+ $.ajax({
|
|
|
276
|
+ type: "post",
|
|
|
277
|
+ url: huayi.config.callcenter_url + "CallInScreen/AddWorkOrder",
|
|
|
278
|
+ dataType: 'json',
|
|
|
279
|
+ async: true,
|
|
|
280
|
+ beforeSend: function() { //触发ajax请求开始时执行
|
|
|
281
|
+ $('.customerSubmit').attr("disabled", true);
|
|
|
282
|
+ $('.customerSubmit').text('保存中...');
|
|
|
283
|
+ },
|
|
|
284
|
+ data: {
|
|
|
285
|
+ token: $.cookie("token"),
|
|
|
286
|
+ callCustomer: $('#name').val(), //姓名
|
|
|
287
|
+ tel: $('#tel').val(), //号码
|
|
|
288
|
+ lddep: $('#testInput1_input').val(), //来电单位
|
|
|
289
|
+ fkdep: $('#testInput2_input').val(), //反馈单位
|
|
|
290
|
+ gdly: $('#DicValueList').val(), //工单来源
|
|
|
291
|
+ gdlx: $('#typeclassId').val(), //工单类型id
|
|
|
292
|
+ gdzt: $('#State').val(), //工单状态id
|
|
|
293
|
+ province: $("#Province").val(),
|
|
|
294
|
+ fkcont: helper.HtmlUtil.htmlEncodeByRegExp(changeEditor.html()), //反馈内容
|
|
|
295
|
+ sendmsg: $('#express').val(), //快递信息
|
|
|
296
|
+ note1: $('#remark1').val(), //备注一
|
|
|
297
|
+ note2: $('#remark2').val(), //备注二
|
|
|
298
|
+ note3: $('#remark3').val(), //备注三
|
|
|
299
|
+ callid: $("#CallID").val()
|
|
|
300
|
+ },
|
|
|
301
|
+ success: function(data) {
|
|
|
302
|
+ if(data.state.toLowerCase() == 'success') {
|
|
|
303
|
+ if (id) {
|
|
|
304
|
+ console.log(parent.layer.getFrameIndex);
|
|
|
305
|
+ var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
|
|
|
306
|
+ parent.layer.close(index); //再执行关闭
|
|
|
307
|
+ parent.$('#list').bootstrapTable('refresh');
|
|
|
308
|
+ var savemsgs = '保存成功';
|
|
|
309
|
+ clear();
|
|
|
310
|
+ $('.customerSubmit').attr("disabled", false);
|
|
|
311
|
+ $('.customerSubmit').text('保存');
|
|
|
312
|
+ parent.layer.msg(savemsgs);
|
|
|
313
|
+ }else{
|
|
|
314
|
+ layer.msg("保存成功!");
|
|
|
315
|
+ clear();
|
|
|
316
|
+ $('.customerSubmit').attr("disabled", false);
|
|
|
317
|
+ $('.customerSubmit').text('保存');
|
|
|
318
|
+ }
|
|
|
319
|
+
|
|
|
320
|
+ }
|
|
|
321
|
+ }
|
|
|
322
|
+ });
|
|
|
323
|
+
|
|
|
324
|
+}
|
|
|
325
|
+// 市场部保存
|
|
|
326
|
+function saveMarket() {
|
|
|
327
|
+ if($('#name_market').val() == '') {
|
|
|
328
|
+ layer.confirm('请输入姓名!', {
|
|
|
329
|
+ icon: 2,
|
|
|
330
|
+ btn: ['确定']
|
|
|
331
|
+ });
|
|
|
332
|
+ return;
|
|
|
333
|
+ }
|
|
|
334
|
+ if($('#tel_market').val() == '') {
|
|
|
335
|
+ layer.confirm('请输入电话!', {
|
|
|
336
|
+ icon: 2,
|
|
|
337
|
+ btn: ['确定']
|
|
|
338
|
+ });
|
|
|
339
|
+ return;
|
|
|
340
|
+ }
|
|
|
341
|
+ if($.trim($('#testInput3_input').val()) == '') {
|
|
|
342
|
+ layer.confirm('请选择来电单位!', {
|
|
|
343
|
+ icon: 2,
|
|
|
344
|
+ btn: ['确定']
|
|
|
345
|
+ });
|
|
|
346
|
+ return;
|
|
|
347
|
+ }
|
|
|
348
|
+ if($.trim($('#testInput4_input').val()) == '') {
|
|
|
349
|
+ layer.confirm('请选择反馈单位!', {
|
|
|
350
|
+ icon: 2,
|
|
|
351
|
+ btn: ['确定']
|
|
|
352
|
+ });
|
|
|
353
|
+ return;
|
|
|
354
|
+ }
|
|
|
355
|
+ if($('#DicValueList_market').val() == '') {
|
|
|
356
|
+ layer.confirm('请选择工单来源!', {
|
|
|
357
|
+ icon: 2,
|
|
|
358
|
+ btn: ['确定']
|
|
|
359
|
+ });
|
|
|
360
|
+ return;
|
|
|
361
|
+ }
|
|
|
362
|
+ if($('#typeclassId_market').val() == '') {
|
|
|
363
|
+ layer.confirm('请选择工单类型!', {
|
|
|
364
|
+ icon: 2,
|
|
|
365
|
+ btn: ['确定']
|
|
|
366
|
+ });
|
|
|
367
|
+ return;
|
|
|
368
|
+ }
|
|
|
369
|
+ $.ajax({
|
|
|
370
|
+ type: "post",
|
|
|
371
|
+ url: huayi.config.callcenter_url + "CallInScreen/AddWorkOrder",
|
|
|
372
|
+ dataType: 'json',
|
|
|
373
|
+ async: true,
|
|
|
374
|
+ beforeSend: function() { //触发ajax请求开始时执行
|
|
|
375
|
+ $('.marketSubmit').attr("disabled", true);
|
|
|
376
|
+ $('.marketSubmit').text('保存中...');
|
|
|
377
|
+ },
|
|
|
378
|
+ data: {
|
|
|
379
|
+ token: $.cookie("token"),
|
|
|
380
|
+ callCustomer: $('#name_market').val(), //姓名
|
|
|
381
|
+ tel: $('#tel_market').val(), //号码
|
|
|
382
|
+ lddep: $('#testInput3_input').val(), //来电单位
|
|
|
383
|
+ fkdep: $('#testInput4_input').val(), //反馈单位
|
|
|
384
|
+ gdly: $('#DicValueList_market').val(), //工单来源
|
|
|
385
|
+ gdlx: $('#typeclassId_market').val(), //工单类型id
|
|
|
386
|
+ fkcont: helper.HtmlUtil.htmlEncodeByRegExp(marketEditor.html()), //反馈内容
|
|
|
387
|
+ callid: $("#CallID").val()
|
|
|
388
|
+ },
|
|
|
389
|
+ success: function(data) {
|
|
|
390
|
+ if(data.state.toLowerCase() == 'success') {
|
|
|
391
|
+ layer.msg("保存成功!");
|
|
|
392
|
+ clear();
|
|
|
393
|
+ $('.marketSubmit').attr("disabled", false);
|
|
|
394
|
+ $('.marketSubmit').text('保存');
|
|
|
395
|
+ }
|
|
|
396
|
+ }
|
|
|
397
|
+ });
|
|
|
398
|
+
|
|
|
399
|
+}
|
|
|
400
|
+
|
|
|
401
|
+function clear() {
|
|
|
402
|
+ if(ns == 1) {
|
|
|
403
|
+ $('#name').val('');
|
|
|
404
|
+ $('#tel').val(''); //号码
|
|
|
405
|
+ $('#testInput1_input').val(''); //来电单位
|
|
|
406
|
+ $('#testInput2_input').val(''); //反馈单位
|
|
|
407
|
+ $('#orderSource').val(''); //工单来源
|
|
|
408
|
+ $('#typeclassId').val(''); //工单类型id
|
|
|
409
|
+ $('#State').val(''); //工单状态id
|
|
|
410
|
+ $('#feedBackCon').val(''); //反馈内容
|
|
|
411
|
+ $('#express').val(''); //快递信息
|
|
|
412
|
+ $('#remark1').val(''); //备注一
|
|
|
413
|
+ $('#remark2').val(''); //备注二
|
|
|
414
|
+ $('#remark3').val(''); //备注三
|
|
|
415
|
+ $('#typeclass').val('');
|
|
|
416
|
+ changeEditor.html('');
|
|
|
417
|
+ } else {
|
|
|
418
|
+ $('#name_market').val('');
|
|
|
419
|
+ $('#tel_market').val(''); //号码
|
|
|
420
|
+ $('#testInput3_input').val(''); //来电单位
|
|
|
421
|
+ $('#testInput4_input').val(''); //反馈单位
|
|
|
422
|
+ $('#remark_market').val(''); //备注内容
|
|
|
423
|
+ marketEditor.html('');
|
|
|
424
|
+ }
|
|
|
425
|
+
|
|
|
426
|
+}
|