|
@@ -841,442 +841,442 @@ app.controller('AppCtrl', ['$rootScope', '$scope', '$state', '$translate', '$loc
|
841
|
841
|
$rootScope['getExtnDirect' + $rootScope.seiminHj]();
|
842
|
842
|
}
|
843
|
843
|
// --------------------------1------------------------------
|
844
|
|
- // $rootScope.getExtnDirect1 = function () {
|
845
|
|
- // var jry_data_dictionary = {
|
846
|
|
- // key: "hjzx_cornet",
|
847
|
|
- // type: "list"
|
848
|
|
- // }
|
849
|
|
- // api_wechatfile.getDictionary(jry_data_dictionary).then(function (res) {
|
850
|
|
- // var websocket_url = "ws://192.168.3.122:29003/ola_socket";
|
851
|
|
- // var ola_queue = "10009"; //通话配置-队列配置-队列ID
|
852
|
|
- // // var ola_extn = "1001"; //个人信息-座席分机号
|
853
|
|
- // $rootScope.jry_extnNumberSelect = [];
|
854
|
|
- // $rootScope.jry_extnNumberObj = {};
|
855
|
|
- // $rootScope.jry_extnNumberSelect = res;
|
856
|
|
- // $rootScope.jry_extnNumberObj.jry_extnNumber = $rootScope.jry_extnNumberSelect[0];
|
857
|
|
- // function log(msg) {
|
858
|
|
- // //IE has no console
|
859
|
|
- // if ('console' in window) console.log(msg);
|
860
|
|
- // }
|
861
|
|
-
|
862
|
|
- // function websocket_connect() {
|
863
|
|
- // ola.connect(websocket_url);
|
864
|
|
- // ola.onConnect = onConnect;
|
865
|
|
- // ola.onClose = onClose;
|
866
|
|
- // ola.onMessage = onMessage;
|
867
|
|
- // }
|
868
|
|
- // $(document).ready(function () {
|
869
|
|
- // // if(ola_extn!=""){
|
870
|
|
- // if ($rootScope.jry_extnNumberObj.jry_extnNumber) {
|
871
|
|
- // websocket_connect();
|
872
|
|
- // }
|
873
|
|
- // });
|
|
844
|
+ $rootScope.getExtnDirect1 = function () {
|
|
845
|
+ var jry_data_dictionary = {
|
|
846
|
+ key: "hjzx_cornet",
|
|
847
|
+ type: "list"
|
|
848
|
+ }
|
|
849
|
+ api_wechatfile.getDictionary(jry_data_dictionary).then(function (res) {
|
|
850
|
+ var websocket_url = "ws://192.168.3.122:29003/ola_socket";
|
|
851
|
+ var ola_queue = "10009"; //通话配置-队列配置-队列ID
|
|
852
|
+ // var ola_extn = "1001"; //个人信息-座席分机号
|
|
853
|
+ $rootScope.jry_extnNumberSelect = [];
|
|
854
|
+ $rootScope.jry_extnNumberObj = {};
|
|
855
|
+ $rootScope.jry_extnNumberSelect = res;
|
|
856
|
+ $rootScope.jry_extnNumberObj.jry_extnNumber = $rootScope.jry_extnNumberSelect[0];
|
|
857
|
+ function log(msg) {
|
|
858
|
+ //IE has no console
|
|
859
|
+ if ('console' in window) console.log(msg);
|
|
860
|
+ }
|
874
|
861
|
|
|
862
|
+ function websocket_connect() {
|
|
863
|
+ ola.connect(websocket_url);
|
|
864
|
+ ola.onConnect = onConnect;
|
|
865
|
+ ola.onClose = onClose;
|
|
866
|
+ ola.onMessage = onMessage;
|
|
867
|
+ }
|
|
868
|
+ $(document).ready(function () {
|
|
869
|
+ // if(ola_extn!=""){
|
|
870
|
+ if ($rootScope.jry_extnNumberObj.jry_extnNumber) {
|
|
871
|
+ websocket_connect();
|
|
872
|
+ }
|
|
873
|
+ });
|
875
|
874
|
|
876
|
|
- // /* callbacks */
|
877
|
|
- // function onMessage(evt) {
|
878
|
|
- // var phoneData = JSON.parse(evt.data);
|
879
|
|
- // if (phoneData.event_type == "agent_state") {
|
880
|
|
- // console.log(phoneData);
|
881
|
|
- // if (phoneData.state == "busy") {
|
882
|
|
- // $('#agent_state').append(" (" + phoneData.private_data + ")");
|
883
|
|
- // // 来电
|
884
|
|
- // if (phoneData.private_data == "ring") {
|
885
|
|
- // console.log(phoneData);
|
886
|
|
- // $rootScope.jry_state = "laidian";
|
887
|
|
- // var Notification = window.Notification;
|
888
|
|
- // Notification.requestPermission();
|
889
|
|
- // var n = new Notification("你有来电", {
|
890
|
|
- // body: "来电号码:" + phoneData.ani,
|
891
|
|
- // icon: '../bower_components/HTML5-Desktop-Notifications/alert.ico',
|
892
|
|
- // });
|
893
|
|
- // // 摘机
|
894
|
|
- // } else if (phoneData.private_data == "answered") {
|
895
|
|
- // $rootScope.jry_state = "tonghuazhong";
|
896
|
|
- // var jry_findPhone = "";
|
897
|
|
- // if (phoneData.ani) {
|
898
|
|
- // jry_findPhone = phoneData.ani
|
899
|
|
- // } else if (phoneData.dnis && phoneData.other_answered) {
|
900
|
|
- // jry_findPhone = phoneData.dnis
|
901
|
|
- // }
|
902
|
|
- // var filterData = {
|
903
|
|
- // "idx": 0,
|
904
|
|
- // "sum": 100,
|
905
|
|
- // "requester": {
|
906
|
|
- // "mphone": jry_findPhone,
|
907
|
|
- // "telephone": jry_findPhone,
|
908
|
|
- // "selectType": 1
|
909
|
|
- // }
|
910
|
|
- // }
|
911
|
|
- // api_user_data.fetchDataList('requester', filterData).then(function (data) {
|
912
|
|
- // var myData = Restangular.stripRestangular(data);
|
913
|
|
- // // $rootScope.phone="";
|
914
|
|
- // // 新增报修人
|
915
|
|
- // if (myData.list.length == 0) {
|
916
|
|
- // var modalInstance = $modal.open({
|
917
|
|
- // templateUrl: 'assets/views/customform/tpl/modal-add-callrequester.html',
|
918
|
|
- // controller: function ($scope, $modalInstance, api_user_data, SweetAlert, api_wechatfile) {
|
919
|
|
- // $scope.title = "新增报修人";
|
920
|
|
- // $scope.requester = {};
|
921
|
|
- // $scope.onChangeadd = function (searchData) {
|
922
|
|
- // $scope.searchKey = searchData.account;
|
923
|
|
- // // $scope.searchDataadd = searchData;
|
924
|
|
- // var requesdata = angular.copy(searchData)
|
925
|
|
- // // if (requesdata.mphone) {
|
926
|
|
- // // delete requesdata.mphone;
|
927
|
|
- // // }
|
928
|
|
- // if (requesdata.telephone) {
|
929
|
|
- // delete requesdata.telephone;
|
930
|
|
- // }
|
931
|
|
- // angular.extend($scope.requester, requesdata);
|
932
|
|
- // }
|
933
|
|
- // $scope.refreshUseradd = function (searchKey) { //请求人搜索
|
934
|
|
- // $scope.requester.account = searchKey;
|
935
|
|
- // $scope.searchData = searchKey;
|
936
|
|
- // serchdataadd(searchKey);
|
937
|
|
- // }
|
938
|
|
- // $scope.getMydata = function (x) {
|
939
|
|
- // var reqestdatap = JSON.parse(x[0])
|
940
|
|
- // // if ($scope.requester.mphone) {
|
941
|
|
- // // delete reqestdatap.mphone;
|
942
|
|
- // // }
|
943
|
|
- // if ($scope.requester.telephone) {
|
944
|
|
- // delete reqestdatap.telephone;
|
945
|
|
- // }
|
946
|
|
- // $scope.searchField = JSON.parse(x[0]).account;
|
947
|
|
- // angular.extend($scope.requester, reqestdatap);
|
948
|
|
- // }
|
949
|
|
- // $scope.getMydataone = function (x) {
|
950
|
|
- // $scope.searchField = x;
|
951
|
|
- // $scope.requester.account = x;
|
952
|
|
- // }
|
953
|
|
- // serchdataadd();
|
954
|
|
-
|
955
|
|
- // function serchdataadd(searchKey) {
|
956
|
|
- // if (searchKey) {
|
957
|
|
- // var filterData = {
|
958
|
|
- // 'requester': {
|
959
|
|
- // 'searchKey': searchKey,
|
960
|
|
- // },
|
961
|
|
- // idx: 0,
|
962
|
|
- // sum: 10
|
963
|
|
- // };
|
964
|
|
- // } else {
|
965
|
|
- // var filterData = {
|
966
|
|
- // idx: 0,
|
967
|
|
- // sum: 10
|
968
|
|
- // };
|
969
|
|
- // }
|
970
|
|
- // api_user_data.fetchDataList('requester', filterData).then(function (response) {
|
971
|
|
- // var myData = response;
|
972
|
|
- // $scope.myData = myData.list;
|
973
|
|
- // });
|
974
|
|
- // }
|
975
|
|
- // api_user_data.fetchDataList('area', {
|
976
|
|
- // idx: 0,
|
977
|
|
- // sum: 100
|
978
|
|
- // }).then(function (response) {
|
979
|
|
- // if (response.status == 200) {
|
980
|
|
- // $scope.areas = response.list;
|
981
|
|
- // }
|
982
|
|
- // })
|
983
|
|
- // api_wechatfile.getDictionary({
|
984
|
|
- // "key": "requester_type",
|
985
|
|
- // "type": "list"
|
986
|
|
- // }).then(function (response) {
|
987
|
|
- // // if (response.status == 200) {
|
988
|
|
- // $scope.networktypes = response;
|
989
|
|
- // // }
|
990
|
|
- // })
|
991
|
|
- // $scope.requesterAreaid = "";
|
992
|
|
- // $scope.onChange = function (item) {
|
993
|
|
- // $scope.requesterAreaid = item.id;
|
994
|
|
- // $scope.requester.placeDTO = {};
|
995
|
|
- // api_user_data.fetchDataList('place', {
|
996
|
|
- // place: {
|
997
|
|
- // areaId: item.id
|
998
|
|
- // },
|
999
|
|
- // idx: 0,
|
1000
|
|
- // sum: 1000
|
1001
|
|
- // }).then(function (response) {
|
1002
|
|
- // if (response.status == 200) {
|
1003
|
|
- // $scope.places = response.list;
|
1004
|
|
- // }
|
1005
|
|
- // })
|
1006
|
|
- // }
|
1007
|
|
- // //地点搜索
|
1008
|
|
- // $scope.refresh = function (searchVal) {
|
1009
|
|
- // var faildata = {};
|
1010
|
|
- // if ($scope.requesterAreaid) {
|
1011
|
|
- // faildata = {
|
1012
|
|
- // 'idx': 0,
|
1013
|
|
- // 'sum': 1000,
|
1014
|
|
- // 'place': {
|
1015
|
|
- // 'areaId': $scope.requesterAreaid,
|
1016
|
|
- // 'place': searchVal,
|
1017
|
|
- // 'selectType': 'pinyin_qs'
|
1018
|
|
- // }
|
1019
|
|
- // }
|
1020
|
|
- // } else {
|
1021
|
|
- // faildata = {
|
1022
|
|
- // 'idx': 0,
|
1023
|
|
- // 'sum': 1000,
|
1024
|
|
- // 'place': {
|
1025
|
|
- // 'place': searchVal,
|
1026
|
|
- // 'selectType': 'pinyin_qs'
|
1027
|
|
- // }
|
1028
|
|
- // }
|
1029
|
|
- // }
|
1030
|
|
- // api_user_data.fetchDataList('place', faildata).then(function (response) {
|
1031
|
|
- // $scope.places = response.list;
|
1032
|
|
- // delete $scope.requester.placeDTO;
|
1033
|
|
- // })
|
1034
|
|
- // }
|
1035
|
|
-
|
1036
|
|
-
|
1037
|
|
- // $scope.requester = {
|
1038
|
|
- // 'telephone': jry_findPhone
|
1039
|
|
- // };
|
1040
|
|
- // $scope.ok = function () {
|
1041
|
|
- // var reg1 = /^1[3456789][0-9]{9}$/; //手机号
|
1042
|
|
- // var reg2 = /^((0\d{2,3})-)*(\d{7,8})(-(\d{3,}))?$/; //座机号
|
1043
|
|
- // var flag1 = reg1.test($scope.requester.mphone);
|
1044
|
|
- // var flag2 = reg2.test($scope.requester.mphone);
|
1045
|
|
- // console.log($scope.requester)
|
1046
|
|
- // if (angular.isUndefined($scope.requester.name) || $scope.requester.name == null || $scope.requester.name == "") {
|
1047
|
|
- // SweetAlert.swal("报修人姓名未填!", "请填写报修人姓名", "error");
|
1048
|
|
- // } else if (angular.isUndefined($scope.requester.requesterType)) {
|
1049
|
|
- // SweetAlert.swal("人员类型未填!", "请填写人员类型", "error");
|
1050
|
|
- // } else if (angular.isUndefined($scope.requester.mphone) || $scope.requester.mphone == null || $scope.requester.mphone == "") {
|
1051
|
|
- // SweetAlert.swal("报修人电话未填!", "请填写报修人电话", "error");
|
1052
|
|
- // }
|
1053
|
|
- // else {
|
1054
|
|
- // $modalInstance.close($scope.requester);
|
1055
|
|
- // }
|
1056
|
|
- // };
|
1057
|
875
|
|
1058
|
|
- // $scope.cancel = function () {
|
1059
|
|
- // $modalInstance.dismiss('cancel');
|
1060
|
|
- // };
|
1061
|
|
- // },
|
1062
|
|
- // });
|
1063
|
|
- // modalInstance.result.then(function (selectedItem) {
|
1064
|
|
- // if (selectedItem) {
|
1065
|
|
- // if (selectedItem.telephone && !selectedItem.mphone) {
|
1066
|
|
- // selectedItem.telephone = angular.copy(selectedItem.mphone);
|
1067
|
|
- // delete selectedItem.mphone;
|
1068
|
|
- // }
|
1069
|
|
- // var data = {
|
1070
|
|
- // 'requester': selectedItem
|
1071
|
|
- // };
|
1072
|
|
- // api_user_data.addData('requester', data).then(function (response) {
|
1073
|
|
- // if (response.status == 200) {
|
1074
|
|
- // var data = {
|
1075
|
|
- // 'model': {
|
1076
|
|
- // 'requestershow': response.data,
|
1077
|
|
- // 'incident': {
|
1078
|
|
- // 'requester': response.data,
|
1079
|
|
- // 'area': response.data.areaDTO,
|
1080
|
|
- // 'place': response.data.placeDTO,
|
1081
|
|
- // 'houseNumber': response.data.houseNumber,
|
1082
|
|
- // // 'callID': cdrid,
|
1083
|
|
- // 'source': {
|
1084
|
|
- // 'id': 1547
|
1085
|
|
- // }
|
1086
|
|
- // }
|
1087
|
|
- // }
|
1088
|
|
- // }
|
1089
|
|
- // $state.go('app.incident.title', {
|
1090
|
|
- // 'model': JSON.stringify(data)
|
1091
|
|
- // });
|
1092
|
|
- // }
|
1093
|
|
- // })
|
1094
|
|
- // }
|
1095
|
|
- // });
|
1096
|
|
- // } else if (myData.list.length == 1) {
|
1097
|
|
- // var data = {
|
1098
|
|
- // 'model': {
|
1099
|
|
- // 'requestershow': myData.list[0],
|
1100
|
|
- // 'incident': {
|
1101
|
|
- // 'requester': myData.list[0],
|
1102
|
|
- // 'area': myData.list[0].areaDTO,
|
1103
|
|
- // 'place': myData.list[0].placeDTO,
|
1104
|
|
- // 'houseNumber': myData.list[0].houseNumber,
|
1105
|
|
- // // 'callID': cdrid,
|
1106
|
|
- // 'source': {
|
1107
|
|
- // 'id': 1547
|
1108
|
|
- // }
|
1109
|
|
- // }
|
1110
|
|
- // }
|
1111
|
|
- // }
|
1112
|
|
- // $state.go('app.incident.title', {
|
1113
|
|
- // 'model': JSON.stringify(data)
|
1114
|
|
- // });
|
1115
|
|
- // } else {
|
1116
|
|
- // var modalInstance = $modal.open({
|
1117
|
|
- // templateUrl: 'assets/views/createincident.html',
|
1118
|
|
- // controller: function ($scope, $modalInstance, api_user_data) {
|
1119
|
|
- // $scope.title = "请确定报修人";
|
1120
|
|
- // $scope.requester = myData.list;
|
1121
|
|
- // $scope.choice = function (requester) {
|
1122
|
|
- // $modalInstance.dismiss('cancel');
|
1123
|
|
- // var data = {
|
1124
|
|
- // 'model': {
|
1125
|
|
- // 'requestershow': requester,
|
1126
|
|
- // 'incident': {
|
1127
|
|
- // 'requester': requester,
|
1128
|
|
- // 'area': requester.areaDTO,
|
1129
|
|
- // 'place': requester.placeDTO,
|
1130
|
|
- // 'houseNumber': requester.houseNumber,
|
1131
|
|
- // // 'callID': cdrid,
|
1132
|
|
- // 'source': {
|
1133
|
|
- // 'id': 1547
|
1134
|
|
- // }
|
1135
|
|
- // }
|
1136
|
|
- // }
|
1137
|
|
- // }
|
1138
|
|
- // $state.go('app.incident.title', {
|
1139
|
|
- // 'model': JSON.stringify(data)
|
1140
|
|
- // });
|
1141
|
|
- // };
|
1142
|
|
-
|
1143
|
|
- // $scope.cancel = function () {
|
1144
|
|
- // $modalInstance.dismiss('cancel');
|
1145
|
|
- // };
|
1146
|
|
- // },
|
1147
|
|
- // size: "lg"
|
1148
|
|
- // });
|
1149
|
|
- // }
|
|
876
|
+ /* callbacks */
|
|
877
|
+ function onMessage(evt) {
|
|
878
|
+ var phoneData = JSON.parse(evt.data);
|
|
879
|
+ if (phoneData.event_type == "agent_state") {
|
|
880
|
+ console.log(phoneData);
|
|
881
|
+ if (phoneData.state == "busy") {
|
|
882
|
+ $('#agent_state').append(" (" + phoneData.private_data + ")");
|
|
883
|
+ // 来电
|
|
884
|
+ if (phoneData.private_data == "ring") {
|
|
885
|
+ console.log(phoneData);
|
|
886
|
+ $rootScope.jry_state = "laidian";
|
|
887
|
+ var Notification = window.Notification;
|
|
888
|
+ Notification.requestPermission();
|
|
889
|
+ var n = new Notification("你有来电", {
|
|
890
|
+ body: "来电号码:" + phoneData.ani,
|
|
891
|
+ icon: '../bower_components/HTML5-Desktop-Notifications/alert.ico',
|
|
892
|
+ });
|
|
893
|
+ // 摘机
|
|
894
|
+ } else if (phoneData.private_data == "answered") {
|
|
895
|
+ $rootScope.jry_state = "tonghuazhong";
|
|
896
|
+ var jry_findPhone = "";
|
|
897
|
+ if (phoneData.ani) {
|
|
898
|
+ jry_findPhone = phoneData.ani
|
|
899
|
+ } else if (phoneData.dnis && phoneData.other_answered) {
|
|
900
|
+ jry_findPhone = phoneData.dnis
|
|
901
|
+ }
|
|
902
|
+ var filterData = {
|
|
903
|
+ "idx": 0,
|
|
904
|
+ "sum": 100,
|
|
905
|
+ "requester": {
|
|
906
|
+ "mphone": jry_findPhone,
|
|
907
|
+ "telephone": jry_findPhone,
|
|
908
|
+ "selectType": 1
|
|
909
|
+ }
|
|
910
|
+ }
|
|
911
|
+ api_user_data.fetchDataList('requester', filterData).then(function (data) {
|
|
912
|
+ var myData = Restangular.stripRestangular(data);
|
|
913
|
+ // $rootScope.phone="";
|
|
914
|
+ // 新增报修人
|
|
915
|
+ if (myData.list.length == 0) {
|
|
916
|
+ var modalInstance = $modal.open({
|
|
917
|
+ templateUrl: 'assets/views/customform/tpl/modal-add-callrequester.html',
|
|
918
|
+ controller: function ($scope, $modalInstance, api_user_data, SweetAlert, api_wechatfile) {
|
|
919
|
+ $scope.title = "新增报修人";
|
|
920
|
+ $scope.requester = {};
|
|
921
|
+ $scope.onChangeadd = function (searchData) {
|
|
922
|
+ $scope.searchKey = searchData.account;
|
|
923
|
+ // $scope.searchDataadd = searchData;
|
|
924
|
+ var requesdata = angular.copy(searchData)
|
|
925
|
+ // if (requesdata.mphone) {
|
|
926
|
+ // delete requesdata.mphone;
|
|
927
|
+ // }
|
|
928
|
+ if (requesdata.telephone) {
|
|
929
|
+ delete requesdata.telephone;
|
|
930
|
+ }
|
|
931
|
+ angular.extend($scope.requester, requesdata);
|
|
932
|
+ }
|
|
933
|
+ $scope.refreshUseradd = function (searchKey) { //请求人搜索
|
|
934
|
+ $scope.requester.account = searchKey;
|
|
935
|
+ $scope.searchData = searchKey;
|
|
936
|
+ serchdataadd(searchKey);
|
|
937
|
+ }
|
|
938
|
+ $scope.getMydata = function (x) {
|
|
939
|
+ var reqestdatap = JSON.parse(x[0])
|
|
940
|
+ // if ($scope.requester.mphone) {
|
|
941
|
+ // delete reqestdatap.mphone;
|
|
942
|
+ // }
|
|
943
|
+ if ($scope.requester.telephone) {
|
|
944
|
+ delete reqestdatap.telephone;
|
|
945
|
+ }
|
|
946
|
+ $scope.searchField = JSON.parse(x[0]).account;
|
|
947
|
+ angular.extend($scope.requester, reqestdatap);
|
|
948
|
+ }
|
|
949
|
+ $scope.getMydataone = function (x) {
|
|
950
|
+ $scope.searchField = x;
|
|
951
|
+ $scope.requester.account = x;
|
|
952
|
+ }
|
|
953
|
+ serchdataadd();
|
|
954
|
+
|
|
955
|
+ function serchdataadd(searchKey) {
|
|
956
|
+ if (searchKey) {
|
|
957
|
+ var filterData = {
|
|
958
|
+ 'requester': {
|
|
959
|
+ 'searchKey': searchKey,
|
|
960
|
+ },
|
|
961
|
+ idx: 0,
|
|
962
|
+ sum: 10
|
|
963
|
+ };
|
|
964
|
+ } else {
|
|
965
|
+ var filterData = {
|
|
966
|
+ idx: 0,
|
|
967
|
+ sum: 10
|
|
968
|
+ };
|
|
969
|
+ }
|
|
970
|
+ api_user_data.fetchDataList('requester', filterData).then(function (response) {
|
|
971
|
+ var myData = response;
|
|
972
|
+ $scope.myData = myData.list;
|
|
973
|
+ });
|
|
974
|
+ }
|
|
975
|
+ api_user_data.fetchDataList('area', {
|
|
976
|
+ idx: 0,
|
|
977
|
+ sum: 100
|
|
978
|
+ }).then(function (response) {
|
|
979
|
+ if (response.status == 200) {
|
|
980
|
+ $scope.areas = response.list;
|
|
981
|
+ }
|
|
982
|
+ })
|
|
983
|
+ api_wechatfile.getDictionary({
|
|
984
|
+ "key": "requester_type",
|
|
985
|
+ "type": "list"
|
|
986
|
+ }).then(function (response) {
|
|
987
|
+ // if (response.status == 200) {
|
|
988
|
+ $scope.networktypes = response;
|
|
989
|
+ // }
|
|
990
|
+ })
|
|
991
|
+ $scope.requesterAreaid = "";
|
|
992
|
+ $scope.onChange = function (item) {
|
|
993
|
+ $scope.requesterAreaid = item.id;
|
|
994
|
+ $scope.requester.placeDTO = {};
|
|
995
|
+ api_user_data.fetchDataList('place', {
|
|
996
|
+ place: {
|
|
997
|
+ areaId: item.id
|
|
998
|
+ },
|
|
999
|
+ idx: 0,
|
|
1000
|
+ sum: 1000
|
|
1001
|
+ }).then(function (response) {
|
|
1002
|
+ if (response.status == 200) {
|
|
1003
|
+ $scope.places = response.list;
|
|
1004
|
+ }
|
|
1005
|
+ })
|
|
1006
|
+ }
|
|
1007
|
+ //地点搜索
|
|
1008
|
+ $scope.refresh = function (searchVal) {
|
|
1009
|
+ var faildata = {};
|
|
1010
|
+ if ($scope.requesterAreaid) {
|
|
1011
|
+ faildata = {
|
|
1012
|
+ 'idx': 0,
|
|
1013
|
+ 'sum': 1000,
|
|
1014
|
+ 'place': {
|
|
1015
|
+ 'areaId': $scope.requesterAreaid,
|
|
1016
|
+ 'place': searchVal,
|
|
1017
|
+ 'selectType': 'pinyin_qs'
|
|
1018
|
+ }
|
|
1019
|
+ }
|
|
1020
|
+ } else {
|
|
1021
|
+ faildata = {
|
|
1022
|
+ 'idx': 0,
|
|
1023
|
+ 'sum': 1000,
|
|
1024
|
+ 'place': {
|
|
1025
|
+ 'place': searchVal,
|
|
1026
|
+ 'selectType': 'pinyin_qs'
|
|
1027
|
+ }
|
|
1028
|
+ }
|
|
1029
|
+ }
|
|
1030
|
+ api_user_data.fetchDataList('place', faildata).then(function (response) {
|
|
1031
|
+ $scope.places = response.list;
|
|
1032
|
+ delete $scope.requester.placeDTO;
|
|
1033
|
+ })
|
|
1034
|
+ }
|
|
1035
|
+
|
|
1036
|
+
|
|
1037
|
+ $scope.requester = {
|
|
1038
|
+ 'telephone': jry_findPhone
|
|
1039
|
+ };
|
|
1040
|
+ $scope.ok = function () {
|
|
1041
|
+ var reg1 = /^1[3456789][0-9]{9}$/; //手机号
|
|
1042
|
+ var reg2 = /^((0\d{2,3})-)*(\d{7,8})(-(\d{3,}))?$/; //座机号
|
|
1043
|
+ var flag1 = reg1.test($scope.requester.mphone);
|
|
1044
|
+ var flag2 = reg2.test($scope.requester.mphone);
|
|
1045
|
+ console.log($scope.requester)
|
|
1046
|
+ if (angular.isUndefined($scope.requester.name) || $scope.requester.name == null || $scope.requester.name == "") {
|
|
1047
|
+ SweetAlert.swal("报修人姓名未填!", "请填写报修人姓名", "error");
|
|
1048
|
+ } else if (angular.isUndefined($scope.requester.requesterType)) {
|
|
1049
|
+ SweetAlert.swal("人员类型未填!", "请填写人员类型", "error");
|
|
1050
|
+ } else if (angular.isUndefined($scope.requester.mphone) || $scope.requester.mphone == null || $scope.requester.mphone == "") {
|
|
1051
|
+ SweetAlert.swal("报修人电话未填!", "请填写报修人电话", "error");
|
|
1052
|
+ }
|
|
1053
|
+ else {
|
|
1054
|
+ $modalInstance.close($scope.requester);
|
|
1055
|
+ }
|
|
1056
|
+ };
|
|
1057
|
+
|
|
1058
|
+ $scope.cancel = function () {
|
|
1059
|
+ $modalInstance.dismiss('cancel');
|
|
1060
|
+ };
|
|
1061
|
+ },
|
|
1062
|
+ });
|
|
1063
|
+ modalInstance.result.then(function (selectedItem) {
|
|
1064
|
+ if (selectedItem) {
|
|
1065
|
+ if (selectedItem.telephone && !selectedItem.mphone) {
|
|
1066
|
+ selectedItem.telephone = angular.copy(selectedItem.mphone);
|
|
1067
|
+ delete selectedItem.mphone;
|
|
1068
|
+ }
|
|
1069
|
+ var data = {
|
|
1070
|
+ 'requester': selectedItem
|
|
1071
|
+ };
|
|
1072
|
+ api_user_data.addData('requester', data).then(function (response) {
|
|
1073
|
+ if (response.status == 200) {
|
|
1074
|
+ var data = {
|
|
1075
|
+ 'model': {
|
|
1076
|
+ 'requestershow': response.data,
|
|
1077
|
+ 'incident': {
|
|
1078
|
+ 'requester': response.data,
|
|
1079
|
+ 'area': response.data.areaDTO,
|
|
1080
|
+ 'place': response.data.placeDTO,
|
|
1081
|
+ 'houseNumber': response.data.houseNumber,
|
|
1082
|
+ // 'callID': cdrid,
|
|
1083
|
+ 'source': {
|
|
1084
|
+ 'id': 1547
|
|
1085
|
+ }
|
|
1086
|
+ }
|
|
1087
|
+ }
|
|
1088
|
+ }
|
|
1089
|
+ $state.go('app.incident.title', {
|
|
1090
|
+ 'model': JSON.stringify(data)
|
|
1091
|
+ });
|
|
1092
|
+ }
|
|
1093
|
+ })
|
|
1094
|
+ }
|
|
1095
|
+ });
|
|
1096
|
+ } else if (myData.list.length == 1) {
|
|
1097
|
+ var data = {
|
|
1098
|
+ 'model': {
|
|
1099
|
+ 'requestershow': myData.list[0],
|
|
1100
|
+ 'incident': {
|
|
1101
|
+ 'requester': myData.list[0],
|
|
1102
|
+ 'area': myData.list[0].areaDTO,
|
|
1103
|
+ 'place': myData.list[0].placeDTO,
|
|
1104
|
+ 'houseNumber': myData.list[0].houseNumber,
|
|
1105
|
+ // 'callID': cdrid,
|
|
1106
|
+ 'source': {
|
|
1107
|
+ 'id': 1547
|
|
1108
|
+ }
|
|
1109
|
+ }
|
|
1110
|
+ }
|
|
1111
|
+ }
|
|
1112
|
+ $state.go('app.incident.title', {
|
|
1113
|
+ 'model': JSON.stringify(data)
|
|
1114
|
+ });
|
|
1115
|
+ } else {
|
|
1116
|
+ var modalInstance = $modal.open({
|
|
1117
|
+ templateUrl: 'assets/views/createincident.html',
|
|
1118
|
+ controller: function ($scope, $modalInstance, api_user_data) {
|
|
1119
|
+ $scope.title = "请确定报修人";
|
|
1120
|
+ $scope.requester = myData.list;
|
|
1121
|
+ $scope.choice = function (requester) {
|
|
1122
|
+ $modalInstance.dismiss('cancel');
|
|
1123
|
+ var data = {
|
|
1124
|
+ 'model': {
|
|
1125
|
+ 'requestershow': requester,
|
|
1126
|
+ 'incident': {
|
|
1127
|
+ 'requester': requester,
|
|
1128
|
+ 'area': requester.areaDTO,
|
|
1129
|
+ 'place': requester.placeDTO,
|
|
1130
|
+ 'houseNumber': requester.houseNumber,
|
|
1131
|
+ // 'callID': cdrid,
|
|
1132
|
+ 'source': {
|
|
1133
|
+ 'id': 1547
|
|
1134
|
+ }
|
|
1135
|
+ }
|
|
1136
|
+ }
|
|
1137
|
+ }
|
|
1138
|
+ $state.go('app.incident.title', {
|
|
1139
|
+ 'model': JSON.stringify(data)
|
|
1140
|
+ });
|
|
1141
|
+ };
|
|
1142
|
+
|
|
1143
|
+ $scope.cancel = function () {
|
|
1144
|
+ $modalInstance.dismiss('cancel');
|
|
1145
|
+ };
|
|
1146
|
+ },
|
|
1147
|
+ size: "lg"
|
|
1148
|
+ });
|
|
1149
|
+ }
|
|
1150
|
+
|
|
1151
|
+ });
|
|
1152
|
+ }
|
|
1153
|
+ // 挂机
|
|
1154
|
+ } else if (phoneData.state == "login") {
|
|
1155
|
+ go_ready()
|
|
1156
|
+ } else if (phoneData.state == "logout") {
|
|
1157
|
+ $rootScope.jry_state = "weiqianru";
|
|
1158
|
+ } else if (phoneData.state == "ready") {
|
|
1159
|
+ // 来电挂机
|
|
1160
|
+ if (phoneData.old_state == "busy" && phoneData.private_data == "answered") {
|
|
1161
|
+ go_break()
|
|
1162
|
+ } else {
|
|
1163
|
+ $rootScope.jry_state = "shixian";
|
|
1164
|
+ }
|
|
1165
|
+ }
|
|
1166
|
+ // else if (data.old_state == "busy") {
|
1150
|
1167
|
|
1151
|
|
- // });
|
1152
|
|
- // }
|
1153
|
|
- // // 挂机
|
1154
|
|
- // } else if (phoneData.state == "login") {
|
1155
|
|
- // go_ready()
|
1156
|
|
- // } else if (phoneData.state == "logout") {
|
1157
|
|
- // $rootScope.jry_state = "weiqianru";
|
1158
|
|
- // } else if (phoneData.state == "ready") {
|
1159
|
|
- // // 来电挂机
|
1160
|
|
- // if (phoneData.old_state == "busy" && phoneData.private_data == "answered") {
|
1161
|
|
- // go_break()
|
1162
|
|
- // } else {
|
1163
|
|
- // $rootScope.jry_state = "shixian";
|
1164
|
|
- // }
|
1165
|
|
- // }
|
1166
|
|
- // // else if (data.old_state == "busy") {
|
|
1168
|
+ // }
|
|
1169
|
+ } else if (phoneData.event_type == "agent_caller_state") {
|
|
1170
|
+ // special feature, never mind
|
|
1171
|
+ if (phoneData.action == "in") {
|
1167
|
1172
|
|
1168
|
|
- // // }
|
1169
|
|
- // } else if (phoneData.event_type == "agent_caller_state") {
|
1170
|
|
- // // special feature, never mind
|
1171
|
|
- // if (phoneData.action == "in") {
|
|
1173
|
+ } else {
|
1172
|
1174
|
|
1173
|
|
- // } else {
|
|
1175
|
+ }
|
|
1176
|
+ } else if (phoneData.event_type == "command/reply") {
|
|
1177
|
+ if (phoneData.phoneData && phoneData.phoneData.state) {
|
1174
|
1178
|
|
1175
|
|
- // }
|
1176
|
|
- // } else if (phoneData.event_type == "command/reply") {
|
1177
|
|
- // if (phoneData.phoneData && phoneData.phoneData.state) {
|
|
1179
|
+ }
|
|
1180
|
+ }
|
|
1181
|
+ }
|
1178
|
1182
|
|
1179
|
|
- // }
|
1180
|
|
- // }
|
1181
|
|
- // }
|
|
1183
|
+ function onConnect() {
|
|
1184
|
+ console.log("websocket connected!");
|
|
1185
|
+ // ola._extn = ola_extn;
|
|
1186
|
+ // ola.subscribe('ola.queue.' + ola_queue + '.' + ola_extn);
|
|
1187
|
+ // ola.subscribe('ola.caller.' + ola_extn);
|
|
1188
|
+ // ola.get_agent_state(ola_extn);
|
|
1189
|
+ ola._extn = $rootScope.jry_extnNumberObj.jry_extnNumber.name;
|
|
1190
|
+ ola.subscribe('ola.queue.' + ola_queue + '.' + $rootScope.jry_extnNumberObj.jry_extnNumber.name);
|
|
1191
|
+ ola.subscribe('ola.caller.' + $rootScope.jry_extnNumberObj.jry_extnNumber.name);
|
|
1192
|
+ ola.get_agent_state($rootScope.jry_extnNumberObj.jry_extnNumber.name);
|
|
1193
|
+ };
|
1182
|
1194
|
|
1183
|
|
- // function onConnect() {
|
1184
|
|
- // console.log("websocket connected!");
|
1185
|
|
- // // ola._extn = ola_extn;
|
1186
|
|
- // // ola.subscribe('ola.queue.' + ola_queue + '.' + ola_extn);
|
1187
|
|
- // // ola.subscribe('ola.caller.' + ola_extn);
|
1188
|
|
- // // ola.get_agent_state(ola_extn);
|
1189
|
|
- // ola._extn = $rootScope.jry_extnNumberObj.jry_extnNumber.name;
|
1190
|
|
- // ola.subscribe('ola.queue.' + ola_queue + '.' + $rootScope.jry_extnNumberObj.jry_extnNumber.name);
|
1191
|
|
- // ola.subscribe('ola.caller.' + $rootScope.jry_extnNumberObj.jry_extnNumber.name);
|
1192
|
|
- // ola.get_agent_state($rootScope.jry_extnNumberObj.jry_extnNumber.name);
|
1193
|
|
- // };
|
1194
|
|
-
|
1195
|
|
- // function onClose() {
|
1196
|
|
- // }
|
|
1195
|
+ function onClose() {
|
|
1196
|
+ }
|
1197
|
1197
|
|
1198
|
|
- // function login() {
|
1199
|
|
- // // ola.login(ola_queue, ola_extn, {type: "onhook"});
|
1200
|
|
- // console.log($rootScope.jry_extnNumberObj.jry_extnNumber);
|
1201
|
|
- // ola.login(ola_queue, $rootScope.jry_extnNumberObj.jry_extnNumber.name, { type: "onhook" });
|
1202
|
|
- // }
|
|
1198
|
+ function login() {
|
|
1199
|
+ // ola.login(ola_queue, ola_extn, {type: "onhook"});
|
|
1200
|
+ console.log($rootScope.jry_extnNumberObj.jry_extnNumber);
|
|
1201
|
+ ola.login(ola_queue, $rootScope.jry_extnNumberObj.jry_extnNumber.name, { type: "onhook" });
|
|
1202
|
+ }
|
1203
|
1203
|
|
1204
|
|
- // function logout() {
|
1205
|
|
- // ola.logout();
|
1206
|
|
- // }
|
|
1204
|
+ function logout() {
|
|
1205
|
+ ola.logout();
|
|
1206
|
+ }
|
1207
|
1207
|
|
1208
|
|
- // function go_ready() {
|
1209
|
|
- // ola.go_ready();
|
1210
|
|
- // }
|
|
1208
|
+ function go_ready() {
|
|
1209
|
+ ola.go_ready();
|
|
1210
|
+ }
|
1211
|
1211
|
|
1212
|
|
- // function go_break() {
|
1213
|
|
- // ola.go_break($('#break_reason').val());
|
1214
|
|
- // $rootScope.jry_state = "shimang";
|
1215
|
|
- // }
|
|
1212
|
+ function go_break() {
|
|
1213
|
+ ola.go_break($('#break_reason').val());
|
|
1214
|
+ $rootScope.jry_state = "shimang";
|
|
1215
|
+ }
|
1216
|
1216
|
|
1217
|
|
- // function answer() {
|
1218
|
|
- // ola.answer();
|
1219
|
|
- // }
|
|
1217
|
+ function answer() {
|
|
1218
|
+ ola.answer();
|
|
1219
|
+ }
|
1220
|
1220
|
|
1221
|
|
- // function dial(dst) {
|
1222
|
|
- // ola.dial(dst);
|
1223
|
|
- // }
|
1224
|
|
- // $rootScope.dial = function (dst) {
|
1225
|
|
- // ola.dial(dst);
|
1226
|
|
- // }
|
1227
|
|
- // function conference(dst) {
|
1228
|
|
- // ola.conference(dst);
|
1229
|
|
- // }
|
|
1221
|
+ function dial(dst) {
|
|
1222
|
+ ola.dial(dst);
|
|
1223
|
+ }
|
|
1224
|
+ $rootScope.dial = function (dst) {
|
|
1225
|
+ ola.dial(dst);
|
|
1226
|
+ }
|
|
1227
|
+ function conference(dst) {
|
|
1228
|
+ ola.conference(dst);
|
|
1229
|
+ }
|
1230
|
1230
|
|
1231
|
|
- // function conference_uuid(channel_uuid) {
|
1232
|
|
- // ola.conference_uuid(channel_uuid);
|
1233
|
|
- // }
|
|
1231
|
+ function conference_uuid(channel_uuid) {
|
|
1232
|
+ ola.conference_uuid(channel_uuid);
|
|
1233
|
+ }
|
1234
|
1234
|
|
1235
|
|
- // function hangup() {
|
1236
|
|
- // ola.hangup();
|
1237
|
|
- // }
|
|
1235
|
+ function hangup() {
|
|
1236
|
+ ola.hangup();
|
|
1237
|
+ }
|
1238
|
1238
|
|
1239
|
|
- // function take_call(uuid) {
|
1240
|
|
- // // ola.take_call(ola_extn, uuid);
|
1241
|
|
- // ola.take_call($rootScope.jry_extnNumberObj.jry_extnNumber.name, uuid);
|
1242
|
|
- // }
|
1243
|
|
- // // 签入
|
1244
|
|
- // $rootScope.jry_qianru = function () {
|
1245
|
|
- // login();
|
1246
|
|
- // }
|
1247
|
|
- // // 示闲
|
1248
|
|
- // $rootScope.jry_shixian = function () {
|
1249
|
|
- // go_ready()
|
1250
|
|
- // }
|
1251
|
|
- // // 示忙
|
1252
|
|
- // $rootScope.jry_shimang = function () {
|
1253
|
|
- // go_break()
|
1254
|
|
- // }
|
1255
|
|
- // // 签出
|
1256
|
|
- // $rootScope.jry_qianchu = function () {
|
1257
|
|
- // logout()
|
1258
|
|
- // }
|
1259
|
|
- // $rootScope.jry_bohao = function (res) {
|
1260
|
|
- // if ($rootScope.jry_state == "weiqianru") {
|
1261
|
|
- // // SweetAlert.swal({
|
1262
|
|
- // // title: "拨打失败",
|
1263
|
|
- // // text: "请先签入!",
|
1264
|
|
- // // type: "error",
|
1265
|
|
- // // confirmButtonColor: "#DD6B55"
|
1266
|
|
- // // });
|
1267
|
|
- // } else if ($rootScope.jry_state == "shimang") {
|
1268
|
|
- // // SweetAlert.swal({
|
1269
|
|
- // // title: "拨打失败",
|
1270
|
|
- // // text: "请先示闲!",
|
1271
|
|
- // // type: "error",
|
1272
|
|
- // // confirmButtonColor: "#DD6B55"
|
1273
|
|
- // // });
|
1274
|
|
- // } else {
|
1275
|
|
- // dial(res);
|
1276
|
|
- // }
|
1277
|
|
- // }
|
1278
|
|
- // })
|
1279
|
|
- // }
|
|
1239
|
+ function take_call(uuid) {
|
|
1240
|
+ // ola.take_call(ola_extn, uuid);
|
|
1241
|
+ ola.take_call($rootScope.jry_extnNumberObj.jry_extnNumber.name, uuid);
|
|
1242
|
+ }
|
|
1243
|
+ // 签入
|
|
1244
|
+ $rootScope.jry_qianru = function () {
|
|
1245
|
+ login();
|
|
1246
|
+ }
|
|
1247
|
+ // 示闲
|
|
1248
|
+ $rootScope.jry_shixian = function () {
|
|
1249
|
+ go_ready()
|
|
1250
|
+ }
|
|
1251
|
+ // 示忙
|
|
1252
|
+ $rootScope.jry_shimang = function () {
|
|
1253
|
+ go_break()
|
|
1254
|
+ }
|
|
1255
|
+ // 签出
|
|
1256
|
+ $rootScope.jry_qianchu = function () {
|
|
1257
|
+ logout()
|
|
1258
|
+ }
|
|
1259
|
+ $rootScope.jry_bohao = function (res) {
|
|
1260
|
+ if ($rootScope.jry_state == "weiqianru") {
|
|
1261
|
+ // SweetAlert.swal({
|
|
1262
|
+ // title: "拨打失败",
|
|
1263
|
+ // text: "请先签入!",
|
|
1264
|
+ // type: "error",
|
|
1265
|
+ // confirmButtonColor: "#DD6B55"
|
|
1266
|
+ // });
|
|
1267
|
+ } else if ($rootScope.jry_state == "shimang") {
|
|
1268
|
+ // SweetAlert.swal({
|
|
1269
|
+ // title: "拨打失败",
|
|
1270
|
+ // text: "请先示闲!",
|
|
1271
|
+ // type: "error",
|
|
1272
|
+ // confirmButtonColor: "#DD6B55"
|
|
1273
|
+ // });
|
|
1274
|
+ } else {
|
|
1275
|
+ dial(res);
|
|
1276
|
+ }
|
|
1277
|
+ }
|
|
1278
|
+ })
|
|
1279
|
+ }
|
1280
|
1280
|
// ------------------------------2--------------------------
|
1281
|
1281
|
$rootScope.getExtnDirect2 = function () {
|
1282
|
1282
|
var jry_data_dictionary = {
|
|
@@ -1615,6 +1615,7 @@ app.controller('AppCtrl', ['$rootScope', '$scope', '$state', '$translate', '$loc
|
1615
|
1615
|
function oncallin(jso) {
|
1616
|
1616
|
console.log(jso);//lmm
|
1617
|
1617
|
$rootScope.callInPhoneNumber = jso.caller;//来电的电话
|
|
1618
|
+ $rootScope.sockid = jso.sockid;//来电的话机id
|
1618
|
1619
|
if (jso) {
|
1619
|
1620
|
console.log('呼入坐席成功,请摘机-----seimin');
|
1620
|
1621
|
$.toaster({
|
|
@@ -1661,7 +1662,8 @@ app.controller('AppCtrl', ['$rootScope', '$scope', '$state', '$translate', '$loc
|
1661
|
1662
|
incident: {
|
1662
|
1663
|
requester: {
|
1663
|
1664
|
hjzxPhone: $rootScope.callInPhoneNumber
|
1664
|
|
- }
|
|
1665
|
+ },
|
|
1666
|
+ sockid: $rootScope.sockid
|
1665
|
1667
|
}
|
1666
|
1668
|
}
|
1667
|
1669
|
})
|
|
@@ -1673,7 +1675,8 @@ app.controller('AppCtrl', ['$rootScope', '$scope', '$state', '$translate', '$loc
|
1673
|
1675
|
model: {
|
1674
|
1676
|
incident: {
|
1675
|
1677
|
requester: requesters[0],
|
1676
|
|
- contactsInformation: requesters[0].mphone
|
|
1678
|
+ contactsInformation: requesters[0].mphone,
|
|
1679
|
+ sockid: $rootScope.sockid
|
1677
|
1680
|
},
|
1678
|
1681
|
}
|
1679
|
1682
|
})
|
|
@@ -1700,7 +1703,8 @@ app.controller('AppCtrl', ['$rootScope', '$scope', '$state', '$translate', '$loc
|
1700
|
1703
|
model: {
|
1701
|
1704
|
incident: {
|
1702
|
1705
|
requester: item,
|
1703
|
|
- contactsInformation: item.mphone
|
|
1706
|
+ contactsInformation: item.mphone,
|
|
1707
|
+ sockid: $rootScope.sockid
|
1704
|
1708
|
},
|
1705
|
1709
|
}
|
1706
|
1710
|
})
|