|
@@ -26,6 +26,9 @@ import { HttpRequest, HttpClient, HttpResponse } from '@angular/common/http';
|
26
|
26
|
import cloneDeep from 'lodash-es/cloneDeep'
|
27
|
27
|
import { WebsocketIncomingService } from 'src/app/services/websocket-incoming.service';
|
28
|
28
|
|
|
29
|
+declare const tlwsa: any;
|
|
30
|
+declare const TLWSA: any;
|
|
31
|
+
|
29
|
32
|
// 日期禁用
|
30
|
33
|
function range(start: number, end: number): number[] {
|
31
|
34
|
const result: number[] = [];
|
|
@@ -919,12 +922,19 @@ export class FuwutaiComponent implements OnInit {
|
919
|
922
|
|
920
|
923
|
// 连接websocket
|
921
|
924
|
websocketLoading:boolean = false; //websocket连接状态
|
|
925
|
+ preState:any = '';//最近一次示忙还是示闲的状态
|
|
926
|
+ isShixian = false;//是否示闲
|
|
927
|
+ jry_state = '';//话机状态
|
|
928
|
+ jry_extnNumberObj = {
|
|
929
|
+ // tel1: '',//目的号码对象
|
|
930
|
+ // tel2: '',//转接坐席对象
|
|
931
|
+ }
|
922
|
932
|
getWebsocketPhone() {
|
923
|
933
|
this.websocketLoading = true;
|
924
|
|
- this.incomingService.connectWs().subscribe((data) => {
|
925
|
|
- const sign = this.incomingService.getSign();
|
926
|
|
- if(sign === 'box'){
|
927
|
|
- // 录音盒
|
|
934
|
+ const sign = this.incomingService.getSign();
|
|
935
|
+ if(sign === 'box'){
|
|
936
|
+ // 录音盒
|
|
937
|
+ this.incomingService.connectWs().subscribe((data) => {
|
928
|
938
|
// data = { status: 201, phone: '013581394341' };//ceshi
|
929
|
939
|
console.log(data);
|
930
|
940
|
this.websocketLoading = false;
|
|
@@ -934,35 +944,7 @@ export class FuwutaiComponent implements OnInit {
|
934
|
944
|
this.cancelBindExtensionNumber();
|
935
|
945
|
} else if (data.status == 201 && data.phone) {
|
936
|
946
|
this.incidentModel.incomingPhone = this.callNumber = data.phone;
|
937
|
|
- let dataObj = {
|
938
|
|
- idx: 0,
|
939
|
|
- sum: 10,
|
940
|
|
- department: {
|
941
|
|
- searchType: 2,
|
942
|
|
- phone: data.phone,
|
943
|
|
- },
|
944
|
|
- };
|
945
|
|
- this.mainService
|
946
|
|
- .getFetchDataList("data", "department", dataObj)
|
947
|
|
- .subscribe((result) => {
|
948
|
|
- if (result.status == 200) {
|
949
|
|
- console.log(result);
|
950
|
|
- if (result.list.length > 0) {
|
951
|
|
- //绑定了科室
|
952
|
|
- if (!this.newOrderShow && !this.newOrderShowOpen) {
|
953
|
|
- this.applyDeptMiddle = result.list[0];
|
954
|
|
- this.showNewOrder("yes", data.phone, true);
|
955
|
|
- }
|
956
|
|
- } else {
|
957
|
|
- //没绑定科室
|
958
|
|
- console.log(this.newOrderShow);
|
959
|
|
- if (!this.newOrderShow && !this.newOrderShowOpen) {
|
960
|
|
- this.applyDept = null;
|
961
|
|
- this.showNewOrder("no", data.phone, true);
|
962
|
|
- }
|
963
|
|
- }
|
964
|
|
- }
|
965
|
|
- });
|
|
947
|
+ this.searchBxDept();
|
966
|
948
|
} else if (data.status == 201 && data.phone === "") {
|
967
|
949
|
//没绑定科室
|
968
|
950
|
if (!this.newOrderShow && !this.newOrderShowOpen) {
|
|
@@ -970,72 +952,516 @@ export class FuwutaiComponent implements OnInit {
|
970
|
952
|
this.showNewOrder("no", data.phone, true);
|
971
|
953
|
}
|
972
|
954
|
}
|
973
|
|
- }else if(sign === 'callCenter'){
|
974
|
|
- // 呼叫中心
|
975
|
|
- console.log(data);
|
976
|
|
- this.websocketLoading = false;
|
977
|
|
- // this.incidentModel.callID = data.callId || undefined;
|
978
|
|
- // if (data.status == 200 && data.phone) {
|
979
|
|
- // this.cancelBindExtensionNumber();
|
980
|
|
- // } else if (data.status == 201 && data.phone) {
|
981
|
|
- // let dataObj = {
|
982
|
|
- // idx: 0,
|
983
|
|
- // sum: 10,
|
984
|
|
- // department: {
|
985
|
|
- // searchType: 2,
|
986
|
|
- // phone: data.phone,
|
987
|
|
- // },
|
988
|
|
- // };
|
989
|
|
- // this.mainService
|
990
|
|
- // .getFetchDataList("data", "department", dataObj)
|
991
|
|
- // .subscribe((result) => {
|
992
|
|
- // if (result.status == 200) {
|
993
|
|
- // console.log(result);
|
994
|
|
- // if (result.list.length > 0) {
|
995
|
|
- // //绑定了科室
|
996
|
|
- // if (!this.newOrderShow && !this.newOrderShowOpen) {
|
997
|
|
- // this.applyDeptMiddle = result.list[0];
|
998
|
|
- // this.showNewOrder("yes");
|
999
|
|
- // }
|
1000
|
|
- // } else {
|
1001
|
|
- // //没绑定科室
|
1002
|
|
- // console.log(this.newOrderShow);
|
1003
|
|
- // if (!this.newOrderShow && !this.newOrderShowOpen) {
|
1004
|
|
- // this.applyDept = null;
|
1005
|
|
- // this.showNewOrder("no", data.phone);
|
1006
|
|
- // }
|
1007
|
|
- // }
|
1008
|
|
- // }
|
1009
|
|
- // });
|
1010
|
|
- // } else if (data.status == 201 && data.phone === "") {
|
1011
|
|
- // //没绑定科室
|
1012
|
|
- // if (!this.newOrderShow && !this.newOrderShowOpen) {
|
1013
|
|
- // this.applyDept = null;
|
1014
|
|
- // this.showNewOrder("no", data.phone);
|
1015
|
|
- // }
|
1016
|
|
- // }
|
|
955
|
+ });
|
|
956
|
+ }else if(sign === 'callCenter'){
|
|
957
|
+ // 呼叫中心----start
|
|
958
|
+ let _this = this;
|
|
959
|
+ _this.websocketLoading = false;
|
|
960
|
+ _this.preState = '';
|
|
961
|
+ //连接
|
|
962
|
+ tlwsa.tlaOpen(_this.incomingService.getSocketUrl());
|
|
963
|
+ // 状态回调函数
|
|
964
|
+ // TLWSA.onStatechange = onstatechange;
|
|
965
|
+ // function onstatechange() {
|
|
966
|
+ // console.log('事件:状态变化----------------------------------------------------');
|
|
967
|
+ // _this.getState();
|
|
968
|
+ // }
|
|
969
|
+ //连接呼叫中心回调函数
|
|
970
|
+ TLWSA.onOpenreturn = (err) => {
|
|
971
|
+ err = Number(err);
|
|
972
|
+ if (!err) {
|
|
973
|
+ _this.cancelBindExtensionNumber();
|
|
974
|
+ console.log('呼叫中心连接成功-----seimin');
|
|
975
|
+ _this.getState(0);
|
|
976
|
+ _this.msg.success('呼叫中心连接成功')
|
|
977
|
+
|
|
978
|
+ //如果设置过话机
|
|
979
|
+ if (_this.incomingService.getPhoneNumberPre()) {
|
|
980
|
+ //强制签出,然后签入
|
|
981
|
+ tlwsa.tlaKillworkid(_this.incomingService.getPhoneNumberPre());
|
|
982
|
+ }else{
|
|
983
|
+ // 签入并绑定分机
|
|
984
|
+ tlwsa.tlaLogin(_this.user.user.id, 1, -1);
|
|
985
|
+ }
|
|
986
|
+ } else {
|
|
987
|
+ console.log('呼叫中心连接失败-----seimin');
|
|
988
|
+ _this.getState(0);
|
|
989
|
+ _this.msg.error('呼叫中心连接失败')
|
|
990
|
+ }
|
1017
|
991
|
}
|
1018
|
|
- });
|
|
992
|
+ //绑定分机回调函数
|
|
993
|
+ TLWSA.onSetphonenumberreturn = function (err) {
|
|
994
|
+ err = Number(err);
|
|
995
|
+ if (!err) {
|
|
996
|
+ console.log('绑定分机成功-----seimin');
|
|
997
|
+ _this.msg.success('绑定分机成功')
|
|
998
|
+ _this.incomingService.setPhoneNumberPre(_this.user.user.id);
|
|
999
|
+ _this.qShimang(1);
|
|
1000
|
+ } else {
|
|
1001
|
+ console.log('绑定分机失败-----seimin');
|
|
1002
|
+ _this.getState(0);
|
|
1003
|
+ _this.msg.error('绑定分机失败')
|
|
1004
|
+ }
|
|
1005
|
+ }
|
|
1006
|
+ //强制示忙回调函数
|
|
1007
|
+ // TLWSA.onAcw = onacw;
|
|
1008
|
+ // function onacw(err) {
|
|
1009
|
+ // err = Number(err);
|
|
1010
|
+ // if (!err) {
|
|
1011
|
+ // console.log('强制示忙成功-----seimin');
|
|
1012
|
+ // _this.getState(2);
|
|
1013
|
+ // $.toaster({
|
|
1014
|
+ // priority: 'info',
|
|
1015
|
+ // title: '操作',
|
|
1016
|
+ // message: '示忙成功'
|
|
1017
|
+ // });
|
|
1018
|
+ // } else {
|
|
1019
|
+ // console.log('强制示忙失败-----seimin');
|
|
1020
|
+ // $.toaster({
|
|
1021
|
+ // priority: 'info',
|
|
1022
|
+ // title: '操作',
|
|
1023
|
+ // message: '示忙失败'
|
|
1024
|
+ // });
|
|
1025
|
+ // }
|
|
1026
|
+ // }
|
|
1027
|
+ // //强制示闲回调函数
|
|
1028
|
+ // TLWSA.onWca = onwca;
|
|
1029
|
+ // function onwca(err) {
|
|
1030
|
+ // console.log(err)
|
|
1031
|
+ // err = Number(err);
|
|
1032
|
+ // if (!err) {
|
|
1033
|
+ // console.log('强制示闲成功-----seimin');
|
|
1034
|
+ // _this.getState(1);
|
|
1035
|
+ // $.toaster({
|
|
1036
|
+ // priority: 'info',
|
|
1037
|
+ // title: '操作',
|
|
1038
|
+ // message: '示闲成功'
|
|
1039
|
+ // });
|
|
1040
|
+ // } else {
|
|
1041
|
+ // console.log('强制示闲失败-----seimin');
|
|
1042
|
+ // $.toaster({
|
|
1043
|
+ // priority: 'info',
|
|
1044
|
+ // title: '操作',
|
|
1045
|
+ // message: '示闲失败'
|
|
1046
|
+ // });
|
|
1047
|
+ // }
|
|
1048
|
+ // }
|
|
1049
|
+ //与服务器网络连接中断回调函数
|
|
1050
|
+ let timer = null;
|
|
1051
|
+ TLWSA.onClosed = () => {
|
|
1052
|
+ _this.getState(0);
|
|
1053
|
+ console.log('与服务器网络连接中断-----seimin');
|
|
1054
|
+ _this.msg.info('与服务器网络连接中断,2分钟后重连')
|
|
1055
|
+ console.log('2分钟后自动重连-----seimin')
|
|
1056
|
+ clearTimeout(timer);
|
|
1057
|
+ timer = setTimeout(function () {
|
|
1058
|
+ //连接
|
|
1059
|
+ tlwsa.tlaOpen(_this.incomingService.getSocketUrl());
|
|
1060
|
+ }, 120000)
|
|
1061
|
+ }
|
|
1062
|
+ //签入回调函数
|
|
1063
|
+ TLWSA.onLoginreturn = function (err) {
|
|
1064
|
+ err = Number(err);
|
|
1065
|
+ if (!err) {
|
|
1066
|
+ console.log('签入成功-----seimin');
|
|
1067
|
+ _this.msg.success('签入成功')
|
|
1068
|
+ setTimeout(function () {
|
|
1069
|
+ console.log(_this.incomingService.getPhoneNumber(), 1111)
|
|
1070
|
+ var phoneNumber = _this.incomingService.getPhoneNumber();
|
|
1071
|
+ console.log('开始绑定分机【' + phoneNumber + '】-----seimin');
|
|
1072
|
+ tlwsa.tlaSetphonenumber(phoneNumber);
|
|
1073
|
+ }, 0)
|
|
1074
|
+ } else if (err == 9011) {
|
|
1075
|
+ console.log('签入失败,该分机已登录-----seimin');
|
|
1076
|
+ _this.msg.error('签入失败,该分机已登录')
|
|
1077
|
+ } else {
|
|
1078
|
+ console.log('签入失败-----seimin');
|
|
1079
|
+ _this.msg.error('签入失败')
|
|
1080
|
+ }
|
|
1081
|
+ }
|
|
1082
|
+ // 强制签出回调函数
|
|
1083
|
+ TLWSA.onKillreturn = function (err) {
|
|
1084
|
+ err = Number(err);
|
|
1085
|
+ if (!err) {
|
|
1086
|
+ console.log('强制签出成功-----seimin');
|
|
1087
|
+ _this.getState(0);
|
|
1088
|
+ // $.toaster({
|
|
1089
|
+ // priority: 'info',
|
|
1090
|
+ // title: '操作',
|
|
1091
|
+ // message: '强制签出成功'
|
|
1092
|
+ // });
|
|
1093
|
+ } else {
|
|
1094
|
+ console.log('强制签出失败,该分机不是签入状态-----seimin');
|
|
1095
|
+ // $.toaster({
|
|
1096
|
+ // priority: 'info',
|
|
1097
|
+ // title: '操作',
|
|
1098
|
+ // message: '强制签出失败'
|
|
1099
|
+ // });
|
|
1100
|
+ }
|
|
1101
|
+ //如果设置过话机
|
|
1102
|
+ if (_this.incomingService.getPhoneNumberPre()) {
|
|
1103
|
+ // 签入并绑定分机
|
|
1104
|
+ tlwsa.tlaLogin(_this.incomingService.getPhoneNumberPre(), 1, -1);
|
|
1105
|
+ }
|
|
1106
|
+ }
|
|
1107
|
+ // 签出回调函数
|
|
1108
|
+ TLWSA.onLogoffreturn = function (err) {
|
|
1109
|
+ err = Number(err);
|
|
1110
|
+ if (!err) {
|
|
1111
|
+ console.log('签出成功-----seimin');
|
|
1112
|
+ _this.getState(0);
|
|
1113
|
+ _this.msg.success('签出成功')
|
|
1114
|
+ _this.incomingService.removePhoneNumberPre();
|
|
1115
|
+ _this.incomingService.removePhoneNumber();
|
|
1116
|
+ } else {
|
|
1117
|
+ console.log('签出失败-----seimin');
|
|
1118
|
+ _this.msg.error('签出失败')
|
|
1119
|
+ }
|
|
1120
|
+ }
|
|
1121
|
+ //示忙回调函数
|
|
1122
|
+ TLWSA.onAcwreturn = function (err) {
|
|
1123
|
+ err = Number(err);
|
|
1124
|
+ if (!err) {
|
|
1125
|
+ console.log('示忙成功-----seimin');
|
|
1126
|
+ if (location.href.includes('app/incident/editor') || location.href.includes('app/incident/chart')) {
|
|
1127
|
+ _this.isShixian = false;
|
|
1128
|
+ } else {
|
|
1129
|
+ _this.isShixian = true;
|
|
1130
|
+ }
|
|
1131
|
+ _this.getState(2);
|
|
1132
|
+ _this.preState = 2;
|
|
1133
|
+ _this.msg.success('示忙成功')
|
|
1134
|
+ } else {
|
|
1135
|
+ console.log('示忙失败-----seimin');
|
|
1136
|
+ // $.toaster({
|
|
1137
|
+ // priority: 'info',
|
|
1138
|
+ // title: '操作',
|
|
1139
|
+ // message: '示忙失败'
|
|
1140
|
+ // });
|
|
1141
|
+ }
|
|
1142
|
+ }
|
|
1143
|
+ //示闲回调函数
|
|
1144
|
+ TLWSA.onWcareturn = function (err) {
|
|
1145
|
+ err = Number(err);
|
|
1146
|
+ if (!err) {
|
|
1147
|
+ console.log('示闲成功-----seimin');
|
|
1148
|
+ _this.getState(1);
|
|
1149
|
+ _this.preState = 1;
|
|
1150
|
+ _this.msg.success('示闲成功')
|
|
1151
|
+ } else {
|
|
1152
|
+ console.log('示闲失败-----seimin');
|
|
1153
|
+ _this.msg.error('示闲失败')
|
|
1154
|
+ }
|
|
1155
|
+ }
|
|
1156
|
+ //呼叫坐席回调函数
|
|
1157
|
+ TLWSA.onCallreturn = function (err) {
|
|
1158
|
+ err = Number(err);
|
|
1159
|
+ if (!err) {
|
|
1160
|
+ console.log('呼叫成功,请摘机-----seimin');
|
|
1161
|
+ _this.getState(6);
|
|
1162
|
+ _this.msg.success('呼叫成功,请摘机')
|
|
1163
|
+ } else {
|
|
1164
|
+ console.log('呼叫失败-----seimin');
|
|
1165
|
+ _this.msg.error('呼叫失败')
|
|
1166
|
+ }
|
|
1167
|
+ }
|
|
1168
|
+ //呼叫坐席被接听回调函数
|
|
1169
|
+ TLWSA.onCallresult = function (jso) {
|
|
1170
|
+ console.log(jso);
|
|
1171
|
+ var err = Number(jso.err);
|
|
1172
|
+ if (!err) {
|
|
1173
|
+ console.log('呼叫被接听成功-----seimin');
|
|
1174
|
+ _this.getState(5);
|
|
1175
|
+ _this.msg.success('呼叫被接听成功')
|
|
1176
|
+ } else {
|
|
1177
|
+ console.log('呼叫被接听失败-----seimin');
|
|
1178
|
+ _this.qShimang(1);
|
|
1179
|
+ _this.msg.error('呼叫被接听失败')
|
|
1180
|
+ }
|
|
1181
|
+ }
|
|
1182
|
+ //挂断回调函数
|
|
1183
|
+ TLWSA.onCallend = function (jso) {
|
|
1184
|
+ console.log(jso);//lmm
|
|
1185
|
+ if (jso) {
|
|
1186
|
+ console.log('挂断成功-----seimin');
|
|
1187
|
+ console.log('最近一次话机状态', _this.preState);
|
|
1188
|
+ _this.qShimang(_this.preState);
|
|
1189
|
+ _this.msg.success('挂断成功')
|
|
1190
|
+ } else {
|
|
1191
|
+ console.log('挂断失败-----seimin');
|
|
1192
|
+ _this.msg.error('挂断失败')
|
|
1193
|
+ }
|
|
1194
|
+ }
|
|
1195
|
+ //呼入回调函数
|
|
1196
|
+ TLWSA.onCallin = function (jso) {
|
|
1197
|
+ console.log(jso);
|
|
1198
|
+ _this.callNumber = _this.incidentModel.incomingPhone = jso.caller;//来电的电话
|
|
1199
|
+ _this.incidentModel.callID = jso.crs;//来电的话机id
|
|
1200
|
+ if (jso) {
|
|
1201
|
+ console.log('呼入坐席成功,请摘机-----seimin');
|
|
1202
|
+ _this.getState(3);
|
|
1203
|
+ _this.msg.success('呼入坐席成功,请摘机')
|
|
1204
|
+ console.log('来电了!电话号码是【' + _this.incidentModel.incomingPhone + '】');
|
|
1205
|
+ } else {
|
|
1206
|
+ console.log('呼入坐席失败-----seimin');
|
|
1207
|
+ _this.msg.error('呼入坐席失败')
|
|
1208
|
+ }
|
|
1209
|
+ }
|
|
1210
|
+ // 测试代码start
|
|
1211
|
+ // searchBxDept();
|
|
1212
|
+ // 测试代码end
|
|
1213
|
+ // 查报修科室
|
|
1214
|
+ // function searchBxDept() {
|
|
1215
|
+ // var postData = { "idx": 0, "sum": 10, "department": { phone: _this.callNumber = _this.incidentModel.incomingPhone } };//hjzxPhone
|
|
1216
|
+ // api_user_data.fetchDataList('department', postData).then(function (result) {
|
|
1217
|
+ // if (result.status == 200) {
|
|
1218
|
+ // console.log(result.list);
|
|
1219
|
+ // var requesters = result.list;
|
|
1220
|
+
|
|
1221
|
+
|
|
1222
|
+ // if (requesters.length === 0) {
|
|
1223
|
+ // //未匹配到报修科室
|
|
1224
|
+ // $rootScope.newOrder({
|
|
1225
|
+ // incident: {
|
|
1226
|
+ // sockid: _this.incidentModel.callID,
|
|
1227
|
+ // incomingPhone: _this.callNumber = _this.incidentModel.incomingPhone,
|
|
1228
|
+ // source: { id: 1547, name: '电话' }
|
|
1229
|
+ // },
|
|
1230
|
+ // }, 'incomingCall')
|
|
1231
|
+ // } else if (requesters.length === 1) {
|
|
1232
|
+ // //匹配到一个报修科室
|
|
1233
|
+ // $rootScope.newOrder({
|
|
1234
|
+ // incident: {
|
|
1235
|
+ // department: requesters[0],
|
|
1236
|
+ // phone: requesters[0].phone,
|
|
1237
|
+ // sockid: _this.incidentModel.callID,
|
|
1238
|
+ // incomingPhone: _this.callNumber = _this.incidentModel.incomingPhone,
|
|
1239
|
+ // source: { id: 1547, name: '电话' }
|
|
1240
|
+ // },
|
|
1241
|
+ // }, 'incomingCall')
|
|
1242
|
+ // } else {
|
|
1243
|
+ // //匹配到多个报修科室
|
|
1244
|
+ // $modal.open({
|
|
1245
|
+ // templateUrl: 'assets/views/incident/tpl/tel.html',
|
|
1246
|
+ // controller: function ($scope, $modalInstance, $timeout, SweetAlert) {
|
|
1247
|
+ // $scope.list = requesters;
|
|
1248
|
+ // $scope.selected = {
|
|
1249
|
+ // selectedItem: 0
|
|
1250
|
+ // };
|
|
1251
|
+ // $scope.cancel = function () {
|
|
1252
|
+ // $modalInstance.dismiss('cancel');
|
|
1253
|
+ // };
|
|
1254
|
+ // $scope.changeBxr = function (id) {
|
|
1255
|
+ // $scope.selected.selectedItem = id;
|
|
1256
|
+ // }
|
|
1257
|
+ // $scope.save = function () {
|
|
1258
|
+ // var item = $scope.list.find(v => v.id == $scope.selected.selectedItem);
|
|
1259
|
+ // if (item) {
|
|
1260
|
+ // $scope.cancel();
|
|
1261
|
+ // $rootScope.newOrder({
|
|
1262
|
+ // incident: {
|
|
1263
|
+ // department: item,
|
|
1264
|
+ // phone: item.phone,
|
|
1265
|
+ // sockid: _this.incidentModel.callID,
|
|
1266
|
+ // incomingPhone: _this.callNumber = _this.incidentModel.incomingPhone,
|
|
1267
|
+ // source: { id: 1547, name: '电话' }
|
|
1268
|
+ // },
|
|
1269
|
+ // }, 'incomingCall')
|
|
1270
|
+ // } else {
|
|
1271
|
+ // SweetAlert.swal({
|
|
1272
|
+ // title: "请选择报修科室!",
|
|
1273
|
+ // type: "error"
|
|
1274
|
+ // })
|
|
1275
|
+ // }
|
|
1276
|
+ // }
|
|
1277
|
+ // }
|
|
1278
|
+ // });
|
|
1279
|
+ // }
|
|
1280
|
+ // }
|
|
1281
|
+ // })
|
|
1282
|
+ // }
|
|
1283
|
+
|
|
1284
|
+ //呼入摘机应答回调函数
|
|
1285
|
+ TLWSA.onAnswer = function (err) {
|
|
1286
|
+ err = Number(err);
|
|
1287
|
+ if (!err) {
|
|
1288
|
+ console.log('呼入摘机应答成功-----seimin');
|
|
1289
|
+ _this.getState(5);
|
|
1290
|
+ _this.msg.success('呼入摘机应答成功')
|
|
1291
|
+
|
|
1292
|
+ // 查报修科室
|
|
1293
|
+ _this.searchBxDept();
|
|
1294
|
+ } else {
|
|
1295
|
+ console.log('呼入摘机应答失败-----seimin');
|
|
1296
|
+ _this.msg.error('呼入摘机应答失败')
|
|
1297
|
+ }
|
|
1298
|
+ }
|
|
1299
|
+ //呼入未摘机应答回调函数
|
|
1300
|
+ TLWSA.onMisscall = function (err) {
|
|
1301
|
+ err = Number(err);
|
|
1302
|
+ if (!err) {
|
|
1303
|
+ console.log('呼入未摘机应答成功-----seimin');
|
|
1304
|
+ _this.getState(1);
|
|
1305
|
+ _this.msg.success('呼入未摘机应答成功')
|
|
1306
|
+ } else {
|
|
1307
|
+ console.log('呼入未摘机应答失败-----seimin');
|
|
1308
|
+ _this.msg.error('呼入未摘机应答失败')
|
|
1309
|
+ }
|
|
1310
|
+ }
|
|
1311
|
+ //转接开始回调函数
|
|
1312
|
+ //调用转移方法之后,返回该事件 如果错误码为0,仅仅表示开始转移,不代表转移目标已经接听或已经拒绝
|
|
1313
|
+ TLWSA.onTransferreturn = function (err) {
|
|
1314
|
+ err = Number(err);
|
|
1315
|
+ if (!err) {
|
|
1316
|
+ console.log('转接坐席开始成功-----seimin');
|
|
1317
|
+ _this.getState(7);
|
|
1318
|
+ _this.msg.success('转接坐席开始成功')
|
|
1319
|
+ } else {
|
|
1320
|
+ console.log('转接坐席开始失败-----seimin');
|
|
1321
|
+ _this.msg.error('转接坐席开始失败')
|
|
1322
|
+ }
|
|
1323
|
+ }
|
|
1324
|
+ //转接结果回调函数
|
|
1325
|
+ TLWSA.onTransferresult = function (err) {
|
|
1326
|
+ err = Number(err);
|
|
1327
|
+ if (!err) {
|
|
1328
|
+ console.log('转接坐席结果成功-----seimin');
|
|
1329
|
+ _this.getState(1);
|
|
1330
|
+ _this.msg.success('转接坐席结果成功')
|
|
1331
|
+ } else {
|
|
1332
|
+ console.log('转接坐席结果失败-----seimin');
|
|
1333
|
+ _this.msg.error('转接坐席结果失败')
|
|
1334
|
+ }
|
|
1335
|
+ }
|
|
1336
|
+ // 呼叫中心----end
|
|
1337
|
+ }
|
1019
|
1338
|
}
|
1020
|
|
- //确定绑定
|
1021
|
|
- // bindingOk() {
|
1022
|
|
- // if (this.phoneNumListSelected.length > 0) {
|
1023
|
|
- // this.incomingService.closeWs(true);
|
1024
|
|
- // this.getWebsocketPhone();
|
1025
|
|
- // } else {
|
1026
|
|
- // this.incomingService.removePhoneNumber();
|
1027
|
|
- // this.binding = 3;
|
1028
|
|
- // this.phoneNumListBind = [];
|
1029
|
|
- // this.phoneNumList.forEach((item) => {
|
1030
|
|
- // item.checked = false;
|
1031
|
|
- // });
|
1032
|
|
- // this.incomingService.closeWs(true);
|
1033
|
|
- // }
|
|
1339
|
+
|
|
1340
|
+ // 呼叫中心---start
|
|
1341
|
+ searchBxDept(){
|
|
1342
|
+ let dataObj = {
|
|
1343
|
+ idx: 0,
|
|
1344
|
+ sum: 10,
|
|
1345
|
+ department: {
|
|
1346
|
+ searchType: 2,
|
|
1347
|
+ phone: this.incidentModel.incomingPhone,
|
|
1348
|
+ },
|
|
1349
|
+ };
|
|
1350
|
+ this.mainService
|
|
1351
|
+ .getFetchDataList("data", "department", dataObj)
|
|
1352
|
+ .subscribe((result) => {
|
|
1353
|
+ if (result.status == 200) {
|
|
1354
|
+ console.log(result);
|
|
1355
|
+ if (result.list.length > 0) {
|
|
1356
|
+ //绑定了科室
|
|
1357
|
+ if (!this.newOrderShow && !this.newOrderShowOpen) {
|
|
1358
|
+ this.applyDeptMiddle = result.list[0];
|
|
1359
|
+ this.showNewOrder("yes", this.incidentModel.incomingPhone, true);
|
|
1360
|
+ }
|
|
1361
|
+ } else {
|
|
1362
|
+ //没绑定科室
|
|
1363
|
+ console.log(this.newOrderShow);
|
|
1364
|
+ if (!this.newOrderShow && !this.newOrderShowOpen) {
|
|
1365
|
+ this.applyDept = null;
|
|
1366
|
+ this.showNewOrder("no", this.incidentModel.incomingPhone, true);
|
|
1367
|
+ }
|
|
1368
|
+ }
|
|
1369
|
+ }
|
|
1370
|
+ });
|
|
1371
|
+ }
|
|
1372
|
+ // 强制示忙
|
|
1373
|
+ qShimang(state) {
|
|
1374
|
+ if (location.href.includes('app/incident/editor') || location.href.includes('app/incident/chart')) {
|
|
1375
|
+ //进入页面,强制示忙
|
|
1376
|
+ // tlwsa.tlaForceacw(this.user.user.id);
|
|
1377
|
+ setTimeout(() => {
|
|
1378
|
+ tlwsa.tlaAcw();
|
|
1379
|
+ }, 0)
|
|
1380
|
+ } else {
|
|
1381
|
+ this.getState(state);
|
|
1382
|
+ }
|
|
1383
|
+ }
|
|
1384
|
+ // 获取状态
|
|
1385
|
+ getState(state) {
|
|
1386
|
+ switch (state) {
|
|
1387
|
+ case 0:
|
|
1388
|
+ this.jry_state = 'weiqianru';
|
|
1389
|
+ break;
|
|
1390
|
+ case 1:
|
|
1391
|
+ this.jry_state = 'shixian';
|
|
1392
|
+ break;
|
|
1393
|
+ case 2:
|
|
1394
|
+ this.jry_state = 'shimang';
|
|
1395
|
+ break;
|
|
1396
|
+ case 3:
|
|
1397
|
+ this.jry_state = 'laidian';
|
|
1398
|
+ break;
|
|
1399
|
+ case 5:
|
|
1400
|
+ this.jry_state = 'tonghuazhong';
|
|
1401
|
+ break;
|
|
1402
|
+ case 6:
|
|
1403
|
+ this.jry_state = 'zhengzaiwaihu';
|
|
1404
|
+ break;
|
|
1405
|
+ case 7:
|
|
1406
|
+ this.jry_state = 'zhengzaizhuanyi';
|
|
1407
|
+ break;
|
|
1408
|
+ }
|
|
1409
|
+ }
|
|
1410
|
+ // 签入
|
|
1411
|
+ jry_qianru = function () {
|
|
1412
|
+ if (!this.incomingService.getPhoneNumber()) {
|
|
1413
|
+ this.msg.warning('绑定分机不能为空')
|
|
1414
|
+ return;
|
|
1415
|
+ }
|
|
1416
|
+ // 签入并绑定分机
|
|
1417
|
+ // this.incomingService.getPhoneNumber() 分机号
|
|
1418
|
+ // this.user.user.id 坐席号(用户id)
|
|
1419
|
+ tlwsa.tlaLogin(this.user.user.id, 1, -1);
|
|
1420
|
+ }
|
|
1421
|
+ // 示闲
|
|
1422
|
+ jry_shixian = function () {
|
|
1423
|
+ tlwsa.tlaWca();
|
|
1424
|
+ }
|
|
1425
|
+ // 示忙
|
|
1426
|
+ jry_shimang = function () {
|
|
1427
|
+ tlwsa.tlaAcw();
|
|
1428
|
+ }
|
|
1429
|
+ // 签出
|
|
1430
|
+ jry_qianchu = function () {
|
|
1431
|
+ tlwsa.tlaLogoff();
|
|
1432
|
+ }
|
|
1433
|
+ // 呼叫坐席
|
|
1434
|
+ // tlaCallagc = function () {
|
|
1435
|
+ // tlwsa.tlaCallagc(this.jry_extnNumberObj.tel1)
|
1034
|
1436
|
// }
|
1035
|
|
- // 选择分机
|
1036
|
|
- // changePhones(value) {
|
1037
|
|
- // this.phoneNumListSelected = value;
|
|
1437
|
+ // 呼叫外线
|
|
1438
|
+ tlaCallout = function () {
|
|
1439
|
+ // 选择目的号码
|
|
1440
|
+ var reg1 = /^[0][1-9]{2,3}-[0-9]{5,10}$/;
|
|
1441
|
+ var reg2 = /^(0|9|90|86|17951)?(13[0-9]|15[012356789]|166|17[3678]|18[0-9]|14[57])[0-9]{8}$/;
|
|
1442
|
+ if (!reg1.test(this.jry_extnNumberObj.tel1) && !reg2.test(this.jry_extnNumberObj.tel1)) {
|
|
1443
|
+ this.msg.warning('请输入正确的手机号或座机号')
|
|
1444
|
+ return;
|
|
1445
|
+ }
|
|
1446
|
+ // tlwsa.tlaCallout(this.jry_extnNumberObj.tel1,this.incomingService.getPhoneNumber(),0)
|
|
1447
|
+ tlwsa.tlaCallout(this.jry_extnNumberObj.tel1, '3558177', 1);//襄阳主叫号码写死
|
|
1448
|
+ }
|
|
1449
|
+ // // 转移坐席
|
|
1450
|
+ // tlaTransfertoagc = function () {
|
|
1451
|
+ // tlwsa.tlaTransfertoagc(this.jry_extnNumberObj.tel2)
|
1038
|
1452
|
// }
|
|
1453
|
+ // 转移外线
|
|
1454
|
+ tlaTransferout = function () {
|
|
1455
|
+ // 选择转接号码
|
|
1456
|
+ var reg1 = /^[0][1-9]{2,3}-[0-9]{5,10}$/;
|
|
1457
|
+ var reg2 = /^(0|9|90|86|17951)?(13[0-9]|15[012356789]|166|17[3678]|18[0-9]|14[57])[0-9]{8}$/;
|
|
1458
|
+ if (!reg1.test(this.jry_extnNumberObj.tel2) && !reg2.test(this.jry_extnNumberObj.tel2)) {
|
|
1459
|
+ this.msg.warning('请输入正确的手机号或座机号')
|
|
1460
|
+ return;
|
|
1461
|
+ }
|
|
1462
|
+ tlwsa.tlaTransferout(this.jry_extnNumberObj.tel2, '3558177', 1);//襄阳主叫号码写死
|
|
1463
|
+ }
|
|
1464
|
+ // 呼叫中心---end
|
1039
|
1465
|
|
1040
|
1466
|
onChange(value: number): void {
|
1041
|
1467
|
console.log(`onChange: ${value}`);
|
|
@@ -1683,6 +2109,7 @@ export class FuwutaiComponent implements OnInit {
|
1683
|
2109
|
localStorage.removeItem("user");
|
1684
|
2110
|
localStorage.removeItem("menu");
|
1685
|
2111
|
this.incomingService.removePhoneNumber();
|
|
2112
|
+ this.incomingService.removePhoneNumberPre();
|
1686
|
2113
|
localStorage.removeItem("index");
|
1687
|
2114
|
// 假退出
|
1688
|
2115
|
this.mainService.logOut().subscribe((data) => {
|
|
@@ -1697,6 +2124,7 @@ export class FuwutaiComponent implements OnInit {
|
1697
|
2124
|
localStorage.removeItem("user");
|
1698
|
2125
|
localStorage.removeItem("menu");
|
1699
|
2126
|
this.incomingService.removePhoneNumber();
|
|
2127
|
+ this.incomingService.removePhoneNumberPre();
|
1700
|
2128
|
localStorage.removeItem("index");
|
1701
|
2129
|
}
|
1702
|
2130
|
});
|