'use strict'; 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) { //保存报修主体 $scope.repairMain = JSON.parse(sessionStorage.getItem("repair_main")); $scope.wxIncidentWithCmdb = JSON.parse(sessionStorage.getItem("wxIncidentWithCmdb"));//资产 $scope.incidentWithConsumable = JSON.parse(sessionStorage.getItem("incidentWithConsumable"));//耗材 //切换报修主体 // $scope.repairMain.valueconfig = 2; $scope.model=JSON.parse($stateParams.model); console.log($scope.model) $scope.fileUrls=[]; $scope.process=[]; api_wechatfile.listAttachment('wechatRequesterIncident',$scope.model.id).then(function(res){ $scope.fileUrls=res.data }); if($scope.model.incident){ api_bpm_domain.flowTracingCustom($scope.model.incident.processInstanceId).then(function(res){ console.log(res); $scope.process=res.data }) } $scope.back=function(){ $state.go('app.desk.chart',{}) } $scope.showBigImg=false; $scope.showBigImgCli=function(data){ $scope.showBigImg=true; $scope.bigImgUrl=data } $scope.closeBigImg=function(){ $scope.showBigImg=false } $scope.dialout = function (teleno) { // var gid = "@0"; // var telephone = "9" + teleno; $rootScope.callout = 2; // var agcount = tlwsa.tlaGetagentcount(); // var agcountFlag = false; // console.log(teleno) // // 查询当前话机是否签入 // for (var i = 0; i < agcount; i++) { // if (tlwsa.tlaGetagentwid(i) == $rootScope.phoneNumber) { // agcountFlag = true; // } // } if (localStorage.getItem('fenjiNumber')) { // var caller = localStorage.getItem('phoneNumber');//呼叫人 // console.log(sessionStorage.getItem('phones')) // var phones = JSON.parse(sessionStorage.getItem('phones')); // var isHuajihao = phones.length?phones.some(v=>v == teleno):false; // console.log(isHuajihao) // if(isHuajihao){ // tlwsa.tlaCallagc(teleno); // }else{ // tlwsa.tlaCallout(teleno, caller, 0); // } // var caller = localStorage.getItem('fenjiNumber');//呼叫人 $rootScope.toggle('off-sidebar'); // tlwsa.tlaCallout(teleno, caller, 0); }else if(localStorage.getItem('hk_phone')){ var gid = "@0" var telephone = '9' + teleno $rootScope.callout = 2; if ($rootScope.takes) { api_text.dialout($rootScope.takes, gid, telephone).then(function (data) { if (data.errno == 0) { $rootScope.status = 6; } }) } else { SweetAlert.swal({ title: "呼叫失败", text: "请先签入呼叫中心!", type: "error", confirmButtonColor: "#DD6B55" }); } } else { SweetAlert.swal({ title: "呼叫失败", text: "请先签入呼叫中心!", type: "error", confirmButtonColor: "#DD6B55", }); } }; }]);