Преглед на файлове

心连心正价,客户投诉页面

miaofuhao преди 6 години
родител
ревизия
2010b3969d

+ 414 - 0
CallCenterWeb.UI/WorkOrder/AddKehuOrder.html

@@ -0,0 +1,414 @@
1
+<!DOCTYPE html>
2
+<html>
3
+
4
+	<head>
5
+		<meta charset="UTF-8">
6
+		<meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+		<title>手工制单</title>
8
+		<script src="../Script/Common/huayi.load.js"></script>
9
+		<script src="../Script/Common/huayi.config.js"></script>
10
+		<link href="../js/bootstrap-select/css/bootstrap-select.css" rel="stylesheet" />
11
+		<link rel="stylesheet" type="text/css" href="../js/bootstrap-treeview/bootstrap-treeview.min.css" />
12
+		<link href="../js/zTree/zTreeStyle.css" rel="stylesheet" />
13
+		<link href="../callScreen/css/call.css" rel="stylesheet" />
14
+		<link href="../css/init.css" rel="stylesheet" />
15
+		<link href="../css/WorkOrder/Search.css" rel="stylesheet">
16
+		<link rel="stylesheet" href="../js/webuploader/webuploader.css" />
17
+		<style type="text/css">
18
+			#Duration,
19
+			#Depth {
20
+				display: none;
21
+			}
22
+			
23
+			.xl_box {
24
+				position: absolute;
25
+				top: 0px;
26
+				left: 12px;
27
+			}
28
+			
29
+			.jieshow {
30
+				position: absolute;
31
+				top: 0;
32
+				left: 400px;
33
+			}
34
+			
35
+			.inpBox {
36
+				border: 1px solid #cccccc;
37
+				height: 31px;
38
+				width: 260px;
39
+				/*   display: inline-block; */
40
+				/* position: relative; */
41
+				vertical-align: middle;
42
+				position: absolute;
43
+				left: 130px;
44
+				top: 0px;
45
+				z-index: 111;
46
+			}
47
+			
48
+			.selDpart1 {
49
+				position: absolute;
50
+				left: 130px;
51
+				top: 31px;
52
+				z-index: 11111;
53
+				width: 220px;
54
+				line-height: 30px;
55
+				background: #FFFFFF;
56
+				/* display: none; */
57
+			}
58
+			
59
+			#sponsor {
60
+				width: 218px;
61
+				margin: 0;
62
+				padding: 0;
63
+				list-style: none;
64
+				max-height: 212px;
65
+				overflow-x: hidden;
66
+				overflow-y: scroll;
67
+			}
68
+			
69
+			#sponsor li {
70
+				margin: 0;
71
+				padding-left: 10px;
72
+				width: 220px;
73
+				height: 30px;
74
+				line-height: 30px;
75
+				list-style: none;
76
+			}
77
+			
78
+			#sponsor li:hover {
79
+				background: #00a1cb;
80
+			}
81
+			
82
+			.addTree {
83
+				background: #fff;
84
+				position: absolute;
85
+				width: auto !important;
86
+				border: 1px solid darkgrey;
87
+				left: 0px;
88
+				top: 29px;
89
+				display: none;
90
+				z-index: 222;
91
+				height: auto !important;
92
+			}
93
+			
94
+			.xl {
95
+				display: inline-block;
96
+				background: url(../../img/dropDown.png) no-repeat;
97
+				height: 100%;
98
+				background-position: center center;
99
+				width: 20px;
100
+				position: absolute;
101
+				right: 0;
102
+				top: 0px;
103
+				/* background-color: #f7bc8b; */
104
+				cursor: pointer;
105
+			}
106
+			
107
+			.ztree li span {
108
+				border: none;
109
+				padding: 0;
110
+			}
111
+			
112
+			.inps {
113
+				width: 217px;
114
+				height: 29px;
115
+				outline: none;
116
+				border: 0;
117
+				border-image-width: 0;
118
+				padding: 0;
119
+				padding-left: 3px;
120
+			}
121
+			
122
+			.xl {
123
+				display: inline-block;
124
+				background: url(../img/dropDown.png) no-repeat;
125
+				height: 100%;
126
+				background-position: center center;
127
+				width: 20px;
128
+				position: absolute;
129
+				right: 0;
130
+				top: 0px;
131
+				/* background-color: #f7bc8b; */
132
+				cursor: pointer;
133
+			}
134
+			
135
+			.Cleans {
136
+				display: inline-block;
137
+				width: 20px;
138
+				position: absolute;
139
+				right: 35px;
140
+				top: 8px;
141
+				/* display: none; */
142
+			}
143
+			
144
+			.Min-width {
145
+				width: 150px;
146
+			}
147
+			
148
+			.btn-default {
149
+				background: #FFFFFF;
150
+				color: #000000;
151
+			}
152
+			
153
+			.jieshow {
154
+				position: relative;
155
+			}
156
+			
157
+			.xl_common {
158
+				height: 100px;
159
+				width: 182px;
160
+				left: 115px;
161
+				top: 28px;
162
+			}
163
+			/* 指派附件开始 */
164
+			
165
+			.file_imgs {
166
+				padding: 10px 70px;
167
+				list-style: none;
168
+				margin-bottom: 60px;
169
+				margin-left: -15px;
170
+			}
171
+			
172
+			.file_imgs li {
173
+				float: left;
174
+				position: relative;
175
+				width: 109px;
176
+				height: 109px;
177
+				margin-left: 10px;
178
+				margin-right: 10px;
179
+				margin-bottom: 40px;
180
+				padding-top: 0;
181
+				padding-bottom: 0;
182
+			}
183
+			
184
+			.file_imgs li:hover .img_mask {
185
+				display: block;
186
+			}
187
+			
188
+			.file_imgs .img_mask {
189
+				display: none;
190
+				position: absolute;
191
+				left: 0;
192
+				top: 0;
193
+				background-color: rgba(0, 0, 0, .3);
194
+				width: 100%;
195
+				height: 22px;
196
+				z-index: 1;
197
+			}
198
+			
199
+			.file_imgs .img_mask i {
200
+				position: absolute;
201
+				right: 5px;
202
+				top: 5px;
203
+				display: inline-block;
204
+				width: 13px;
205
+				height: 12px;
206
+				cursor: pointer;
207
+				background: url(../img/file_img_icons.png) no-repeat 0 0;
208
+			}
209
+			
210
+			.file_imgs .file_name {
211
+				width: 100%;
212
+				display: inline-block;
213
+				text-align: center;
214
+				word-break: break-all;
215
+				padding-top: 8px;
216
+			}
217
+			
218
+			.file_imgs li img {
219
+				width: 100%;
220
+				height: 100%;
221
+				border: 0;
222
+				vertical-align: middle;
223
+			}
224
+			
225
+			.file_imgs .upload-state-done .img_state {
226
+				display: block;
227
+				position: absolute;
228
+				right: 7px;
229
+				bottom: 29px;
230
+				width: 0;
231
+				height: 0;
232
+				border-bottom: 40px solid #01b2fe;
233
+				border-left: 40px solid transparent;
234
+				overflow: inherit;
235
+			}
236
+			
237
+			.file_imgs .img_state i {
238
+				position: absolute;
239
+				right: 4px;
240
+				bottom: -32px;
241
+				display: inline-block;
242
+				width: 15px;
243
+				height: 11px;
244
+				background: url(../../img/file_img_icons.png) no-repeat 0 -16px;
245
+			}
246
+			
247
+			.error {
248
+				color: red;
249
+				text-align: center;
250
+			}
251
+			
252
+			.noThumb {
253
+				width: 109px;
254
+				height: 83px;
255
+				text-align: center;
256
+				color: #1aaad0;
257
+			}
258
+			
259
+			.glyphicon.glyphicon-paperclip {
260
+				font-size: 44px;
261
+				text-align: center;
262
+			}
263
+			
264
+			.img-box {
265
+				float: left;
266
+				width: 120px;
267
+				height: 120px;
268
+				background-size: 100% 100%;
269
+				display: inline-block;
270
+				position: relative;
271
+				border-radius: 5px;
272
+				margin-right: 10px;
273
+				border: solid 1px #e8e8e8;
274
+				cursor: pointer;
275
+				text-align: center;
276
+				line-height: 120px
277
+			}
278
+			
279
+			.img-box .img_mask {
280
+				display: none;
281
+				position: absolute;
282
+				left: 0;
283
+				top: 0;
284
+				background-color: rgba(0, 0, 0, .3);
285
+				width: 100%;
286
+				height: 22px;
287
+				z-index: 5;
288
+			}
289
+			
290
+			.image-item {
291
+				width: 120px;
292
+				height: 120px;
293
+				background-size: 100% 100%;
294
+				display: inline-block;
295
+				position: relative;
296
+				border-radius: 5px;
297
+				margin-right: 10px;
298
+				cursor: pointer;
299
+			}
300
+			
301
+			.img-box .img_mask i {
302
+				position: absolute;
303
+				right: 5px;
304
+				top: 5px;
305
+				display: inline-block;
306
+				width: 13px;
307
+				height: 12px;
308
+				cursor: pointer;
309
+				color: #fff;
310
+			}
311
+			
312
+			.img-box:hover .img_mask {
313
+				display: block;
314
+			}
315
+			
316
+			.img_filename {
317
+				font-size: 14px;
318
+				/* display: block; */
319
+				width: 100%;
320
+				height: calc(100% - 22px);
321
+			}
322
+			
323
+			.Sampling {
324
+				display: none;
325
+			}
326
+		</style>
327
+	</head>
328
+
329
+	<body class="gray-bg">
330
+		<div class="daoHang clearfix" style="margin-bottom: 20px;">
331
+			<div class="dhLeft">
332
+				<sapn>
333
+					<i class="syIcon"></i>位置:
334
+					<a href="javaScript:;" id="ReIndex">首页</a>&gt;
335
+					<a href="javaScript:;">工单管理</a>&gt;
336
+					<a href="" class="nowPosition">手工制单</a>
337
+				</sapn>
338
+			</div>
339
+		</div>
340
+		<div class="complain order_form" style="display:block;">
341
+			<form class="form-inline clearfix" id="order_form">
342
+				<div class="col-md-12 row">
343
+					<div class="form-group col-md-12">
344
+						<div class="form-group col-md-12 clearfix">
345
+							<label class="col-md-1">工单类型:</label>
346
+							<div id="order_isover" class="col-md-6 r_order_type">
347
+								<label class="radio-inline">
348
+								   <input type="radio" name="type" value="1" checked="checked"> 咨询
349
+								</label>
350
+									<label class="radio-inline">
351
+								   <input type="radio" name="type" value="2" > 投诉
352
+								</label>
353
+								<label class="radio-inline">
354
+						           <input type="radio" name="type" value="4" > 建议及其他
355
+						        </label>
356
+							</div>
357
+						</div>
358
+					</div>
359
+					<div class="form-group col-md-12">
360
+						<div class="form-group col-md-4">
361
+							<label for="order_handle">客户姓名:</label>
362
+							<input type="text" class="form-control input-sm" id="kehuxing" placeholder="请输入姓名">
363
+						</div>
364
+
365
+						<div class="form-group col-md-4">
366
+							<label for="order_handle">客户电话:</label>
367
+							<input type="text" class="form-control input-sm" id="kehudian" placeholder="请输入电话" maxlength="11" onkeyup="this.value=this.value.replace(/\D/g,'')">
368
+						</div>
369
+						<div class="form-group col-md-4">
370
+							<label for="order_handle">渠道类型:</label>
371
+							<select class="form-control input-sm " id="order_handle">
372
+								<option selected="selected" value="">请选择</option>
373
+							</select>
374
+						</div>
375
+					</div>
376
+					<div class="form-group col-md-12" style="border-bottom:1px dashed #00A1CB;">
377
+						<div class="form-group col-md-12">
378
+							<label for="order_tel">详细地址:</label>
379
+							<textarea id="xiangxi" rows="3" cols="20" class="form-control" placeholder="请输入详细地址"></textarea>
380
+						</div>
381
+					</div>
382
+				</div>
383
+				<div class="form-group col-md-12">
384
+					<div class="form-group col-md-12">
385
+						<label for="order_reception">问题描述:</label>
386
+						<textarea id="reception" rows="3" cols="20" class="form-control" placeholder="请输入问题描述"></textarea>
387
+					</div>	
388
+				</div>
389
+				<div class=" form-group col-md-12 clearfix " style="margin:20px 0 0 -15px;">
390
+					<label class="col-md-2">附件:</label>
391
+					<div id="imgPicker" class="apply_forms_file">+</div>
392
+					<p class="help-block text-warning" style="display:inline-block;">
393
+						<span id="fileNum">0</span>/6 每个文件大小不超过30M
394
+					</p>
395
+					<ul id="fileList" class="file_imgs clearfix"></ul>
396
+				</div>
397
+				<div class="form-group text-center col-sm-12" style="margin-top: 20px;">
398
+					<button type="button" class="btn btn-primary btn-sm" id="save_order">创建</button>
399
+				</div>
400
+			</form>
401
+		</div>
402
+
403
+		<script src="../js/laydate/laydate.js"></script>
404
+		<script src="../js/autosize/autosize.min.js"></script>
405
+		<script src="../js/bootstrap-select/js/bootstrap-select.js"></script>
406
+		<script src="../js/bootstrap-select/js/i18n/defaults-zh_CN.js"></script>
407
+		<script src="../js/bootstrap-treeview/bootstrap-treeview.min.js"></script>
408
+		<script src="../js/zTree/jquery.ztree.core.js"></script>
409
+		<script src="../Script/Common/regexs.js"></script>
410
+		<script src="js/AddKehuOrder.js"></script>
411
+		<script src="../js/webuploader/webuploader.min.js"></script>
412
+	</body>
413
+
414
+</html>

