meansapplylist.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697
  1. 'use strict';
  2. app.controller('meansapplyListCtrl', ["$scope", "$sce", "$http", "i18nService", "$rootScope", "$state", "$timeout", "moment", "$interval", "$modal", "$stateParams", "SweetAlert", "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_bpm_domain", "api_text", "api_bpm_data", "api_user_data", "api_cmdb","api_wechatfile", function($scope, $sce, $http, i18nService, $rootScope, $state, $timeout, moment, $interval, $modal, $stateParams, SweetAlert, uiGridConstants, uiGridGroupingConstants, Restangular, api_bpm_domain, api_text, api_bpm_data, api_user_data, api_cmdb,api_wechatfile) {
  3. $scope.langs = i18nService.getAllLangs();
  4. $scope.lang = 'zh-cn';
  5. i18nService.setCurrentLang($scope.lang);
  6. $scope.myData = [];
  7. var loginUser = $rootScope.user;
  8. // var voiceurl=$rootScope.audioiIp;
  9. // delete $rootScope.user.authority;
  10. var pdKey = $state.current.pdKey;
  11. $scope.gridOptions = {};
  12. $scope.gridOptions.data = 'myData';
  13. $scope.gridOptions.enableColumnResizing = true;
  14. $scope.gridOptions.enableFiltering = false;
  15. $scope.gridOptions.enableGridMenu = true;
  16. $scope.gridOptions.enableSelectAll = true;
  17. $scope.gridOptions.enableRowSelection = true;
  18. $scope.gridOptions.showGridFooter = true;
  19. $scope.gridOptions.showColumnFooter = false;
  20. $scope.gridOptions.fastWatch = true;
  21. $scope.gridOptions.enableSorting = true;
  22. $scope.gridOptions.useExternalSorting = true;
  23. $scope.gridOptions.useExternalFiltering = false;
  24. $scope.gridOptions.useExternalPagination = true;
  25. $scope.gridOptions.paginationPageSizes = [10, 20, 50, 100];
  26. $scope.gridOptions.paginationPageSize = 10;
  27. $scope.gridOptions.multiSelect = true;
  28. var mun = $scope.gridOptions.paginationPageSize;
  29. $scope.gridOptions.rowTemplate = "<div ng-click=\"onDblClick(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>";
  30. $scope.gridOptions.rowIdentity = function(row) {
  31. return row.id;
  32. };
  33. $scope.gridOptions.getRowIdentity = function(row) {
  34. return row.id;
  35. };
  36. $scope.typedata = function(row) {
  37. if (row.type == 0) {
  38. return "资产入库";
  39. } else if (row.type == 2) {
  40. return "资产归还";
  41. } else if (row.type == 1) {
  42. return "资产领用";
  43. } else if (row.type == 4) {
  44. return "资产更换";
  45. }
  46. };
  47. $scope.statedata = function(row) {
  48. if (row.status == 0) {
  49. return "待批准";
  50. } else if (row.status == 1) {
  51. return "已驳回";
  52. } else if (row.status == 2) {
  53. return "待出库";
  54. } else if (row.status == 3) {
  55. return "信息更新";
  56. } else if (row.status == 4) {
  57. return "信息确认";
  58. } else if (row.status == 5) {
  59. return "已关闭";
  60. }
  61. };
  62. $scope.getStateSelect=function(){
  63. var data={
  64. "key":"applicationForm_status",
  65. "type":"list"
  66. }
  67. api_wechatfile.getDictionary(data).then(function(res){
  68. $scope.states=res
  69. })
  70. }
  71. $scope.getStateSelect();
  72. // $scope.states = [
  73. // { id: 0, name: '待批准' },
  74. // { id: 1, name: '已驳回' },
  75. // { id: 2, name: '待出库' },
  76. // { id: 3, name: '信息更新' },
  77. // { id: 4, name: '信息确认' },
  78. // { id: 5, name: '已关闭' }
  79. // ];
  80. // $scope.getTypeSelect=function(){
  81. // var data={
  82. // "key":"applicationForm_type",
  83. // "type":"list"
  84. // }
  85. // api_wechatfile.getDictionary(data).then(function(res){
  86. // $scope.type=res
  87. // })
  88. // }
  89. // $scope.getTypeSelect();
  90. $scope.getTypeSelect=function(){
  91. $scope.type=[];
  92. var data1={
  93. "key":"applicationForm_type_entrance",
  94. "type":"list"
  95. }
  96. var data2={
  97. "key":"applicationForm_type_exit",
  98. "type":"list"
  99. }
  100. api_wechatfile.getDictionary(data1).then(function(res1){
  101. api_wechatfile.getDictionary(data2).then(function(res2){
  102. for(var i=0;i<res1.length;i++){
  103. $scope.type.push(res1[i])
  104. }
  105. for(var i=0;i<res2.length;i++){
  106. $scope.type.push(res2[i])
  107. }
  108. })
  109. })
  110. }
  111. $scope.getTypeSelect();
  112. // $scope.type = [
  113. // { id: 0, name: '资产入库' },
  114. // { id: 2, name: '资产归还' },
  115. // { id: 1, name: '资产领用' },
  116. // { id: 4, name: '资产更换' }
  117. // ];
  118. $scope.application = [
  119. { value: "serialNumbe", name: '申请单编号' },
  120. // { value: "proposer", name: '申请人' },
  121. { value: "purpose", name: '领用用途' },
  122. // { value: "cmdbsign", name: '设备编号' }
  123. ];
  124. $scope.gridOptions.columnDefs = [{
  125. name: 'item',
  126. displayName: '序号',
  127. width: 50
  128. },
  129. {
  130. name: 'serialNumbe',
  131. displayName: '申请单编号',
  132. width: '15%',
  133. enableSorting: false
  134. },
  135. {
  136. name: 'proposer.name',
  137. displayName: '申请人',
  138. width: '18%',
  139. enableSorting: false
  140. },
  141. {
  142. name: 'type.name',
  143. displayName: '类型',
  144. width: '8%',
  145. enableFiltering: false,
  146. cellTemplate: '<div><div class="ui-grid-cell-contents">{{row.entity.type.name}}</div></div>'
  147. },
  148. {
  149. name: 'status.name',
  150. displayName: '状态',
  151. width: '10%',
  152. enableFiltering: false,
  153. cellTemplate: '<div><div class="ui-grid-cell-contents">{{row.entity.status.name}}</div></div>'
  154. },
  155. {
  156. name: 'linkProposer.name',
  157. displayName: '环节处理人',
  158. width: '15%'
  159. },
  160. {
  161. name: 'purpose',
  162. displayName: '领用用途',
  163. width: '12%',
  164. enableFiltering: false
  165. },
  166. { name: '操作', enableSorting: false, cellTemplate: '<meanoperator item="row.entity" colobject="col">', enableFiltering: false },
  167. ];
  168. $scope.value = 10;
  169. $scope.decrement = function() {
  170. $scope.value = $scope.value - 1;
  171. };
  172. $scope.data = {}
  173. $scope.data.url = $sce.trustAsResourceUrl("http://192.168.3.176:28083/aaa.wav");
  174. // $sce.trustAsResourceUrl("http://192.168.3.176:28083/aaa.wav");
  175. $scope.record = function() {
  176. api_text.record($rootScope.takes).then(function(data) {
  177. if (data.errno == 0) {
  178. $scope.busy = false;
  179. }
  180. })
  181. };
  182. $scope.parameters = null;
  183. $scope.open = function($event) {
  184. $event.preventDefault();
  185. $event.stopPropagation();
  186. $scope.opened = !$scope.opened;
  187. };
  188. $scope.endOpen = function($event) {
  189. $event.preventDefault();
  190. $event.stopPropagation();
  191. $scope.startOpened = false;
  192. $scope.endOpened = !$scope.endOpened;
  193. };
  194. $scope.startOpen = function($event) {
  195. $event.preventDefault();
  196. $event.stopPropagation();
  197. $scope.endOpened = false;
  198. $scope.startOpened = !$scope.startOpened;
  199. };
  200. $scope.othcode = {};
  201. $scope.clear = function() {
  202. $scope.searchkeys = {};
  203. // $scope.othcode = {};
  204. $scope.parameters = {};
  205. var fildata = {
  206. "applicationForm": {},
  207. "assignee": $rootScope.user.id,
  208. "candidateGroups": $rootScope.user.group[0].id,
  209. "searchType": "todo",
  210. idx: 0,
  211. sum: mun
  212. }
  213. $scope.memoryfilterData = fildata;
  214. $scope.refreshData('expand-right', fildata);
  215. }
  216. $scope.chiceIncident = function(parameters, item, stateid) {
  217. var fildata = defaultFilterData;
  218. fildata.applicationForm = {};
  219. if (item.alltitle && item.alldata) {
  220. fildata.applicationForm[item.alltitle.value] = item.alldata
  221. }
  222. if (item.linkProposer) {
  223. fildata.applicationForm.linkProposer = item.linkProposer
  224. }
  225. if (item.proposer) {
  226. fildata.applicationForm.proposer = item.proposer
  227. }
  228. if (item.status) {
  229. fildata.applicationForm['status'] = item.status.id;
  230. }
  231. if (item.type) {
  232. fildata.applicationForm['type'] = item.type.id;
  233. }
  234. $scope.gridOptions.paginationCurrentPage = 1;
  235. if (parameters && parameters.paramDateFrom && parameters.paramDateTo) {
  236. angular.extend(fildata, { 'idx': 0, 'sum': $scope.gridOptions.paginationPageSize })
  237. angular.extend(fildata.applicationForm, { 'startDate': moment(parameters.paramDateFrom).format('YYYY-MM-DD HH:mm:ss'), 'endDate': moment(parameters.paramDateTo).format('YYYY-MM-DD 23:59:59') })
  238. }
  239. var transitiondata = angular.copy(item);
  240. // angular.extend(fildata.applicationForm, transitiondata)
  241. $scope.refreshData('expand-right', fildata);
  242. }
  243. //区域地点过滤
  244. $scope.key = {};
  245. api_user_data.fetchDataList('area', { "idx": 0, "sum": 1000 }).then(function(response) {
  246. if (response) {
  247. if (response.status = 200) {
  248. $scope.outarea = response.list;
  249. }
  250. }
  251. })
  252. //受理人,处理人
  253. $scope.searchkeys = {};
  254. var fieldata = { "idx": 0, "sum": 1000, "flag": -1,user: {engineer: 1,} };
  255. getUser(fieldata, 3);
  256. function getUser(fieldatas, it) {
  257. api_user_data.fetchDataList('user', fieldatas).then(function(data) {
  258. if (it == 1) {
  259. $scope.acceptUser = data.list;
  260. } else if (it == 2) {
  261. $scope.handlingPersonnelUser = data.list;
  262. } else if (it == 3) {
  263. $scope.acceptUser = data.list;
  264. $scope.handlingPersonnelUser = data.list;
  265. }
  266. });
  267. }
  268. //受理人过滤
  269. $scope.onChangeacceptUser = function(key) {
  270. getUser({
  271. "idx": 0,
  272. "sum": 1000,
  273. "flag": -1,
  274. "user": { "flag": -1, "name": key, engineer: 1, }
  275. }, 1);
  276. }
  277. //处理人过滤
  278. $scope.onChangehandling = function(key) {
  279. getuser({
  280. "idx": 0,
  281. "sum": 1000,
  282. "flag": -1,
  283. "user": { "flag": -1, "name": key,engineer: 1, }
  284. }, 2);
  285. }
  286. //状态
  287. api_bpm_data.fetchDataList('incidentstatus', { "idx": 0, "sum": 100 }).then(function(response) {
  288. if (response) {
  289. if (response.status = 200) {
  290. $scope.state = response.list;
  291. }
  292. }
  293. })
  294. //地点区域过滤
  295. $scope.onChangearea = function(data) {
  296. delete $scope.searchkeys.place;
  297. if ($scope.memoryfilterData.incident) {
  298. delete $scope.memoryfilterData.incident.place;
  299. }
  300. var fildata = { "idx": 0, "sum": 1000, "place": { areaId: data.area.id } };
  301. api_user_data.fetchDataList('place', fildata).then(function(response) {
  302. if (response) {
  303. if (response.status = 200) {
  304. $scope.outplace = response.list;
  305. }
  306. }
  307. })
  308. };
  309. $scope.starttime = function(data) {
  310. return moment(new Date(data)).format('YYYY-MM-DD')
  311. }
  312. $scope.overtime = function(data) {
  313. return moment(new Date(data)).format('YYYY-MM-DD HH:mm')
  314. }
  315. //列表排序
  316. $scope.gridOptions.onRegisterApi = function(gridApi) {
  317. $scope.gridApi = gridApi;
  318. gridApi.pagination.on.paginationChanged($scope, function(newPage, pageSize) {
  319. var filtersData = $scope.memoryfilterData;
  320. filtersData.idx = newPage - 1;
  321. filtersData.sum = pageSize;
  322. // sessionStorage.idx = JSON.stringify(newPage-1)
  323. $scope.refreshData('expand-right', filtersData);
  324. // $scope.refreshData('expand-right', {"assignee":$rootScope.user.id, "candidateGroups":$rootScope.user.group[0].id, "idx":newPage-1,"sum":pageSize});
  325. });
  326. // gridApi.selection.on.rowSelectionChanged($scope, function(data) {
  327. // data.grid.appScope.selected.items = data.entity
  328. // });
  329. $scope.selected = {
  330. items: []
  331. }
  332. // gridApi.selection.on.rowSelectionChanged($scope, function(scope, ect) {
  333. // if (scope.isSelected) {
  334. // scope.grid.appScope.selected.items.push(scope.entity)
  335. // } else {
  336. // for (var i = 0; i <= scope.grid.appScope.selected.items.length; i++) {
  337. // if (scope.grid.appScope.selected.items[i].id == scope.entity.id) {
  338. // scope.grid.appScope.selected.items.splice(i, 1);
  339. // break;
  340. // }
  341. // }
  342. // }
  343. // $scope.selected.items = $scope.gridApi.selection.getSelectedRows();
  344. // });
  345. // gridApi.selection.on.rowSelectionChangedBatch($scope, function(rows) {
  346. // var selectitem = [];
  347. // selectitem = angular.copy($scope.selected.items);
  348. // for (var j = 0; j < rows.length; j++) {
  349. // if (rows[j].isSelected == true) {
  350. // selectitem.push(rows[j].entity);
  351. // } else {
  352. // delete selectitem[j];
  353. // // rows.splice(j, 1);
  354. // }
  355. // }
  356. // $scope.selected.items = [];
  357. // for (var i = 0; i < selectitem.length; i++) {
  358. // if (selectitem[i]) {
  359. // $scope.selected.items.push(selectitem[i]);
  360. // }
  361. // }
  362. // });
  363. };
  364. $scope.selectRowFunction = function(data) {
  365. $state.go('app.means.applyediter', { taskId: data.taskId, processInstanceId: data.processInstanceId,id:data.id });
  366. };
  367. $scope.selectRowFunctionout = function(data) {
  368. $state.go('app.means.outediter', { taskId: data.taskId, processInstanceId: data.processInstanceId,id:data.id });
  369. };
  370. //查看
  371. $scope.onDblClick = function(data) {
  372. $state.go('app.means.detail', { formKey: 'applicationForm_editor', pdKey: 'applicationForm', dataId: data.entity.id, taskId: data.taskId, processInstanceId: data.entity.processInstanceId,id:data.id });
  373. };
  374. // //查看
  375. // $scope.followFunction = function(data) {
  376. // //console.log('data='+JSON.stringify(data));
  377. // $state.go('app.detail', { formKey: 'statusform', pdKey: 'incident', dataId: data.id, processInstanceId: data.processInstanceId });
  378. // };
  379. //删除
  380. $scope.eventDeleted = function(event) {
  381. SweetAlert.swal({
  382. title: "确认删除?",
  383. text: "删除的数据不可恢复,请确认继续操作!",
  384. type: "warning",
  385. showCancelButton: true,
  386. confirmButtonColor: "#DD6B55",
  387. confirmButtonText: "继续删除",
  388. cancelButtonText: "取消操作",
  389. closeOnConfirm: false,
  390. closeOnCancel: false
  391. }, function(isConfirm) {
  392. if (isConfirm) {
  393. api_bpm_schedule.remove([event.id]).then(function(response) {
  394. if (response.status == 200) {
  395. $scope.events.splice(event.id, 1); //有修改的一行
  396. SweetAlert.swal("操作成功!", "数据已经被删除.", "success");
  397. } else {
  398. SweetAlert.swal("操作失败!", "数据暂时无法被删除,请稍候重试", "error");
  399. }
  400. });
  401. } else {
  402. SweetAlert.swal("操作取消", "数据安全", "error");
  403. }
  404. });
  405. };
  406. //导出
  407. $scope.export = function() {
  408. var modalInstance = $modal.open({
  409. templateUrl: 'assets/views/delete.html',
  410. controller: function($scope, scope, $modalInstance, api_bpm_data) {
  411. $scope.title = '资产单导出';
  412. $scope.connect = '共导出' + scope.gridOptions['totalItems'] + '条申请单';
  413. $scope.ok = function() {
  414. $modalInstance.close(scope.selected.items);
  415. };
  416. $scope.cancel = function() {
  417. $modalInstance.dismiss('cancel');
  418. };
  419. },
  420. size: 'sm',
  421. resolve: {
  422. scope: function() {
  423. return $scope;
  424. }
  425. }
  426. });
  427. modalInstance.result.then(function(selectedItem) {
  428. // $rootScope.isMask = true;
  429. if (selectedItem) {
  430. var type = 1;
  431. var fildata = angular.copy($scope.memoryfilterData);
  432. // fildata.applicationForm = { "collate": 1 };
  433. $http({
  434. url: api_bpm_data.downDataModel("applicationForm", type).getRequestedUrl(),
  435. method: 'POST',
  436. data: JSON.stringify(fildata),
  437. headers: {
  438. // 'Content-type' : 'application/xls',
  439. 'Accept': '*/*'
  440. },
  441. responseType: 'arraybuffer'
  442. }).success(function(data, status, headers, config) {
  443. // $rootScope.isMask = false;
  444. var file = new Blob([data], {
  445. type: 'application/octet-stream'
  446. // type : 'application/vnd.ms-excel'
  447. });
  448. //trick to download store a file having its URL
  449. var fileURL = URL.createObjectURL(file);
  450. var a = document.createElement('a');
  451. a.href = fileURL;
  452. a.target = '_blank';
  453. a.download = '申请单列表.xlsx';
  454. document.body.appendChild(a);
  455. a.click();
  456. }).error(function(data, status, headers, config) {
  457. // $rootScope.isMask = false;
  458. console.log(data);
  459. });
  460. } else {
  461. SweetAlert.swal({
  462. title: "未选择资产分类!",
  463. text: "请选择资产分类",
  464. type: "error"
  465. }, function() {
  466. // $rootScope.isMask = false;
  467. });
  468. }
  469. // }
  470. });
  471. }
  472. if ($stateParams.model) {
  473. if (JSON.parse($stateParams.model).searchType && JSON.parse($stateParams.model).searchType != null) {
  474. $scope.searchTypes = JSON.parse($stateParams.model).searchType;
  475. } else {
  476. $scope.searchTypes = "todo";
  477. }
  478. } else {
  479. $scope.searchTypes = "todo";
  480. }
  481. $scope.memoryfilterData = {
  482. "applicationForm": {},
  483. "assignee": $rootScope.user.id,
  484. "candidateGroups": $rootScope.user.group[0].id,
  485. "searchType": "todo",
  486. "idx": 0,
  487. "sum": mun
  488. };
  489. if ($rootScope.user.group) {
  490. var defaultFilterData = {
  491. "applicationForm": {},
  492. "assignee": $rootScope.user.id,
  493. "candidateGroups": $rootScope.user.group[0].id,
  494. "searchType": "todo",
  495. "idx": 0,
  496. "sum": mun
  497. };
  498. } else {
  499. var defaultFilterData = {
  500. "applicationForm": {},
  501. "assignee": $rootScope.user.id,
  502. "searchType": "todo",
  503. "idx": 0,
  504. "sum": mun
  505. };
  506. }
  507. // var defaultFilterData = {
  508. // "assignee":$rootScope.user.id,
  509. // "candidateGroups":$rootScope.user.group[0].id,
  510. // "idx":0,
  511. // "sum":mun
  512. // };
  513. $scope.ldloading = {};
  514. // $scope.Change= function(upTypes){
  515. // if(angular.isDefined(upTypes)&&upTypes=='upincident'){
  516. // $state.go('app.problem.incident',{});
  517. // }
  518. // else if(angular.isDefined(upTypes)&&upTypes=='upchange'){
  519. // $state.go('app.change.incident',{});
  520. // }
  521. // }
  522. //事件类型筛选
  523. $scope.searchstate = 'todo';
  524. $scope.onChange = function(searchType) {
  525. $scope.searchstate = searchType;
  526. defaultFilterData = $scope.memoryfilterData;
  527. defaultFilterData['searchType'] = searchType;
  528. $scope.refreshData('expand-right', defaultFilterData);
  529. }
  530. //刷新
  531. $scope.resh = function() {
  532. $scope.refreshData('expand-right', $scope.memoryfilterData);
  533. }
  534. //获取列表数据
  535. $scope.refreshData = function(style, filterData) {
  536. $scope.ldloading[style.replace('-', '_')] = true;
  537. if (angular.isUndefined(filterData)) {
  538. filterData = defaultFilterData;
  539. }
  540. // if (angular.isDefined($scope.searchTypes)) {
  541. // $rootScope['search'] = {};
  542. // filterData['searchType'] = $scope.searchTypes;
  543. // $rootScope['search']['incident'] = $scope.searchTypes;
  544. // }
  545. // if(sessionStorage.idx){
  546. // filterData.idx = Number(sessionStorage.idx);
  547. // $scope.gridOptions.idx = Number(sessionStorage.idx)+1;
  548. // }
  549. $scope.myData = [];
  550. //var start = new Date();
  551. //var sec = $interval(function () {
  552. //$scope.callsPending++;
  553. $scope.gridOptions['sum'] = filterData.sum;
  554. $scope.memoryfilterData = filterData;
  555. api_bpm_data.fetchDataList(pdKey, filterData).then(function(data) {
  556. if (data.status) {
  557. var myData = Restangular.stripRestangular(data);
  558. var list = [];
  559. $scope.gridOptions['totalItems'] = myData.totalNum;
  560. $scope.myData = myData.list;
  561. for (var i = 0; i < $scope.myData.length; i++) {
  562. $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum
  563. }
  564. } else {
  565. SweetAlert.swal({
  566. title: "系统错误",
  567. text: "请稍后再试!",
  568. type: "error"
  569. });
  570. }
  571. $scope.ldloading[style.replace('-', '_')] = false;
  572. }, function() {
  573. $scope.ldloading[style.replace('-', '_')] = false;
  574. });
  575. };
  576. $scope.refreshData('expand-right', defaultFilterData);
  577. }]);
  578. //操作按钮权限控制
  579. app.controller('MeanOperCtrl', ['$rootScope', '$http', '$scope', '$modal', function($rootScope, $http, $scope, $modal) {
  580. // console.log('$rootScope.user3='+JSON.stringify($scope.item));
  581. // if ($scope.item.state.id != null && $scope.item.handlerUser != null) {
  582. // if ($rootScope.user.id == $scope.item.handlerUser.id) {
  583. // $scope.item.chaozuoPower = true;
  584. // if ($scope.item.state.id == 4) {
  585. // $scope.item.coordination = true;
  586. // }
  587. // }
  588. // }
  589. // $rootScope.callid = $scope.item.callID;
  590. // if ($scope.item.callID) {
  591. // $scope.item.listen = true;
  592. // } else { $scope.item.listen = false; }
  593. // if ($scope.item.state.id != 6 && $scope.item.handlerUser == null) {
  594. // angular.forEach($rootScope.user.group, function(item) {
  595. // if (item.id == $scope.item.candidateGroups) {
  596. // $scope.item.tiquPower = true;
  597. // }
  598. // })
  599. // }
  600. if ($rootScope.user.id == $scope.item.linkProposer.id && $scope.item.status.value != "5") {
  601. $scope.item.chaozuo = true;
  602. } else {
  603. $scope.item.chaozuo = false;
  604. }
  605. $scope.coordination = function() {
  606. $scope.colobject.grid.appScope.coordination($scope.item);
  607. }
  608. $scope.look = function() {
  609. //$state.go('app.detail', { formKey:'incident_back', pdKey:'incident', dataId: $scope.item.id});
  610. $scope.colobject.grid.appScope.lookFunction($scope.item);
  611. // console.log('$scope.item='+JSON.stringify($scope.item));
  612. //$scope.doEdit($scope.item.id);
  613. }
  614. $scope.edit = function() {
  615. if (angular.isDefined($scope.item.type) && ($scope.item.type == 0 || $scope.item.type == 2)) {
  616. $scope.colobject.grid.appScope.selectRowFunction($scope.item);
  617. } else {
  618. $scope.colobject.grid.appScope.selectRowFunctionout($scope.item);
  619. }
  620. // console.log('$scope.item='+JSON.stringify($scope.item));
  621. // $scope.doEdit($scope.item.id);
  622. }
  623. $scope.print = function() { //print
  624. $scope.colobject.grid.appScope.open($scope.item);
  625. // $scope.doEdit($scope.item.id);
  626. }
  627. $scope.record = function() { //record
  628. $scope.colobject.grid.appScope.play($scope.item);
  629. // $scope.doEdit($scope.item.id);
  630. }
  631. $scope.handler = function() {
  632. $scope.colobject.grid.appScope.acceptTaskAction($scope.item);
  633. $scope.doComment($scope.item.id);
  634. }
  635. $scope.follow = function() {
  636. $scope.colobject.grid.appScope.followFunction($scope.item);
  637. }
  638. // $scope.play = function() {
  639. // // console.log($scope.item.callID)
  640. // var modalInstance = $modal.open({
  641. // templateUrl: 'assets/views/incident/tpl/audio.html',
  642. // controller: function($scope, $modalInstance,$sce){
  643. // $scope.data={
  644. // "name":"视频",
  645. // "url":"http://192.168.3.69:8088/recording/recording?callID="+$rootScope.callid
  646. // };
  647. // $scope.data.url = $sce.trustAsResourceUrl($scope.data.url);
  648. // // $scope.audiourl={url:$sce.trustAsResourceUrl("http://192.168.3.69:8088/recording/recording?callID=218147232")};
  649. // $scope.cancel = function() {
  650. // $modalInstance.dismiss('cancel');
  651. // };
  652. // $modalInstance.close();
  653. // }
  654. // });
  655. // };
  656. }]);
  657. //操作按钮
  658. app.directive('meanoperator', function() {
  659. return {
  660. restrict: 'E',
  661. scope: {
  662. item: '=',
  663. colobject: '='
  664. },
  665. controller: 'MeanOperCtrl',
  666. template: '<div><div class="cl-effect-1 ui-grid-cell-contents " >' +
  667. // '<a ng-click="look()" tooltip-placement="left">查看</a>' +
  668. // '<a ng-click="handler()" ng-show="{{item.tiquPower}}" class="handlefont" >接单</a>' +
  669. '<a ng-click="edit()" ng-show="{{item.chaozuo}}" class="bianjifont">编辑</a>' +
  670. // '<a ng-click="print()" class="printfont" ng-show="{{item.chaozuo}}" >打印</a>' +
  671. // '<a ng-click="record()" ng-show="{{item.listen}}" class="luyinfont" >录音</a>' +
  672. '</div></div>'
  673. };
  674. });