meansapplylist.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699
  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.searchstate = JSON.parse(sessionStorage.getItem("searchincident")).searchType;
  204. // $scope.othcode = {};
  205. $scope.parameters = {};
  206. var fildata = {
  207. "applicationForm": {},
  208. "assignee": $rootScope.user.id,
  209. "candidateGroups": $rootScope.user.group[0].id,
  210. "searchType": "todo",
  211. idx: 0,
  212. sum: mun
  213. }
  214. // sessionStorage.removeItem("searchincident");
  215. $scope.memoryfilterData = fildata;
  216. $scope.refreshData('expand-right', fildata);
  217. }
  218. $scope.chiceIncident = function(parameters, item, stateid) {
  219. var fildata = defaultFilterData;
  220. fildata.applicationForm = {};
  221. if (item.alltitle && item.alldata) {
  222. fildata.applicationForm[item.alltitle.value] = item.alldata
  223. }
  224. if (item.linkProposer) {
  225. fildata.applicationForm.linkProposer = item.linkProposer
  226. }
  227. if (item.proposer) {
  228. fildata.applicationForm.proposer = item.proposer
  229. }
  230. if (item.status) {
  231. fildata.applicationForm['status'] = item.status.id;
  232. }
  233. if (item.type) {
  234. fildata.applicationForm['type'] = item.type.id;
  235. }
  236. $scope.gridOptions.paginationCurrentPage = 1;
  237. if (parameters && parameters.paramDateFrom && parameters.paramDateTo) {
  238. angular.extend(fildata, { 'idx': 0, 'sum': $scope.gridOptions.paginationPageSize })
  239. 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') })
  240. }
  241. var transitiondata = angular.copy(item);
  242. // angular.extend(fildata.applicationForm, transitiondata)
  243. $scope.refreshData('expand-right', fildata);
  244. }
  245. //区域地点过滤
  246. $scope.key = {};
  247. api_user_data.fetchDataList('area', { "idx": 0, "sum": 1000 }).then(function(response) {
  248. if (response) {
  249. if (response.status = 200) {
  250. $scope.outarea = response.list;
  251. }
  252. }
  253. })
  254. //受理人,处理人
  255. $scope.searchkeys = {};
  256. var fieldata = { "idx": 0, "sum": 1000, "flag": -1 };
  257. getUser(fieldata, 3);
  258. function getUser(fieldatas, it) {
  259. api_user_data.fetchDataList('user', fieldatas).then(function(data) {
  260. if (it == 1) {
  261. $scope.acceptUser = data.list;
  262. } else if (it == 2) {
  263. $scope.handlingPersonnelUser = data.list;
  264. } else if (it == 3) {
  265. $scope.acceptUser = data.list;
  266. $scope.handlingPersonnelUser = data.list;
  267. }
  268. });
  269. }
  270. //受理人过滤
  271. $scope.onChangeacceptUser = function(key) {
  272. getUser({
  273. "idx": 0,
  274. "sum": 1000,
  275. "flag": -1,
  276. "user": { "flag": -1, "name": key }
  277. }, 1);
  278. }
  279. //处理人过滤
  280. $scope.onChangehandling = function(key) {
  281. getuser({
  282. "idx": 0,
  283. "sum": 1000,
  284. "flag": -1,
  285. "user": { "flag": -1, "name": key }
  286. }, 2);
  287. }
  288. //状态
  289. api_bpm_data.fetchDataList('incidentstatus', { "idx": 0, "sum": 100 }).then(function(response) {
  290. if (response) {
  291. if (response.status = 200) {
  292. $scope.state = response.list;
  293. }
  294. }
  295. })
  296. //地点区域过滤
  297. $scope.onChangearea = function(data) {
  298. delete $scope.searchkeys.place;
  299. if ($scope.memoryfilterData.incident) {
  300. delete $scope.memoryfilterData.incident.place;
  301. }
  302. var fildata = { "idx": 0, "sum": 1000, "place": { areaId: data.area.id } };
  303. api_user_data.fetchDataList('place', fildata).then(function(response) {
  304. if (response) {
  305. if (response.status = 200) {
  306. $scope.outplace = response.list;
  307. }
  308. }
  309. })
  310. };
  311. $scope.starttime = function(data) {
  312. return moment(new Date(data)).format('YYYY-MM-DD')
  313. }
  314. $scope.overtime = function(data) {
  315. return moment(new Date(data)).format('YYYY-MM-DD HH:mm')
  316. }
  317. //列表排序
  318. $scope.gridOptions.onRegisterApi = function(gridApi) {
  319. $scope.gridApi = gridApi;
  320. gridApi.pagination.on.paginationChanged($scope, function(newPage, pageSize) {
  321. var filtersData = $scope.memoryfilterData;
  322. filtersData.idx = newPage - 1;
  323. filtersData.sum = pageSize;
  324. // sessionStorage.idx = JSON.stringify(newPage-1)
  325. $scope.refreshData('expand-right', filtersData);
  326. // $scope.refreshData('expand-right', {"assignee":$rootScope.user.id, "candidateGroups":$rootScope.user.group[0].id, "idx":newPage-1,"sum":pageSize});
  327. });
  328. // gridApi.selection.on.rowSelectionChanged($scope, function(data) {
  329. // data.grid.appScope.selected.items = data.entity
  330. // });
  331. $scope.selected = {
  332. items: []
  333. }
  334. // gridApi.selection.on.rowSelectionChanged($scope, function(scope, ect) {
  335. // if (scope.isSelected) {
  336. // scope.grid.appScope.selected.items.push(scope.entity)
  337. // } else {
  338. // for (var i = 0; i <= scope.grid.appScope.selected.items.length; i++) {
  339. // if (scope.grid.appScope.selected.items[i].id == scope.entity.id) {
  340. // scope.grid.appScope.selected.items.splice(i, 1);
  341. // break;
  342. // }
  343. // }
  344. // }
  345. // $scope.selected.items = $scope.gridApi.selection.getSelectedRows();
  346. // });
  347. // gridApi.selection.on.rowSelectionChangedBatch($scope, function(rows) {
  348. // var selectitem = [];
  349. // selectitem = angular.copy($scope.selected.items);
  350. // for (var j = 0; j < rows.length; j++) {
  351. // if (rows[j].isSelected == true) {
  352. // selectitem.push(rows[j].entity);
  353. // } else {
  354. // delete selectitem[j];
  355. // // rows.splice(j, 1);
  356. // }
  357. // }
  358. // $scope.selected.items = [];
  359. // for (var i = 0; i < selectitem.length; i++) {
  360. // if (selectitem[i]) {
  361. // $scope.selected.items.push(selectitem[i]);
  362. // }
  363. // }
  364. // });
  365. };
  366. $scope.selectRowFunction = function(data) {
  367. $state.go('app.means.applyediter', { taskId: data.taskId, processInstanceId: data.processInstanceId,id:data.id });
  368. };
  369. $scope.selectRowFunctionout = function(data) {
  370. $state.go('app.means.outediter', { taskId: data.taskId, processInstanceId: data.processInstanceId,id:data.id });
  371. };
  372. //查看
  373. $scope.onDblClick = function(data) {
  374. $state.go('app.means.detail', { formKey: 'applicationForm_editor', pdKey: 'applicationForm', dataId: data.entity.id, taskId: data.taskId, processInstanceId: data.entity.processInstanceId,id:data.id });
  375. };
  376. // //查看
  377. // $scope.followFunction = function(data) {
  378. // //console.log('data='+JSON.stringify(data));
  379. // $state.go('app.detail', { formKey: 'statusform', pdKey: 'incident', dataId: data.id, processInstanceId: data.processInstanceId });
  380. // };
  381. //删除
  382. $scope.eventDeleted = function(event) {
  383. SweetAlert.swal({
  384. title: "确认删除?",
  385. text: "删除的数据不可恢复,请确认继续操作!",
  386. type: "warning",
  387. showCancelButton: true,
  388. confirmButtonColor: "#DD6B55",
  389. confirmButtonText: "继续删除",
  390. cancelButtonText: "取消操作",
  391. closeOnConfirm: false,
  392. closeOnCancel: false
  393. }, function(isConfirm) {
  394. if (isConfirm) {
  395. api_bpm_schedule.remove([event.id]).then(function(response) {
  396. if (response.status == 200) {
  397. $scope.events.splice(event.id, 1); //有修改的一行
  398. SweetAlert.swal("操作成功!", "数据已经被删除.", "success");
  399. } else {
  400. SweetAlert.swal("操作失败!", "数据暂时无法被删除,请稍候重试", "error");
  401. }
  402. });
  403. } else {
  404. SweetAlert.swal("操作取消", "数据安全", "error");
  405. }
  406. });
  407. };
  408. //导出
  409. $scope.export = function() {
  410. var modalInstance = $modal.open({
  411. templateUrl: 'assets/views/delete.html',
  412. controller: function($scope, scope, $modalInstance, api_bpm_data) {
  413. $scope.title = '资产单导出';
  414. $scope.connect = '共导出' + scope.gridOptions['totalItems'] + '条申请单';
  415. $scope.ok = function() {
  416. $modalInstance.close(scope.selected.items);
  417. };
  418. $scope.cancel = function() {
  419. $modalInstance.dismiss('cancel');
  420. };
  421. },
  422. size: 'sm',
  423. resolve: {
  424. scope: function() {
  425. return $scope;
  426. }
  427. }
  428. });
  429. modalInstance.result.then(function(selectedItem) {
  430. // $rootScope.isMask = true;
  431. if (selectedItem) {
  432. var type = 1;
  433. var fildata = angular.copy($scope.memoryfilterData);
  434. // fildata.applicationForm = { "collate": 1 };
  435. $http({
  436. url: api_bpm_data.downDataModel("applicationForm", type).getRequestedUrl(),
  437. method: 'POST',
  438. data: JSON.stringify(fildata),
  439. headers: {
  440. // 'Content-type' : 'application/xls',
  441. 'Accept': '*/*'
  442. },
  443. responseType: 'arraybuffer'
  444. }).success(function(data, status, headers, config) {
  445. // $rootScope.isMask = false;
  446. var file = new Blob([data], {
  447. type: 'application/octet-stream'
  448. // type : 'application/vnd.ms-excel'
  449. });
  450. //trick to download store a file having its URL
  451. var fileURL = URL.createObjectURL(file);
  452. var a = document.createElement('a');
  453. a.href = fileURL;
  454. a.target = '_blank';
  455. a.download = '申请单列表.xlsx';
  456. document.body.appendChild(a);
  457. a.click();
  458. }).error(function(data, status, headers, config) {
  459. // $rootScope.isMask = false;
  460. console.log(data);
  461. });
  462. } else {
  463. SweetAlert.swal({
  464. title: "未选择资产分类!",
  465. text: "请选择资产分类",
  466. type: "error"
  467. }, function() {
  468. // $rootScope.isMask = false;
  469. });
  470. }
  471. // }
  472. });
  473. }
  474. if ($stateParams.model) {
  475. if (JSON.parse($stateParams.model).searchType && JSON.parse($stateParams.model).searchType != null) {
  476. $scope.searchTypes = JSON.parse($stateParams.model).searchType;
  477. } else {
  478. $scope.searchTypes = "todo";
  479. }
  480. } else {
  481. $scope.searchTypes = "todo";
  482. }
  483. $scope.memoryfilterData = {
  484. "applicationForm": {},
  485. "assignee": $rootScope.user.id,
  486. "candidateGroups": $rootScope.user.group[0].id,
  487. "searchType": "todo",
  488. "idx": 0,
  489. "sum": mun
  490. };
  491. if ($rootScope.user.group) {
  492. var defaultFilterData = {
  493. "applicationForm": {},
  494. "assignee": $rootScope.user.id,
  495. "candidateGroups": $rootScope.user.group[0].id,
  496. "searchType": "todo",
  497. "idx": 0,
  498. "sum": mun
  499. };
  500. } else {
  501. var defaultFilterData = {
  502. "applicationForm": {},
  503. "assignee": $rootScope.user.id,
  504. "searchType": "todo",
  505. "idx": 0,
  506. "sum": mun
  507. };
  508. }
  509. // var defaultFilterData = {
  510. // "assignee":$rootScope.user.id,
  511. // "candidateGroups":$rootScope.user.group[0].id,
  512. // "idx":0,
  513. // "sum":mun
  514. // };
  515. $scope.ldloading = {};
  516. // $scope.Change= function(upTypes){
  517. // if(angular.isDefined(upTypes)&&upTypes=='upincident'){
  518. // $state.go('app.problem.incident',{});
  519. // }
  520. // else if(angular.isDefined(upTypes)&&upTypes=='upchange'){
  521. // $state.go('app.change.incident',{});
  522. // }
  523. // }
  524. //事件类型筛选
  525. $scope.searchstate = 'todo';
  526. $scope.onChange = function(searchType) {
  527. $scope.searchstate = searchType;
  528. defaultFilterData = $scope.memoryfilterData;
  529. defaultFilterData['searchType'] = searchType;
  530. $scope.refreshData('expand-right', defaultFilterData);
  531. }
  532. //刷新
  533. $scope.resh = function() {
  534. $scope.refreshData('expand-right', $scope.memoryfilterData);
  535. }
  536. //获取列表数据
  537. $scope.refreshData = function(style, filterData) {
  538. $scope.ldloading[style.replace('-', '_')] = true;
  539. if (angular.isUndefined(filterData)) {
  540. filterData = defaultFilterData;
  541. }
  542. // if (angular.isDefined($scope.searchTypes)) {
  543. // $rootScope['search'] = {};
  544. // filterData['searchType'] = $scope.searchTypes;
  545. // $rootScope['search']['incident'] = $scope.searchTypes;
  546. // }
  547. // if(sessionStorage.idx){
  548. // filterData.idx = Number(sessionStorage.idx);
  549. // $scope.gridOptions.idx = Number(sessionStorage.idx)+1;
  550. // }
  551. $scope.myData = [];
  552. //var start = new Date();
  553. //var sec = $interval(function () {
  554. //$scope.callsPending++;
  555. $scope.gridOptions['sum'] = filterData.sum;
  556. $scope.memoryfilterData = filterData;
  557. api_bpm_data.fetchDataList(pdKey, filterData).then(function(data) {
  558. if (data.status) {
  559. var myData = Restangular.stripRestangular(data);
  560. var list = [];
  561. $scope.gridOptions['totalItems'] = myData.totalNum;
  562. $scope.myData = myData.list;
  563. for (var i = 0; i < $scope.myData.length; i++) {
  564. $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum
  565. }
  566. } else {
  567. SweetAlert.swal({
  568. title: "系统错误",
  569. text: "请稍后再试!",
  570. type: "error"
  571. });
  572. }
  573. $scope.ldloading[style.replace('-', '_')] = false;
  574. }, function() {
  575. $scope.ldloading[style.replace('-', '_')] = false;
  576. });
  577. };
  578. $scope.refreshData('expand-right', defaultFilterData);
  579. }]);
  580. //操作按钮权限控制
  581. app.controller('MeanOperCtrl', ['$rootScope', '$http', '$scope', '$modal', function($rootScope, $http, $scope, $modal) {
  582. // console.log('$rootScope.user3='+JSON.stringify($scope.item));
  583. // if ($scope.item.state.id != null && $scope.item.handlerUser != null) {
  584. // if ($rootScope.user.id == $scope.item.handlerUser.id) {
  585. // $scope.item.chaozuoPower = true;
  586. // if ($scope.item.state.id == 4) {
  587. // $scope.item.coordination = true;
  588. // }
  589. // }
  590. // }
  591. // $rootScope.callid = $scope.item.callID;
  592. // if ($scope.item.callID) {
  593. // $scope.item.listen = true;
  594. // } else { $scope.item.listen = false; }
  595. // if ($scope.item.state.id != 6 && $scope.item.handlerUser == null) {
  596. // angular.forEach($rootScope.user.group, function(item) {
  597. // if (item.id == $scope.item.candidateGroups) {
  598. // $scope.item.tiquPower = true;
  599. // }
  600. // })
  601. // }
  602. if ($rootScope.user.id == $scope.item.linkProposer.id && $scope.item.status.value != "5") {
  603. $scope.item.chaozuo = true;
  604. } else {
  605. $scope.item.chaozuo = false;
  606. }
  607. $scope.coordination = function() {
  608. $scope.colobject.grid.appScope.coordination($scope.item);
  609. }
  610. $scope.look = function() {
  611. //$state.go('app.detail', { formKey:'incident_back', pdKey:'incident', dataId: $scope.item.id});
  612. $scope.colobject.grid.appScope.lookFunction($scope.item);
  613. // console.log('$scope.item='+JSON.stringify($scope.item));
  614. //$scope.doEdit($scope.item.id);
  615. }
  616. $scope.edit = function() {
  617. if (angular.isDefined($scope.item.type) && ($scope.item.type == 0 || $scope.item.type == 2)) {
  618. $scope.colobject.grid.appScope.selectRowFunction($scope.item);
  619. } else {
  620. $scope.colobject.grid.appScope.selectRowFunctionout($scope.item);
  621. }
  622. // console.log('$scope.item='+JSON.stringify($scope.item));
  623. // $scope.doEdit($scope.item.id);
  624. }
  625. $scope.print = function() { //print
  626. $scope.colobject.grid.appScope.open($scope.item);
  627. // $scope.doEdit($scope.item.id);
  628. }
  629. $scope.record = function() { //record
  630. $scope.colobject.grid.appScope.play($scope.item);
  631. // $scope.doEdit($scope.item.id);
  632. }
  633. $scope.handler = function() {
  634. $scope.colobject.grid.appScope.acceptTaskAction($scope.item);
  635. $scope.doComment($scope.item.id);
  636. }
  637. $scope.follow = function() {
  638. $scope.colobject.grid.appScope.followFunction($scope.item);
  639. }
  640. // $scope.play = function() {
  641. // // console.log($scope.item.callID)
  642. // var modalInstance = $modal.open({
  643. // templateUrl: 'assets/views/incident/tpl/audio.html',
  644. // controller: function($scope, $modalInstance,$sce){
  645. // $scope.data={
  646. // "name":"视频",
  647. // "url":"http://192.168.3.69:8088/recording/recording?callID="+$rootScope.callid
  648. // };
  649. // $scope.data.url = $sce.trustAsResourceUrl($scope.data.url);
  650. // // $scope.audiourl={url:$sce.trustAsResourceUrl("http://192.168.3.69:8088/recording/recording?callID=218147232")};
  651. // $scope.cancel = function() {
  652. // $modalInstance.dismiss('cancel');
  653. // };
  654. // $modalInstance.close();
  655. // }
  656. // });
  657. // };
  658. }]);
  659. //操作按钮
  660. app.directive('meanoperator', function() {
  661. return {
  662. restrict: 'E',
  663. scope: {
  664. item: '=',
  665. colobject: '='
  666. },
  667. controller: 'MeanOperCtrl',
  668. template: '<div><div class="cl-effect-1 ui-grid-cell-contents " >' +
  669. // '<a ng-click="look()" tooltip-placement="left">查看</a>' +
  670. // '<a ng-click="handler()" ng-show="{{item.tiquPower}}" class="handlefont" >抢单</a>' +
  671. '<a ng-click="edit()" ng-show="{{item.chaozuo}}" class="bianjifont">编辑</a>' +
  672. // '<a ng-click="print()" class="printfont" ng-show="{{item.chaozuo}}" >打印</a>' +
  673. // '<a ng-click="record()" ng-show="{{item.listen}}" class="luyinfont" >录音</a>' +
  674. '</div></div>'
  675. };
  676. });