jry_emergencyCtrl.js 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155
  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','api_sysinfo',
  3. function($scope, i18nService, $rootScope, $state, $timeout, $interval, $modal, SweetAlert, uiGridConstants, uiGridGroupingConstants, Restangular, api_bpm_data, api_text, moment,api_wechatfile,api_sysinfo) {
  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. api_sysinfo.fetchDataList("systemConfiguration", {
  347. "idx": 0,
  348. "sum": 999
  349. }).then(function (data) {
  350. if (data.status == 200) {
  351. data.list = data.list || [];
  352. var alarmCategory = data.list.find(v => v.keyconfig == 'alarmCategory');
  353. if(alarmCategory && alarmCategory.valueconfig){
  354. formdata.model.incident.category = {id: alarmCategory.valueconfig}
  355. }
  356. console.log(formdata)
  357. $state.go('app.incident.chart', { 'model': JSON.stringify(formdata) });
  358. }
  359. });
  360. };
  361. $scope.lookFunction = function(data) {
  362. var modelfile = { model: { incident: data } };
  363. // $state.go('app.incident.detail', { formKey: 'incident_back', pdKey: 'incident', dataId: data.id, taskId: data.taskId, processInstanceId: data.processInstanceId });
  364. if (data.state == "未受理") {
  365. angular.extend(modelfile.model.incident, { status: 1 })
  366. } else {
  367. angular.extend(modelfile.model.incident, { status: 0 })
  368. }
  369. $state.go('app.desk.form_editor', { formKey: 'desk_detail', service: 'api_user_data', model: JSON.stringify(modelfile) });
  370. };
  371. // $scope.followFunction = function(data){
  372. // //console.log('data='+JSON.stringify(data));
  373. // $state.go('app.detail', { formKey:'statusform', pdKey:'incident', dataId: data.id,processInstanceId: data.processInstanceId});
  374. // };
  375. $scope.onDblClick = function(row) {
  376. if(!row.entity){
  377. row.entity = angular.copy(row);
  378. }
  379. console.log(row)
  380. if (row.entity.alarm.alarmExtension) {
  381. row.entity.alarm.alarmExtension = row.entity.alarm.alarmExtension.replace('{', "");
  382. row.entity.alarm.alarmExtension = row.entity.alarm.alarmExtension.replace('}', "");
  383. row.entity.alarm.alarmExtension = row.entity.alarm.alarmExtension.replace(/,/g, '\n');
  384. }
  385. event.stopPropagation();
  386. var modelfile = { model: row.entity };
  387. // if (row.entity.state == "未受理") {
  388. // angular.extend(modelfile.model.incident, { status: 1 })
  389. // } else {
  390. // angular.extend(modelfile.model.incident, { status: 0 })
  391. // }
  392. console.log(modelfile)
  393. $state.go('app.desk.form_editor', { formKey: 'desk_emergency', service: 'api_user_data', model: JSON.stringify(modelfile) });
  394. };
  395. var defaultFilterData = {
  396. // "assignee":$rootScope.user.id,
  397. // "candidateGroups":$rootScope.user.group[0].id,
  398. "idx": 0,
  399. "sum": 15,
  400. alarmIncident: {
  401. state: '未处理',
  402. }
  403. };
  404. // if(angular.isDefined($rootScope.search)&&angular.isDefined($rootScope.search.incident)){
  405. // defaultFilterData['searchType']=$rootScope.search.incident;
  406. // $scope.searchTypes=$rootScope.search.incident;
  407. // }
  408. // if($rootScope['cmdbs']!='incident'){$rootScope.idx=1}
  409. // if(angular.isDefined($rootScope.idx)&&$rootScope.cmdbs!="false"){
  410. // $rootScope['cmdbs']='incident';
  411. // defaultFilterData.idx=$rootScope.idx-1;
  412. // }else{$rootScope.cmdbs="";}
  413. $scope.ldloading = {};
  414. // $scope.Change= function(upTypes){
  415. // if(angular.isDefined(upTypes)&&upTypes=='upincident'){
  416. // $state.go('app.problem.incident',{});
  417. // }
  418. // else if(angular.isDefined(upTypes)&&upTypes=='upchange'){
  419. // $state.go('app.change.incident',{});
  420. // }
  421. // }
  422. // $scope.submit = function(searchType) {
  423. // api_apply.wxIncidentReject(1, { "rejectRemark": "不受理" }).then(function(data) {
  424. // if (data && data.status == 200) {
  425. // SweetAlert.swal({
  426. // title: "提交成功",
  427. // text: '不受理提交成功',
  428. // type: "success",
  429. // }, function() {
  430. // $scope.reload();
  431. // });
  432. // } else {
  433. // SweetAlert.swal({
  434. // title: "提交失败",
  435. // text: '不受理提交失败',
  436. // type: "error"
  437. // });
  438. // }
  439. // });
  440. // }
  441. $scope.onChange = function(searchType) {
  442. // console.log(searchType)
  443. // $scope.searchstate = searchType;
  444. // defaultFilterData = $scope.memoryfilterData;
  445. // defaultFilterData['searchType'] = searchType;
  446. // defaultFilterData.alarmIncident.state = searchType
  447. // console.log(defaultFilterData)
  448. $scope.searchstate=searchType;
  449. $scope.fileData.alarmIncident.state=searchType;
  450. $scope.refreshData('expand-right',$scope.fileData);
  451. }
  452. $scope.refreshData = function(style, filterData) {
  453. // $scope.ldloading[style.replace('-', '_')] = true;
  454. // if (angular.isUndefined(filterData)) {
  455. // filterData = defaultFilterData;
  456. // }
  457. // console.log($scope.searchstate);
  458. // filterData.alarmIncident.state = $scope.searchstate
  459. // console.log(filterData);
  460. console.log(filterData);
  461. $scope.myData = [];
  462. $scope.gridOptions['sum'] = filterData.sum;
  463. api_bpm_data.fetchDataList("alarmIncident", filterData, 'alarmIncident').then(function(data) {
  464. console.log(data)
  465. var myData6 = Restangular.stripRestangular(data);
  466. $scope.gridOptions['totalItems'] = myData6.totalNum;
  467. $scope.myData = myData6.list;
  468. for (var i = 0; i < $scope.myData.length; i++) {
  469. $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum
  470. }
  471. // $scope.handle = false;
  472. // $scope.notBeing = false;
  473. // for (var i = 0; i < $scope.myData.length; i++) {
  474. // $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum;
  475. // // $scope.TIME = $scope.myData[i].alarm['alarmActiveTime'];
  476. // // $scope.myData[i].alarm.alarmActiveTime = moment($scope.TIME).format("YYYY-MM-DD HH:mm:ss");
  477. // console.log($scope.myData[i]['state'])
  478. // if ($scope.myData[i]['state'] == '未处理') {
  479. // $scope.handle = true;
  480. // $scope.notBeing = true;
  481. // }
  482. // else {
  483. // $scope.handle = false;
  484. // }
  485. // if ($scope.myData[i]['state'] == '暂不处理') {
  486. // $scope.notBeing = false;
  487. // $scope.handle = true;
  488. // }
  489. // }
  490. // $scope.ldloading[style.replace('-', '_')] = false;
  491. }, function() {
  492. // $scope.ldloading[style.replace('-', '_')] = false;
  493. });
  494. };
  495. $scope.dictionaryData=[];
  496. $scope.getDictionary=function(){
  497. var data={
  498. "key":"alarmincident_state",
  499. "type":"list"
  500. }
  501. api_wechatfile.getDictionary(data).then(function(res){
  502. $scope.dictionaryData=res;
  503. $scope.fileData={
  504. "idx":0,
  505. "sum":mun,
  506. "alarmIncident":{
  507. "state":$scope.dictionaryData[0]
  508. }
  509. };
  510. $scope.searchstate = $scope.dictionaryData[0];
  511. $scope.refreshData('expand-right', $scope.fileData);
  512. })
  513. } ;
  514. $scope.getDictionary();
  515. }
  516. ]);
  517. app.controller('WechatOperCtrl2', ['$rootScope', '$http', '$scope', '$modal', 'SweetAlert', '$state', 'api_bpm_data', function($rootScope, $http, $scope, $modal, SweetAlert, $state, api_bpm_data) {
  518. $scope.handle = false;
  519. var loginUser = $rootScope.user;
  520. console.log($scope.item);
  521. if ($scope.item.state.name == '未处理') {
  522. $scope.handle = true;
  523. $scope.notBeing = true;
  524. } else {
  525. $scope.handle = false;
  526. }
  527. if ($scope.item.state.name == '暂不处理') {
  528. $scope.notBeing = false;
  529. $scope.handle = true;
  530. }
  531. // if ($scope.item.alarm.alarmStatus == '恢复') {
  532. // $scope.notBeing = false;
  533. // $scope.handle = false;
  534. // }
  535. // console.log($scope.notBeing);
  536. // 查看
  537. $scope.look = function() {
  538. $scope.colobject.grid.appScope.onDblClick($scope.item);
  539. }
  540. // 处理 --wt
  541. $scope.edit = function() {
  542. $scope.colobject.grid.appScope.selectRowFunction($scope.item);
  543. // $scope.doEdit($scope.item.id);
  544. // console.log($scope.item)
  545. }
  546. // 不处理 --wt
  547. $scope.notAccept = function() {
  548. console.log($scope.item);
  549. var modalInstance = $modal.open({
  550. templateUrl: 'assets/views/desk/emergencyReason.html',
  551. controller: function($scope, $modalInstance, SweetAlert, item, $scope1, style, filterData) {
  552. $scope.ok = function() {
  553. console.log(item)
  554. console.log($scope1.colobject.grid.appScope);
  555. if ($scope.rejectRemark) {
  556. item.rejectRemark = $scope.rejectRemark;
  557. item.oprator = $rootScope.user.name;
  558. delete(item.item);
  559. console.log(item);
  560. // item.state = "不受理";
  561. item.state.id=1605;
  562. // item = { alarmIncident: item };
  563. item={"alarmIncident":item};
  564. api_bpm_data.updData("alarmIncident",item).then(function(data) {
  565. console.log(data);
  566. console.log(item)
  567. SweetAlert.swal({
  568. title: "提交成功!",
  569. confirmButtonColor: "#007AFF"
  570. });
  571. $modalInstance.dismiss('cancel');
  572. $scope1.colobject.grid.appScope.refreshData('expand-right', $scope1.colobject.grid.appScope.fileData);
  573. })
  574. } else {
  575. SweetAlert.swal({
  576. title: "不受理原因为空!",
  577. confirmButtonColor: "#007AFF"
  578. });
  579. }
  580. // $state.go('app.desk.emergency', {});
  581. };
  582. $scope.cancel = function() {
  583. $modalInstance.dismiss('cancel');
  584. };
  585. },
  586. size: 'sm',
  587. resolve: {
  588. item: function() {
  589. return $scope.item;
  590. },
  591. $scope1: function() {
  592. return $scope;
  593. },
  594. style: function() {
  595. return $rootScope.stylewt;
  596. },
  597. filterData: function() {
  598. return $rootScope.filterDatawt;
  599. }
  600. }
  601. });
  602. // $scope.colobject.grid.appScope.lookFunction($scope.item);
  603. // $scope.doEdit($scope.item.id);
  604. };
  605. // 暂不处理 --wt
  606. $scope.being = function() {
  607. console.log($scope.item);
  608. console.log($scope.colobject.grid.appScope)
  609. $scope.item.oprator = $rootScope.user.name;
  610. // $scope.item.state = '暂不处理'
  611. $scope.item.state.id=1606;
  612. delete($scope.item.item);
  613. console.log($scope.item)
  614. $scope.item = { alarmIncident: $scope.item };
  615. api_bpm_data.updData("alarmIncident",$scope.item).then(function(data) {
  616. console.log(data)
  617. if (data.status == 200) {
  618. $scope.notBeing = false;
  619. SweetAlert.swal({
  620. title: "提交成功!",
  621. confirmButtonColor: "#007AFF"
  622. });
  623. $scope.colobject.grid.appScope.refreshData('expand-right', $scope.colobject.grid.appScope.fileData);
  624. }
  625. })
  626. }
  627. console.log($scope.handle)
  628. }]);
  629. app.directive('wechatoperator2', function() {
  630. return {
  631. restrict: 'E',
  632. scope: {
  633. item: '=',
  634. colobject: '='
  635. },
  636. controller: 'WechatOperCtrl2',
  637. template: '<div class="links cl-effect-1 ui-grid-cell-contents pull-left" >' +
  638. // '<a ng-click="edit()" ng-show="{{handle}}" tooltip="生成事件" tooltip-placement="left"><i class="icon iconfont icon-bianji bianjifont"></i></a>' +
  639. '<a ng-click="look()" tooltip="查看" tooltip-placement="right">查看</a>' +
  640. '<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>' +
  641. // '<a ng-click="look()" ng-show="{{!handle}}" tooltip="查看" tooltip-placement="right"><i class="ti-eye"></i></a>' +
  642. '</div>'
  643. };
  644. });