+ 234 - 0
CallCenterWeb.UI/WorkOrder/js/AddKehuOrder.js

@@ -0,0 +1,234 @@
1
+/**
2
+ * 手工制单
3
+ * */
4
+$(function() {
5
+	//helper.getDropList.getlistDropByDic($('#order_handle'), 'QDLX');
6
+	CPZL($("#order_handle"));
7
+	uploaderImages();
8
+})
9
+$('#save_order').click(function() { //ID为test的元素点击时
10
+	orderSave();
11
+});
12
+//新建工单 保存
13
+function orderSave() {
14
+	if($('#kehuxing').val()=="") {
15
+    	layer.confirm('请输入客户姓名!', {
16
+    		icon: 2,
17
+    		btn: ['确定']
18
+    	});
19
+    	return;
20
+    }
21
+	if($('#kehudian').val()=="") {
22
+    	layer.confirm('请输入电话!', {
23
+    		icon: 2,
24
+    		btn: ['确定']
25
+    	});
26
+    	return;
27
+    }
28
+	if($("#xiangxi").val()=="") {
29
+    	layer.confirm('请输入详细地址!', {
30
+    		icon: 2,
31
+    		btn: ['确定']
32
+    	});
33
+    	return;
34
+    }
35
+	if($("#reception").val()=="") {
36
+    	layer.confirm('请输入问题描述!', {
37
+    		icon: 2,
38
+    		btn: ['确定']
39
+    	});
40
+    	return;
41
+    }
42
+	$.post(huayi.config.callcenter_url + 'WxLogin/CustomAdd', {
43
+		F_Source: 4, //工单来源
44
+		F_Type: $('#order_isover').find('input[type="radio"]:checked').val(), //工单类型
45
+		F_CusName: $('#kehuxing').val(), //客户姓名
46
+		F_CusPhone: $('#kehudian').val(), //否	string	客户电话
47
+	    F_Canal:$('#order_handle').val(), //渠道类型
48
+		F_IncidentDetailed: $("#xiangxi").val(), //详细地址
49
+		F_Description: $("#reception").val(), //问题描述
50
+		F_Files: proimglist && proimglist.join(',') //附件
51
+	}, function(result) {
52
+		result = $.parseJSON(result);
53
+		if(result.state.toLowerCase() == "success") {
54
+			layer.msg("保存成功");
55
+			setTimeout(function(){ window.location.reload() ; }, 1000);
56
+			
57
+		}
58
+	})
59
+}
60
+function CPZL(obj) {
61
+	obj.empty();
62
+	obj.append('<option selected="selected" value="">请选择</option>');
63
+	$.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlagWx", {
64
+		"token": $.cookie("token"),
65
+		flag: 'QDLX'
66
+	}, function (data) {
67
+		if (data.state.toLowerCase() == "success") {
68
+			var content = data.data;
69
+			$(content).each(function (i, n) {
70
+				$("<option value='" + n.F_Name + "'>" + n.F_Name + "</option>").appendTo(obj);
71
+			})
72
+		}
73
+	})
74
+}
75
+
76
+/**
77
+ * 附件上传
78
+ * */
79
+var proimglist = []; //保存附件数组
80
+var uploader; //上传实例
81
+var limitNum = 6; //限制数量
82
+
83
+
84
+//上传附件
85
+function uploaderImages() {
86
+	debugger
87
+	if(uploader) {
88
+		uploader.destroy();
89
+	}
90
+	uploader = WebUploader.create({
91
+		auto: true, // 选完文件后,是否自动上传 
92
+		swf: '../../js/webuploader/Uploader.swf', // swf文件路径 
93
+		server: huayi.config.callcenter_url + "Knowledge/UpLoadProcess", // 文件接收服务端 
94
+		pick: '#imgPicker', // 选择文件的按钮。可选 
95
+		formData: {
96
+
97
+		},
98
+		// 多类型文件上传 
99
+		accept: {
100
+			title: 'Files',
101
+			extensions: 'gif,jpg,jpeg,bmp,png,pdf,doc,docx,txt,xls,xlsx,ppt,pptx,zip,mp3,mp4,text,csv',
102
+			mimeTypes: 'image/*,text/*,audio/mpeg,audio/mp4, video/mp4'
103
+					//word
104
+			+',application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document'
105
+					//excel
106
+			+',application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
107
+					//ppt
108
+			+',application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation'
109
+			+',application/pdf'
110
+			+',application/zip'
111
+			+',application/csv'
112
+			//			title: 'Images',
113
+			//			extensions: 'gif,jpg,jpeg,bmp,png',
114
+			//			mimeTypes: 'image/*'
115
+		},
116
+		compress: false, //webuploader默认压缩图片,设置compress:false,可以按照原始比例上传图片  
117
+		//fileVal: "upFile",//设置文件上传域的name。  
118
+		threads: limitNum, //上传并发数。允许同时最大上传进程数,为了保证文件上传顺序  
119
+		fileNumLimit: limitNum,
120
+		fileSizeLimit: 180 * 1024 * 1024, // 180 M
121
+		fileSingleSizeLimit: 30 * 1024 * 1024 // 30 M
122
+	});
123
+
124
+	uploader.on('fileQueued', function(file) {
125
+		var $list = $("#fileList"),
126
+			$li = $(
127
+				'<li id="' + file.id + '"><span class="img_mask"><i class="img_del"></i></span>' +
128
+				'<img/>' +
129
+				'<span class="img_state"><i></i></span>' +
130
+				'<span class="file_name">' + file.name + '</span>' +
131
+				'</li>'
132
+			),
133
+			$img = $li.find('img');
134
+
135
+		// $list为容器jQuery实例 
136
+		$list.append($li);
137
+
138
+		// 保存缩略图 
139
+		uploader.makeThumb(file, function(error, src) {
140
+			if(error) {
141
+				$img.replaceWith('<div class="noThumb"><i class="glyphicon glyphicon-paperclip"></i><p>无法预览</p></div>');
142
+				return;
143
+			}
144
+			$img.attr('src', src);
145
+		}, 109, 109); //109*109为缩略图尺寸 
146
+
147
+		//绑定删除
148
+		$('#' + file.id).on('click', '.img_del', function() {
149
+			uploader.removeFile(file);
150
+			var $fileLi = $('#' + file.id);
151
+			$fileLi.off().find('.img_del').off().end().remove();
152
+			var itemFileName = $(this).parent().parent().find('.file_name').text();
153
+			$.each(proimglist, function(i, v) {
154
+				if(v && v.filename == itemFileName) {
155
+					proimglist.splice(i, 1);
156
+					//helper.methods.delImgs(v.filesmallurl, v.fileurl);
157
+				}
158
+			});
159
+			$('#fileNum').text(proimglist.length);
160
+		});
161
+
162
+	});
163
+
164
+	// 文件上传过程中保存进度条实时显示。 
165
+	uploader.on('uploadProgress', function(file, percentage) {
166
+		var $li = $('#' + file.id),
167
+			$percent = $li.find('.progress span');
168
+
169
+		// 避免重复保存 
170
+		if(!$percent.length) {
171
+			$percent = $('<div class="progress" style="">' +
172
+					'<span class="text">0%</span>' +
173
+					'<span class="percentage"></span>' +
174
+					'</div>')
175
+				.appendTo($li)
176
+				.find('span');
177
+		}
178
+
179
+		$percent.eq(0).text(Math.round(percentage * 100) + '%');
180
+		$percent.eq(1).css('width', Math.round(percentage * 100) + '%');
181
+	});
182
+
183
+	// 文件上传成功,给item添加成功class, 用样式标记上传成功。 
184
+	uploader.on('uploadSuccess', function(file, res) {
185
+		proimglist.push(res.data.F_FileId);
186
+		$('#fileNum').text(proimglist.length);
187
+		$('#' + file.id).addClass('upload-state-done');
188
+	});
189
+
190
+	// 文件上传失败,显示上传出错。 
191
+	uploader.on('uploadError', function(file) {
192
+		var $li = $('#' + file.id),
193
+			$error = $li.find('div.error');
194
+
195
+		// 避免重复创建
196
+		if(!$error.length) {
197
+			$error = $('<div class="error"></div>').appendTo($li);
198
+		}
199
+
200
+		$error.text('上传失败');
201
+	});
202
+
203
+	// 完成上传完了,成功或者失败,先删除进度条。 
204
+	uploader.on('uploadComplete', function(file) {
205
+		$('#' + file.id).find('.progress').remove();
206
+	});
207
+
208
+	uploader.onError = function(code) {
209
+		//		console.log('Error:' + code);
210
+		switch(code) {
211
+			case "Q_EXCEED_NUM_LIMIT":
212
+				layer.msg('只能上传六个文件。');
213
+				break;
214
+			case "Q_TYPE_DENIED":
215
+				layer.msg('文件类型不正确。');
216
+				break;
217
+			case "F_DUPLICATE":
218
+				layer.msg('该文件已上传,请选择其它文件。');
219
+				break;
220
+			case "F_EXCEED_SIZE":
221
+				layer.msg('单文件大小不能超过30M。');
222
+				break;
223
+			case "Q_EXCEED_SIZE_LIMIT":
224
+				layer.msg('总文件大小不能超过180M。');
225
+				break;
226
+			default:
227
+				break;
228
+		}
229
+
230
+	};
231
+}
232
+/**
233
+ * 附件上传直接在知识库管理拿来用     结束
234
+ * */

