meansapplylist.js 26 KB

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