jry_emergencyCtrl.js 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147
  1. 'use strict';
  2. app.controller('jry_emergencyCtrl', ["$scope", "i18nService", "$rootScope", "$state", "$timeout", "$interval", "$modal", "SweetAlert", "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_bpm_data", "api_text", 'moment','api_wechatfile',
  3. function($scope, i18nService, $rootScope, $state, $timeout, $interval, $modal, SweetAlert, uiGridConstants, uiGridGroupingConstants, Restangular, api_bpm_data, api_text, moment,api_wechatfile) {
  4. console.log($scope);
  5. $scope.langs = i18nService.getAllLangs();
  6. $scope.lang = 'zh-cn';
  7. i18nService.setCurrentLang($scope.lang);
  8. // $(window).resize(function() {
  9. // // console.log("1111")
  10. // });
  11. var loginUser = $rootScope.user;
  12. // var voiceurl=$rootScope.audioiIp;
  13. // delete $rootScope.user.authority;
  14. var pdKey = $state.current.pdKey;
  15. $scope.gridOptions = {};
  16. $scope.gridOptions.data = 'myData';
  17. $scope.gridOptions.enableColumnResizing = true;
  18. $scope.gridOptions.enableFiltering = false;
  19. $scope.gridOptions.enableGridMenu = true;
  20. $scope.gridOptions.enableSelectAll = true;
  21. $scope.gridOptions.enableRowSelection = true;
  22. $scope.gridOptions.showGridFooter = true;
  23. $scope.gridOptions.showColumnFooter = false;
  24. $scope.gridOptions.fastWatch = true;
  25. $scope.gridOptions.enableSorting = true;
  26. $scope.gridOptions.useExternalSorting = true;
  27. $scope.gridOptions.useExternalFiltering = false;
  28. $scope.gridOptions.useExternalPagination = true;
  29. $scope.gridOptions.paginationPageSizes = [10, 15, 20, 50, 100];
  30. $scope.gridOptions.paginationPageSize = 15;
  31. $scope.gridOptions.multiSelect = true;
  32. var mun = $scope.gridOptions.paginationPageSize;
  33. $scope.gridOptions.rowTemplate = "<div ng-click=\"lookFunction(row)\" ng-repeat=\"(colRenderIndex, col) in colContainer.renderedColumns track by col.uid\" ui-grid-one-bind-id-grid=\"rowRenderIndex + '-' + col.uid + '-cell'\" class=\"ui-grid-cell\" ng-class=\"{ 'ui-grid-row-header-cell': col.isRowHeader }\" role=\"{{col.isRowHeader ? 'rowheader' : 'gridcell'}}\" ui-grid-cell></div>";
  34. $scope.gridOptions.rowIdentity = function(row) {
  35. return row.id;
  36. };
  37. $scope.gridOptions.getRowIdentity = function(row) {
  38. return row.id;
  39. };
  40. $scope.gridOptions.columnDefs = [
  41. {
  42. name: 'item',
  43. displayName: '序号',
  44. width: 50,
  45. cellTemplate: '<div>' +
  46. '<div class="ui-grid-cell-contents">{{row.entity.item}}</div>' +
  47. '</div>'
  48. },
  49. {
  50. name: 'alarmId',
  51. displayName: '告警ID',
  52. width: '10%',
  53. cellTemplate: '<div>' +
  54. '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.alarm.alarmId}}</div>' +
  55. '</div>'
  56. },
  57. {
  58. name: 'equipment',
  59. displayName: '告警来源',
  60. width: '10%',
  61. cellTemplate: '<div>' +
  62. '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.alarm.equipment}}</div>' +
  63. '</div>'
  64. }, {
  65. name: 'incidentDescription',
  66. displayName: '告警内容',
  67. width: '20%',
  68. cellTemplate: '<div>' +
  69. '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.alarm.alarmContent}}</div>' +
  70. '</div>'
  71. },
  72. // {
  73. // name: 'requester.name',
  74. // displayName: '故障现象报修',
  75. // width: '10%',
  76. // cellTemplate: '<div>' +
  77. // '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.alarm.alarmType}}</div>' +
  78. // '</div>'
  79. // },
  80. {
  81. name: 'alarmStatus',
  82. displayName: '告警状态',
  83. width: '8%',
  84. cellTemplate: '<div>' +
  85. '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.alarm.alarmStatus}}</div>' +
  86. '</div>'
  87. }, {
  88. name: 'state',
  89. displayName: '工单状态',
  90. width: '8%',
  91. cellTemplate: '<div>' +
  92. '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.state.name}}</div>' +
  93. '</div>'
  94. }, {
  95. name: 'address',
  96. displayName: '告警IP',
  97. width: '13%',
  98. maxWidth:'120',
  99. cellTemplate: '<div>' +
  100. '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" > {{row.entity.alarm.alarmIp}}</div>' +
  101. '</div>'
  102. }, {
  103. name: 'contactsInformation',
  104. displayName: '紧急度',
  105. width: '6%',
  106. cellTemplate: '<div>' +
  107. '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.alarm.alarmSeverity}}</div>' +
  108. '</div>'
  109. },
  110. {
  111. name: 'createTime',
  112. displayName: '告警时间',
  113. width: '140',
  114. cellTemplate: '<div>' +
  115. '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{grid.appScope.transferTime(row.entity.alarm.alarmActiveTime)}}</div>' +
  116. '</div>'
  117. // },
  118. // {
  119. // name: '生成事件',
  120. // width: 80,
  121. // cellTemplate: '<div class="links cl-effect-1">' +
  122. // '<a ng-click="grid.appScope.selectRowFunction(row.entity)" tooltip="新建事件" tooltip-placement="left"><i class="fa fa-pencil-square-o"></i></a>' +
  123. // '</div>'
  124. },
  125. {
  126. name: '操作',
  127. enableSorting: false,
  128. enableFiltering: false,
  129. width: 295,
  130. cellTemplate: '<wechatoperator2 item="row.entity" colobject="col">'
  131. // '<div class="links cl-effect-1 ui-grid-cell-contents pull-left" >' +
  132. // // '<a ng-click="edit()" ng-show="{{handle}}" tooltip="生成事件" tooltip-placement="left"><i class="icon iconfont icon-bianji bianjifont"></i></a>' +
  133. // '<a ng-click="edit()" ng-if="handle" class="bianjifont">建单</a>' + '<a ng-click="notAccept ()" class="bianjifont">不受理</a>' + '<a ng-click="being ()" class="bianjifont">暂不处理</a>' +
  134. // // '<a ng-click="look()" ng-show="{{!handle}}" tooltip="查看" tooltip-placement="right"><i class="ti-eye"></i></a>' +
  135. // '</div>'
  136. }
  137. ];
  138. //批量恢复
  139. $scope.oneClickRecovery = function () {
  140. console.log($scope.selected.items);
  141. var modalInstance = $modal.open({
  142. templateUrl: 'assets/views/delete.html',
  143. controller: function ($scope, $modalInstance) {
  144. $scope.title = '批量恢复';
  145. $scope.connect = '确定要批量恢复?';
  146. $scope.ok = function () {
  147. $modalInstance.close("start");
  148. };
  149. $scope.cancel = function () {
  150. $modalInstance.dismiss('cancel');
  151. };
  152. },
  153. size: 'sm'
  154. })
  155. modalInstance.result.then(function (result) {
  156. if (result) {
  157. if ($scope.selected.items.length != 0) {
  158. $rootScope.isMask = true;
  159. }
  160. var rmvList = [];
  161. angular.forEach($scope.selected.items, function (item) {
  162. rmvList.push(item.id);
  163. });
  164. if (rmvList.length > 0) {
  165. api_bpm_data.oneClickRecovery({ids: String(rmvList)}).then(function (response) {
  166. if (response.status == 200) {
  167. $rootScope.isMask = false;
  168. SweetAlert.swal({
  169. title: "操作成功!",
  170. type: "success",
  171. confirmButtonColor: "#007AFF"
  172. }, function () {
  173. $scope.myData = _.reject($scope.myData, function (o) {
  174. return _.includes(rmvList, o.id);
  175. });
  176. $scope.selected = {
  177. items: []
  178. };
  179. });
  180. $scope.gridApi.selection.clearSelectedRows();
  181. $scope.refreshData('expand-right', $scope.fileData);
  182. } else {
  183. $rootScope.isMask = false;
  184. SweetAlert.swal({
  185. title: "操作异常!",
  186. text: "系统异常,请稍后重试,或者联系管理员!",
  187. type: "error"
  188. });
  189. }
  190. })
  191. }
  192. }
  193. }, function () {
  194. // $scope.ldloading[style.replace('-', '_')] = false;
  195. });
  196. }
  197. // console.log(row);
  198. $scope.wtwt = function(row) {
  199. console.log(row)
  200. }
  201. $scope.value = 10;
  202. $scope.decrement = function(row) {
  203. $scope.value = $scope.value - 1;
  204. };
  205. $scope.transferTime = function(time) {
  206. if(time){
  207. return moment(time).format('YYYY-MM-DD HH:mm');
  208. }else{
  209. return '无';
  210. }
  211. }
  212. // $scope.record = function() {
  213. // api_text.record($rootScope.takes).then(function(data){
  214. // if(data.errno==0){
  215. // $scope.busy=false;
  216. // }
  217. // })
  218. // };
  219. $scope.gridOptions.onRegisterApi = function(gridApi) {
  220. // console.log(row);
  221. $scope.gridApi = gridApi;
  222. // var index = 0;
  223. // var oldheader = {};
  224. // gridApi.grid.sortColumn = function(gridApi) {
  225. // if (oldheader.field) {
  226. // if (oldheader.field == gridApi.field) {
  227. // // index = 0;
  228. // } else {
  229. // index = 0;
  230. // }
  231. // }
  232. // index++;
  233. // oldheader = gridApi;
  234. // var fildata = $scope.memoryfilterData;
  235. // if (index % 3 == 0) {
  236. // delete $scope.memoryfilterData.incident;
  237. // fildata = $scope.memoryfilterData;
  238. // } else if (index % 3 == 1) {
  239. // angular.extend(fildata, { 'incident': { "sort": gridApi.field } });
  240. // } else if (index % 3 == 2) {
  241. // angular.extend(fildata, { 'incident': { "sort": gridApi.field, "order": "asc" } });
  242. // }
  243. // $scope.refreshData('expand-right', fildata);
  244. // }
  245. gridApi.pagination.on.paginationChanged($scope, function(newPage, pageSize) {
  246. var filtersData = $scope.memoryfilterData;
  247. filtersData.idx = newPage - 1;
  248. filtersData.sum = pageSize;
  249. $scope.fileData.idx=newPage - 1;
  250. $scope.fileData.sum=pageSize;
  251. $scope.refreshData('expand-right', $scope.fileData);
  252. // $scope.refreshData('expand-right', {"assignee":$rootScope.user.id, "candidateGroups":$rootScope.user.group[0].id, "idx":newPage-1,"sum":pageSize});
  253. });
  254. //勾选行事件
  255. gridApi.selection.on.rowSelectionChanged($scope, function (data) {
  256. if (data.isSelected) {
  257. $scope.selected.items.push(data.entity);
  258. } else {
  259. //objs:需要遍历的集合 data:遍历时当前的数据 index:遍历时当前索引
  260. //array:需要遍历的集合,每次遍历时都会把objs原样的传一次。
  261. //angular.forEach(objs, function(data,index,array)
  262. angular.forEach($scope.selected.items, function (ObjIndex, index, destObj) {
  263. // console.log(ObjIndex);
  264. // console.log(index);
  265. // console.log(destObj);
  266. if (ObjIndex.id == data.entity.id) {
  267. destObj.splice(index, 1)
  268. }
  269. })
  270. }
  271. });
  272. //批量全选
  273. gridApi.selection.on.rowSelectionChangedBatch($scope, function (rows, event) {
  274. angular.forEach(rows, function (ObjIndex, index, destObj) {
  275. if (ObjIndex.isSelected) {
  276. $scope.selected.items.push(ObjIndex.entity);
  277. } else {
  278. $scope.selected.items = [];
  279. }
  280. });
  281. });
  282. $scope.selected = {
  283. items: []
  284. }
  285. };
  286. $scope.memoryfilterData = defaultFilterData = {
  287. // "assignee":$rootScope.user.id,
  288. // "candidateGroups":$rootScope.user.group[0].id,
  289. "idx": 0,
  290. "sum": mun,
  291. 'alarmIncident': {
  292. "state": ''
  293. }
  294. };
  295. $scope.selectRowFunction = function(data) {
  296. console.log(data)
  297. var login_requester = JSON.parse(localStorage.getItem('login_requester'));
  298. var formdata = {
  299. // 'model': {
  300. // 'incident': {
  301. // 'requester': data.requester,
  302. // 'area': data.area,
  303. // 'place': data.place,
  304. // 'houseNumber': data.address,
  305. // 'contacts': data.contacts,
  306. // 'contactsInformation': data.contactsInformation,
  307. // // 'category': data.wxIncidentClassifyDTO.category,
  308. // 'description': data.incidentDescription,
  309. // 'source': { 'id': 4 },
  310. // 'sourceType': data.sourceType,
  311. // 'fileUrl': data.fileUrl
  312. // },
  313. // 'networkInformation': data.requester,
  314. // 'flow': data.id
  315. // }
  316. 'model':{
  317. 'incident':{
  318. 'description': 'ID:'+(data.alarm.alarmId||'')+'\r\n'+ '来源:'+(data.alarm.equipment||'')+'\r\n'+ '时间:'+(data.alarm.alarmActiveTime||'')+'\r\n'+ '紧急度:'+(data.alarm.alarmSeverity||'')+'\r\n'+ '内容:'+(data.alarm.alarmContent||'')+'\r\n'+ '描述:'+(data.alarm.alarmDescription||'')+'\r\n'+ 'IP:'+(data.alarm.alarmIp||'') +'\r\n'+ '地址:'+(data.alarm.alarmLocation||'')+'\r\n',
  319. 'alarm': data.alarm
  320. }
  321. },
  322. 'alarmIncident': data
  323. }
  324. if(login_requester){
  325. formdata.model.incident.requester = login_requester;
  326. formdata.model.incident.area = login_requester.place?login_requester.place.area:undefined;
  327. formdata.model.incident.place = login_requester.place;
  328. formdata.model.incident.contacts = login_requester.name;
  329. formdata.model.incident.contactsInformation = login_requester.mphone;
  330. formdata.model.incident.source = { 'id': 1550 };
  331. }
  332. console.log(formdata)
  333. // if (formdata.alarmIncident.state == '未建单') {
  334. // formdata.alarmIncident.state = 0;
  335. // }
  336. delete(formdata.alarmIncident.item);
  337. console.log(formdata);
  338. // if (data.requester.requesterTypeDTO && data.requester.requesterTypeDTO.id == 2) {
  339. // angular.extend(formdata.model.incident, { 'priority': { 'id': 2 } });
  340. // }
  341. if (formdata.alarmIncident.alarm.alarmExtension) {
  342. formdata.alarmIncident.alarm.alarmExtension = formdata.alarmIncident.alarm.alarmExtension.replace('{', "");
  343. formdata.alarmIncident.alarm.alarmExtension = formdata.alarmIncident.alarm.alarmExtension.replace('}', "");
  344. // formdata.alarmIncident.alarm.alarmExtension = formdata.alarmIncident.alarm.alarmExtension.replace(/,/g, '\n');
  345. }
  346. console.log(formdata);
  347. $state.go('app.incident.chart', { 'model': JSON.stringify(formdata) });
  348. };
  349. $scope.lookFunction = function(data) {
  350. var modelfile = { model: { incident: data } };
  351. // $state.go('app.incident.detail', { formKey: 'incident_back', pdKey: 'incident', dataId: data.id, taskId: data.taskId, processInstanceId: data.processInstanceId });
  352. if (data.state == "未受理") {
  353. angular.extend(modelfile.model.incident, { status: 1 })
  354. } else {
  355. angular.extend(modelfile.model.incident, { status: 0 })
  356. }
  357. $state.go('app.desk.form_editor', { formKey: 'desk_detail', service: 'api_user_data', model: JSON.stringify(modelfile) });
  358. };
  359. // $scope.followFunction = function(data){
  360. // //console.log('data='+JSON.stringify(data));
  361. // $state.go('app.detail', { formKey:'statusform', pdKey:'incident', dataId: data.id,processInstanceId: data.processInstanceId});
  362. // };
  363. $scope.onDblClick = function(row) {
  364. if(!row.entity){
  365. row.entity = angular.copy(row);
  366. }
  367. console.log(row)
  368. if (row.entity.alarm.alarmExtension) {
  369. row.entity.alarm.alarmExtension = row.entity.alarm.alarmExtension.replace('{', "");
  370. row.entity.alarm.alarmExtension = row.entity.alarm.alarmExtension.replace('}', "");
  371. row.entity.alarm.alarmExtension = row.entity.alarm.alarmExtension.replace(/,/g, '\n');
  372. }
  373. event.stopPropagation();
  374. var modelfile = { model: row.entity };
  375. // if (row.entity.state == "未受理") {
  376. // angular.extend(modelfile.model.incident, { status: 1 })
  377. // } else {
  378. // angular.extend(modelfile.model.incident, { status: 0 })
  379. // }
  380. console.log(modelfile)
  381. $state.go('app.desk.form_editor', { formKey: 'desk_emergency', service: 'api_user_data', model: JSON.stringify(modelfile) });
  382. };
  383. var defaultFilterData = {
  384. // "assignee":$rootScope.user.id,
  385. // "candidateGroups":$rootScope.user.group[0].id,
  386. "idx": 0,
  387. "sum": 15,
  388. alarmIncident: {
  389. state: '未处理',
  390. }
  391. };
  392. // if(angular.isDefined($rootScope.search)&&angular.isDefined($rootScope.search.incident)){
  393. // defaultFilterData['searchType']=$rootScope.search.incident;
  394. // $scope.searchTypes=$rootScope.search.incident;
  395. // }
  396. // if($rootScope['cmdbs']!='incident'){$rootScope.idx=1}
  397. // if(angular.isDefined($rootScope.idx)&&$rootScope.cmdbs!="false"){
  398. // $rootScope['cmdbs']='incident';
  399. // defaultFilterData.idx=$rootScope.idx-1;
  400. // }else{$rootScope.cmdbs="";}
  401. $scope.ldloading = {};
  402. // $scope.Change= function(upTypes){
  403. // if(angular.isDefined(upTypes)&&upTypes=='upincident'){
  404. // $state.go('app.problem.incident',{});
  405. // }
  406. // else if(angular.isDefined(upTypes)&&upTypes=='upchange'){
  407. // $state.go('app.change.incident',{});
  408. // }
  409. // }
  410. // $scope.submit = function(searchType) {
  411. // api_apply.wxIncidentReject(1, { "rejectRemark": "不受理" }).then(function(data) {
  412. // if (data && data.status == 200) {
  413. // SweetAlert.swal({
  414. // title: "提交成功",
  415. // text: '不受理提交成功',
  416. // type: "success",
  417. // }, function() {
  418. // $scope.reload();
  419. // });
  420. // } else {
  421. // SweetAlert.swal({
  422. // title: "提交失败",
  423. // text: '不受理提交失败',
  424. // type: "error"
  425. // });
  426. // }
  427. // });
  428. // }
  429. $scope.onChange = function(searchType) {
  430. // console.log(searchType)
  431. // $scope.searchstate = searchType;
  432. // defaultFilterData = $scope.memoryfilterData;
  433. // defaultFilterData['searchType'] = searchType;
  434. // defaultFilterData.alarmIncident.state = searchType
  435. // console.log(defaultFilterData)
  436. $scope.searchstate=searchType;
  437. $scope.fileData.alarmIncident.state=searchType;
  438. $scope.refreshData('expand-right',$scope.fileData);
  439. }
  440. $scope.refreshData = function(style, filterData) {
  441. // $scope.ldloading[style.replace('-', '_')] = true;
  442. // if (angular.isUndefined(filterData)) {
  443. // filterData = defaultFilterData;
  444. // }
  445. // console.log($scope.searchstate);
  446. // filterData.alarmIncident.state = $scope.searchstate
  447. // console.log(filterData);
  448. console.log(filterData);
  449. $scope.myData = [];
  450. $scope.gridOptions['sum'] = filterData.sum;
  451. api_bpm_data.fetchDataList("alarmIncident", filterData, 'alarmIncident').then(function(data) {
  452. console.log(data)
  453. var myData6 = Restangular.stripRestangular(data);
  454. $scope.gridOptions['totalItems'] = myData6.totalNum;
  455. $scope.myData = myData6.list;
  456. for (var i = 0; i < $scope.myData.length; i++) {
  457. $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum
  458. }
  459. // $scope.handle = false;
  460. // $scope.notBeing = false;
  461. // for (var i = 0; i < $scope.myData.length; i++) {
  462. // $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum;
  463. // // $scope.TIME = $scope.myData[i].alarm['alarmActiveTime'];
  464. // // $scope.myData[i].alarm.alarmActiveTime = moment($scope.TIME).format("YYYY-MM-DD HH:mm:ss");
  465. // console.log($scope.myData[i]['state'])
  466. // if ($scope.myData[i]['state'] == '未处理') {
  467. // $scope.handle = true;
  468. // $scope.notBeing = true;
  469. // }
  470. // else {
  471. // $scope.handle = false;
  472. // }
  473. // if ($scope.myData[i]['state'] == '暂不处理') {
  474. // $scope.notBeing = false;
  475. // $scope.handle = true;
  476. // }
  477. // }
  478. // $scope.ldloading[style.replace('-', '_')] = false;
  479. }, function() {
  480. // $scope.ldloading[style.replace('-', '_')] = false;
  481. });
  482. };
  483. $scope.dictionaryData=[];
  484. $scope.getDictionary=function(){
  485. var data={
  486. "key":"alarmincident_state",
  487. "type":"list"
  488. }
  489. api_wechatfile.getDictionary(data).then(function(res){
  490. $scope.dictionaryData=res;
  491. $scope.fileData={
  492. "idx":0,
  493. "sum":mun,
  494. "alarmIncident":{
  495. "state":$scope.dictionaryData[0]
  496. }
  497. };
  498. $scope.searchstate = $scope.dictionaryData[0];
  499. $scope.refreshData('expand-right', $scope.fileData);
  500. })
  501. } ;
  502. $scope.getDictionary();
  503. }
  504. ]);
  505. app.controller('WechatOperCtrl2', ['$rootScope', '$http', '$scope', '$modal', 'SweetAlert', '$state', 'api_bpm_data', function($rootScope, $http, $scope, $modal, SweetAlert, $state, api_bpm_data) {
  506. $scope.handle = false;
  507. var loginUser = $rootScope.user;
  508. console.log($scope.item);
  509. if ($scope.item.state.name == '未处理') {
  510. $scope.handle = true;
  511. $scope.notBeing = true;
  512. } else {
  513. $scope.handle = false;
  514. }
  515. if ($scope.item.state.name == '暂不处理') {
  516. $scope.notBeing = false;
  517. $scope.handle = true;
  518. }
  519. // if ($scope.item.alarm.alarmStatus == '恢复') {
  520. // $scope.notBeing = false;
  521. // $scope.handle = false;
  522. // }
  523. // console.log($scope.notBeing);
  524. // 查看
  525. $scope.look = function() {
  526. $scope.colobject.grid.appScope.onDblClick($scope.item);
  527. }
  528. // 处理 --wt
  529. $scope.edit = function() {
  530. $scope.colobject.grid.appScope.selectRowFunction($scope.item);
  531. // $scope.doEdit($scope.item.id);
  532. // console.log($scope.item)
  533. }
  534. // 不处理 --wt
  535. $scope.notAccept = function() {
  536. console.log($scope.item);
  537. var modalInstance = $modal.open({
  538. templateUrl: 'assets/views/desk/emergencyReason.html',
  539. controller: function($scope, $modalInstance, SweetAlert, item, $scope1, style, filterData) {
  540. $scope.ok = function() {
  541. console.log(item)
  542. console.log($scope1.colobject.grid.appScope);
  543. if ($scope.rejectRemark) {
  544. item.rejectRemark = $scope.rejectRemark;
  545. item.oprator = $rootScope.user.name;
  546. delete(item.item);
  547. console.log(item);
  548. // item.state = "不受理";
  549. item.state.id=1605;
  550. // item = { alarmIncident: item };
  551. item={"alarmIncident":item};
  552. api_bpm_data.updData("alarmIncident",item).then(function(data) {
  553. console.log(data);
  554. console.log(item)
  555. SweetAlert.swal({
  556. title: "提交成功!",
  557. confirmButtonColor: "#007AFF"
  558. });
  559. $modalInstance.dismiss('cancel');
  560. $scope1.colobject.grid.appScope.refreshData('expand-right', $scope1.colobject.grid.appScope.fileData);
  561. })
  562. } else {
  563. SweetAlert.swal({
  564. title: "不受理原因为空!",
  565. confirmButtonColor: "#007AFF"
  566. });
  567. }
  568. // $state.go('app.desk.emergency', {});
  569. };
  570. $scope.cancel = function() {
  571. $modalInstance.dismiss('cancel');
  572. };
  573. },
  574. size: 'sm',
  575. resolve: {
  576. item: function() {
  577. return $scope.item;
  578. },
  579. $scope1: function() {
  580. return $scope;
  581. },
  582. style: function() {
  583. return $rootScope.stylewt;
  584. },
  585. filterData: function() {
  586. return $rootScope.filterDatawt;
  587. }
  588. }
  589. });
  590. // $scope.colobject.grid.appScope.lookFunction($scope.item);
  591. // $scope.doEdit($scope.item.id);
  592. };
  593. // 暂不处理 --wt
  594. $scope.being = function() {
  595. console.log($scope.item);
  596. console.log($scope.colobject.grid.appScope)
  597. $scope.item.oprator = $rootScope.user.name;
  598. // $scope.item.state = '暂不处理'
  599. $scope.item.state.id=1606;
  600. delete($scope.item.item);
  601. console.log($scope.item)
  602. $scope.item = { alarmIncident: $scope.item };
  603. api_bpm_data.updData("alarmIncident",$scope.item).then(function(data) {
  604. console.log(data)
  605. if (data.status == 200) {
  606. $scope.notBeing = false;
  607. SweetAlert.swal({
  608. title: "提交成功!",
  609. confirmButtonColor: "#007AFF"
  610. });
  611. $scope.colobject.grid.appScope.refreshData('expand-right', $scope.colobject.grid.appScope.fileData);
  612. }
  613. })
  614. }
  615. console.log($scope.handle)
  616. }]);
  617. app.directive('wechatoperator2', function() {
  618. return {
  619. restrict: 'E',
  620. scope: {
  621. item: '=',
  622. colobject: '='
  623. },
  624. controller: 'WechatOperCtrl2',
  625. template: '<div class="links cl-effect-1 ui-grid-cell-contents pull-left" >' +
  626. // '<a ng-click="edit()" ng-show="{{handle}}" tooltip="生成事件" tooltip-placement="left"><i class="icon iconfont icon-bianji bianjifont"></i></a>' +
  627. '<a ng-click="look()" tooltip="查看" tooltip-placement="right">查看</a>' +
  628. '<a ng-click="edit()" ng-show="{{handle}}" class="bianjifont">建单</a>' + '<a ng-click="notAccept ()" ng-show="{{handle}}" class="bianjifont">不受理</a>' + '<a ng-click="being ()" ng-show="{{notBeing}}" class="bianjifont">暂不处理</a>' +
  629. // '<a ng-click="look()" ng-show="{{!handle}}" tooltip="查看" tooltip-placement="right"><i class="ti-eye"></i></a>' +
  630. '</div>'
  631. };
  632. });