|
@@ -4,6 +4,7 @@ import {
|
4
|
4
|
TemplateRef,
|
5
|
5
|
ViewChild,
|
6
|
6
|
ElementRef,
|
|
7
|
+ HostListener,
|
7
|
8
|
} from "@angular/core";
|
8
|
9
|
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
|
9
|
10
|
import { Router, ActivatedRoute } from "@angular/router";
|
|
@@ -643,6 +644,7 @@ export class FuwutaiComponent implements OnInit {
|
643
|
644
|
});
|
644
|
645
|
}
|
645
|
646
|
ngOnInit() {
|
|
647
|
+ this.websocketLoading = true;
|
646
|
648
|
this.coopBtns = this.tool.initCoopBtns(this.route);
|
647
|
649
|
//防抖
|
648
|
650
|
this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
|
|
@@ -704,9 +706,17 @@ export class FuwutaiComponent implements OnInit {
|
704
|
706
|
this.initControlView();
|
705
|
707
|
this.moveMenu("fixedMenu");
|
706
|
708
|
this.moveMenu("fixedMenuLeft");
|
707
|
|
- this.getPhoneNum();
|
|
709
|
+ if(this.incomingService.getSign() === 'box'){
|
|
710
|
+ this.getPhoneNum();
|
|
711
|
+ }else if(this.incomingService.getSign() === 'callCenter'){
|
|
712
|
+ let _this = this;
|
|
713
|
+ setTimeout(this.getPhoneNum.bind(this), 2000)
|
|
714
|
+ }else{
|
|
715
|
+ this.websocketLoading = false;
|
|
716
|
+ }
|
708
|
717
|
this.getUnassignedBuilding2();
|
709
|
718
|
this.getInspectAndPatientTransportConfigTasktype();
|
|
719
|
+ this.initCallCenter();
|
710
|
720
|
}
|
711
|
721
|
ngOnDestroy() {
|
712
|
722
|
document.removeEventListener("keydown", this.quickShowNewOrder.bind(this));
|
|
@@ -719,6 +729,386 @@ export class FuwutaiComponent implements OnInit {
|
719
|
729
|
// 快捷键打开新建工单
|
720
|
730
|
document.addEventListener("keydown", this.quickShowNewOrder.bind(this));
|
721
|
731
|
}
|
|
732
|
+
|
|
733
|
+ // 初始化呼叫中心方法
|
|
734
|
+ initCallCenter(){
|
|
735
|
+ let _this = this;
|
|
736
|
+ // 状态回调函数
|
|
737
|
+ // TLWSA.onStatechange = onstatechange;
|
|
738
|
+ // function onstatechange() {
|
|
739
|
+ // console.log('事件:状态变化----------------------------------------------------');
|
|
740
|
+ // _this.getState();
|
|
741
|
+ // }
|
|
742
|
+ //连接呼叫中心回调函数
|
|
743
|
+ TLWSA.onOpenreturn = (err) => {
|
|
744
|
+ err = Number(err);
|
|
745
|
+ if (!err) {
|
|
746
|
+ _this.websocketLoading = false;
|
|
747
|
+ _this.cancelBindExtensionNumber();
|
|
748
|
+ console.log('呼叫中心连接成功-----seimin');
|
|
749
|
+ _this.getState(0);
|
|
750
|
+ _this.msg.success('呼叫中心连接成功')
|
|
751
|
+
|
|
752
|
+ //如果设置过话机
|
|
753
|
+ if (_this.incomingService.getPhoneNumberPre()) {
|
|
754
|
+ //强制签出,然后签入
|
|
755
|
+ tlwsa.tlaKillworkid(+_this.incomingService.getPhoneNumberPre());
|
|
756
|
+ }else{
|
|
757
|
+ // 签入并绑定分机
|
|
758
|
+ tlwsa.tlaLogin(_this.user.user.id, 1, -1);
|
|
759
|
+ }
|
|
760
|
+ } else {
|
|
761
|
+ console.log('呼叫中心连接失败-----seimin');
|
|
762
|
+ _this.getState(0);
|
|
763
|
+ _this.msg.error('呼叫中心连接失败')
|
|
764
|
+ }
|
|
765
|
+ }
|
|
766
|
+ //绑定分机回调函数
|
|
767
|
+ TLWSA.onSetphonenumberreturn = function (err) {
|
|
768
|
+ err = Number(err);
|
|
769
|
+ if (!err) {
|
|
770
|
+ console.log('绑定分机成功-----seimin');
|
|
771
|
+ _this.msg.success('绑定分机成功')
|
|
772
|
+ _this.incomingService.setPhoneNumberPre(_this.user.user.id);
|
|
773
|
+ _this.qShimang(1);
|
|
774
|
+ } else {
|
|
775
|
+ console.log('绑定分机失败-----seimin');
|
|
776
|
+ _this.getState(0);
|
|
777
|
+ _this.msg.error('绑定分机失败')
|
|
778
|
+ }
|
|
779
|
+ }
|
|
780
|
+ //强制示忙回调函数
|
|
781
|
+ // TLWSA.onAcw = onacw;
|
|
782
|
+ // function onacw(err) {
|
|
783
|
+ // err = Number(err);
|
|
784
|
+ // if (!err) {
|
|
785
|
+ // console.log('强制示忙成功-----seimin');
|
|
786
|
+ // _this.getState(2);
|
|
787
|
+ // $.toaster({
|
|
788
|
+ // priority: 'info',
|
|
789
|
+ // title: '操作',
|
|
790
|
+ // message: '示忙成功'
|
|
791
|
+ // });
|
|
792
|
+ // } else {
|
|
793
|
+ // console.log('强制示忙失败-----seimin');
|
|
794
|
+ // $.toaster({
|
|
795
|
+ // priority: 'info',
|
|
796
|
+ // title: '操作',
|
|
797
|
+ // message: '示忙失败'
|
|
798
|
+ // });
|
|
799
|
+ // }
|
|
800
|
+ // }
|
|
801
|
+ // //强制示闲回调函数
|
|
802
|
+ // TLWSA.onWca = onwca;
|
|
803
|
+ // function onwca(err) {
|
|
804
|
+ // console.log(err)
|
|
805
|
+ // err = Number(err);
|
|
806
|
+ // if (!err) {
|
|
807
|
+ // console.log('强制示闲成功-----seimin');
|
|
808
|
+ // _this.getState(1);
|
|
809
|
+ // $.toaster({
|
|
810
|
+ // priority: 'info',
|
|
811
|
+ // title: '操作',
|
|
812
|
+ // message: '示闲成功'
|
|
813
|
+ // });
|
|
814
|
+ // } else {
|
|
815
|
+ // console.log('强制示闲失败-----seimin');
|
|
816
|
+ // $.toaster({
|
|
817
|
+ // priority: 'info',
|
|
818
|
+ // title: '操作',
|
|
819
|
+ // message: '示闲失败'
|
|
820
|
+ // });
|
|
821
|
+ // }
|
|
822
|
+ // }
|
|
823
|
+ //与服务器网络连接中断回调函数
|
|
824
|
+ let timer = null;
|
|
825
|
+ TLWSA.onClosed = () => {
|
|
826
|
+ _this.getState(0);
|
|
827
|
+ console.log('与服务器网络连接中断-----seimin');
|
|
828
|
+ _this.msg.info('与服务器网络连接中断,2分钟后重连')
|
|
829
|
+ console.log('2分钟后自动重连-----seimin')
|
|
830
|
+ clearTimeout(timer);
|
|
831
|
+ timer = setTimeout(function () {
|
|
832
|
+ //连接
|
|
833
|
+ tlwsa.tlaOpen(_this.incomingService.getSocketUrl());
|
|
834
|
+ }, 120000)
|
|
835
|
+ }
|
|
836
|
+ //签入回调函数
|
|
837
|
+ TLWSA.onLoginreturn = function (err) {
|
|
838
|
+ err = Number(err);
|
|
839
|
+ if (!err) {
|
|
840
|
+ console.log('签入成功-----seimin');
|
|
841
|
+ _this.msg.success('签入成功')
|
|
842
|
+ setTimeout(function () {
|
|
843
|
+ console.log(_this.incomingService.getPhoneNumber(), 1111)
|
|
844
|
+ var phoneNumber = _this.incomingService.getPhoneNumber();
|
|
845
|
+ console.log('开始绑定分机【' + phoneNumber + '】-----seimin');
|
|
846
|
+ tlwsa.tlaSetphonenumber(phoneNumber);
|
|
847
|
+ }, 0)
|
|
848
|
+ } else if (err == 9011) {
|
|
849
|
+ console.log('签入失败,该分机已登录-----seimin');
|
|
850
|
+ _this.msg.error('签入失败,该分机已登录')
|
|
851
|
+ } else {
|
|
852
|
+ console.log('签入失败-----seimin');
|
|
853
|
+ _this.msg.error('签入失败')
|
|
854
|
+ }
|
|
855
|
+ }
|
|
856
|
+ // 强制签出回调函数
|
|
857
|
+ TLWSA.onKillreturn = function (err) {
|
|
858
|
+ err = Number(err);
|
|
859
|
+ if (!err) {
|
|
860
|
+ console.log('强制签出成功-----seimin');
|
|
861
|
+ _this.getState(0);
|
|
862
|
+ // $.toaster({
|
|
863
|
+ // priority: 'info',
|
|
864
|
+ // title: '操作',
|
|
865
|
+ // message: '强制签出成功'
|
|
866
|
+ // });
|
|
867
|
+ } else {
|
|
868
|
+ console.log('强制签出失败,该分机不是签入状态-----seimin');
|
|
869
|
+ // $.toaster({
|
|
870
|
+ // priority: 'info',
|
|
871
|
+ // title: '操作',
|
|
872
|
+ // message: '强制签出失败'
|
|
873
|
+ // });
|
|
874
|
+ }
|
|
875
|
+ //如果设置过话机
|
|
876
|
+ if (_this.incomingService.getPhoneNumberPre()) {
|
|
877
|
+ // 签入并绑定分机
|
|
878
|
+ tlwsa.tlaLogin(+_this.incomingService.getPhoneNumberPre(), 1, -1);
|
|
879
|
+ }
|
|
880
|
+ }
|
|
881
|
+ // 签出回调函数
|
|
882
|
+ TLWSA.onLogoffreturn = function (err) {
|
|
883
|
+ err = Number(err);
|
|
884
|
+ if (!err) {
|
|
885
|
+ console.log('签出成功-----seimin');
|
|
886
|
+ _this.getState(0);
|
|
887
|
+ _this.msg.success('签出成功')
|
|
888
|
+ _this.incomingService.removePhoneNumberPre();
|
|
889
|
+ _this.incomingService.removePhoneNumber();
|
|
890
|
+ } else {
|
|
891
|
+ console.log('签出失败-----seimin');
|
|
892
|
+ _this.msg.error('签出失败')
|
|
893
|
+ }
|
|
894
|
+ }
|
|
895
|
+ //示忙回调函数
|
|
896
|
+ TLWSA.onAcwreturn = function (err) {
|
|
897
|
+ err = Number(err);
|
|
898
|
+ if (!err) {
|
|
899
|
+ console.log('示忙成功-----seimin');
|
|
900
|
+ if (location.href.includes('app/incident/editor') || location.href.includes('app/incident/chart')) {
|
|
901
|
+ _this.isShixian = false;
|
|
902
|
+ } else {
|
|
903
|
+ _this.isShixian = true;
|
|
904
|
+ }
|
|
905
|
+ _this.getState(2);
|
|
906
|
+ _this.preState = 2;
|
|
907
|
+ _this.msg.success('示忙成功')
|
|
908
|
+ } else {
|
|
909
|
+ console.log('示忙失败-----seimin');
|
|
910
|
+ // $.toaster({
|
|
911
|
+ // priority: 'info',
|
|
912
|
+ // title: '操作',
|
|
913
|
+ // message: '示忙失败'
|
|
914
|
+ // });
|
|
915
|
+ }
|
|
916
|
+ }
|
|
917
|
+ //示闲回调函数
|
|
918
|
+ TLWSA.onWcareturn = function (err) {
|
|
919
|
+ err = Number(err);
|
|
920
|
+ if (!err) {
|
|
921
|
+ console.log('示闲成功-----seimin');
|
|
922
|
+ _this.getState(1);
|
|
923
|
+ _this.preState = 1;
|
|
924
|
+ _this.msg.success('示闲成功')
|
|
925
|
+ } else {
|
|
926
|
+ console.log('示闲失败-----seimin');
|
|
927
|
+ _this.msg.error('示闲失败')
|
|
928
|
+ }
|
|
929
|
+ }
|
|
930
|
+ //呼叫坐席回调函数
|
|
931
|
+ TLWSA.onCallreturn = function (err) {
|
|
932
|
+ err = Number(err);
|
|
933
|
+ if (!err) {
|
|
934
|
+ console.log('呼叫成功,请摘机-----seimin');
|
|
935
|
+ _this.getState(6);
|
|
936
|
+ _this.msg.success('呼叫成功,请摘机')
|
|
937
|
+ } else {
|
|
938
|
+ console.log('呼叫失败-----seimin');
|
|
939
|
+ _this.msg.error('呼叫失败')
|
|
940
|
+ }
|
|
941
|
+ }
|
|
942
|
+ //呼叫坐席被接听回调函数
|
|
943
|
+ TLWSA.onCallresult = function (jso) {
|
|
944
|
+ console.log(jso);
|
|
945
|
+ var err = Number(jso.err);
|
|
946
|
+ if (!err) {
|
|
947
|
+ console.log('呼叫被接听成功-----seimin');
|
|
948
|
+ _this.getState(5);
|
|
949
|
+ _this.msg.success('呼叫被接听成功')
|
|
950
|
+ } else {
|
|
951
|
+ console.log('呼叫被接听失败-----seimin');
|
|
952
|
+ _this.qShimang(1);
|
|
953
|
+ _this.msg.error('呼叫被接听失败')
|
|
954
|
+ }
|
|
955
|
+ }
|
|
956
|
+ //挂断回调函数
|
|
957
|
+ TLWSA.onCallend = function (jso) {
|
|
958
|
+ console.log(jso);//lmm
|
|
959
|
+ if (jso) {
|
|
960
|
+ console.log('挂断成功-----seimin');
|
|
961
|
+ console.log('最近一次话机状态', _this.preState);
|
|
962
|
+ _this.qShimang(_this.preState);
|
|
963
|
+ _this.msg.success('挂断成功')
|
|
964
|
+ } else {
|
|
965
|
+ console.log('挂断失败-----seimin');
|
|
966
|
+ _this.msg.error('挂断失败')
|
|
967
|
+ }
|
|
968
|
+ }
|
|
969
|
+ //呼入回调函数
|
|
970
|
+ TLWSA.onCallin = function (jso) {
|
|
971
|
+ console.log(jso);
|
|
972
|
+ _this.callNumber = _this.incidentModel.incomingPhone = jso.caller;//来电的电话
|
|
973
|
+ _this.incidentModel.callID = jso.crs;//来电的话机id
|
|
974
|
+ if (jso) {
|
|
975
|
+ console.log('呼入坐席成功,请摘机-----seimin');
|
|
976
|
+ _this.getState(3);
|
|
977
|
+ _this.msg.success('呼入坐席成功,请摘机')
|
|
978
|
+ console.log('来电了!电话号码是【' + _this.incidentModel.incomingPhone + '】');
|
|
979
|
+ } else {
|
|
980
|
+ console.log('呼入坐席失败-----seimin');
|
|
981
|
+ _this.msg.error('呼入坐席失败')
|
|
982
|
+ }
|
|
983
|
+ }
|
|
984
|
+ // 测试代码start
|
|
985
|
+ // searchBxDept();
|
|
986
|
+ // 测试代码end
|
|
987
|
+ // 查报修科室
|
|
988
|
+ // function searchBxDept() {
|
|
989
|
+ // var postData = { "idx": 0, "sum": 10, "department": { phone: _this.callNumber = _this.incidentModel.incomingPhone } };//hjzxPhone
|
|
990
|
+ // api_user_data.fetchDataList('department', postData).then(function (result) {
|
|
991
|
+ // if (result.status == 200) {
|
|
992
|
+ // console.log(result.list);
|
|
993
|
+ // var requesters = result.list;
|
|
994
|
+
|
|
995
|
+
|
|
996
|
+ // if (requesters.length === 0) {
|
|
997
|
+ // //未匹配到报修科室
|
|
998
|
+ // $rootScope.newOrder({
|
|
999
|
+ // incident: {
|
|
1000
|
+ // sockid: _this.incidentModel.callID,
|
|
1001
|
+ // incomingPhone: _this.callNumber = _this.incidentModel.incomingPhone,
|
|
1002
|
+ // source: { id: 1547, name: '电话' }
|
|
1003
|
+ // },
|
|
1004
|
+ // }, 'incomingCall')
|
|
1005
|
+ // } else if (requesters.length === 1) {
|
|
1006
|
+ // //匹配到一个报修科室
|
|
1007
|
+ // $rootScope.newOrder({
|
|
1008
|
+ // incident: {
|
|
1009
|
+ // department: requesters[0],
|
|
1010
|
+ // phone: requesters[0].phone,
|
|
1011
|
+ // sockid: _this.incidentModel.callID,
|
|
1012
|
+ // incomingPhone: _this.callNumber = _this.incidentModel.incomingPhone,
|
|
1013
|
+ // source: { id: 1547, name: '电话' }
|
|
1014
|
+ // },
|
|
1015
|
+ // }, 'incomingCall')
|
|
1016
|
+ // } else {
|
|
1017
|
+ // //匹配到多个报修科室
|
|
1018
|
+ // $modal.open({
|
|
1019
|
+ // templateUrl: 'assets/views/incident/tpl/tel.html',
|
|
1020
|
+ // controller: function ($scope, $modalInstance, $timeout, SweetAlert) {
|
|
1021
|
+ // $scope.list = requesters;
|
|
1022
|
+ // $scope.selected = {
|
|
1023
|
+ // selectedItem: 0
|
|
1024
|
+ // };
|
|
1025
|
+ // $scope.cancel = function () {
|
|
1026
|
+ // $modalInstance.dismiss('cancel');
|
|
1027
|
+ // };
|
|
1028
|
+ // $scope.changeBxr = function (id) {
|
|
1029
|
+ // $scope.selected.selectedItem = id;
|
|
1030
|
+ // }
|
|
1031
|
+ // $scope.save = function () {
|
|
1032
|
+ // var item = $scope.list.find(v => v.id == $scope.selected.selectedItem);
|
|
1033
|
+ // if (item) {
|
|
1034
|
+ // $scope.cancel();
|
|
1035
|
+ // $rootScope.newOrder({
|
|
1036
|
+ // incident: {
|
|
1037
|
+ // department: item,
|
|
1038
|
+ // phone: item.phone,
|
|
1039
|
+ // sockid: _this.incidentModel.callID,
|
|
1040
|
+ // incomingPhone: _this.callNumber = _this.incidentModel.incomingPhone,
|
|
1041
|
+ // source: { id: 1547, name: '电话' }
|
|
1042
|
+ // },
|
|
1043
|
+ // }, 'incomingCall')
|
|
1044
|
+ // } else {
|
|
1045
|
+ // SweetAlert.swal({
|
|
1046
|
+ // title: "请选择报修科室!",
|
|
1047
|
+ // type: "error"
|
|
1048
|
+ // })
|
|
1049
|
+ // }
|
|
1050
|
+ // }
|
|
1051
|
+ // }
|
|
1052
|
+ // });
|
|
1053
|
+ // }
|
|
1054
|
+ // }
|
|
1055
|
+ // })
|
|
1056
|
+ // }
|
|
1057
|
+
|
|
1058
|
+ //呼入摘机应答回调函数
|
|
1059
|
+ TLWSA.onAnswer = function (err) {
|
|
1060
|
+ err = Number(err);
|
|
1061
|
+ if (!err) {
|
|
1062
|
+ console.log('呼入摘机应答成功-----seimin');
|
|
1063
|
+ _this.getState(5);
|
|
1064
|
+ _this.msg.success('呼入摘机应答成功')
|
|
1065
|
+
|
|
1066
|
+ // 查报修科室
|
|
1067
|
+ _this.searchBxDept();
|
|
1068
|
+ } else {
|
|
1069
|
+ console.log('呼入摘机应答失败-----seimin');
|
|
1070
|
+ _this.msg.error('呼入摘机应答失败')
|
|
1071
|
+ }
|
|
1072
|
+ }
|
|
1073
|
+ //呼入未摘机应答回调函数
|
|
1074
|
+ TLWSA.onMisscall = function (err) {
|
|
1075
|
+ err = Number(err);
|
|
1076
|
+ if (!err) {
|
|
1077
|
+ console.log('呼入未摘机应答成功-----seimin');
|
|
1078
|
+ _this.getState(1);
|
|
1079
|
+ _this.msg.success('呼入未摘机应答成功')
|
|
1080
|
+ } else {
|
|
1081
|
+ console.log('呼入未摘机应答失败-----seimin');
|
|
1082
|
+ _this.msg.error('呼入未摘机应答失败')
|
|
1083
|
+ }
|
|
1084
|
+ }
|
|
1085
|
+ //转接开始回调函数
|
|
1086
|
+ //调用转移方法之后,返回该事件 如果错误码为0,仅仅表示开始转移,不代表转移目标已经接听或已经拒绝
|
|
1087
|
+ TLWSA.onTransferreturn = function (err) {
|
|
1088
|
+ err = Number(err);
|
|
1089
|
+ if (!err) {
|
|
1090
|
+ console.log('转接坐席开始成功-----seimin');
|
|
1091
|
+ _this.getState(7);
|
|
1092
|
+ _this.msg.success('转接坐席开始成功')
|
|
1093
|
+ } else {
|
|
1094
|
+ console.log('转接坐席开始失败-----seimin');
|
|
1095
|
+ _this.msg.error('转接坐席开始失败')
|
|
1096
|
+ }
|
|
1097
|
+ }
|
|
1098
|
+ //转接结果回调函数
|
|
1099
|
+ TLWSA.onTransferresult = function (err) {
|
|
1100
|
+ err = Number(err);
|
|
1101
|
+ if (!err) {
|
|
1102
|
+ console.log('转接坐席结果成功-----seimin');
|
|
1103
|
+ _this.getState(1);
|
|
1104
|
+ _this.msg.success('转接坐席结果成功')
|
|
1105
|
+ } else {
|
|
1106
|
+ console.log('转接坐席结果失败-----seimin');
|
|
1107
|
+ _this.msg.error('转接坐席结果失败')
|
|
1108
|
+ }
|
|
1109
|
+ }
|
|
1110
|
+ // 呼叫中心----end
|
|
1111
|
+ }
|
722
|
1112
|
// 快捷键打开新建工单
|
723
|
1113
|
quickShowNewOrder(e){
|
724
|
1114
|
if (e.ctrlKey && e.key == "s") {
|
|
@@ -862,6 +1252,7 @@ export class FuwutaiComponent implements OnInit {
|
862
|
1252
|
// 保存工单信息
|
863
|
1253
|
confirmOrderScope(data){
|
864
|
1254
|
if (data.status == 200) {
|
|
1255
|
+ this.websocketLoading = true;
|
865
|
1256
|
this.cancelOrderScope();
|
866
|
1257
|
this.showPromptModal("保存", true, "");
|
867
|
1258
|
// 关闭phone的websocket
|
|
@@ -898,6 +1289,7 @@ export class FuwutaiComponent implements OnInit {
|
898
|
1289
|
|
899
|
1290
|
// 保存绑定分机-签入
|
900
|
1291
|
checkIn(phoneNumber){
|
|
1292
|
+ this.websocketLoading = true;
|
901
|
1293
|
this.incomingService.setPhoneNumber(phoneNumber);
|
902
|
1294
|
this.incomingService.closeWs(true);
|
903
|
1295
|
this.getWebsocketPhone();
|
|
@@ -930,7 +1322,6 @@ export class FuwutaiComponent implements OnInit {
|
930
|
1322
|
// tel2: '',//转接坐席对象
|
931
|
1323
|
}
|
932
|
1324
|
getWebsocketPhone() {
|
933
|
|
- this.websocketLoading = true;
|
934
|
1325
|
const sign = this.incomingService.getSign();
|
935
|
1326
|
if(sign === 'box'){
|
936
|
1327
|
// 录音盒
|
|
@@ -955,385 +1346,9 @@ export class FuwutaiComponent implements OnInit {
|
955
|
1346
|
});
|
956
|
1347
|
}else if(sign === 'callCenter'){
|
957
|
1348
|
// 呼叫中心----start
|
958
|
|
- let _this = this;
|
959
|
|
- _this.websocketLoading = false;
|
960
|
|
- _this.preState = '';
|
|
1349
|
+ this.preState = '';
|
961
|
1350
|
//连接
|
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
|
|
- }
|
991
|
|
- }
|
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
|
|
1351
|
+ tlwsa.tlaOpen(this.incomingService.getSocketUrl());
|
1337
|
1352
|
}
|
1338
|
1353
|
}
|
1339
|
1354
|
|
|
@@ -2110,6 +2125,9 @@ export class FuwutaiComponent implements OnInit {
|
2110
|
2125
|
localStorage.removeItem("menu");
|
2111
|
2126
|
this.incomingService.removePhoneNumber();
|
2112
|
2127
|
this.incomingService.removePhoneNumberPre();
|
|
2128
|
+ this.incomingService.removeSocketUrl();
|
|
2129
|
+ this.incomingService.removeSign();
|
|
2130
|
+ this.incomingService.removePhoneNumberPre();
|
2113
|
2131
|
localStorage.removeItem("index");
|
2114
|
2132
|
// 假退出
|
2115
|
2133
|
this.mainService.logOut().subscribe((data) => {
|
|
@@ -2124,6 +2142,8 @@ export class FuwutaiComponent implements OnInit {
|
2124
|
2142
|
localStorage.removeItem("user");
|
2125
|
2143
|
localStorage.removeItem("menu");
|
2126
|
2144
|
this.incomingService.removePhoneNumber();
|
|
2145
|
+ this.incomingService.removeSocketUrl();
|
|
2146
|
+ this.incomingService.removeSign();
|
2127
|
2147
|
this.incomingService.removePhoneNumberPre();
|
2128
|
2148
|
localStorage.removeItem("index");
|
2129
|
2149
|
}
|
|
@@ -4603,7 +4623,11 @@ export class FuwutaiComponent implements OnInit {
|
4603
|
4623
|
this.delModal = false;
|
4604
|
4624
|
this.msg.info('签出成功');
|
4605
|
4625
|
|
4606
|
|
- this.incomingService.closeWs(true);
|
|
4626
|
+ if(this.incomingService.getSign() === 'box'){
|
|
4627
|
+ this.incomingService.closeWs(true);
|
|
4628
|
+ }if(this.incomingService.getSign() === 'callCenter'){
|
|
4629
|
+ this.jry_qianchu();
|
|
4630
|
+ }
|
4607
|
4631
|
this.incomingService.removePhoneNumber();
|
4608
|
4632
|
}
|
4609
|
4633
|
}
|