|
@@ -116,7 +116,12 @@ export class FuwutaiComponent implements OnInit {
|
116
|
116
|
private http: HttpClient,
|
117
|
117
|
public route: ActivatedRoute,
|
118
|
118
|
public incomingService: WebsocketIncomingService,
|
119
|
|
- ) {}
|
|
119
|
+ ) {
|
|
120
|
+ // 在组件中订阅服务的Observable
|
|
121
|
+ this.phones.getDataUpdate().subscribe(data => {
|
|
122
|
+ this.websocketLoading = data;
|
|
123
|
+ });
|
|
124
|
+ }
|
120
|
125
|
validateFormZy!: FormGroup;
|
121
|
126
|
validateFormQt!: FormGroup;
|
122
|
127
|
// ---------------------------------------
|
|
@@ -804,6 +809,7 @@ export class FuwutaiComponent implements OnInit {
|
804
|
809
|
TLWSA.onOpenreturn = (err) => {
|
805
|
810
|
err = Number(err);
|
806
|
811
|
if (!err) {
|
|
812
|
+ _this.incomingService.setPhoneNumber(TLWSA.phoneNumber);
|
807
|
813
|
_this.websocketLoading = false;
|
808
|
814
|
_this.cancelBindExtensionNumber();
|
809
|
815
|
console.log('呼叫中心连接成功-----seimin');
|
|
@@ -888,12 +894,17 @@ export class FuwutaiComponent implements OnInit {
|
888
|
894
|
clearTimeout(timer);
|
889
|
895
|
if(location.hash === '#/dispatchingDesk'){
|
890
|
896
|
console.log('与服务器网络连接中断-----seimin');
|
891
|
|
- _this.msg.info('与服务器网络连接中断,2分钟后重连')
|
892
|
|
- console.log('2分钟后自动重连-----seimin')
|
893
|
|
- timer = setTimeout(function () {
|
894
|
|
- //连接
|
895
|
|
- tlwsa.tlaOpen(_this.incomingService.getSocketUrl());
|
896
|
|
- }, 120000)
|
|
897
|
+ if(this.incomingService.getPhoneNumber()){
|
|
898
|
+ _this.msg.info('与服务器网络连接中断,2分钟后重连')
|
|
899
|
+ console.log('2分钟后自动重连-----seimin')
|
|
900
|
+ timer = setTimeout(function () {
|
|
901
|
+ //连接
|
|
902
|
+ TLWSA.phoneNumber = _this.incomingService.getPhoneNumber();
|
|
903
|
+ tlwsa.tlaOpen(_this.incomingService.getSocketUrl());
|
|
904
|
+ }, 120000)
|
|
905
|
+ }else{
|
|
906
|
+ _this.websocketLoading = false;
|
|
907
|
+ }
|
897
|
908
|
}
|
898
|
909
|
}
|
899
|
910
|
//签入回调函数
|
|
@@ -1349,14 +1360,15 @@ export class FuwutaiComponent implements OnInit {
|
1349
|
1360
|
|
1350
|
1361
|
showBindExtensionNumber() {
|
1351
|
1362
|
this.showBindExtensionNumberModal = true;
|
|
1363
|
+ this.websocketLoading = false;
|
1352
|
1364
|
}
|
1353
|
1365
|
|
1354
|
1366
|
// 保存绑定分机-签入
|
1355
|
1367
|
checkIn(phoneNumber){
|
1356
|
1368
|
this.websocketLoading = true;
|
1357
|
|
- this.incomingService.setPhoneNumber(phoneNumber);
|
|
1369
|
+ // this.incomingService.setPhoneNumber(phoneNumber);
|
1358
|
1370
|
this.incomingService.closeWs(true);
|
1359
|
|
- this.getWebsocketPhone();
|
|
1371
|
+ this.getWebsocketPhone(phoneNumber);
|
1360
|
1372
|
}
|
1361
|
1373
|
|
1362
|
1374
|
// 签出
|
|
@@ -1385,11 +1397,11 @@ export class FuwutaiComponent implements OnInit {
|
1385
|
1397
|
// tel1: '',//目的号码对象
|
1386
|
1398
|
// tel2: '',//转接坐席对象
|
1387
|
1399
|
}
|
1388
|
|
- getWebsocketPhone() {
|
|
1400
|
+ getWebsocketPhone(phoneNumber) {
|
1389
|
1401
|
const sign = this.incomingService.getSign();
|
1390
|
1402
|
if(sign === 'box'){
|
1391
|
1403
|
// 录音盒
|
1392
|
|
- this.incomingService.connectWs().subscribe((data) => {
|
|
1404
|
+ this.incomingService.connectWs(phoneNumber).subscribe((data) => {
|
1393
|
1405
|
// data = { status: 201, phone: '013581394341' };//ceshi
|
1394
|
1406
|
console.log(data);
|
1395
|
1407
|
console.log(this.incidentModel);
|
|
@@ -1397,6 +1409,7 @@ export class FuwutaiComponent implements OnInit {
|
1397
|
1409
|
|
1398
|
1410
|
// 200签入 201摘机 202来电
|
1399
|
1411
|
if (data.status == 200 && data.phone) {
|
|
1412
|
+ this.incomingService.setPhoneNumber(phoneNumber);
|
1400
|
1413
|
this.incidentModel = {};
|
1401
|
1414
|
this.incidentMsg = {};
|
1402
|
1415
|
this.incidentModel.callID = data.callId || undefined;
|
|
@@ -1426,6 +1439,7 @@ export class FuwutaiComponent implements OnInit {
|
1426
|
1439
|
// 呼叫中心----start
|
1427
|
1440
|
this.preState = '';
|
1428
|
1441
|
//连接
|
|
1442
|
+ TLWSA.phoneNumber = phoneNumber;
|
1429
|
1443
|
tlwsa.tlaOpen(this.incomingService.getSocketUrl());
|
1430
|
1444
|
}else{
|
1431
|
1445
|
this.websocketLoading = false;
|
|
@@ -2485,7 +2499,7 @@ export class FuwutaiComponent implements OnInit {
|
2485
|
2499
|
this.incomingService.removePhoneNumber();
|
2486
|
2500
|
}
|
2487
|
2501
|
if (this.incomingService.getPhoneNumber()) {
|
2488
|
|
- this.getWebsocketPhone();
|
|
2502
|
+ this.getWebsocketPhone(this.incomingService.getPhoneNumber());
|
2489
|
2503
|
}else{
|
2490
|
2504
|
this.websocketLoading = false;
|
2491
|
2505
|
}
|