recordCtrl.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672
  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('phoneNumber')) {
  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. } else {
  389. SweetAlert.swal({
  390. title: "呼叫失败",
  391. text: "请先签入呼叫中心!",
  392. type: "error",
  393. confirmButtonColor: "#DD6B55",
  394. });
  395. }
  396. };
  397. /*--------- old record --------- */
  398. $scope.oldRecord = function(data) {
  399. api_bpm_data.updData("hjzxRecord", { 'id': data.id, 'field1': '1', 'isValid': data.isValid, 'isExcute': data.isExcute }).then(function(data) {
  400. if (data.status) {
  401. $scope.refreshData('expand-right', defaultFilterData);
  402. }
  403. });
  404. };
  405. /*--------- record status translate --------- */
  406. $scope.record = function(data) {
  407. var keydata = 0;
  408. if (data.isValid == 1) {
  409. keydata = 0;
  410. } else {
  411. keydata = 1;
  412. }
  413. api_bpm_data.updData("hjzxRecord", { 'id': data.id, 'isValid': keydata, 'isExcute': 1, 'field1': '1' }).then(function(data) {
  414. if (data.status) {
  415. SweetAlert.swal({
  416. title: "提交成功!",
  417. text: "有效状态转换成功!",
  418. type: "success"
  419. }, function() {
  420. $scope.refreshData('expand-right', defaultFilterData);
  421. });
  422. } else {
  423. SweetAlert.swal({
  424. title: "提交失败!",
  425. text: "有效状态转换失败,请重试!",
  426. type: "error"
  427. });
  428. }
  429. }, function() {
  430. $scope.ldloading[style.replace('-', '_')] = false;
  431. });
  432. };
  433. /*--------- double click --------- */
  434. // $scope.onDblClick = function(row) {
  435. // var modelfile = { model: { incident: row.entity } };
  436. // if (row.entity.state == "未受理") {
  437. // angular.extend(modelfile.model.incident, { status: 1 })
  438. // } else {
  439. // angular.extend(modelfile.model.incident, { status: 0 })
  440. // }
  441. // $state.go('app.desk.form_editor', { formKey: 'desk_detail', service: 'api_user_data', model: JSON.stringify(modelfile) });
  442. // };
  443. $scope.open = function ($event) {
  444. $event.preventDefault();
  445. $event.stopPropagation();
  446. $scope.opened = !$scope.opened;
  447. };
  448. $scope.endOpen = function ($event) {
  449. $event.preventDefault();
  450. $event.stopPropagation();
  451. $scope.startOpened = false;
  452. $scope.endOpened = !$scope.endOpened;
  453. };
  454. $scope.startOpen = function ($event) {
  455. $event.preventDefault();
  456. $event.stopPropagation();
  457. $scope.endOpened = false;
  458. $scope.startOpened = !$scope.startOpened;
  459. };
  460. /*--------- get zhe list data--------- */
  461. var defaultFilterData = {
  462. "idx": 0,
  463. "sum": mun
  464. };
  465. $scope.filData={
  466. "idx":0,
  467. "sum":10,
  468. "hjzxRecord":{
  469. "isExcute":0
  470. }
  471. }
  472. $scope.searchstate="weishouli";
  473. $scope.toIncident=function(data){
  474. $state.go('app.incident.detail', {
  475. formKey: 'incident_back',
  476. pdKey: 'incident',
  477. dataId: data.incidentDTO.id,
  478. taskId: data.incidentDTO.taskId,
  479. processInstanceId: data.incidentDTO.processInstanceId,
  480. isRecord:"ok"
  481. });
  482. }
  483. $scope.onChange=function(data){
  484. var toData="";
  485. if(data=="weishouli"){
  486. toData=0
  487. }else if(data=="yishouli"){
  488. toData=1
  489. }else if(data=="bushouli"){
  490. toData=2
  491. }
  492. $scope.filData.hjzxRecord.isExcute=toData;
  493. $scope.searchstate=data;
  494. $scope.refreshData('expand-right', $scope.filData);
  495. }
  496. // 搜索
  497. $scope.search=function(){
  498. if($scope.filData.hjzxRecord.startTime){
  499. $scope.filData.hjzxRecord.startTime=moment($scope.filData.hjzxRecord.startTime).format('YYYY-MM-DD HH:mm:ss')
  500. }
  501. if($scope.filData.hjzxRecord.endTime){
  502. $scope.filData.hjzxRecord.endTime=moment($scope.filData.hjzxRecord.endTime).format('YYYY-MM-DD HH:mm:ss')
  503. }
  504. $scope.refreshData('expand-right', $scope.filData);
  505. }
  506. // 清空
  507. $scope.cleanItem=function(){
  508. delete $scope.filData.hjzxRecord.startTime;
  509. delete $scope.filData.hjzxRecord.endTime;
  510. $scope.refreshData('expand-right', $scope.filData);
  511. }
  512. $scope.ldloading = {};
  513. $scope.refreshData = function(style, filterData) {
  514. $scope.ldloading[style.replace('-', '_')] = true;
  515. if (angular.isUndefined(filterData)) {
  516. filterData = defaultFilterData;
  517. }
  518. $scope.myData = [];
  519. $scope.gridOptions['sum'] = filterData.sum;
  520. api_bpm_data.fetchDataList("hjzxRecord", filterData).then(function(data) {
  521. var myData = Restangular.stripRestangular(data);
  522. $scope.gridOptions['totalItems'] = myData.totalNum;
  523. $scope.myData = myData.list;
  524. for (var i = 0; i < $scope.myData.length; i++) {
  525. $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum;
  526. if(!$scope.myData[i]["id"]){
  527. $scope.myData[i]["id"]=i
  528. }
  529. }
  530. // console.log($scope.myData)
  531. $scope.ldloading[style.replace('-', '_')] = false;
  532. }, function() {
  533. $scope.ldloading[style.replace('-', '_')] = false;
  534. });
  535. };
  536. $scope.refreshData2 = function(style, filterData) {
  537. $scope.ldloading[style.replace('-', '_')] = true;
  538. if (angular.isUndefined(filterData)) {
  539. filterData = defaultFilterData;
  540. }
  541. // $scope.myData = [];
  542. $scope.gridOptions['sum'] = filterData.sum;
  543. api_bpm_data.fetchDataList("hjzxRecord", filterData).then(function(data) {
  544. var myData = Restangular.stripRestangular(data);
  545. $scope.gridOptions['totalItems'] = myData.totalNum;
  546. $scope.myData = myData.list;
  547. for (var i = 0; i < $scope.myData.length; i++) {
  548. $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum;
  549. if(!$scope.myData[i]["id"]){
  550. $scope.myData[i]["id"]=i
  551. }
  552. }
  553. // console.log($scope.myData)
  554. $scope.ldloading[style.replace('-', '_')] = false;
  555. }, function() {
  556. $scope.ldloading[style.replace('-', '_')] = false;
  557. });
  558. };
  559. $scope.refreshData('expand-right', $scope.filData);
  560. $scope.timer=$interval(function(){
  561. $scope.refreshData2('expand-right', $scope.filData);
  562. },$rootScope.refreshTime);
  563. $scope.$on('$destroy',function(){
  564. $interval.cancel($scope.timer)
  565. });
  566. }]);
  567. /*--------- operation --------- */
  568. app.controller('Recordoperator', ['$rootScope', '$http', '$scope', '$modal', function($rootScope, $http, $scope, $modal) {
  569. // $scope.handle = false;
  570. // $scope.isvalid = false;
  571. // $scope.novalid = false;
  572. // console.log($scope.item);
  573. // if (!$scope.item.isExcute && !$scope.item.isValid) {
  574. // $scope.handle = true;
  575. // } else { $scope.handle = false; }
  576. // if (!$scope.item.isExcute) {
  577. // if ($scope.item.isValid) {
  578. // $scope.isvalid = true;
  579. // $scope.novalid = false;
  580. // } else {
  581. // $scope.isvalid = false;
  582. // $scope.novalid = true;
  583. // }
  584. // } else {
  585. // $scope.isvalid = false;
  586. // }
  587. $scope.isHuibo = (function(){
  588. var phones = JSON.parse(sessionStorage.getItem('phones'));
  589. console.log(phones,$scope.item.ano)
  590. var isHuajihao = phones.length?phones.some(v=>v == $scope.item.ano):false;
  591. return !isHuajihao;
  592. })()
  593. $scope.weishouli=false;
  594. $scope.yishouli=false;
  595. $scope.bushouli=false;
  596. var loginUser = $rootScope.user;
  597. $scope.chuli=false;
  598. for(var i=0;i<loginUser.menu.length;i++){
  599. if(loginUser.menu[i].link=="liuyanliebiao_chuli"){
  600. $scope.chuli=true
  601. }
  602. }
  603. if($scope.item.isExcute==1){
  604. $scope.yishouli=true
  605. }else if($scope.item.isExcute==2){
  606. $scope.bushouli=true
  607. }else{
  608. $scope.weishouli=true
  609. }
  610. $scope.edit = function() {
  611. $scope.colobject.grid.appScope.selectRowFunction($scope.item);
  612. // $scope.doEdit($scope.item.id);
  613. }
  614. $scope.record = function() {
  615. $scope.colobject.grid.appScope.record($scope.item);
  616. // $scope.doEdit($scope.item.id);
  617. }
  618. $scope.recordcall = function() {
  619. $scope.colobject.grid.appScope.recordcall($scope.item);
  620. // $scope.doEdit($scope.item.id);
  621. }
  622. $scope.recordcallid = function() {
  623. $scope.colobject.grid.appScope.recordcallid($scope.item);
  624. // $scope.doEdit($scope.item.id);
  625. }
  626. $scope.bushouli=function(){
  627. $scope.colobject.grid.appScope.bushouli($scope.item);
  628. }
  629. $scope.toIncident=function(){
  630. $scope.colobject.grid.appScope.toIncident($scope.item);
  631. }
  632. }]);
  633. app.directive('recordoperator', function() {
  634. return {
  635. restrict: 'E',
  636. scope: {
  637. item: '=',
  638. colobject: '='
  639. },
  640. controller: 'Recordoperator',
  641. template: '<div class="links cl-effect-1 ui-grid-cell-contents pull-left" >' +
  642. '<a ng-click="edit()" ng-show="weishouli&&chuli" class="bianjifont">新建事件</a>' +
  643. '<a ng-click="bushouli()" ng-show="weishouli&&chuli" class="bianjifont">不受理</a>' +
  644. // '<a ng-click="record()" ng-show="{{isvalid}}&&{{handle}}" class="luyinfont">有效</a>' +
  645. // '<a ng-click="record()" ng-show="{{novalid}}&&{{handle}}" class="luyinfont">无效</a>' +
  646. '<a ng-click="recordcall()" ng-show="(weishouli||yishouli)&&chuli" class="bianjifont">回放</a>' +
  647. '<a ng-click="recordcallid()" ng-show="(weishouli||yishouli)&&chuli&&isHuibo" class="bianjifont">回拨</a>' +
  648. '<a ng-click="toIncident()" ng-show="yishouli" class="bianjifont">查看事件</a>' +
  649. '</div>'
  650. };
  651. });