recordCtrl.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  1. 'use strict';
  2. app.controller('recordCtrl', ["$scope", "i18nService", "$rootScope", "$state", "$timeout", "$interval", "$modal", "SweetAlert", "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_bpm_data", "api_text", "api_user_data", function($scope, i18nService, $rootScope, $state, $timeout, $interval, $modal, SweetAlert, uiGridConstants, uiGridGroupingConstants, Restangular, api_bpm_data, api_text, api_user_data) {
  3. $scope.langs = i18nService.getAllLangs();
  4. $scope.lang = 'zh-cn';
  5. i18nService.setCurrentLang($scope.lang);
  6. // $(window).resize(function() {
  7. // // console.log("1111")
  8. // });
  9. var loginUser = $rootScope.user;
  10. // var voiceurl=$rootScope.audioiIp;
  11. // delete $rootScope.user.authority;
  12. var pdKey = $state.current.pdKey;
  13. $scope.gridOptions = {};
  14. $scope.gridOptions.data = 'myData';
  15. $scope.gridOptions.enableColumnResizing = true;
  16. $scope.gridOptions.enableFiltering = false;
  17. $scope.gridOptions.enableGridMenu = true;
  18. $scope.gridOptions.enableRowSelection = true;
  19. $scope.gridOptions.showGridFooter = true;
  20. $scope.gridOptions.showColumnFooter = false;
  21. $scope.gridOptions.fastWatch = true;
  22. // $scope.gridOptions.useExternalFiltering=true;
  23. $scope.gridOptions.useExternalPagination = true;
  24. $scope.gridOptions.paginationPageSizes = [10, 20, 50, 100];
  25. $scope.gridOptions.paginationPageSize = 10;
  26. $scope.gridOptions.multiSelect = true;
  27. var mun = $scope.gridOptions.paginationPageSize;
  28. // $scope.gridOptions.rowTemplate = "<div ng-click=\"lookFunction(row)\" ng-repeat=\"(colRenderIndex, col) in colContainer.renderedColumns track by col.uid\" ui-grid-one-bind-id-grid=\"rowRenderIndex + '-' + col.uid + '-cell'\" class=\"ui-grid-cell\" ng-class=\"{ 'ui-grid-row-header-cell': col.isRowHeader }\" role=\"{{col.isRowHeader ? 'rowheader' : 'gridcell'}}\" ui-grid-cell></div>";
  29. $scope.gridOptions.rowIdentity = function(row) {
  30. return row.id;
  31. };
  32. $scope.gridOptions.getRowIdentity = function(row) {
  33. return row.id;
  34. };
  35. $scope.transferstate = function(item) {
  36. // var handstate = "未受理";
  37. if (item.isExcute==1) {
  38. return "已受理";
  39. }else if(item.isExcute==2){
  40. return "不受理";
  41. }else{
  42. return "未受理";
  43. }
  44. }
  45. $scope.bushouli=function(item){
  46. // console.log(item)
  47. SweetAlert.swal({
  48. title: "确认不受理?",
  49. text: "确认不受理后,将无法转换为事件工单!",
  50. type: "warning",
  51. showCancelButton: true,
  52. confirmButtonColor: "#DD6B55",
  53. confirmButtonText: "确定",
  54. cancelButtonText: "取消",
  55. closeOnConfirm: false,
  56. closeOnCancel: false
  57. }, function (isConfirm) {
  58. if (isConfirm) {
  59. item.isExcute=2;
  60. delete item.item;
  61. api_bpm_data.updData("hjzxRecord",{"hjzxRecord":item}).then(function(res){
  62. if(res.status==200){
  63. SweetAlert.swal({
  64. title: "操作成功!",
  65. type: "success",
  66. confirmButtonColor: "#007AFF"
  67. }, function() {
  68. $scope.refreshData('expand-right', $scope.filData);
  69. });
  70. }else{
  71. SweetAlert.swal({
  72. title: "系统错误",
  73. text: "系统错误,请稍后重试!",
  74. type: "error",
  75. confirmButtonColor: "#DD6B55"
  76. });
  77. }
  78. })
  79. } else {
  80. SweetAlert.swal("操作取消", "数据安全", "error");
  81. }
  82. });
  83. }
  84. $scope.transfersucc = function(item) {
  85. var handstate = "有效";
  86. if (item.isValid) { //未处理
  87. handstate = "无效";
  88. }
  89. return handstate;
  90. }
  91. $scope.transferTime = function(time) {
  92. return moment(time).format('YYYY-MM-DD HH:mm');
  93. }
  94. $scope.gridOptions.columnDefs = [{
  95. name: 'item',
  96. displayName: '序号',
  97. width: 50,
  98. cellTemplate: '<div>' +
  99. '<div class="ui-grid-cell-contents"}">{{row.entity.item}}</div>' +
  100. '</div>'
  101. },
  102. {
  103. name: 'recTime',
  104. displayName: '留言时间',
  105. width: '23%',
  106. cellTemplate: '<div>' +
  107. '<div class="ui-grid-cell-contents"}">{{grid.appScope.transferTime(row.entity.recTime)}}</div>' +
  108. '</div>'
  109. },
  110. {
  111. name: 'ano',
  112. displayName: '来电号码',
  113. width: '20%',
  114. cellTemplate: '<div>' +
  115. '<div class="ui-grid-cell-contents"}">{{row.entity.ano}}</div>' +
  116. '</div>'
  117. },
  118. // {
  119. // name: 'isValid',
  120. // displayName: '有效状态',
  121. // width: '10%',
  122. // cellTemplate: '<div>' +
  123. // '<div class="ui-grid-cell-contents"}">{{grid.appScope.transfersucc(row.entity)}}</div>' +
  124. // '</div>'
  125. // },
  126. {
  127. name: 'isExcute',
  128. displayName: '处理状态',
  129. width: '13%',
  130. cellTemplate: '<div>' +
  131. '<div class="ui-grid-cell-contents"}">{{grid.appScope.transferstate(row.entity)}}</div>'
  132. },
  133. { name: '操作', cellTemplate: '<recordoperator item="row.entity" colobject="col">' }
  134. ];
  135. $scope.value = 10;
  136. $scope.decrement = function() {
  137. $scope.value = $scope.value - 1;
  138. };
  139. $scope.gridOptions.onRegisterApi = function(gridApi) {
  140. $scope.gridApi = gridApi;
  141. gridApi.pagination.on.paginationChanged($scope, function(newPage, pageSize) {
  142. var filtersData = $scope.memoryfilterData;
  143. filtersData.idx = newPage - 1;
  144. filtersData.sum = pageSize;
  145. $scope.refreshData('expand-right', filtersData);
  146. });
  147. $scope.selected = {
  148. items: []
  149. }
  150. };
  151. $scope.memoryfilterData = defaultFilterData = {
  152. "idx": 0,
  153. "sum": mun
  154. };
  155. /*--------- new incident --------- */
  156. $scope.selectRowFunction = function(recorddata) {
  157. var filterData = { "idx": 0, "sum": 10, "requester": { "mphone": recorddata.ano, "telephone": recorddata.ano, "selectType": 1 } }
  158. api_user_data.fetchDataList('requester', filterData).then(function(data) {
  159. var myData = Restangular.stripRestangular(data);
  160. // $rootScope.phone="";
  161. $rootScope.setbusy();
  162. if (myData.list.length == 0) {
  163. var modalInstance = $modal.open({
  164. templateUrl: 'assets/views/customform/tpl/modal-add-callrequester.html',
  165. controller: function($scope, $modalInstance, api_user_data) {
  166. $scope.title = "新增报修人";
  167. $scope.requester = {};
  168. $scope.onChangeadd = function(searchData) {
  169. $scope.searchKey = searchData.account;
  170. var requesdata = angular.copy(searchData)
  171. if (requesdata.telephone) {
  172. delete requesdata.telephone;
  173. }
  174. angular.extend($scope.requester, requesdata);
  175. }
  176. $scope.refreshUseradd = function(searchKey) { //请求人搜索
  177. $scope.requester.account = searchKey;
  178. $scope.searchData = searchKey;
  179. serchdataadd(searchKey);
  180. }
  181. $scope.getMydata = function(x) {
  182. var reqestdatap = JSON.parse(x[0])
  183. if ($scope.requester.telephone) {
  184. delete reqestdatap.telephone;
  185. }
  186. $scope.searchField = JSON.parse(x[0]).account;
  187. angular.extend($scope.requester, reqestdatap);
  188. }
  189. $scope.getMydataone = function(x) {
  190. $scope.searchField = x;
  191. $scope.requester.account = x;
  192. }
  193. serchdataadd();
  194. function serchdataadd(searchKey) {
  195. if (searchKey) {
  196. var filterData = {
  197. 'requester': {
  198. 'searchKey': searchKey,
  199. },
  200. idx: 0,
  201. sum: 10
  202. };
  203. } else {
  204. var filterData = {
  205. idx: 0,
  206. sum: 10
  207. };
  208. }
  209. api_user_data.fetchDataList('requester', filterData).then(function(response) {
  210. var myData = response;
  211. $scope.myData = myData.list;
  212. });
  213. }
  214. $scope.requester = { 'telephone': recorddata.ano };
  215. $scope.ok = function() {
  216. $modalInstance.close($scope.requester);
  217. };
  218. $scope.cancel = function() {
  219. $modalInstance.dismiss('cancel');
  220. };
  221. },
  222. });
  223. modalInstance.result.then(function(selectedItem) {
  224. if (selectedItem) {
  225. if (selectedItem.telephone && !selectedItem.mphone) {
  226. selectedItem.telephone = angular.copy(selectedItem.mphone);
  227. delete selectedItem.mphone;
  228. }
  229. var data = {
  230. 'requester': selectedItem
  231. };
  232. api_user_data.addData('requester', data).then(function(response) {
  233. if (response.status == 200) {
  234. var data = { 'model': { 'requestershow': response.data, 'recordId': recorddata.id, 'incident': { 'requester': response.data, 'area': response.areaDTO, 'place': response.placeDTO, 'houseNumber': response.houseNumber, 'source': { 'id': 1548 } } } }
  235. $state.go('app.incident.title', { 'model': JSON.stringify(data) });
  236. }
  237. })
  238. }
  239. });
  240. } else if (myData.list.length == 1) {
  241. var data = { 'model': { 'requestershow': myData.list[0], 'recordId': recorddata.id, 'incident': { 'requester': myData.list[0], 'area': myData.list[0].areaDTO, 'place': myData.list[0].placeDTO, 'houseNumber': myData.list[0].houseNumber, 'source': { 'id': 1548 } } } }
  242. $state.go('app.incident.title', { 'model': JSON.stringify(data) });
  243. } else {
  244. var modalInstance = $modal.open({
  245. templateUrl: 'assets/views/createincident.html',
  246. controller: function($scope, datas, $modalInstance, api_user_data) {
  247. $scope.title = "请确定报修人";
  248. $scope.requester = myData.list;
  249. $scope.choice = function(requester) {
  250. $modalInstance.dismiss('cancel');
  251. var data = { 'model': { 'requestershow': requester, 'recordId': recorddata.id, 'incident': { 'requester': requester, 'area': requester.areaDTO, 'place': requester.placeDTO, 'houseNumber': requester.houseNumber, 'source': { 'id': 1548 } } } }
  252. $state.go('app.incident.title', { 'model': JSON.stringify(data) });
  253. };
  254. $scope.cancel = function() {
  255. $modalInstance.dismiss('cancel');
  256. };
  257. },
  258. resolve: {
  259. datas: function() {
  260. return recorddata;
  261. }
  262. },
  263. size: "lg"
  264. });
  265. }
  266. });
  267. // var formdata = {
  268. // 'model': {
  269. // 'incident': {
  270. // 'source': { 'id': 1 },
  271. // },
  272. // 'recordId': data.id
  273. // }
  274. // }
  275. // $state.go('app.incident.chart', { 'model': JSON.stringify(formdata) });
  276. };
  277. /*--------- Recordings --------- */
  278. // $scope.recordcall = function(data) {
  279. // $scope.oldRecord(data);
  280. // var modalInstance = $modal.open({
  281. // templateUrl: 'assets/views/incident/tpl/audio.html',
  282. // controller: function($rootScope, $scope, $modalInstance, $sce) {
  283. // $scope.data = {
  284. // "name": "视频",
  285. // "url": callIp + "/recording/recording?recordId=" + data.id
  286. // };
  287. // $rootScope.setbusy();
  288. // $scope.data.url = $sce.trustAsResourceUrl($scope.data.url);
  289. // $scope.cancel = function() {
  290. // $modalInstance.dismiss('cancel');
  291. // // $rootScope.setidle();
  292. // };
  293. // $modalInstance.close();
  294. // }
  295. // });
  296. // modalInstance.result.then(function(result) {
  297. // // $rootScope.setidle();
  298. // }, function(reason) {
  299. // $rootScope.setidle();
  300. // });
  301. // };
  302. //录音
  303. $scope.recordcall = function(data) {
  304. var modalInstance = $modal.open({
  305. backdrop: "static",
  306. templateUrl: 'assets/views/incident/tpl/audio.html',
  307. controller: function($rootScope, $scope, $modalInstance, $sce, $http, api_playservice) {
  308. $scope.audioUrl=$sce.trustAsResourceUrl(callIp+data.recFileName);
  309. // $rootScope.setbusy();
  310. // $scope.datasurl = "";
  311. // $http({
  312. // url: callIp + "/recording/recording?recordId=" + data.id,
  313. // method: 'GET',
  314. // headers: {},
  315. // }).success(function(data, status, headers, config) {
  316. // $scope.data = {
  317. // "name": "视频",
  318. // "url": $sce.trustAsResourceUrl("http://" + data.rrpath)
  319. // };
  320. // $scope.datasurl = data.rrpath;
  321. // }).error(function(data, status, headers, config) {});
  322. // $scope.download = function(contentId, filename) {
  323. // $http({
  324. // url: "http://" + $scope.datasurl,
  325. // method: 'GET',
  326. // headers: {
  327. // 'Content-type': 'application/octet-stream',
  328. // },
  329. // responseType: 'arraybuffer'
  330. // }).success(function(data, status, headers, config) {
  331. // var file = new Blob([data], {
  332. // type: 'application/octet-stream'
  333. // });
  334. // //trick to download store a file having its URL
  335. // var fileURL = URL.createObjectURL(file);
  336. // var a = document.createElement('a');
  337. // a.href = fileURL;
  338. // a.target = '_blank';
  339. // a.download = filename;
  340. // document.body.appendChild(a);
  341. // a.click();
  342. // }).error(function(data, status, headers, config) {
  343. // // console.log(data);
  344. // });
  345. // }
  346. $scope.cancel = function() {
  347. $modalInstance.dismiss('cancel');
  348. };
  349. $modalInstance.close();
  350. }
  351. });
  352. modalInstance.result.then(function(result) {
  353. // $rootScope.setidle();
  354. }, function(reason) {
  355. $rootScope.setidle();
  356. });
  357. };
  358. /*--------- call --------- */
  359. $scope.recordcallid = function(data) {
  360. // var telephone = '9' + data.ano;
  361. $rootScope.callout = 2;
  362. // if ($rootScope.takes) {
  363. // api_text.dialout($rootScope.takes, "@0", telephone).then(function(data) {
  364. // if (data.errno == 0) {
  365. // $rootScope.status = 6;
  366. // $scope.oldRecord(data);
  367. // }
  368. // })
  369. // } else {
  370. // SweetAlert.swal({
  371. // title: "呼叫失败",
  372. // text: "请先签入呼叫中心!",
  373. // type: "error",
  374. // confirmButtonColor: "#DD6B55"
  375. // });
  376. // }
  377. if (localStorage.getItem('fenjiNumber')) {
  378. // var caller = localStorage.getItem('phoneNumber');//呼叫人
  379. // console.log(sessionStorage.getItem('phones'))
  380. // var phones = JSON.parse(sessionStorage.getItem('phones'));
  381. // var isHuajihao = phones.length?phones.some(v=>v == data.ano):false;
  382. // console.log(isHuajihao)
  383. // if(isHuajihao){
  384. // tlwsa.tlaCallagc(data.ano);//呼叫坐席
  385. // }else{
  386. // tlwsa.tlaCallout(data.ano, caller, 0);//呼叫外线
  387. // }
  388. // var caller = localStorage.getItem('fenjiNumber');//呼叫人
  389. // tlwsa.tlaCallout(data.ano, caller, 0);
  390. $rootScope.toggle('off-sidebar');
  391. } else {
  392. SweetAlert.swal({
  393. title: "呼叫失败",
  394. text: "请先签入呼叫中心!",
  395. type: "error",
  396. confirmButtonColor: "#DD6B55",
  397. });
  398. }
  399. };
  400. /*--------- old record --------- */
  401. $scope.oldRecord = function(data) {
  402. api_bpm_data.updData("hjzxRecord", { 'id': data.id, 'field1': '1', 'isValid': data.isValid, 'isExcute': data.isExcute }).then(function(data) {
  403. if (data.status) {
  404. $scope.refreshData('expand-right', defaultFilterData);
  405. }
  406. });
  407. };
  408. /*--------- record status translate --------- */
  409. $scope.record = function(data) {
  410. var keydata = 0;
  411. if (data.isValid == 1) {
  412. keydata = 0;
  413. } else {
  414. keydata = 1;
  415. }
  416. api_bpm_data.updData("hjzxRecord", { 'id': data.id, 'isValid': keydata, 'isExcute': 1, 'field1': '1' }).then(function(data) {
  417. if (data.status) {
  418. SweetAlert.swal({
  419. title: "提交成功!",
  420. text: "有效状态转换成功!",
  421. type: "success"
  422. }, function() {
  423. $scope.refreshData('expand-right', defaultFilterData);
  424. });
  425. } else {
  426. SweetAlert.swal({
  427. title: "提交失败!",
  428. text: "有效状态转换失败,请重试!",
  429. type: "error"
  430. });
  431. }
  432. }, function() {
  433. $scope.ldloading[style.replace('-', '_')] = false;
  434. });
  435. };
  436. /*--------- double click --------- */
  437. // $scope.onDblClick = function(row) {
  438. // var modelfile = { model: { incident: row.entity } };
  439. // if (row.entity.state == "未受理") {
  440. // angular.extend(modelfile.model.incident, { status: 1 })
  441. // } else {
  442. // angular.extend(modelfile.model.incident, { status: 0 })
  443. // }
  444. // $state.go('app.desk.form_editor', { formKey: 'desk_detail', service: 'api_user_data', model: JSON.stringify(modelfile) });
  445. // };
  446. $scope.open = function ($event) {
  447. $event.preventDefault();
  448. $event.stopPropagation();
  449. $scope.opened = !$scope.opened;
  450. };
  451. $scope.endOpen = function ($event) {
  452. $event.preventDefault();
  453. $event.stopPropagation();
  454. $scope.startOpened = false;
  455. $scope.endOpened = !$scope.endOpened;
  456. };
  457. $scope.startOpen = function ($event) {
  458. $event.preventDefault();
  459. $event.stopPropagation();
  460. $scope.endOpened = false;
  461. $scope.startOpened = !$scope.startOpened;
  462. };
  463. /*--------- get zhe list data--------- */
  464. var defaultFilterData = {
  465. "idx": 0,
  466. "sum": mun
  467. };
  468. $scope.filData={
  469. "idx":0,
  470. "sum":10,
  471. "hjzxRecord":{
  472. "isExcute":0
  473. }
  474. }
  475. $scope.searchstate="weishouli";
  476. $scope.toIncident=function(data){
  477. $state.go('app.incident.detail', {
  478. formKey: 'incident_back',
  479. pdKey: 'incident',
  480. dataId: data.incidentDTO.id,
  481. taskId: data.incidentDTO.taskId,
  482. processInstanceId: data.incidentDTO.processInstanceId,
  483. isRecord:"ok"
  484. });
  485. }
  486. $scope.onChange=function(data){
  487. var toData="";
  488. if(data=="weishouli"){
  489. toData=0
  490. }else if(data=="yishouli"){
  491. toData=1
  492. }else if(data=="bushouli"){
  493. toData=2
  494. }
  495. $scope.filData.hjzxRecord.isExcute=toData;
  496. $scope.searchstate=data;
  497. $scope.refreshData('expand-right', $scope.filData);
  498. }
  499. // 搜索
  500. $scope.search=function(){
  501. if($scope.filData.hjzxRecord.startTime){
  502. $scope.filData.hjzxRecord.startTime=moment($scope.filData.hjzxRecord.startTime).format('YYYY-MM-DD HH:mm:ss')
  503. }
  504. if($scope.filData.hjzxRecord.endTime){
  505. $scope.filData.hjzxRecord.endTime=moment($scope.filData.hjzxRecord.endTime).format('YYYY-MM-DD HH:mm:ss')
  506. }
  507. $scope.refreshData('expand-right', $scope.filData);
  508. }
  509. // 清空
  510. $scope.cleanItem=function(){
  511. delete $scope.filData.hjzxRecord.startTime;
  512. delete $scope.filData.hjzxRecord.endTime;
  513. $scope.refreshData('expand-right', $scope.filData);
  514. }
  515. $scope.ldloading = {};
  516. $scope.refreshData = function(style, filterData) {
  517. $scope.ldloading[style.replace('-', '_')] = true;
  518. if (angular.isUndefined(filterData)) {
  519. filterData = defaultFilterData;
  520. }
  521. $scope.myData = [];
  522. $scope.gridOptions['sum'] = filterData.sum;
  523. api_bpm_data.fetchDataList("hjzxRecord", filterData).then(function(data) {
  524. var myData = Restangular.stripRestangular(data);
  525. $scope.gridOptions['totalItems'] = myData.totalNum;
  526. $scope.myData = myData.list;
  527. for (var i = 0; i < $scope.myData.length; i++) {
  528. $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum;
  529. if(!$scope.myData[i]["id"]){
  530. $scope.myData[i]["id"]=i
  531. }
  532. }
  533. // console.log($scope.myData)
  534. $scope.ldloading[style.replace('-', '_')] = false;
  535. }, function() {
  536. $scope.ldloading[style.replace('-', '_')] = false;
  537. });
  538. };
  539. $scope.refreshData2 = function(style, filterData) {
  540. $scope.ldloading[style.replace('-', '_')] = true;
  541. if (angular.isUndefined(filterData)) {
  542. filterData = defaultFilterData;
  543. }
  544. // $scope.myData = [];
  545. $scope.gridOptions['sum'] = filterData.sum;
  546. api_bpm_data.fetchDataList("hjzxRecord", filterData).then(function(data) {
  547. var myData = Restangular.stripRestangular(data);
  548. $scope.gridOptions['totalItems'] = myData.totalNum;
  549. $scope.myData = myData.list;
  550. for (var i = 0; i < $scope.myData.length; i++) {
  551. $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum;
  552. if(!$scope.myData[i]["id"]){
  553. $scope.myData[i]["id"]=i
  554. }
  555. }
  556. // console.log($scope.myData)
  557. $scope.ldloading[style.replace('-', '_')] = false;
  558. }, function() {
  559. $scope.ldloading[style.replace('-', '_')] = false;
  560. });
  561. };
  562. $scope.refreshData('expand-right', $scope.filData);
  563. $scope.timer=$interval(function(){
  564. $scope.refreshData2('expand-right', $scope.filData);
  565. },$rootScope.refreshTime);
  566. $scope.$on('$destroy',function(){
  567. $interval.cancel($scope.timer)
  568. });
  569. }]);
  570. /*--------- operation --------- */
  571. app.controller('Recordoperator', ['$rootScope', '$http', '$scope', '$modal', function($rootScope, $http, $scope, $modal) {
  572. // $scope.handle = false;
  573. // $scope.isvalid = false;
  574. // $scope.novalid = false;
  575. // console.log($scope.item);
  576. // if (!$scope.item.isExcute && !$scope.item.isValid) {
  577. // $scope.handle = true;
  578. // } else { $scope.handle = false; }
  579. // if (!$scope.item.isExcute) {
  580. // if ($scope.item.isValid) {
  581. // $scope.isvalid = true;
  582. // $scope.novalid = false;
  583. // } else {
  584. // $scope.isvalid = false;
  585. // $scope.novalid = true;
  586. // }
  587. // } else {
  588. // $scope.isvalid = false;
  589. // }
  590. $scope.isHuibo = (function(){
  591. var phones = JSON.parse(sessionStorage.getItem('phones'));
  592. console.log(phones,$scope.item.ano)
  593. var isHuajihao = phones.length?phones.some(v=>v == $scope.item.ano):false;
  594. return !isHuajihao;
  595. })()
  596. $scope.weishouli=false;
  597. $scope.yishouli=false;
  598. $scope.bushouli=false;
  599. var loginUser = $rootScope.user;
  600. $scope.chuli=false;
  601. for(var i=0;i<loginUser.menu.length;i++){
  602. if(loginUser.menu[i].link=="liuyanliebiao_chuli"){
  603. $scope.chuli=true
  604. }
  605. }
  606. if($scope.item.isExcute==1){
  607. $scope.yishouli=true
  608. }else if($scope.item.isExcute==2){
  609. $scope.bushouli=true
  610. }else{
  611. $scope.weishouli=true
  612. }
  613. $scope.edit = function() {
  614. $scope.colobject.grid.appScope.selectRowFunction($scope.item);
  615. // $scope.doEdit($scope.item.id);
  616. }
  617. $scope.record = function() {
  618. $scope.colobject.grid.appScope.record($scope.item);
  619. // $scope.doEdit($scope.item.id);
  620. }
  621. $scope.recordcall = function() {
  622. $scope.colobject.grid.appScope.recordcall($scope.item);
  623. // $scope.doEdit($scope.item.id);
  624. }
  625. $scope.recordcallid = function() {
  626. $scope.colobject.grid.appScope.recordcallid($scope.item);
  627. // $scope.doEdit($scope.item.id);
  628. }
  629. $scope.bushouli=function(){
  630. $scope.colobject.grid.appScope.bushouli($scope.item);
  631. }
  632. $scope.toIncident=function(){
  633. $scope.colobject.grid.appScope.toIncident($scope.item);
  634. }
  635. }]);
  636. app.directive('recordoperator', function() {
  637. return {
  638. restrict: 'E',
  639. scope: {
  640. item: '=',
  641. colobject: '='
  642. },
  643. controller: 'Recordoperator',
  644. template: '<div class="links cl-effect-1 ui-grid-cell-contents pull-left" >' +
  645. '<a ng-click="edit()" ng-show="weishouli&&chuli" class="bianjifont">新建事件</a>' +
  646. '<a ng-click="bushouli()" ng-show="weishouli&&chuli" class="bianjifont">不受理</a>' +
  647. // '<a ng-click="record()" ng-show="{{isvalid}}&&{{handle}}" class="luyinfont">有效</a>' +
  648. // '<a ng-click="record()" ng-show="{{novalid}}&&{{handle}}" class="luyinfont">无效</a>' +
  649. '<a ng-click="recordcall()" ng-show="(weishouli||yishouli)&&chuli" class="bianjifont">回放</a>' +
  650. '<a ng-click="recordcallid()" ng-show="(weishouli||yishouli)&&chuli&&isHuibo" class="bianjifont">回拨</a>' +
  651. '<a ng-click="toIncident()" ng-show="yishouli" class="bianjifont">查看事件</a>' +
  652. '</div>'
  653. };
  654. });