jry_wxDetailCtrl.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. 'use strict';
  2. app.controller('wxDetailCtrl', ["$scope", "i18nService", "$rootScope", "$state","$stateParams", "$timeout", "$interval", "$modal", "SweetAlert", "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_bpm_data", "api_text", "api_user_data","api_wechatfile","api_bpm_domain", function($scope, i18nService, $rootScope, $state,$stateParams, $timeout, $interval, $modal, SweetAlert, uiGridConstants, uiGridGroupingConstants, Restangular, api_bpm_data, api_text, api_user_data,api_wechatfile,api_bpm_domain) {
  3. //保存报修主体
  4. $scope.repairMain = JSON.parse(sessionStorage.getItem("repair_main"));
  5. $scope.wxIncidentWithCmdb = JSON.parse(sessionStorage.getItem("wxIncidentWithCmdb"));//资产
  6. $scope.incidentWithConsumable = JSON.parse(sessionStorage.getItem("incidentWithConsumable"));//耗材
  7. //切换报修主体
  8. // $scope.repairMain.valueconfig = 2;
  9. $scope.model=JSON.parse($stateParams.model);
  10. console.log($scope.model)
  11. $scope.fileUrls=[];
  12. $scope.process=[];
  13. api_wechatfile.listAttachment('wechatRequesterIncident',$scope.model.id).then(function(res){
  14. $scope.fileUrls=res.data
  15. });
  16. if($scope.model.incident){
  17. api_bpm_domain.flowTracingCustom($scope.model.incident.processInstanceId).then(function(res){
  18. console.log(res);
  19. $scope.process=res.data
  20. })
  21. }
  22. $scope.back=function(){
  23. $state.go('app.desk.chart',{})
  24. }
  25. $scope.showBigImg=false;
  26. $scope.showBigImgCli=function(data){
  27. $scope.showBigImg=true;
  28. $scope.bigImgUrl=data
  29. }
  30. $scope.closeBigImg=function(){
  31. $scope.showBigImg=false
  32. }
  33. $scope.dialout = function (teleno) {
  34. // var gid = "@0";
  35. // var telephone = "9" + teleno;
  36. // $rootScope.callout = 2;
  37. // var agcount = tlwsa.tlaGetagentcount();
  38. // var agcountFlag = false;
  39. // console.log(teleno)
  40. // // 查询当前话机是否签入
  41. // for (var i = 0; i < agcount; i++) {
  42. // if (tlwsa.tlaGetagentwid(i) == $rootScope.phoneNumber) {
  43. // agcountFlag = true;
  44. // }
  45. // }
  46. if (localStorage.getItem('fenjiNumber')) {
  47. // var caller = localStorage.getItem('phoneNumber');//呼叫人
  48. // console.log(sessionStorage.getItem('phones'))
  49. // var phones = JSON.parse(sessionStorage.getItem('phones'));
  50. // var isHuajihao = phones.length?phones.some(v=>v == teleno):false;
  51. // console.log(isHuajihao)
  52. // if(isHuajihao){
  53. // tlwsa.tlaCallagc(teleno);
  54. // }else{
  55. // tlwsa.tlaCallout(teleno, caller, 0);
  56. // }
  57. // var caller = localStorage.getItem('fenjiNumber');//呼叫人
  58. $rootScope.toggle('off-sidebar');
  59. // tlwsa.tlaCallout(teleno, caller, 0);
  60. }else if(localStorage.getItem('hk_phone')){
  61. var gid = "@0";
  62. var telephone = '9' + teleno;
  63. if ($rootScope.takes) {
  64. $rootScope.isMask = true;
  65. api_text.dialout($rootScope.takes, gid, telephone).then(function (data) {
  66. $rootScope.isMask = false;
  67. if (data.errno == 0) {
  68. $rootScope.preStatus = $rootScope.callStatus;
  69. $rootScope.callStatus = 4;
  70. $rootScope.callout = 2;
  71. }else{
  72. new Notification("呼叫失败1!", {
  73. icon: './bower_components/HTML5-Desktop-Notifications/alert.ico',
  74. });
  75. }
  76. }, function(err){
  77. $rootScope.isMask = false;
  78. console.error('err', err);
  79. new Notification("呼叫失败2!", {
  80. icon: './bower_components/HTML5-Desktop-Notifications/alert.ico',
  81. });
  82. })
  83. } else {
  84. SweetAlert.swal({
  85. title: "呼叫失败",
  86. text: "请先签入呼叫中心!",
  87. type: "error",
  88. confirmButtonColor: "#DD6B55"
  89. });
  90. }
  91. } else {
  92. SweetAlert.swal({
  93. title: "呼叫失败",
  94. text: "请先签入呼叫中心!",
  95. type: "error",
  96. confirmButtonColor: "#DD6B55",
  97. });
  98. }
  99. };
  100. }]);