meansapplylist.js 26 KB

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