|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+var recordsCallOutId = 0;
|
|
|
2
|
+$(document).ready(function () {
|
|
|
3
|
+ //加载列表
|
|
|
4
|
+ initTable();
|
|
|
5
|
+
|
|
|
6
|
+ //搜索
|
|
|
7
|
+ $(".search").on("click", function(){
|
|
|
8
|
+ initTable();
|
|
|
9
|
+ })
|
|
|
10
|
+ //添加
|
|
|
11
|
+ $(".add").on("click", function(){
|
|
|
12
|
+ btnAdd();
|
|
|
13
|
+ })
|
|
|
14
|
+ //修改
|
|
|
15
|
+ $(".modify").on("click", function(){
|
|
|
16
|
+ btnModify();
|
|
|
17
|
+ })
|
|
|
18
|
+ timingCallOut()
|
|
|
19
|
+})
|
|
|
20
|
+
|
|
|
21
|
+//列表
|
|
|
22
|
+function initTable() {
|
|
|
23
|
+ //先销毁表格
|
|
|
24
|
+ $('#workorderlist').bootstrapTable('destroy');
|
|
|
25
|
+ //初始化表格,动态从服务器加载数据
|
|
|
26
|
+ $("#workorderlist").bootstrapTable({
|
|
|
27
|
+ method: "get", //使用get请求到服务器获取数据
|
|
|
28
|
+ url: huayi.config.callcenter_url + "RegRecordsCallOut/GetList", //获取数据的Servlet地址
|
|
|
29
|
+ contentType: 'application/x-www-form-urlencoded',
|
|
|
30
|
+ striped: true, //表格显示条纹
|
|
|
31
|
+ pagination: true, //启动分页
|
|
|
32
|
+ pageSize: 10, //每页显示的记录数
|
|
|
33
|
+ pageNumber: 1, //当前第几页
|
|
|
34
|
+ pageList: [10, 20, 50, 100], //记录数可选列表
|
|
|
35
|
+ search: false, //是否启用查询
|
|
|
36
|
+ showColumns: false, //显示下拉框勾选要显示的列
|
|
|
37
|
+ showRefresh: false, //显示刷新按钮
|
|
|
38
|
+ sidePagination: "server", //表示服务端请求
|
|
|
39
|
+ //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
|
|
|
40
|
+ //设置为limit可以获取limit, offset, search, sort, order
|
|
|
41
|
+ queryParamsType: "undefined",
|
|
|
42
|
+ queryParams: function queryParams(params) { //设置查询参数
|
|
|
43
|
+ var param = {
|
|
|
44
|
+ token: $.cookie("token"),
|
|
|
45
|
+ keywords: $("#searchBlurry").val(), //模糊搜索
|
|
|
46
|
+ pageindex: params.pageNumber, //页码
|
|
|
47
|
+ pagesize: params.pageSize, //条数
|
|
|
48
|
+ };
|
|
|
49
|
+ return param;
|
|
|
50
|
+ },
|
|
|
51
|
+ onLoadSuccess: function () { //加载成功时执行
|
|
|
52
|
+ //layer.msg("加载成功");
|
|
|
53
|
+ },
|
|
|
54
|
+ onLoadError: function () { //加载失败时执行
|
|
|
55
|
+ //layer.msg("加载数据失败", { time: 1500, icon: 2 });
|
|
|
56
|
+ }
|
|
|
57
|
+ });
|
|
|
58
|
+}
|
|
|
59
|
+
|
|
|
60
|
+//添加
|
|
|
61
|
+function btnAdd () {
|
|
|
62
|
+ layer.open({
|
|
|
63
|
+ type: 2,
|
|
|
64
|
+ title: '添加',
|
|
|
65
|
+ maxmin: true, //开启最大化最小化按钮
|
|
|
66
|
+ area: ['80%', '70%'],
|
|
|
67
|
+ content: "./contactsAdd.html?",
|
|
|
68
|
+ });
|
|
|
69
|
+}
|
|
|
70
|
+
|
|
|
71
|
+//修改
|
|
|
72
|
+function btnModify () {
|
|
|
73
|
+ var ids = $.map($("#workorderlist").bootstrapTable('getSelections'), function (row) {
|
|
|
74
|
+ return row.id;
|
|
|
75
|
+ });
|
|
|
76
|
+ var id = ids.toString();
|
|
|
77
|
+ if (ids.length != 1) {
|
|
|
78
|
+ layer.confirm('请选择一行进行修改!', {
|
|
|
79
|
+ btn: ['确定']
|
|
|
80
|
+ });
|
|
|
81
|
+ return;
|
|
|
82
|
+ } else {
|
|
|
83
|
+ layer.open({
|
|
|
84
|
+ type: 2,
|
|
|
85
|
+ title: '修改',
|
|
|
86
|
+ maxmin: true, //开启最大化最小化按钮
|
|
|
87
|
+ area: ['80%', '70%'],
|
|
|
88
|
+ content: "./contactsModify.html?id=" + id,
|
|
|
89
|
+ });
|
|
|
90
|
+ }
|
|
|
91
|
+}
|
|
|
92
|
+
|
|
|
93
|
+//删除
|
|
|
94
|
+$('.delete').click(function () {
|
|
|
95
|
+ var ids = $.map($("#workorderlist").bootstrapTable('getSelections'), function (row) {
|
|
|
96
|
+ console.log("row", row)
|
|
|
97
|
+ return row.id;
|
|
|
98
|
+ });
|
|
|
99
|
+ console.log("ids",ids);
|
|
|
100
|
+ if (ids.length <= 0) {
|
|
|
101
|
+ layer.confirm('请选择要删除的行!', {
|
|
|
102
|
+ btn: ['确定']
|
|
|
103
|
+ });
|
|
|
104
|
+ return;
|
|
|
105
|
+ } else {
|
|
|
106
|
+ var laye = layer.confirm('您确定要删除吗?', {
|
|
|
107
|
+ btn: ['确定', '取消'] //可以无限个按钮
|
|
|
108
|
+ }, function () {
|
|
|
109
|
+ //按钮【按钮一】的回调
|
|
|
110
|
+ $.ajax({
|
|
|
111
|
+ type: "post",
|
|
|
112
|
+ url: huayi.config.callcenter_url + "AddressBook/DelAddressBook",
|
|
|
113
|
+ async: true,
|
|
|
114
|
+ dataType: "json",
|
|
|
115
|
+ data: {
|
|
|
116
|
+ token: $.cookie("token"),
|
|
|
117
|
+ ids: ids
|
|
|
118
|
+ },
|
|
|
119
|
+ success: function (data) {
|
|
|
120
|
+ if (data.state.toLowerCase() == 'success') {
|
|
|
121
|
+ layer.msg("删除成功!");
|
|
|
122
|
+ $("#workorderlist").bootstrapTable('refresh');
|
|
|
123
|
+ }
|
|
|
124
|
+ }
|
|
|
125
|
+ });
|
|
|
126
|
+ }, function (index) {
|
|
|
127
|
+ //按钮【按钮二】的回调
|
|
|
128
|
+ layer.close(laye)
|
|
|
129
|
+ });
|
|
|
130
|
+ }
|
|
|
131
|
+})
|
|
|
132
|
+
|
|
|
133
|
+//按enter搜索
|
|
|
134
|
+$('#searchBlurry').bind('keypress', function (event) {
|
|
|
135
|
+ if (event.keyCode == "13") {
|
|
|
136
|
+ initTable();
|
|
|
137
|
+ return false;
|
|
|
138
|
+ }
|
|
|
139
|
+});
|
|
|
140
|
+
|
|
|
141
|
+//呼叫状态
|
|
|
142
|
+function formatterRecCode(val) {
|
|
|
143
|
+ var formatterRecCodeTypeArr = ["待呼叫", "呼叫中", "已呼叫"]
|
|
|
144
|
+ return formatterRecCodeTypeArr[val]
|
|
|
145
|
+}
|
|
|
146
|
+
|
|
|
147
|
+//登记类型
|
|
|
148
|
+function formatterRegisterType(val, row) {
|
|
|
149
|
+ var formatterRegisterTypeArr = ["", "咨询", "投诉", "求助", "其他"]
|
|
|
150
|
+ return formatterRegisterTypeArr[val]
|
|
|
151
|
+}
|
|
|
152
|
+
|
|
|
153
|
+//登记状态
|
|
|
154
|
+function formatterRegisterStatus(val, row) {
|
|
|
155
|
+ var formatterRegisterStatusArr = ["转移中", "已接收", "已退回",]
|
|
|
156
|
+ return formatterRegisterStatusArr[val]
|
|
|
157
|
+}
|
|
|
158
|
+
|
|
|
159
|
+//呼叫方向
|
|
|
160
|
+function formatterRegisterDirection(val, row) {
|
|
|
161
|
+ var formatterRegisterDirectionArr = ["呼入", "呼出"]
|
|
|
162
|
+ return formatterRegisterDirectionArr[val]
|
|
|
163
|
+}
|
|
|
164
|
+
|
|
|
165
|
+//登记信息
|
|
|
166
|
+function formatterOperating(val, row) {
|
|
|
167
|
+ return '<ul class="tool_downs">' +
|
|
|
168
|
+ '<li><a href="javascript:;" class="aBtn" authorize="yes" id="HY_outbound_' + row.F_ID + '" onclick="btn_outbound(\'' + row.F_userPhone + '\',' + '\''+ row.F_ID +'\')" title="外呼">外呼</a></li>' +
|
|
|
169
|
+ '<li><a href="javascript:;" class="aBtn" authorize="yes" id="HY_end_call_' + row.F_ID + '" onclick="btn_end_call(\'' + row.F_userPhone + '\',' + '\''+ row.F_ID +'\')" title="结束通话">结束通话</a></li>' +
|
|
|
170
|
+ '</ul>';
|
|
|
171
|
+}
|
|
|
172
|
+
|
|
|
173
|
+//外呼
|
|
|
174
|
+function btn_outbound(phone, id) {
|
|
|
175
|
+ recordsCallOutId = id;
|
|
|
176
|
+ if(phone) {
|
|
|
177
|
+ $.ajax({
|
|
|
178
|
+ type: "get",
|
|
|
179
|
+ url: huayi.config.callcenter_url + "CallOutOpt/GetCallOutprefix",
|
|
|
180
|
+ async: true,
|
|
|
181
|
+ dataType: 'json',
|
|
|
182
|
+ data: {
|
|
|
183
|
+ token: $.cookie("token"),
|
|
|
184
|
+ phone: phone
|
|
|
185
|
+ },
|
|
|
186
|
+ success: function(result) {
|
|
|
187
|
+ // result = $.parseJSON(result);
|
|
|
188
|
+ if(result.state.toLowerCase() == "success") {
|
|
|
189
|
+ var guid = uuid();
|
|
|
190
|
+ parent.obj.Type = 'MakeCall';
|
|
|
191
|
+ parent.obj.DestinationNumber = result.data.phone;
|
|
|
192
|
+ parent.obj.Header = result.data.fix;
|
|
|
193
|
+ parent.obj.TaskType = "0"; //0:拨号外呼;1:95005回访外呼;2:电销回访外呼
|
|
|
194
|
+ parent.obj.TaskPhoneID = ""; //回访的电话ID
|
|
|
195
|
+ parent.obj.TaskID = guid; //回访记录编号
|
|
|
196
|
+ parent.Send();
|
|
|
197
|
+ parent.iframeOutbound = 1;
|
|
|
198
|
+ }
|
|
|
199
|
+ }
|
|
|
200
|
+ });
|
|
|
201
|
+ }
|
|
|
202
|
+}
|
|
|
203
|
+
|
|
|
204
|
+
|
|
|
205
|
+function recordsCallOut () {
|
|
|
206
|
+ $.ajax({
|
|
|
207
|
+ type: "get",
|
|
|
208
|
+ url: huayi.config.callcenter_url + "RegRecordsCallOut/Update",
|
|
|
209
|
+ async: true,
|
|
|
210
|
+ dataType: 'json',
|
|
|
211
|
+ data: {
|
|
|
212
|
+ token: $.cookie("token"),
|
|
|
213
|
+ id: recordsCallOutId
|
|
|
214
|
+ },
|
|
|
215
|
+ success: function(result) {
|
|
|
216
|
+ // if(result.state.toLowerCase() == "success") {
|
|
|
217
|
+ // }
|
|
|
218
|
+ }
|
|
|
219
|
+ });
|
|
|
220
|
+}
|
|
|
221
|
+
|
|
|
222
|
+setInterval(function() {
|
|
|
223
|
+ judgmentCallOut()
|
|
|
224
|
+},10000);
|
|
|
225
|
+
|
|
|
226
|
+function timingCallOut() {
|
|
|
227
|
+ $.ajax({
|
|
|
228
|
+ type: "get",
|
|
|
229
|
+ url: huayi.config.callcenter_url + "RegRecordsCallOut/GetList",
|
|
|
230
|
+ async: true,
|
|
|
231
|
+ dataType: 'json',
|
|
|
232
|
+ data: {
|
|
|
233
|
+ token: $.cookie("token"),
|
|
|
234
|
+ },
|
|
|
235
|
+ success: function(result) {
|
|
|
236
|
+ if(result.state.toLowerCase() == "success") {
|
|
|
237
|
+ var res = result.rows[0]
|
|
|
238
|
+ if (res.F_RecCode === "0") {
|
|
|
239
|
+ btn_outbound(res.F_userPhone, res.F_ID)
|
|
|
240
|
+ } else {
|
|
|
241
|
+ $('.tool_downs').find('[id*="HY_outbound_"]').hide();
|
|
|
242
|
+ }
|
|
|
243
|
+ }
|
|
|
244
|
+ }
|
|
|
245
|
+ });
|
|
|
246
|
+}
|
|
|
247
|
+
|
|
|
248
|
+function judgmentCallOut() {
|
|
|
249
|
+ $.ajax({
|
|
|
250
|
+ type: "get",
|
|
|
251
|
+ url: huayi.config.callcenter_url + "RegRecordsCallOut/GetFlag",
|
|
|
252
|
+ async: true,
|
|
|
253
|
+ dataType: 'json',
|
|
|
254
|
+ data: {
|
|
|
255
|
+ token: $.cookie("token"),
|
|
|
256
|
+ },
|
|
|
257
|
+ success: function(result) {
|
|
|
258
|
+ if(result.state.toLowerCase() == "success") {
|
|
|
259
|
+ if(result.data == true) {
|
|
|
260
|
+ timingCallOut()
|
|
|
261
|
+ }
|
|
|
262
|
+ }
|
|
|
263
|
+ }
|
|
|
264
|
+ });
|
|
|
265
|
+}
|
|
|
266
|
+
|
|
|
267
|
+//结束通话
|
|
|
268
|
+function btn_end_call(phone) {
|
|
|
269
|
+ $.ajax({
|
|
|
270
|
+ type: "get",
|
|
|
271
|
+ url: huayi.config.callcenter_url + "RegRecordsCallOut/Update2",
|
|
|
272
|
+ async: true,
|
|
|
273
|
+ dataType: 'json',
|
|
|
274
|
+ data: {
|
|
|
275
|
+ token: $.cookie("token"),
|
|
|
276
|
+ phone: phone,
|
|
|
277
|
+ },
|
|
|
278
|
+ success: function(result) {
|
|
|
279
|
+ if(result.state.toLowerCase() == "success") {
|
|
|
280
|
+ // $("#workorderlist").bootstrapTable('refresh');
|
|
|
281
|
+ }
|
|
|
282
|
+ }
|
|
|
283
|
+ });
|
|
|
284
|
+}
|