+ 1 - 2
CallCenterWeb.UI/js/WorkOrder/WorkOrder.js

@@ -1018,7 +1018,7 @@ function btn_deleteid(id) {
1018 1018
 		/*执行删除*/
1019 1019
 		$.ajax({
1020 1020
 			type: "post",
1021
-			url: huayi.config.callcenter_url + "WorkOrderNew/DeleteWorkOrder",
1021
+			url: huayi.config.callcenter_url + "WorkOrderNew/DelWorkOrder",
1022 1022
 			dataType: 'json',
1023 1023
 			async: true,
1024 1024
 			data: {
@@ -1028,7 +1028,6 @@ function btn_deleteid(id) {
1028 1028
 			success: function(data) {
1029 1029
 				layer.msg("删除成功!");
1030 1030
 				$('#workorderlist').bootstrapTable('refresh');
1031
-				// top.workcount();
1032 1031
 				$('.Closed').trigger('click');
1033 1032
 				layer.close(index);
1034 1033
 			}

+ 660 - 0
CallCenterWeb.UI/js/main1017.js

@@ -0,0 +1,660 @@
1
+var ws, n = 0,
2
+	timer,hidTel,hidCallID,hidActionID;
3
+var lockReconnect = false; //避免重复连接
4
+var obj = {};
5
+var directType;
6
+var sendType;
7
+var mesCont;
8
+var eorrorConnect;
9
+var cls = 0;
10
+var lasttime = new Date().getTime();
11
+var errorState;
12
+var reconnecTion;
13
+var recon;
14
+var loginOr;
15
+//创建scoket连接
16
+function createWebSocket() {
17
+	try {
18
+		$("#top-search li i").removeClass("active");
19
+		
20
+		Connect();
21
+	} catch(e) {
22
+		//打印日志
23
+		directType="lianjie";
24
+		sendType="异常错误"; //JSON.stringify(data)
25
+		mesCont=e.message;
26
+		debuggerLog();
27
+		reconnect();
28
+	}
29
+}
30
+//连接
31
+function Connect() {
32
+
33
+		ws = new WebSocket("ws://" + huayi.config.socket_ip + ":" + huayi.config.socket_port);
34
+		ws.onopen = function() {
35
+			console.log(new Date() + "    " + "建立连接");
36
+			//心跳检测重置
37
+			heartCheck.reset().start();
38
+			cls = 0;
39
+			$(".Login").addClass("active");
40
+			//自动签入
41
+			//lasttime = new Date().getTime();
42
+			//obj.Type = "Login";
43
+			//obj.AgentType = "0";
44
+			//Send(); /*2018-05-19zhangshaungnan注释*/
45
+			if (errorState) {
46
+				//自动签入
47
+				lasttime = new Date().getTime();
48
+				obj.Type = "Login";
49
+				obj.AgentType = "0";
50
+				Send();
51
+				directType="recive";
52
+				sendType="自动签入 "; //JSON.stringify(data)
53
+				//mesCont=JSON.stringify(data);
54
+				debuggerLog();
55
+				clearInterval(timer);
56
+				//loginOr=false;
57
+				errorState=false;
58
+			}else{
59
+				//签入
60
+				Send();
61
+				
62
+			}
63
+		};
64
+		//接收到消息的回调方法
65
+		ws.onmessage = function(evt) {
66
+			//如果获取到消息,心跳检测重置
67
+			//拿到任何消息都说明当前连接是正常的
68
+			heartCheck.reset().start();
69
+			var myDate = new Date();
70
+			console.log(myDate + "  receive  " + evt.data);
71
+			var data = JSON.parse(evt.data)[0];
72
+			//打印日志
73
+			directType="recive";
74
+			sendType=data.Type; //JSON.stringify(data)
75
+			mesCont=JSON.stringify(data);
76
+			debuggerLog()
77
+			if(data) {
78
+				var rlt = data.Result;
79
+				if(rlt == true) {
80
+					var type = data.Type;
81
+					if (eorrorConnect) {
82
+						LoginBack();
83
+						obj.Type = "Login";
84
+						Send();
85
+						eorrorConnect=false;
86
+					}
87
+					switch(type.toLowerCase()) {
88
+						//case "heart": HeartBack(); break;//心跳
89
+						case "login":
90
+							LoginBack();
91
+							break; //签入
92
+						case "logout":
93
+							LogoutBack();
94
+							break; //签出
95
+						case "dropcall":
96
+							DropCallBack();
97
+							break; //挂断
98
+						case "makecall":
99
+							MakeCallBack();
100
+							break; //外呼
101
+						case "setstate":
102
+							SetState(data);
103
+							break; //置忙置闲
104
+							//case "saybusy": SayBusyBack(data); break;
105
+							//case "sayfree": SayFreeBack(data); break;
106
+						case "meeting":
107
+							MeetingBack();
108
+							break; //多方通话
109
+						case "transfer":
110
+							TransferBack();
111
+							break; //转移
112
+						case "hold":
113
+							HoldBack();
114
+							break; //保持
115
+						case "retrieve":
116
+							RetrieveBack();
117
+							break; //接回
118
+						case "incoming":
119
+							IncomingBack(data);
120
+							break; //来电
121
+						case "subscribe":
122
+							SubScribeBack();
123
+							break; //监测
124
+						case "subscribecancel":
125
+							SubScribeCancelBack();
126
+							break; //停止监测
127
+						case "agentstate":
128
+							AgentStateBack(data);
129
+							break; //坐席状态
130
+						case "linestate":
131
+							LineStateBack(data);
132
+							break; //线路状态
133
+						case "motorsetstate":
134
+							SayFreeBack();
135
+							break; //班长置闲
136
+						case "linestateagent":
137
+							LineStateAgentBack(data);
138
+							break; //线路状态通知
139
+						case "callid":
140
+							CallIDBack(data);
141
+							break; //获取callid
142
+						case "recordpath":
143
+							RecordPathBack(data);
144
+							break; //录音返回
145
+					}
146
+				} else {
147
+					if(rlt == false) {
148
+						if (data.Type=="AcdConnectNotify") {
149
+							//LogoutBack();
150
+							$(".hwzt").text('连接异常!');
151
+							setTimeout(function () {
152
+//								签入
153
+								obj.Type = "login";
154
+								Send();
155
+					        }, 5000);
156
+						}
157
+						$(".hwzt").text('操作失败!');
158
+					} else {
159
+						$(".hwzt").text(rlt);
160
+						//layer.confirm(rlt, {
161
+						//    btn: ['确定']
162
+						//});
163
+					}
164
+				}
165
+			}
166
+		};
167
+		//连接关闭的回调方法
168
+		ws.onclose = function(evt) {
169
+			var data = JSON.parse(evt.data)[0];
170
+			directType="recive";
171
+			sendType="close"; //JSON.stringify(data)
172
+			mesCont=JSON.stringify(data);
173
+			debuggerLog();
174
+			if(cls == 0) {
175
+				cls = 1;
176
+				//console.log("连接关闭!");
177
+				//layer.confirm('连接关闭!', {
178
+				//    btn: ['确定']
179
+				//});
180
+				$(".hwzt").text('连接关闭!');
181
+				$("#top-search li i").removeClass("active");
182
+				reconnect();
183
+			}
184
+		};
185
+		//连接发生错误的回调方法
186
+		ws.onerror = function(evt) {
187
+			var data = JSON.parse(evt.data)[0];
188
+			directType="recive";
189
+			sendType="连接错误 "; //JSON.stringify(data)
190
+			mesCont=JSON.stringify(data);
191
+			debuggerLog();
192
+			//产生异常
193
+			$(".hwzt").text('连接出现异常!');
194
+			console.log(ws);
195
+			if(ws == null || ws.readyState != ws.OPEN) {
196
+				console.log(new Date() + "开始重连");
197
+				reconnect();
198
+			}
199
+
200
+		};
201
+}
202
+
203
+//重连
204
+function reconnect() {
205
+	if(lockReconnect) return;
206
+	lockReconnect = true;
207
+	//没连接上会一直重连,设置延迟避免请求过多
208
+	setTimeout(function() {
209
+		directType="send";
210
+		sendType="重连中 "; //JSON.stringify(data)
211
+		mesCont="重连中";
212
+		debuggerLog();
213
+		console.log(new Date() + "    " + "重连中……");
214
+		createWebSocket("ws://" + huayi.config.socket_ip + ":" + huayi.config.socket_port);
215
+		lockReconnect = false;
216
+	}, 2000);
217
+}
218
+function debuggerLog(){
219
+	$.post(huayi.config.callcenter_url + 'Log/CallOpt', {
220
+		direct: directType,
221
+		type: sendType,
222
+		cont: mesCont,
223
+		"token": $.cookie("token")
224
+	}, function(result) {
225
+		result = $.parseJSON(result);
226
+		if(result.state.toLowerCase() == "warning") {
227
+			//layer.msg("创建工单成功");
228
+		}
229
+	})
230
+}
231
+
232
+//异常重连
233
+function errorFun(){
234
+	clearInterval(timer);
235
+	var errorNum=0
236
+	timer = setInterval(function() {
237
+		errorNum++;
238
+		if (errorNum>2) {
239
+			//$("#top-search li i").removeClass("active");
240
+			$(".hwzt").text('连接异常!');
241
+		}else{
242
+			LogoutBack();
243
+		}
244
+		reconnect();
245
+		$(".hwzt").text('连接异常!');
246
+	}, 15000);
247
+}
248
+noLine();
249
+clearInterval(recon);
250
+recon = setInterval(function () { 
251
+	if(loginOr){
252
+		noLine();
253
+		setTimeout(function () {
254
+			lineState();
255
+    	}, 2000);
256
+	}
257
+}, 1000*10);
258
+function lineState(){
259
+	if (reconnecTion) {
260
+		reconnecTion=false;
261
+	}else{
262
+		directType="send";
263
+		sendType="断网 "; //JSON.stringify(data)
264
+		mesCont="断网";
265
+		debuggerLog();
266
+		errorState=true;
267
+		errorFun();
268
+		var numEorr=0;
269
+		numEorr++;
270
+		if (numEorr>2) {
271
+			$("#top-search li i").removeClass("active");
272
+		}
273
+		LogoutBack();
274
+		$(".hwzt").text('网络异常!');
275
+	}
276
+}
277
+function noLine(){
278
+	$.ajax({
279
+		type: "get",
280
+		url: huayi.config.callcenter_url + 'UserAccount/GetNowUser',
281
+		async: true,
282
+		dataType: 'json',
283
+		data: {
284
+			"token": $.cookie("token")
285
+		},
286
+		success: function(data) {
287
+			reconnecTion = data.data.user.F_UserCode;
288
+		}
289
+	});
290
+}
291
+//发送
292
+function Send() {
293
+	if(ws.readyState != ws.OPEN) {
294
+		errorState=true;
295
+		LogoutBack();
296
+		errorFun();
297
+		directType="send";
298
+		sendType=ws.readyState; //JSON.stringify(data)
299
+		mesCont="异常了";
300
+		debuggerLog();
301
+		$(".hwzt").text('连接异常!');
302
+		reconnect();
303
+	}
304
+	if(ws.readyState == ws.OPEN) {
305
+		console.log(new Date() + "  send  " + JSON.stringify(obj));
306
+		if (obj.Type) {
307
+			directType="send";
308
+			sendType=obj.Type;
309
+			mesCont=JSON.stringify(obj);
310
+			debuggerLog()
311
+		}else{
312
+			directType="send";
313
+			sendType="建立连接";
314
+			mesCont=JSON.stringify(obj);
315
+			debuggerLog()
316
+		}
317
+		ws.send(JSON.stringify(obj));
318
+	}
319
+}
320
+
321
+//心跳检测
322
+var heartCheck = {
323
+	timeout:15000, //25秒
324
+	timeoutObj: null,
325
+	serverTimeoutObj: null,
326
+	reset: function() {
327
+		clearTimeout(this.timeoutObj);
328
+		clearTimeout(this.serverTimeoutObj);
329
+		return this;
330
+	},
331
+	start: function() {
332
+		var self = this;
333
+		this.timeoutObj = setTimeout(function() {
334
+			//这里发送一个心跳,后端收到后,返回一个心跳消息,
335
+			//onmessage拿到返回的心跳就说明连接正常
336
+			obj.Type = "Heart";
337
+			Send();
338
+			self.serverTimeoutObj = setTimeout(function() { //如果超过一定时间还没重置,说明后端主动断开了
339
+				ws.close(); //如果onclose会执行reconnect,我们执行ws.close()就行了.如果直接执行reconnect 会触发onclose导致重连两次
340
+				//同步签出状态
341
+				$("#top-search li i").removeClass("active");
342
+				$(".Login").addClass("active");
343
+				$(".zxzt").removeClass("bl").addClass("br");
344
+				$(".fwzt").removeClass("bl").addClass("br");
345
+				$(".hwzt").text('');
346
+				//打印日志
347
+				directType="heart";
348
+				sendType="心跳"; //JSON.stringify(data)
349
+				mesCont="未收到";
350
+				debuggerLog();
351
+				
352
+			}, self.timeout)
353
+		}, this.timeout)
354
+	}
355
+}
356
+
357
+//签入
358
+function LoginBack() {
359
+	loginOr=true;
360
+	$("#top-search li i").removeClass("active");
361
+	$(".Logout").addClass("active");
362
+	$(".SayBusy").addClass("active");
363
+	$(".MakeCall").addClass("active");
364
+
365
+	$(".zxzt").removeClass("br").addClass("bl");
366
+	$(".fwzt").removeClass("br").addClass("bl");
367
+	$(".hwzt").text('');
368
+}
369
+//签出
370
+function LogoutBack() {
371
+	loginOr=false;
372
+	$("#top-search li i").removeClass("active");
373
+	$(".Login").addClass("active");
374
+	$(".zxzt").removeClass("bl").addClass("br");
375
+	$(".fwzt").removeClass("bl").addClass("br");
376
+	$(".hwzt").text('');
377
+}
378
+//来电
379
+function IncomingBack(data) {
380
+	debugger
381
+	if(data.CallID!=0){   
382
+		var p = '<a href="javascript:;" class="active J_menuTab" data-id="./callScreen/callScreen.html?tel=' + data.Number + '&CallID=' + data.CallID + '&TrunkNumber=' + data.TrunkNumber +'">来电弹屏' + data.Number + ' <i class="fa fa-times-circle"></i></a>';
383
+		$(".J_menuTab").removeClass("active");
384
+		var nif = '<iframe class="J_iframe J_iframeNew" name="iframe'+ data.CallID  +'"  width="100%" height="100%" src="./callScreen/callScreen.html?Number=' + data.Number + '&CallID=' + data.CallID + '&ActionID=' + data.ActionID + '&TrunkNumber=' + data.TrunkNumber + '" frameborder="0" data-id="./callScreen/callScreen.html?tel=' + data.Number + '&CallID=' + data.CallID +  '&TrunkNumber=' + data.TrunkNumber +'" seamless></iframe>';
385
+		$(".J_mainContent").find("iframe.J_iframe").hide().parents(".J_mainContent").append(nif);
386
+		$(".J_menuTabs .page-tabs-content").append(p);
387
+		hidTel=data.Number;
388
+		hidCallID=data.CallID;
389
+		hidActionID=data.ActionID;
390
+	}else{
391
+	var timestamp = Date.parse(new Date());
392
+	var p = '<a href="javascript:;" class="active J_menuTab" data-id="./callScreen/callScreen.html?tel=' + data.Number + '&CallID='+timestamp+ '&TrunkNumber=' + data.TrunkNumber +'">来电弹屏' + data.Number + ' <i class="fa fa-times-circle"></i></a>';
393
+	$(".J_menuTab").removeClass("active");
394
+	var nif = '<iframe class="J_iframe J_iframeNew" name="iframe'+timestamp+'"  width="100%" height="100%" src="./callScreen/callScreen.html?Number=' + data.Number + '&CallID='+timestamp+ '&TrunkNumber=' + data.TrunkNumber +'" frameborder="0" data-id="./callScreen/callScreen.html?tel=' + data.Number + '&CallID='+timestamp+ '&TrunkNumber=' + data.TrunkNumber +'" seamless></iframe>';
395
+	$(".J_mainContent").find("iframe.J_iframe").hide().parents(".J_mainContent").append(nif);
396
+	$(".J_menuTabs .page-tabs-content").append(p);
397
+	hidTel=data.Number;
398
+	hidCallID=timestamp;
399
+	}
400
+	
401
+}
402
+
403
+//***************************************************
404
+function CallIDBack(data) {
405
+	//$(".hidCallID").val(data.CurrID);
406
+}
407
+
408
+//挂断
409
+function DropCallBack() {
410
+	$("#top-search li i").removeClass("active");
411
+	$(".Logout").addClass("active");
412
+	$(".SayBusy").addClass("active");
413
+	$(".MakeCall").addClass("active");
414
+	var obj = $("iframe:visible")
415
+//  if (obj.attr("data-id") == './callScreen/callScreen.html?tel=' + hidTel + '&CallID=' + hidCallID + '') {
416
+//	        window.frames[obj.attr("name")].$(".td-call").hide();
417
+//	        window.frames['iframe'+ hidCallID +''].$(".td-call").hide();
418
+//	    }
419
+
420
+	if(window.frames['iframe'+ hidCallID +'']){
421
+		 window.frames['iframe'+ hidCallID +''].$(".td-call").hide();
422
+	}
423
+
424
+
425
+}
426
+//线路状态通知
427
+function LineStateAgentBack(data) {
428
+	 var objiframe = $("iframe:visible")
429
+	//0分机不可用,1空闲,2摘机等待拨号,3正在拨号,4呼出振铃,5来电振铃,6通话中,7播放忙音中,8移除IP分机,9通话保持中
430
+	if(data.State == '0') {
431
+		$(".hwzt").text('分机不可用'); //左下角状态显示
432
+		//$(".fwzt").removeClass("br").removeClass("bl");
433
+		$(".fwzt").removeClass("bl").addClass("br");//20180509 by fanlongfei 增加话机状态灯
434
+		$(".zxzt").removeClass("bl").addClass("br");//20180509 by fanlongfei 增加坐席状态灯
435
+	}
436
+	if(data.State == '1') {
437
+		$(".hwzt").text('空闲'); //左下角状态显示
438
+		$(".fwzt").removeClass("br").addClass("bl");
439
+		$(".zxzt").removeClass("br").addClass("bl");//20180509 by fanlongfei 增加坐席状态灯
440
+		if(window.frames['iframe'+ hidCallID +'']){
441
+			 window.frames['iframe'+ hidCallID +''].clearInter();
442
+		}
443
+		 if (hidTel && hidCallID) {
444
+            $.post(huayi.config.callcenter_url + 'CallInScreen/UpdateGJ', {
445
+                callid: hidCallID,
446
+                "token": $.cookie("token")
447
+            }, function (result) {
448
+                result = JSON.parse(result);
449
+                if (result.state.toLowerCase() == "success") { }
450
+            })
451
+        }
452
+		$("#top-search li i").removeClass("active");
453
+		$(".Logout").addClass("active");
454
+		$(".SayBusy").addClass("active");
455
+		$(".MakeCall").addClass("active");
456
+
457
+		if(window.frames['iframe'+ hidCallID +'']){
458
+			  window.frames['iframe'+ hidCallID +''].$(".td-call").hide();
459
+		}
460
+	}
461
+	if(data.State == '2') {
462
+		$(".hwzt").text('摘机等待拨号'); //左下角状态显示
463
+	}
464
+	if(data.State == '3') {
465
+		$(".hwzt").text('正在拨号'); //左下角状态显示
466
+	}
467
+	if(data.State == '4') {
468
+		$(".hwzt").text('呼出振铃'); //左下角状态显示
469
+	}
470
+	if(data.State == '5') {
471
+		$(".hwzt").text('来电振铃'); //左下角状态显示
472
+		//$(".fwzt").removeClass("bl").addClass("br");
473
+		$(".fwzt").removeClass("br").addClass("bl");//20180509 by fanlongfei 增加话机状态灯
474
+		$(".zxzt").removeClass("bl").addClass("br");//20180509 by fanlongfei 增加坐席状态灯
475
+		if (hidTel && hidCallID) {
476
+            $.post(huayi.config.callcenter_url + 'CallInScreen/UpdateZL', {
477
+                callid: hidCallID,
478
+                "token": $.cookie("token")
479
+            }, function (result) {
480
+                result = JSON.parse(result);
481
+                if (result.state.toLowerCase() == "success") { }
482
+            })
483
+        }
484
+	}
485
+	if(data.State == '6') {
486
+		$(".hwzt").text('通话中'); //左下角状态显示
487
+		$(".fwzt").removeClass("bl").addClass("br");
488
+		$(".zxzt").removeClass("bl").addClass("br");//20180509 by fanlongfei 增加坐席状态灯
489
+		if(hidTel && hidCallID) {
490
+			$.post(huayi.config.callcenter_url + 'CallInScreen/UpdateZJ', {
491
+				callid: hidCallID,
492
+				"token": $.cookie("token")
493
+			}, function(result) {
494
+				result = JSON.parse(result);
495
+				if(result.state.toLowerCase() == "success") {}
496
+			})
497
+		}
498
+		$("#top-search li i").removeClass("active");
499
+		$(".DropCall").addClass("active");
500
+		$(".Hold").addClass("active");
501
+		$(".Transfer").addClass("active");
502
+		$(".Meeting").addClass("active");
503
+		var aaa=data.CallDirection;
504
+		if(data.CallDirection=="in"){
505
+//			if (objiframe.attr("data-id") == './callScreen/callScreen.html?tel=' + hidTel + '&CallID=' + hidCallID + '') {
506
+				setTimeout(window.frames['iframe'+ hidCallID +''].calling(),500);/*2018-05-19 zhangshuangnan 修改  ps: 因软电话设置为 自动应答 通话时间不计时问题*/
507
+//		    }
508
+		}
509
+	}
510
+	if(data.State == '7') {
511
+		$(".hwzt").text('播放忙音中'); //左下角状态显示
512
+	}
513
+	if(data.State == '8') {
514
+		$(".hwzt").text('移除IP分机'); //左下角状态显示
515
+	}
516
+	if(data.State == '9') {
517
+		$(".hwzt").text('通话保持中'); //左下角状态显示
518
+	}
519
+}
520
+
521
+function toDub(i) {
522
+	return i < 10 ? "0" + i : "" + i;
523
+}
524
+//外呼
525
+function MakeCallBack() {
526
+	$("#top-search li i").removeClass("active");
527
+	$(".DropCall").addClass("active");
528
+//	alert('1');
529
+//	 window.frames[obj.attr("name")].calling();
530
+}
531
+
532
+//置忙置闲
533
+function SetState(obj) {
534
+	if(obj.State == '5') {
535
+		$(".SayBusy").removeClass("active");
536
+		$(".SayFree").addClass("active");
537
+		$(".zxzt").removeClass("bl").addClass("br");
538
+		$(".hwzt").text('置忙');
539
+
540
+	}
541
+	if(obj.State == '2') {
542
+		$(".SayBusy").addClass("active");
543
+		$(".SayFree").removeClass("active");
544
+		$(".zxzt").removeClass("br").addClass("bl");
545
+		$(".hwzt").text('空闲');
546
+	}
547
+}
548
+//置忙
549
+function SayBusyBack() {
550
+	$(".SayBusy").removeClass("active");
551
+	$(".SayFree").addClass("active");
552
+}
553
+//坐席班长置闲
554
+function SayFreeBack() {
555
+	$(".SayBusy").addClass("active");
556
+	$(".SayFree").removeClass("active");
557
+	$(".zxzt").removeClass("br").addClass("bl"); // 2018/05/09 by fanlongfei 增加坐席状态指示
558
+	$(".hwzt").text('空闲');// 2018/05/09 by fanlongfei 增加坐席状态指示
559
+}
560
+//多方通话
561
+function MeetingBack() {
562
+
563
+}
564
+//转移
565
+function TransferBack() {
566
+	$("#top-search li i").removeClass("active");
567
+	$(".Logout").addClass("active");
568
+	$(".SayBusy").addClass("active");
569
+	$(".MakeCall").addClass("active");
570
+}
571
+//保持
572
+function HoldBack() {
573
+	$(".Hold").removeClass("active");
574
+	$(".Retrieve").addClass("active");
575
+}
576
+//接回
577
+function RetrieveBack() {
578
+	$(".Hold").addClass("active");
579
+	$(".Retrieve").removeClass("active");
580
+}
581
+//监测
582
+function SubScribeBack() {
583
+	$('#content-main .J_iframeNew').each(function(i,n){
584
+		if($(this).attr('data-id') == "./TelCall/SeatMonitor.html"){
585
+			window.frames[$(this).attr("name")].Start();
586
+		}
587
+	})/*2018-05-24 zhangshuangnan 修改 解决通话中时 坐席监控状态不改变的问题*/
588
+	
589
+	
590
+}
591
+//取消监测
592
+function SubScribeCancelBack() {
593
+//	var obj = $("iframe:visible")
594
+//	if(obj.attr("data-id") == "./TelCall/SeatMonitor.html") {
595
+//		window.frames[obj.attr("name")].();
596
+//	}
597
+	$('#content-main .J_iframeNew').each(function(i,n){
598
+		if($(this).attr('data-id') == "./TelCall/SeatMonitor.html"){
599
+			window.frames[$(this).attr("name")].Stop();
600
+		}
601
+	})/*2018-05-24 zhangshuangnan 修改 解决通话中时 坐席监控状态不改变的问题*/
602
+	
603
+}
604
+//班长监测返回状态
605
+//坐席状态
606
+function AgentStateBack(data) {
607
+	$('#content-main .J_iframeNew').each(function(i,n){
608
+		if($(this).attr('data-id') == "./TelCall/SeatMonitor.html"){
609
+			window.frames[$(this).attr("name")].UpdateAgentState(data.AgentID, data.State);
610
+		}
611
+	})/*2018-05-24 zhangshuangnan 修改 解决通话中时 坐席监控状态不改变的问题*/
612
+}
613
+//线路状态
614
+function LineStateBack(data) {
615
+	$('#content-main .J_iframeNew').each(function(i,n){
616
+		if($(this).attr('data-id') == "./TelCall/SeatMonitor.html"){
617
+			window.frames[$(this).attr("name")].UpdateLineState(data.AgentID, data.State);
618
+		}
619
+	})/*2018-05-24 zhangshuangnan 修改 解决通话中时 坐席监控状态不改变的问题*/
620
+}
621
+//录音返回
622
+function RecordPathBack(data) {
623
+	$(".hidCallID").val(data.CallID);
624
+	//if ($(".hidTel").val() && $(".hidCallID").val()) {
625
+	//    $.post(huayi.config.callcenter_url + 'CallInScreen/UpdateLY', { callid: $(".hidCallID").val(),path:data.RecPath, "token": $.cookie("token") }, function (result) {
626
+	//        result = JSON.parse(result);
627
+	//        if (result.state.toLowerCase() == "success") {
628
+	//        }
629
+	//    })
630
+	//}
631
+	
632
+	if(hidTel) {
633
+		$.post(huayi.config.callcenter_url + 'CallInScreen/UpdateLY', {
634
+			callid: data.CallID,
635
+			path: data.RecPath,
636
+			"token": $.cookie("token")
637
+		}, function(result) {
638
+			result = JSON.parse(result);
639
+			if(result.state.toLowerCase() == "success") {}
640
+		})
641
+	}
642
+}
643
+//获取当前的日期时间 格式“yyyy-MM-dd HH:mm:ss”
644
+function getNowFormatDate() {
645
+	var date = new Date();
646
+	var seperator1 = "-";
647
+	var seperator2 = ":";
648
+	var month = date.getMonth() + 1;
649
+	var strDate = date.getDate();
650
+	if(month >= 1 && month <= 9) {
651
+		month = "0" + month;
652
+	}
653
+	if(strDate >= 0 && strDate <= 9) {
654
+		strDate = "0" + strDate;
655
+	}
656
+	var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate +
657
+		" " + date.getHours() + seperator2 + date.getMinutes() +
658
+		seperator2 + date.getSeconds();
659
+	return currentdate;
660
+}

BIN
WebChartNew/img/slide_bg1.png


+ 15 - 0
WebChartNewEdit/css/threeScreen.css

@@ -0,0 +1,15 @@
1
+.pieClass{
2
+	width: 100%;
3
+	height: 100%;
4
+	overflow: hidden;
5
+	padding-top: 20px;
6
+}
7
+.pieDiv{
8
+	width: 25%;
9
+	height: 33%;
10
+	float: left;
11
+}
12
+.pieDiv1{
13
+	width:750px;
14
+	height: 520px;
15
+}

BIN
WebChartNewEdit/img/go_next1.png


BIN
WebChartNewEdit/img/go_prev1.png


BIN
WebChartNewEdit/img/slide_title31.png


+ 316 - 0
WebChartNewEdit/js/threeScreen.js

@@ -0,0 +1,316 @@
1
+/**
2
+ * 运维图形统计  报修 耗材 隐藏
3
+ * */
4
+var stateVal = 0; //默认当天
5
+$(function() {
6
+	//获取数据
7
+	getPiedatas();
8
+	initPies();
9
+});
10
+
11
+//获取数据
12
+function getPiedatas(start,end) {
13
+	myChart0 = echarts.init(document.getElementById('pieChart0')); 
14
+	$.ajax({
15
+		type: "get",
16
+		url: huayi.config.callcenter_url + "WOReport/GetComplainthandlList",
17
+		async: false,
18
+		dataType: 'json',
19
+		data: {
20
+			stime: start,
21
+            endtime: end,
22
+            questionName:$(".quesType").val(),
23
+            isEnd:$('#customer_exceed').val(),
24
+			product:$("#product_name").val(),//产品
25
+			salesBase:$("#category").val(),//基地
26
+		},
27
+		success: function(data) {
28
+			if(data.state.toLowerCase() == "success") {
29
+				data = data.rows;
30
+				if(data.length>0) {
31
+					leftHigh=data[0].number
32
+					rightHigh=Math.round(data[0].ongesttime)
33
+					
34
+					quesTypeData=[];
35
+					$(data).each(function(i, n) {
36
+						//数据
37
+						quesTypeData[i]=n.name;
38
+					})
39
+					
40
+					
41
+					//数量
42
+					numberData = [];
43
+					$(data).each(function(i, n) {
44
+						numberData[i] = n.number;
45
+					})
46
+					
47
+					if ($('#customer_exceed').val()==1) {
48
+						//超期未完成
49
+						endOverdueName="超期未完成";
50
+						endOverdueData = [];
51
+						$(data).each(function(i, n) {
52
+							endOverdueData[i] = n.Overdue;
53
+						})
54
+						console.log(endOverdueData)
55
+					}else if($('#customer_exceed').val()==2){
56
+						//已回访数量
57
+						endOverdueName="已回访"
58
+						endOverdueData = [];
59
+						$(data).each(function(i, n) {
60
+							endOverdueData[i] = n.EndOverdue;
61
+						})	
62
+					}
63
+					//效率提升率
64
+					efficiencyData = [];
65
+					$(data).each(function(i, n) {
66
+						efficiencyData[i] = n.efficiency.split('%')[0];
67
+					})
68
+					
69
+					//平均用时
70
+					averageData = [];
71
+					$(data).each(function(i, n) {
72
+						averageData[i] = n.averageTime.split('h')[0];
73
+					})	
74
+					
75
+					//中位数
76
+					medianData = [];
77
+					$(data).each(function(i, n) {
78
+						medianData[i] = n.median.split('h')[0];
79
+					})	
80
+					
81
+					//用时最短
82
+					minimumtimeData = [];
83
+					$(data).each(function(i, n) {
84
+						minimumtimeData[i] = n.minimumtime.split('h')[0];
85
+					})	
86
+					
87
+					//用时最长
88
+					ongesttimeData = [];
89
+					$(data).each(function(i, n) {
90
+						ongesttimeData[i] = n.ongesttime.split('h')[0];
91
+					})	
92
+				}else{
93
+					//数据
94
+					quesTypeData = []
95
+					//数量
96
+					numberData = []
97
+					if ($('#customer_exceed').val()==1) {
98
+						//超期未完成
99
+						endOverdueName="超期未完成";
100
+						endOverdueData = [];
101
+					}else if($('#customer_exceed').val()==2){
102
+						//已回访数量
103
+						endOverdueName="已回访"
104
+						endOverdueData = [];
105
+					}
106
+					//效率提升率
107
+					efficiencyData = [];
108
+					//平均用时
109
+					averageData = [];
110
+					//中位数
111
+					medianData = [];
112
+					//用时最短
113
+					minimumtimeData = [];
114
+					//用时最长
115
+					ongesttimeData = [];
116
+					
117
+				}
118
+			}
119
+		}
120
+	});
121
+}
122
+//初始化图形
123
+function initPies() {
124
+	initPie0(); //初始化 工单数量统计
125
+}
126
+//初始化 工单数量统计
127
+function initPie0() {
128
+	myChart0.on('click', function (params) {
129
+        if(params.componentType == "xAxis"){
130
+        }else{
131
+        	Yname =params.name;
132
+        	if (Yname=="合计") {
133
+        		Yname=""
134
+        	}
135
+			$('.tagcloud').html('');
136
+			textCon();
137
+        }
138
+    });
139
+
140
+	myChart0.setOption({
141
+		textStyle: {
142
+			fontSize: 16 * getHeightScale,
143
+		},
144
+		tooltip: {
145
+			trigger: 'axis',
146
+			axisPointer: {
147
+				type: 'cross',
148
+				crossStyle: {
149
+					color: '#999'
150
+				}
151
+			}
152
+		},
153
+		toolbox: {
154
+			feature: {
155
+				dataView: {
156
+					show: false,
157
+					readOnly: false
158
+				},
159
+				magicType: {
160
+					show: false,
161
+					type: ['line','bar']
162
+				},
163
+				restore: {
164
+					show: false
165
+				},
166
+				saveAsImage: {
167
+					show: false
168
+				}
169
+			}
170
+		},
171
+		legend: {
172
+			data: quesTypeData
173
+		},
174
+		color: ['#2FCDCD','#1852B5','#D08065','#1852B5','#1852B5', '#1852B5', '#1852B5'],
175
+		//color: ['#2F4554','#2F4554','#61A0A8','#D48265','#91C7AE','#749F83', '#CA8622', '#00e9ff'],
176
+		xAxis: [{
177
+			type: 'category',
178
+			data: quesTypeData,
179
+			triggerEvent:true,
180
+			axisPointer: {
181
+				type: 'shadow'
182
+			},
183
+			axisLine: { //这是x轴文字颜色
184
+				lineStyle: {
185
+					color: "#00e9ff",
186
+				}
187
+			},
188
+			axisLabel: {
189
+				textStyle: {
190
+					fontSize: 16 * getHeightScale // 让字体变大
191
+				}
192
+			}
193
+		}],
194
+		yAxis: [{
195
+				type: 'value',
196
+				name: '数量',
197
+				min: 0,
198
+				max: leftHigh,
199
+				interval: Math.ceil(leftHigh/10),
200
+				splitLine: {    
201
+					show: false  
202
+				},
203
+				axisLine: { //这是x轴文字颜色
204
+					lineStyle: {
205
+						color: "#00e9ff",
206
+					}
207
+				},
208
+				axisLabel: {
209
+					formatter: '{value}',
210
+					textStyle: {
211
+						fontSize: 16 * getHeightScale // 让字体变大
212
+					}
213
+				}
214
+			},
215
+			{
216
+				type: 'value',
217
+				name: '天',
218
+				min: 0,
219
+				max: rightHigh,
220
+				interval: Math.ceil(rightHigh/10),
221
+				splitLine: {    
222
+						show: false  
223
+				},
224
+				axisLine: { //这是x轴文字颜色
225
+					lineStyle: {
226
+						color: "#00e9ff",
227
+					}
228
+				},
229
+				
230
+				axisLabel: {
231
+					formatter: '{value} 天',
232
+					textStyle: {
233
+						fontSize: 16 * getHeightScale // 让字体变大
234
+					}
235
+				}
236
+			}
237
+			
238
+		],
239
+		
240
+		series: [
241
+           	
242
+           	{
243
+				name: endOverdueName,
244
+				type: 'bar',
245
+				data: endOverdueData
246
+			},
247
+			{
248
+				name: '总数',
249
+				type: 'bar',
250
+				data: numberData
251
+			},
252
+			{
253
+				name: '平均用时',
254
+				type: 'line',
255
+				data: averageData,
256
+				yAxisIndex: 1,
257
+				smooth: true
258
+
259
+			}
260
+			,
261
+           	{
262
+				name: '中位数',
263
+				type: 'line',
264
+				symbolSize: 0, // symbol的大小设置为0
265
+			    showSymbol: false, // 不显示symbol
266
+			    lineStyle: {
267
+					normal: {
268
+						color: 'rgba(0, 0, 0, 0)', // 线的颜色是透明的
269
+						width: 0
270
+					}
271
+				},
272
+				data: medianData
273
+			},
274
+			{
275
+				name: '效率提升率(%)',
276
+				type: 'line',
277
+				symbolSize: 0, // symbol的大小设置为0
278
+			    showSymbol: false, // 不显示symbol
279
+			    lineStyle: {
280
+					normal: {
281
+						color: 'rgba(0, 0, 0, 0)', // 线的颜色是透明的
282
+						width: 0
283
+					}
284
+				},
285
+				data: efficiencyData
286
+			},
287
+			{
288
+				name: '用时最短',
289
+				type: 'line',
290
+				symbolSize: 0, // symbol的大小设置为0
291
+			    showSymbol: false, // 不显示symbol
292
+			    lineStyle: {
293
+					normal: {
294
+						color: 'rgba(0, 0, 0, 0)', // 线的颜色是透明的
295
+						width: 0
296
+					}
297
+				},
298
+				data: minimumtimeData
299
+			},
300
+			
301
+			{
302
+				name: '用时最长',
303
+				type: 'line',
304
+				symbolSize: 0, // symbol的大小设置为0
305
+			    showSymbol: false, // 不显示symbol
306
+			    lineStyle: {
307
+					normal: {
308
+						color: 'rgba(0, 0, 0, 0)', // 线的颜色是透明的
309
+						width: 0
310
+					}
311
+				},
312
+				data: ongesttimeData
313
+			}
314
+		]
315
+	})
316
+}