|
@@ -4,6 +4,7 @@
|
4
|
4
|
*/
|
5
|
5
|
app.controller('AppCtrl', ['$rootScope', '$scope', '$state', '$translate', '$localStorage', '$cookieStore', '$window', '$modal', '$document', '$timeout', '$filter', '$auth', 'cfpLoadingBar', 'DDP', 'deskNotification', 'Restangular', 'api_login', 'api_text', 'api_user_data', 'api_wechatfile', 'api_bpm_data', 'api_msg', 'Myservice', '$interval', 'jry_api_bpm',
|
6
|
6
|
function ($rootScope, $scope, $state, $translate, $localStorage, $cookieStore, $window, $modal, $document, $timeout, $filter, $auth, cfpLoadingBar, DDP, deskNotification, Restangular, api_login, api_text, api_user_data, api_wechatfile, api_bpm_data, api_msg, Myservice, $interval, jry_api_bpm) {
|
|
7
|
+
|
7
|
8
|
// 未读消息数量seimin
|
8
|
9
|
$rootScope.getMsgNum = function (id) {
|
9
|
10
|
api_msg.msgDataList({ idx: 0, sum: 1, messageStation: { readStatus: 0, userId: id } }).then(function (data) {
|
|
@@ -44,6 +45,24 @@ app.controller('AppCtrl', ['$rootScope', '$scope', '$state', '$translate', '$loc
|
44
|
45
|
// $auth.deleteData('auth_headers')
|
45
|
46
|
// }
|
46
|
47
|
$rootScope.$on('$stateChangeStart', function (event, toState, toParams, fromState, fromParams) {
|
|
48
|
+ console.log(event, toState, toParams, fromState, fromParams,'cao')
|
|
49
|
+ if((toState.name == 'app.incident.editor'||toState.name == 'app.incident.editor')&&
|
|
50
|
+ fromState.name){
|
|
51
|
+ $rootScope.phoneNumber = localStorage.getItem('phoneNumber');
|
|
52
|
+ //进入页面强制示忙
|
|
53
|
+ if(tlwsa){
|
|
54
|
+ tlwsa.tlaForceacw($rootScope.phoneNumber);
|
|
55
|
+ }
|
|
56
|
+ }
|
|
57
|
+ if((fromState.name == 'app.incident.editor'||fromState.name == 'app.incident.editor')&&
|
|
58
|
+ toState.name != 'app.incident.editor'&&toState.name != 'app.incident.editor'
|
|
59
|
+ ){
|
|
60
|
+ $rootScope.phoneNumber = localStorage.getItem('phoneNumber');
|
|
61
|
+ //进入页面强制示闲
|
|
62
|
+ if(tlwsa){
|
|
63
|
+ tlwsa.tlaForcewca($rootScope.phoneNumber);
|
|
64
|
+ }
|
|
65
|
+ }
|
47
|
66
|
if (isEmpty($auth.retrieveData('auth_headers'))) {
|
48
|
67
|
// if (toState.name != "login.signin" && toState.name != "echart") {
|
49
|
68
|
// event.preventDefault();
|
|
@@ -1273,330 +1292,17 @@ app.controller('AppCtrl', ['$rootScope', '$scope', '$state', '$translate', '$loc
|
1273
|
1292
|
$rootScope.jry_extnNumberObj.tel2 = angular.copy(res[0]);//转接坐席对象
|
1274
|
1293
|
//连接
|
1275
|
1294
|
tlwsa.tlaOpen(websocket_url);
|
1276
|
|
- /* callbacks */
|
1277
|
|
- function onMessage(evt) {
|
1278
|
|
- var phoneData = JSON.parse(evt.data);
|
1279
|
|
- if (phoneData.event_type == "agent_state") {
|
1280
|
|
- console.log(phoneData);
|
1281
|
|
- if (phoneData.state == "busy") {
|
1282
|
|
- $('#agent_state').append(" (" + phoneData.private_data + ")");
|
1283
|
|
- // 来电
|
1284
|
|
- if (phoneData.private_data == "ring") {
|
1285
|
|
- console.log(phoneData);
|
1286
|
|
- $rootScope.jry_state = "laidian";
|
1287
|
|
- var Notification = window.Notification;
|
1288
|
|
- Notification.requestPermission();
|
1289
|
|
- var n = new Notification("你有来电", {
|
1290
|
|
- body: "来电号码:" + phoneData.ani,
|
1291
|
|
- icon: '../bower_components/HTML5-Desktop-Notifications/alert.ico',
|
1292
|
|
- });
|
1293
|
|
- // 摘机
|
1294
|
|
- } else if (phoneData.private_data == "answered") {
|
1295
|
|
- $rootScope.jry_state = "tonghuazhong";
|
1296
|
|
- var jry_findPhone = "";
|
1297
|
|
- if (phoneData.ani) {
|
1298
|
|
- jry_findPhone = phoneData.ani
|
1299
|
|
- } else if (phoneData.dnis && phoneData.other_answered) {
|
1300
|
|
- jry_findPhone = phoneData.dnis
|
1301
|
|
- }
|
1302
|
|
- var filterData = {
|
1303
|
|
- "idx": 0,
|
1304
|
|
- "sum": 100,
|
1305
|
|
- "requester": {
|
1306
|
|
- "mphone": jry_findPhone,
|
1307
|
|
- "telephone": jry_findPhone,
|
1308
|
|
- "selectType": 1
|
1309
|
|
- }
|
1310
|
|
- }
|
1311
|
|
- api_user_data.fetchDataList('requester', filterData).then(function (data) {
|
1312
|
|
- var myData = Restangular.stripRestangular(data);
|
1313
|
|
- // $rootScope.phone="";
|
1314
|
|
- // 新增报修人baba
|
1315
|
|
- if (myData.list.length == 0) {
|
1316
|
|
- var modalInstance = $modal.open({
|
1317
|
|
- templateUrl: 'assets/views/customform/tpl/modal-add-callrequester.html',
|
1318
|
|
- controller: function ($scope, $modalInstance, api_user_data, SweetAlert, api_wechatfile) {
|
1319
|
|
- $scope.title = "新增报修人";
|
1320
|
|
- $scope.requester = {};
|
1321
|
|
- $scope.onChangeadd = function (searchData) {
|
1322
|
|
- $scope.searchKey = searchData.account;
|
1323
|
|
- // $scope.searchDataadd = searchData;
|
1324
|
|
- var requesdata = angular.copy(searchData)
|
1325
|
|
- // if (requesdata.mphone) {
|
1326
|
|
- // delete requesdata.mphone;
|
1327
|
|
- // }
|
1328
|
|
- if (requesdata.telephone) {
|
1329
|
|
- delete requesdata.telephone;
|
1330
|
|
- }
|
1331
|
|
- angular.extend($scope.requester, requesdata);
|
1332
|
|
- }
|
1333
|
|
- $scope.refreshUseradd = function (searchKey) { //请求人搜索
|
1334
|
|
- $scope.requester.account = searchKey;
|
1335
|
|
- $scope.searchData = searchKey;
|
1336
|
|
- serchdataadd(searchKey);
|
1337
|
|
- }
|
1338
|
|
- $scope.getMydata = function (x) {
|
1339
|
|
- var reqestdatap = JSON.parse(x[0])
|
1340
|
|
- // if ($scope.requester.mphone) {
|
1341
|
|
- // delete reqestdatap.mphone;
|
1342
|
|
- // }
|
1343
|
|
- if ($scope.requester.telephone) {
|
1344
|
|
- delete reqestdatap.telephone;
|
1345
|
|
- }
|
1346
|
|
- $scope.searchField = JSON.parse(x[0]).account;
|
1347
|
|
- angular.extend($scope.requester, reqestdatap);
|
1348
|
|
- }
|
1349
|
|
- $scope.getMydataone = function (x) {
|
1350
|
|
- $scope.searchField = x;
|
1351
|
|
- $scope.requester.account = x;
|
1352
|
|
- }
|
1353
|
|
- serchdataadd();
|
1354
|
|
-
|
1355
|
|
- function serchdataadd(searchKey) {
|
1356
|
|
- if (searchKey) {
|
1357
|
|
- var filterData = {
|
1358
|
|
- 'requester': {
|
1359
|
|
- 'searchKey': searchKey,
|
1360
|
|
- },
|
1361
|
|
- idx: 0,
|
1362
|
|
- sum: 10
|
1363
|
|
- };
|
1364
|
|
- } else {
|
1365
|
|
- var filterData = {
|
1366
|
|
- idx: 0,
|
1367
|
|
- sum: 10
|
1368
|
|
- };
|
1369
|
|
- }
|
1370
|
|
- api_user_data.fetchDataList('requester', filterData).then(function (response) {
|
1371
|
|
- var myData = response;
|
1372
|
|
- $scope.myData = myData.list;
|
1373
|
|
- });
|
1374
|
|
- }
|
1375
|
|
- api_user_data.fetchDataList('area', {
|
1376
|
|
- idx: 0,
|
1377
|
|
- sum: 100
|
1378
|
|
- }).then(function (response) {
|
1379
|
|
- if (response.status == 200) {
|
1380
|
|
- $scope.areas = response.list;
|
1381
|
|
- }
|
1382
|
|
- })
|
1383
|
|
- api_wechatfile.getDictionary({
|
1384
|
|
- "key": "requester_type",
|
1385
|
|
- "type": "list"
|
1386
|
|
- }).then(function (response) {
|
1387
|
|
- // if (response.status == 200) {
|
1388
|
|
- $scope.networktypes = response;
|
1389
|
|
- // }
|
1390
|
|
- })
|
1391
|
|
- $scope.requesterAreaid = "";
|
1392
|
|
- $scope.onChange = function (item) {
|
1393
|
|
- $scope.requesterAreaid = item.id;
|
1394
|
|
- $scope.requester.placeDTO = {};
|
1395
|
|
- api_user_data.fetchDataList('place', {
|
1396
|
|
- place: {
|
1397
|
|
- areaId: item.id
|
1398
|
|
- },
|
1399
|
|
- idx: 0,
|
1400
|
|
- sum: 1000
|
1401
|
|
- }).then(function (response) {
|
1402
|
|
- if (response.status == 200) {
|
1403
|
|
- $scope.places = response.list;
|
1404
|
|
- }
|
1405
|
|
- })
|
1406
|
|
- }
|
1407
|
|
- //地点搜索
|
1408
|
|
- $scope.refresh = function (searchVal) {
|
1409
|
|
- var faildata = {};
|
1410
|
|
- if ($scope.requesterAreaid) {
|
1411
|
|
- faildata = {
|
1412
|
|
- 'idx': 0,
|
1413
|
|
- 'sum': 1000,
|
1414
|
|
- 'place': {
|
1415
|
|
- 'areaId': $scope.requesterAreaid,
|
1416
|
|
- 'place': searchVal,
|
1417
|
|
- 'selectType': 'pinyin_qs'
|
1418
|
|
- }
|
1419
|
|
- }
|
1420
|
|
- } else {
|
1421
|
|
- faildata = {
|
1422
|
|
- 'idx': 0,
|
1423
|
|
- 'sum': 1000,
|
1424
|
|
- 'place': {
|
1425
|
|
- 'place': searchVal,
|
1426
|
|
- 'selectType': 'pinyin_qs'
|
1427
|
|
- }
|
1428
|
|
- }
|
1429
|
|
- }
|
1430
|
|
- api_user_data.fetchDataList('place', faildata).then(function (response) {
|
1431
|
|
- $scope.places = response.list;
|
1432
|
|
- delete $scope.requester.placeDTO;
|
1433
|
|
- })
|
1434
|
|
- }
|
1435
|
|
-
|
1436
|
|
-
|
1437
|
|
- $scope.requester = {
|
1438
|
|
- 'telephone': jry_findPhone
|
1439
|
|
- };
|
1440
|
|
- $scope.ok = function () {
|
1441
|
|
- var reg1 = /^1[3456789][0-9]{9}$/; //手机号
|
1442
|
|
- var reg2 = /^((0\d{2,3})-)*(\d{7,8})(-(\d{3,}))?$/; //座机号
|
1443
|
|
- var flag1 = reg1.test($scope.requester.mphone);
|
1444
|
|
- var flag2 = reg2.test($scope.requester.mphone);
|
1445
|
|
- console.log($scope.requester)
|
1446
|
|
- if (angular.isUndefined($scope.requester.name) || $scope.requester.name == null || $scope.requester.name == "") {
|
1447
|
|
- SweetAlert.swal("报修人姓名未填!", "请填写报修人姓名", "error");
|
1448
|
|
- } else if (angular.isUndefined($scope.requester.requesterType)) {
|
1449
|
|
- SweetAlert.swal("人员类型未填!", "请填写人员类型", "error");
|
1450
|
|
- } else if (angular.isUndefined($scope.requester.mphone) || $scope.requester.mphone == null || $scope.requester.mphone == "") {
|
1451
|
|
- SweetAlert.swal("报修人电话未填!", "请填写报修人电话", "error");
|
1452
|
|
- }
|
1453
|
|
- else {
|
1454
|
|
- $modalInstance.close($scope.requester);
|
1455
|
|
- }
|
1456
|
|
- };
|
1457
|
|
-
|
1458
|
|
- $scope.cancel = function () {
|
1459
|
|
- $modalInstance.dismiss('cancel');
|
1460
|
|
- };
|
1461
|
|
- },
|
1462
|
|
- });
|
1463
|
|
- modalInstance.result.then(function (selectedItem) {
|
1464
|
|
- if (selectedItem) {
|
1465
|
|
- if (selectedItem.telephone && !selectedItem.mphone) {
|
1466
|
|
- selectedItem.telephone = angular.copy(selectedItem.mphone);
|
1467
|
|
- delete selectedItem.mphone;
|
1468
|
|
- }
|
1469
|
|
- var data = {
|
1470
|
|
- 'requester': selectedItem
|
1471
|
|
- };
|
1472
|
|
- api_user_data.addData('requester', data).then(function (response) {
|
1473
|
|
- if (response.status == 200) {
|
1474
|
|
- var data = {
|
1475
|
|
- 'model': {
|
1476
|
|
- 'requestershow': response.data,
|
1477
|
|
- 'incident': {
|
1478
|
|
- 'requester': response.data,
|
1479
|
|
- 'area': response.data.areaDTO,
|
1480
|
|
- 'place': response.data.placeDTO,
|
1481
|
|
- 'houseNumber': response.data.houseNumber,
|
1482
|
|
- // 'callID': cdrid,
|
1483
|
|
- 'source': {
|
1484
|
|
- 'id': 1547
|
1485
|
|
- }
|
1486
|
|
- }
|
1487
|
|
- }
|
1488
|
|
- }
|
1489
|
|
- $state.go('app.incident.title', {
|
1490
|
|
- 'model': JSON.stringify(data)
|
1491
|
|
- });
|
1492
|
|
- }
|
1493
|
|
- })
|
1494
|
|
- }
|
1495
|
|
- });
|
1496
|
|
- } else if (myData.list.length == 1) {
|
1497
|
|
- var data = {
|
1498
|
|
- 'model': {
|
1499
|
|
- 'requestershow': myData.list[0],
|
1500
|
|
- 'incident': {
|
1501
|
|
- 'requester': myData.list[0],
|
1502
|
|
- 'area': myData.list[0].areaDTO,
|
1503
|
|
- 'place': myData.list[0].placeDTO,
|
1504
|
|
- 'houseNumber': myData.list[0].houseNumber,
|
1505
|
|
- // 'callID': cdrid,
|
1506
|
|
- 'source': {
|
1507
|
|
- 'id': 1547
|
1508
|
|
- }
|
1509
|
|
- }
|
1510
|
|
- }
|
1511
|
|
- }
|
1512
|
|
- $state.go('app.incident.title', {
|
1513
|
|
- 'model': JSON.stringify(data)
|
1514
|
|
- });
|
1515
|
|
- } else {
|
1516
|
|
- var modalInstance = $modal.open({
|
1517
|
|
- templateUrl: 'assets/views/createincident.html',
|
1518
|
|
- controller: function ($scope, $modalInstance, api_user_data) {
|
1519
|
|
- $scope.title = "请确定报修人";
|
1520
|
|
- $scope.requester = myData.list;
|
1521
|
|
- $scope.choice = function (requester) {
|
1522
|
|
- $modalInstance.dismiss('cancel');
|
1523
|
|
- var data = {
|
1524
|
|
- 'model': {
|
1525
|
|
- 'requestershow': requester,
|
1526
|
|
- 'incident': {
|
1527
|
|
- 'requester': requester,
|
1528
|
|
- 'area': requester.areaDTO,
|
1529
|
|
- 'place': requester.placeDTO,
|
1530
|
|
- 'houseNumber': requester.houseNumber,
|
1531
|
|
- // 'callID': cdrid,
|
1532
|
|
- 'source': {
|
1533
|
|
- 'id': 1547
|
1534
|
|
- }
|
1535
|
|
- }
|
1536
|
|
- }
|
1537
|
|
- }
|
1538
|
|
- $state.go('app.incident.title', {
|
1539
|
|
- 'model': JSON.stringify(data)
|
1540
|
|
- });
|
1541
|
|
- };
|
1542
|
|
-
|
1543
|
|
- $scope.cancel = function () {
|
1544
|
|
- $modalInstance.dismiss('cancel');
|
1545
|
|
- };
|
1546
|
|
- },
|
1547
|
|
- size: "lg"
|
1548
|
|
- });
|
1549
|
|
- }
|
1550
|
|
-
|
1551
|
|
- });
|
1552
|
|
- }
|
1553
|
|
- // 挂机
|
1554
|
|
- } else if (phoneData.state == "login") {
|
1555
|
|
- go_ready()
|
1556
|
|
- } else if (phoneData.state == "logout") {
|
1557
|
|
- $rootScope.jry_state = "weiqianru";
|
1558
|
|
- } else if (phoneData.state == "ready") {
|
1559
|
|
- // 来电挂机
|
1560
|
|
- if (phoneData.old_state == "busy" && phoneData.private_data == "answered") {
|
1561
|
|
- go_break()
|
1562
|
|
- } else {
|
1563
|
|
- $rootScope.jry_state = "shixian";
|
1564
|
|
- }
|
1565
|
|
- }
|
1566
|
|
- // else if (data.old_state == "busy") {
|
1567
|
|
-
|
1568
|
|
- // }
|
1569
|
|
- } else if (phoneData.event_type == "agent_caller_state") {
|
1570
|
|
- // special feature, never mind
|
1571
|
|
- if (phoneData.action == "in") {
|
1572
|
|
-
|
1573
|
|
- } else {
|
1574
|
|
-
|
1575
|
|
- }
|
1576
|
|
- } else if (phoneData.event_type == "command/reply") {
|
1577
|
|
- if (phoneData.phoneData && phoneData.phoneData.state) {
|
1578
|
|
-
|
1579
|
|
- }
|
1580
|
|
- }
|
1581
|
|
- }
|
1582
|
|
- // $modal.open({
|
1583
|
|
- // template:' ',
|
1584
|
|
- // controller: function ($scope,$modalInstance,SweetAlert){
|
1585
|
|
- // SweetAlert.swal({
|
1586
|
|
- // title: "呼叫失败",
|
1587
|
|
- // text: "呼叫失败!",
|
1588
|
|
- // type: "error"
|
1589
|
|
- // },function(){
|
1590
|
|
- // $modalInstance.close('cancel')
|
1591
|
|
- // })
|
1592
|
|
- // }
|
1593
|
|
- // })
|
1594
|
1295
|
//连接呼叫中心回调函数
|
1595
|
1296
|
TLWSA.onOpenreturn = onopenreturn;
|
1596
|
1297
|
function onopenreturn(err) {
|
1597
|
1298
|
err = Number(err);
|
1598
|
1299
|
if (!err) {
|
1599
|
1300
|
console.log('呼叫中心连接成功-----seimin');
|
|
1301
|
+ $.toaster({
|
|
1302
|
+ priority: 'info',
|
|
1303
|
+ title: '操作',
|
|
1304
|
+ message: '呼叫中心连接成功'
|
|
1305
|
+ });
|
1600
|
1306
|
//如果设置过话机
|
1601
|
1307
|
if (localStorage.getItem('phoneNumber')) {
|
1602
|
1308
|
// 签入并绑定分机
|
|
@@ -1615,13 +1321,57 @@ app.controller('AppCtrl', ['$rootScope', '$scope', '$state', '$translate', '$loc
|
1615
|
1321
|
console.log('绑定分机成功-----seimin');
|
1616
|
1322
|
$rootScope.jry_state = 'shixian';
|
1617
|
1323
|
localStorage.setItem('phoneNumber', $rootScope.phoneNumber);
|
|
1324
|
+ if(location.href.includes('app/incident/editor')||location.href.includes('app/incident/chart')){
|
|
1325
|
+ //进入页面,强制示忙
|
|
1326
|
+ tlwsa.tlaForceacw($rootScope.phoneNumber);
|
|
1327
|
+ }
|
1618
|
1328
|
} else {
|
1619
|
1329
|
console.log('绑定分机失败-----seimin');
|
1620
|
1330
|
}
|
1621
|
1331
|
}
|
|
1332
|
+ //强制示忙回调函数
|
|
1333
|
+ TLWSA.onAcw=onacw;
|
|
1334
|
+ function onacw(err) {
|
|
1335
|
+ err = Number(err);
|
|
1336
|
+ if (!err) {
|
|
1337
|
+ $rootScope.jry_state = 'shimang';
|
|
1338
|
+ console.log('强制示忙成功-----seimin');
|
|
1339
|
+ }else{
|
|
1340
|
+ console.log('强制示忙失败-----seimin');
|
|
1341
|
+ }
|
|
1342
|
+ }
|
|
1343
|
+ //强制示闲回调函数
|
|
1344
|
+ TLWSA.onWca = onwca;
|
|
1345
|
+ function onwca(err) {
|
|
1346
|
+ console.log(err)
|
|
1347
|
+ err = Number(err);
|
|
1348
|
+ if (!err) {
|
|
1349
|
+ $rootScope.jry_state = 'shixian';
|
|
1350
|
+ console.log('强制示闲成功-----seimin');
|
|
1351
|
+ }else{
|
|
1352
|
+ console.log('强制示闲失败-----seimin');
|
|
1353
|
+ }
|
|
1354
|
+ }
|
|
1355
|
+ //与服务器网络连接中断回调函数
|
|
1356
|
+ TLWSA.onClosed=onclosed;
|
|
1357
|
+ function onclosed() {
|
|
1358
|
+ $rootScope.jry_state = 'weiqianru';
|
|
1359
|
+ console.log('与服务器网络连接中断-----seimin');
|
|
1360
|
+ $.toaster({
|
|
1361
|
+ priority: 'info',
|
|
1362
|
+ title: '操作',
|
|
1363
|
+ message: '与服务器网络连接中断,2分钟后重连'
|
|
1364
|
+ });
|
|
1365
|
+ console.log('2分钟后自动重连-----seimin')
|
|
1366
|
+ $timeout(function(){
|
|
1367
|
+ //连接
|
|
1368
|
+ tlwsa.tlaOpen(websocket_url);
|
|
1369
|
+ },120000)
|
|
1370
|
+ }
|
1622
|
1371
|
//签入回调函数
|
1623
|
1372
|
TLWSA.onLoginreturn = onloginreturn;
|
1624
|
1373
|
function onloginreturn(err) {
|
|
1374
|
+ console.log(err)
|
1625
|
1375
|
err = Number(err);
|
1626
|
1376
|
if (!err) {
|
1627
|
1377
|
console.log('签入成功-----seimin');
|
|
@@ -1728,36 +1478,35 @@ app.controller('AppCtrl', ['$rootScope', '$scope', '$state', '$translate', '$loc
|
1728
|
1478
|
if (!err) {
|
1729
|
1479
|
console.log('呼入摘机应答成功-----seimin');
|
1730
|
1480
|
$rootScope.jry_state = 'tonghuazhong';
|
1731
|
|
- //根据电话号码反查报修人
|
1732
|
|
- var postData = { "idx": 0, "sum": 10, "requester": { hjzxPhone: $rootScope.callInPhoneNumber } };
|
|
1481
|
+ //根据电话号码反查报修人hjzxPhone
|
|
1482
|
+ var postData = { "idx": 0, "sum": 10, "requester": { mphone: $rootScope.callInPhoneNumber } };
|
1733
|
1483
|
api_user_data.fetchDataList('requester', postData).then(function (result) {
|
1734
|
1484
|
if (result.status == 200) {
|
1735
|
1485
|
console.log(result.list);
|
1736
|
1486
|
var requesters = result.list;
|
|
1487
|
+
|
1737
|
1488
|
|
1738
|
|
- $state.go('app.incident.chart',{
|
1739
|
|
- model: JSON.stringify({
|
1740
|
|
- model:{
|
1741
|
|
- incident:{
|
1742
|
|
- requester:{
|
1743
|
|
- hjzxPhone:$rootScope.callInPhoneNumber
|
1744
|
|
- }
|
1745
|
|
- }
|
1746
|
|
- }
|
1747
|
|
- })
|
1748
|
|
- });
|
1749
|
|
- return;
|
1750
|
1489
|
if (requesters.length === 0) {
|
1751
|
1490
|
//未匹配到报修人,则弹窗添加报修人yeye
|
1752
|
|
-
|
|
1491
|
+ $state.go('app.incident.chart', {
|
|
1492
|
+ model: JSON.stringify({
|
|
1493
|
+ model: {
|
|
1494
|
+ incident: {
|
|
1495
|
+ requester: {
|
|
1496
|
+ hjzxPhone: $rootScope.callInPhoneNumber
|
|
1497
|
+ }
|
|
1498
|
+ }
|
|
1499
|
+ }
|
|
1500
|
+ })
|
|
1501
|
+ });
|
1753
|
1502
|
} else if (requesters.length === 1) {
|
1754
|
1503
|
//匹配到一个报修人
|
1755
|
|
- $state.go('app.incident.chart',{
|
|
1504
|
+ $state.go('app.incident.chart', {
|
1756
|
1505
|
model: JSON.stringify({
|
1757
|
|
- model:{
|
|
1506
|
+ model: {
|
1758
|
1507
|
incident: {
|
1759
|
1508
|
requester: requesters[0],
|
1760
|
|
- contactsInformation:requesters[0].mphone
|
|
1509
|
+ contactsInformation: requesters[0].mphone
|
1761
|
1510
|
},
|
1762
|
1511
|
}
|
1763
|
1512
|
})
|
|
@@ -1765,17 +1514,39 @@ app.controller('AppCtrl', ['$rootScope', '$scope', '$state', '$translate', '$loc
|
1765
|
1514
|
} else {
|
1766
|
1515
|
//匹配到多个报修人
|
1767
|
1516
|
$modal.open({
|
1768
|
|
- template:' ',
|
1769
|
|
- controller: function ($scope,$modalInstance,SweetAlert){
|
1770
|
|
- SweetAlert.swal({
|
1771
|
|
- title: "呼叫失败",
|
1772
|
|
- text: "呼叫失败!",
|
|
1517
|
+ templateUrl: 'assets/views/incident/tpl/tel.html',
|
|
1518
|
+ controller: function ($scope, $modalInstance,$timeout,SweetAlert) {
|
|
1519
|
+ $scope.list = requesters;
|
|
1520
|
+ $scope.selectedItem = 0;
|
|
1521
|
+ $scope.cancel = function () {
|
|
1522
|
+ $modalInstance.dismiss('cancel');
|
|
1523
|
+ };
|
|
1524
|
+ $scope.changeBxr = function(id){
|
|
1525
|
+ $scope.selectedItem = id;
|
|
1526
|
+ }
|
|
1527
|
+ $scope.save = function () {
|
|
1528
|
+ var item = $scope.list.find(v => v.id == $scope.selectedItem);
|
|
1529
|
+ if (item) {
|
|
1530
|
+ $scope.cancel();
|
|
1531
|
+ $state.go('app.incident.chart', {
|
|
1532
|
+ model: JSON.stringify({
|
|
1533
|
+ model: {
|
|
1534
|
+ incident: {
|
|
1535
|
+ requester: item,
|
|
1536
|
+ contactsInformation: item.mphone
|
|
1537
|
+ },
|
|
1538
|
+ }
|
|
1539
|
+ })
|
|
1540
|
+ });
|
|
1541
|
+ }else{
|
|
1542
|
+ SweetAlert.swal({
|
|
1543
|
+ title: "请选择报修人!",
|
1773
|
1544
|
type: "error"
|
1774
|
|
- },function(){
|
1775
|
|
- $modalInstance.close('cancel')
|
1776
|
|
- })
|
|
1545
|
+ })
|
|
1546
|
+ }
|
|
1547
|
+ }
|
1777
|
1548
|
}
|
1778
|
|
- })
|
|
1549
|
+ });
|
1779
|
1550
|
}
|
1780
|
1551
|
}
|
1781
|
1552
|
})
|
|
@@ -1826,6 +1597,7 @@ app.controller('AppCtrl', ['$rootScope', '$scope', '$state', '$translate', '$loc
|
1826
|
1597
|
});
|
1827
|
1598
|
}
|
1828
|
1599
|
}
|
|
1600
|
+
|
1829
|
1601
|
// 签入
|
1830
|
1602
|
$rootScope.jry_qianru = function () {
|
1831
|
1603
|
// 签入并绑定分机
|