recordCtrl.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  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. $rootScope.setbusy();
  309. $scope.datasurl = "";
  310. $http({
  311. url: callIp + "/recording/recording?recordId=" + data.id,
  312. method: 'GET',
  313. headers: {},
  314. }).success(function(data, status, headers, config) {
  315. $scope.data = {
  316. "name": "视频",
  317. "url": $sce.trustAsResourceUrl("http://" + data.rrpath)
  318. };
  319. $scope.datasurl = data.rrpath;
  320. }).error(function(data, status, headers, config) {});
  321. $scope.download = function(contentId, filename) {
  322. $http({
  323. url: "http://" + $scope.datasurl,
  324. method: 'GET',
  325. headers: {
  326. 'Content-type': 'application/octet-stream',
  327. },
  328. responseType: 'arraybuffer'
  329. }).success(function(data, status, headers, config) {
  330. var file = new Blob([data], {
  331. type: 'application/octet-stream'
  332. });
  333. //trick to download store a file having its URL
  334. var fileURL = URL.createObjectURL(file);
  335. var a = document.createElement('a');
  336. a.href = fileURL;
  337. a.target = '_blank';
  338. a.download = filename;
  339. document.body.appendChild(a);
  340. a.click();
  341. }).error(function(data, status, headers, config) {
  342. // console.log(data);
  343. });
  344. }
  345. $scope.cancel = function() {
  346. $modalInstance.dismiss('cancel');
  347. };
  348. $modalInstance.close();
  349. }
  350. });
  351. modalInstance.result.then(function(result) {
  352. // $rootScope.setidle();
  353. }, function(reason) {
  354. $rootScope.setidle();
  355. });
  356. };
  357. /*--------- call --------- */
  358. $scope.recordcallid = function(data) {
  359. var telephone = '9' + data.ano;
  360. $rootScope.callout = 2;
  361. if ($rootScope.takes) {
  362. api_text.dialout($rootScope.takes, "@0", telephone).then(function(data) {
  363. if (data.errno == 0) {
  364. $rootScope.status = 6;
  365. $scope.oldRecord(data);
  366. }
  367. })
  368. } else {
  369. SweetAlert.swal({
  370. title: "呼叫失败",
  371. text: "请先签入呼叫中心!",
  372. type: "error",
  373. confirmButtonColor: "#DD6B55"
  374. });
  375. }
  376. };
  377. /*--------- old record --------- */
  378. $scope.oldRecord = function(data) {
  379. api_bpm_data.updData("hjzxRecord", { 'id': data.id, 'field1': '1', 'isValid': data.isValid, 'isExcute': data.isExcute }).then(function(data) {
  380. if (data.status) {
  381. $scope.refreshData('expand-right', defaultFilterData);
  382. }
  383. });
  384. };
  385. /*--------- record status translate --------- */
  386. $scope.record = function(data) {
  387. var keydata = 0;
  388. if (data.isValid == 1) {
  389. keydata = 0;
  390. } else {
  391. keydata = 1;
  392. }
  393. api_bpm_data.updData("hjzxRecord", { 'id': data.id, 'isValid': keydata, 'isExcute': 1, 'field1': '1' }).then(function(data) {
  394. if (data.status) {
  395. SweetAlert.swal({
  396. title: "提交成功!",
  397. text: "有效状态转换成功!",
  398. type: "success"
  399. }, function() {
  400. $scope.refreshData('expand-right', defaultFilterData);
  401. });
  402. } else {
  403. SweetAlert.swal({
  404. title: "提交失败!",
  405. text: "有效状态转换失败,请重试!",
  406. type: "error"
  407. });
  408. }
  409. }, function() {
  410. $scope.ldloading[style.replace('-', '_')] = false;
  411. });
  412. };
  413. /*--------- double click --------- */
  414. // $scope.onDblClick = function(row) {
  415. // var modelfile = { model: { incident: row.entity } };
  416. // if (row.entity.state == "未受理") {
  417. // angular.extend(modelfile.model.incident, { status: 1 })
  418. // } else {
  419. // angular.extend(modelfile.model.incident, { status: 0 })
  420. // }
  421. // $state.go('app.desk.form_editor', { formKey: 'desk_detail', service: 'api_user_data', model: JSON.stringify(modelfile) });
  422. // };
  423. $scope.open = function ($event) {
  424. $event.preventDefault();
  425. $event.stopPropagation();
  426. $scope.opened = !$scope.opened;
  427. };
  428. $scope.endOpen = function ($event) {
  429. $event.preventDefault();
  430. $event.stopPropagation();
  431. $scope.startOpened = false;
  432. $scope.endOpened = !$scope.endOpened;
  433. };
  434. $scope.startOpen = function ($event) {
  435. $event.preventDefault();
  436. $event.stopPropagation();
  437. $scope.endOpened = false;
  438. $scope.startOpened = !$scope.startOpened;
  439. };
  440. /*--------- get zhe list data--------- */
  441. var defaultFilterData = {
  442. "idx": 0,
  443. "sum": mun
  444. };
  445. $scope.filData={
  446. "idx":0,
  447. "sum":10,
  448. "hjzxRecord":{
  449. "isExcute":0
  450. }
  451. }
  452. $scope.searchstate="weishouli";
  453. $scope.toIncident=function(data){
  454. $state.go('app.incident.detail', {
  455. formKey: 'incident_back',
  456. pdKey: 'incident',
  457. dataId: data.incidentDTO.id,
  458. taskId: data.incidentDTO.taskId,
  459. processInstanceId: data.incidentDTO.processInstanceId,
  460. isRecord:"ok"
  461. });
  462. }
  463. $scope.onChange=function(data){
  464. var toData="";
  465. if(data=="weishouli"){
  466. toData=0
  467. }else if(data=="yishouli"){
  468. toData=1
  469. }else if(data=="bushouli"){
  470. toData=2
  471. }
  472. $scope.filData.hjzxRecord.isExcute=toData;
  473. $scope.searchstate=data;
  474. $scope.refreshData('expand-right', $scope.filData);
  475. }
  476. // 搜索
  477. $scope.search=function(){
  478. if($scope.filData.hjzxRecord.startTime){
  479. $scope.filData.hjzxRecord.startTime=moment($scope.filData.hjzxRecord.startTime).format('YYYY-MM-DD HH:mm:ss')
  480. }
  481. if($scope.filData.hjzxRecord.endTime){
  482. $scope.filData.hjzxRecord.endTime=moment($scope.filData.hjzxRecord.endTime).format('YYYY-MM-DD HH:mm:ss')
  483. }
  484. $scope.refreshData('expand-right', $scope.filData);
  485. }
  486. // 清空
  487. $scope.cleanItem=function(){
  488. delete $scope.filData.hjzxRecord.startTime;
  489. delete $scope.filData.hjzxRecord.endTime;
  490. $scope.refreshData('expand-right', $scope.filData);
  491. }
  492. $scope.ldloading = {};
  493. $scope.refreshData = function(style, filterData) {
  494. $scope.ldloading[style.replace('-', '_')] = true;
  495. if (angular.isUndefined(filterData)) {
  496. filterData = defaultFilterData;
  497. }
  498. $scope.myData = [];
  499. $scope.gridOptions['sum'] = filterData.sum;
  500. api_bpm_data.fetchDataList("hjzxRecord", filterData).then(function(data) {
  501. var myData = Restangular.stripRestangular(data);
  502. $scope.gridOptions['totalItems'] = myData.totalNum;
  503. $scope.myData = myData.list;
  504. for (var i = 0; i < $scope.myData.length; i++) {
  505. $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum;
  506. if(!$scope.myData[i]["id"]){
  507. $scope.myData[i]["id"]=i
  508. }
  509. }
  510. // console.log($scope.myData)
  511. $scope.ldloading[style.replace('-', '_')] = false;
  512. }, function() {
  513. $scope.ldloading[style.replace('-', '_')] = false;
  514. });
  515. };
  516. $scope.refreshData2 = 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.refreshData('expand-right', $scope.filData);
  540. $scope.timer=$interval(function(){
  541. $scope.refreshData2('expand-right', $scope.filData);
  542. },$rootScope.refreshTime);
  543. $scope.$on('$destroy',function(){
  544. $interval.cancel($scope.timer)
  545. });
  546. }]);
  547. /*--------- operation --------- */
  548. app.controller('Recordoperator', ['$rootScope', '$http', '$scope', '$modal', function($rootScope, $http, $scope, $modal) {
  549. // $scope.handle = false;
  550. // $scope.isvalid = false;
  551. // $scope.novalid = false;
  552. // console.log($scope.item);
  553. // if (!$scope.item.isExcute && !$scope.item.isValid) {
  554. // $scope.handle = true;
  555. // } else { $scope.handle = false; }
  556. // if (!$scope.item.isExcute) {
  557. // if ($scope.item.isValid) {
  558. // $scope.isvalid = true;
  559. // $scope.novalid = false;
  560. // } else {
  561. // $scope.isvalid = false;
  562. // $scope.novalid = true;
  563. // }
  564. // } else {
  565. // $scope.isvalid = false;
  566. // }
  567. $scope.weishouli=false;
  568. $scope.yishouli=false;
  569. $scope.bushouli=false;
  570. var loginUser = $rootScope.user;
  571. $scope.chuli=false;
  572. for(var i=0;i<loginUser.menu.length;i++){
  573. if(loginUser.menu[i].link=="liuyanliebiao_chuli"){
  574. $scope.chuli=true
  575. }
  576. }
  577. if($scope.item.isExcute==1){
  578. $scope.yishouli=true
  579. }else if($scope.item.isExcute==2){
  580. $scope.bushouli=true
  581. }else{
  582. $scope.weishouli=true
  583. }
  584. $scope.edit = function() {
  585. $scope.colobject.grid.appScope.selectRowFunction($scope.item);
  586. // $scope.doEdit($scope.item.id);
  587. }
  588. $scope.record = function() {
  589. $scope.colobject.grid.appScope.record($scope.item);
  590. // $scope.doEdit($scope.item.id);
  591. }
  592. $scope.recordcall = function() {
  593. $scope.colobject.grid.appScope.recordcall($scope.item);
  594. // $scope.doEdit($scope.item.id);
  595. }
  596. $scope.recordcallid = function() {
  597. $scope.colobject.grid.appScope.recordcallid($scope.item);
  598. // $scope.doEdit($scope.item.id);
  599. }
  600. $scope.bushouli=function(){
  601. $scope.colobject.grid.appScope.bushouli($scope.item);
  602. }
  603. $scope.toIncident=function(){
  604. $scope.colobject.grid.appScope.toIncident($scope.item);
  605. }
  606. }]);
  607. app.directive('recordoperator', function() {
  608. return {
  609. restrict: 'E',
  610. scope: {
  611. item: '=',
  612. colobject: '='
  613. },
  614. controller: 'Recordoperator',
  615. template: '<div class="links cl-effect-1 ui-grid-cell-contents pull-left" >' +
  616. '<a ng-click="edit()" ng-show="weishouli&&chuli" class="bianjifont">新建事件</a>' +
  617. '<a ng-click="bushouli()" ng-show="weishouli&&chuli" class="bianjifont">不受理</a>' +
  618. // '<a ng-click="record()" ng-show="{{isvalid}}&&{{handle}}" class="luyinfont">有效</a>' +
  619. // '<a ng-click="record()" ng-show="{{novalid}}&&{{handle}}" class="luyinfont">无效</a>' +
  620. '<a ng-click="recordcall()" ng-show="(weishouli||yishouli)&&chuli" class="bianjifont">回放</a>' +
  621. '<a ng-click="recordcallid()" ng-show="(weishouli||yishouli)&&chuli" class="bianjifont">回拨</a>' +
  622. '<a ng-click="toIncident()" ng-show="yishouli" class="bianjifont">查看事件</a>' +
  623. '</div>'
  624. };
  625. });