chartCtrl.js 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847
  1. 'use strict';
  2. app.controller('chartCtrl', ["$scope", "i18nService", "$rootScope", "$state", "$timeout", "$interval", "$modal", "SweetAlert", "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_bpm_data", "api_text", "api_user_data", "api_wechatfile", "api_search_ks", function ($scope, i18nService, $rootScope, $state, $timeout, $interval, $modal, SweetAlert, uiGridConstants, uiGridGroupingConstants, Restangular, api_bpm_data, api_text, api_user_data, api_wechatfile, api_search_ks) {
  3. $scope.langs = i18nService.getAllLangs();
  4. $scope.lang = 'zh-cn';
  5. i18nService.setCurrentLang($scope.lang);
  6. // $(window).resize(function() {
  7. // // console.log("1111")
  8. // });
  9. var loginUser = $rootScope.user;
  10. //保存报修主体
  11. $scope.repairMain = JSON.parse(sessionStorage.getItem("repair_main"));
  12. $scope.wxIncidentWithCmdb = JSON.parse(sessionStorage.getItem("wxIncidentWithCmdb"));//资产
  13. $scope.incidentWithConsumable = JSON.parse(sessionStorage.getItem("incidentWithConsumable"));//耗材
  14. // ----------------分割线 start-----------------
  15. // 报修科室下拉
  16. $scope.ks_pageNum = 0; //科室下拉列表分页
  17. $scope.ks_len = 0; //科室所有数据列表数量
  18. $scope.ks_arr = [];//科室所有数据
  19. $scope.ksFlag = false;//默认下拉框列表隐藏
  20. $scope.ksModel = '';//科室输入内容
  21. //点击文本框
  22. $scope.ksClickHandle = function () {
  23. $scope.ks_arr = [];
  24. $scope.ks_pageNum = 0;
  25. $scope.getDepartmentList($scope.ks_pageNum);
  26. angular.element('#bx_ks_ul').scrollTop(0);
  27. }
  28. //修改文字,实时监听
  29. $scope.ksChangeHandle = _.debounce(function () {
  30. $scope.ks_arr = [];
  31. $scope.ks_pageNum = 0;
  32. $scope.getDepartmentList($scope.ks_pageNum);
  33. angular.element('#bx_ks_ul').scrollTop(0);
  34. }, 500)
  35. //滚动加载
  36. $scope.ksScrollHandle = function () {
  37. var itemLen = $scope.ks_arr.length;
  38. $scope.ks_pageNum++;
  39. if ($scope.ks_len != itemLen) {
  40. $scope.ks_len = itemLen;
  41. $scope.getDepartmentList($scope.ks_pageNum);
  42. }
  43. }
  44. //获取科室列表seimin
  45. $scope.getDepartmentList = function (idx) {
  46. api_search_ks.getKsList({ "idx": idx, "sum": 50, "department": { "dept": $scope.ksModel } })
  47. .then(res => {
  48. if (res.status == 200) {
  49. //添加分页数据,汇总
  50. $scope.ks_arr = $scope.ks_arr.concat(res.list);
  51. $scope.ksFlag = true;//显示
  52. }
  53. })
  54. .catch(err => {
  55. console.log(err);
  56. })
  57. }
  58. //下拉框列表选中
  59. $scope.ksItemClick = function (obj) {
  60. $scope.ksModel = obj.dept;//文本框赋值
  61. $scope.ksFlag = false;//隐藏
  62. }
  63. //点击空白处隐藏
  64. angular.element(document).on('click', function (e) {
  65. if (e.target !== angular.element('#bx_ks').get(0)) {
  66. $scope.ksFlag = false;//隐藏
  67. //模拟placeholder
  68. // if ($('#bx_ks').val() == '') {
  69. // $('#bx_ks').val('请选择报修科室');
  70. // }
  71. }
  72. })
  73. // -----------------分割线 end----------------
  74. // var voiceurl=$rootScope.audioiIp;
  75. // delete $rootScope.user.authority;
  76. var pdKey = $state.current.pdKey;
  77. $scope.gridOptions = {};
  78. $scope.gridOptions.data = 'myData';
  79. $scope.gridOptions.enableColumnResizing = true;
  80. $scope.gridOptions.enableFiltering = false;
  81. $scope.gridOptions.enableGridMenu = true;
  82. $scope.gridOptions.enableRowSelection = true;
  83. $scope.gridOptions.showGridFooter = true;
  84. $scope.gridOptions.showColumnFooter = false;
  85. $scope.gridOptions.fastWatch = true;
  86. // $scope.gridOptions.useExternalFiltering=true;
  87. $scope.gridOptions.useExternalPagination = true;
  88. $scope.gridOptions.paginationPageSizes = [10, 20, 50, 100];
  89. $scope.gridOptions.paginationPageSize = 10;
  90. $scope.gridOptions.multiSelect = true;
  91. var mun = $scope.gridOptions.paginationPageSize;
  92. $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>";
  93. $scope.gridOptions.rowIdentity = function (row) {
  94. return row.id;
  95. };
  96. $scope.gridOptions.getRowIdentity = function (row) {
  97. return row.id;
  98. };
  99. //表格列表显示
  100. if ($scope.repairMain.valueconfig == 1) {//报修主体为报修人
  101. $scope.gridOptions.columnDefs = [{
  102. name: 'item',
  103. displayName: '序号',
  104. width:50,
  105. cellTemplate: '<div>' +
  106. '<div class="ui-grid-cell-contents">{{row.entity.item}}</div>' +
  107. '</div>'
  108. },{
  109. name: 'bxcode',
  110. displayName: '报修单号',
  111. width:150,
  112. cellTemplate: '<div>' +
  113. '<div class="ui-grid-cell-contents">{{row.entity.bxcode}}</div>' +
  114. '</div>'
  115. }, {
  116. name: 'incidentDescription',
  117. displayName: '事件描述',
  118. width:150,
  119. cellTemplate: '<div>' +
  120. '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.incidentDescription}}</div>' +
  121. '</div>'
  122. },
  123. // {
  124. // name: 'incidentDescription1',
  125. // displayName: '报修科室',
  126. // width: '12%',
  127. // cellTemplate: '<div>' +
  128. // '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.incidentDescription1}}</div>' +
  129. // '</div>'
  130. // },
  131. {
  132. name: 'address',
  133. displayName: '故障地点',
  134. width:150,
  135. cellTemplate: '<div>' +
  136. '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.place.place||""}} {{row.entity.address}}</div>' +
  137. '</div>'
  138. }, {
  139. name: 'contacts',
  140. displayName: '联系人',
  141. width:150,
  142. cellTemplate: '<div>' +
  143. '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.contacts}}</div>' +
  144. '</div>'
  145. },{
  146. name: 'requester.account',
  147. displayName: '学工号',
  148. width:150,
  149. cellTemplate: '<div>' +
  150. '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.requester.account}}</div>' +
  151. '</div>'
  152. }, {
  153. name: 'contactsInformation',
  154. displayName: '联系电话',
  155. width:150,
  156. cellTemplate: '<div>' +
  157. '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.contactsInformation}}</div>' +
  158. '</div>'
  159. },{
  160. name: 'incident.acceptUser.name',
  161. displayName: '受理人',
  162. width:150,
  163. cellTemplate: '<div>' +
  164. '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" ng-if="row.entity.incident&&row.entity.incident.acceptUser">{{row.entity.incident.acceptUser.name||""}}</div>' +
  165. '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" ng-if="row.entity.rejectUser">{{row.entity.rejectUser.name||""}}</div>' +
  166. '</div>'
  167. },
  168. // {
  169. // name: 'requester.name',
  170. // displayName: '报修人',
  171. // width: '10%',
  172. // cellTemplate: '<div>' +
  173. // '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.requester.name}}</div>' +
  174. // '</div>'
  175. // },
  176. {
  177. name: 'serviceState.name',
  178. displayName: '状态',
  179. width:150,
  180. cellTemplate: '<div>' +
  181. '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.serviceState.name}}</div>' +
  182. '</div>'
  183. }, {
  184. name: 'createTime',
  185. displayName: '报修时间',
  186. width:150,
  187. cellTemplate: '<div>' +
  188. '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center">{{grid.appScope.transferTime(row.entity.createTime)}}</div>' +
  189. '</div>'
  190. // },
  191. // {
  192. // name: '生成事件',
  193. // width: 80,
  194. // cellTemplate: '<div class="links cl-effect-1">' +
  195. // '<a ng-click="grid.appScope.selectRowFunction(row.entity)" tooltip="新建事件" tooltip-placement="left"><i class="fa fa-pencil-square-o"></i></a>' +
  196. // '</div>'
  197. },
  198. {
  199. name: '操作',
  200. width:200,
  201. cellTemplate: '<wechatoperator item="row.entity" colobject="col">',
  202. enableFiltering: false
  203. }
  204. ];
  205. // 是否展示资产
  206. if($scope.wxIncidentWithCmdb == 1){
  207. let index = $scope.gridOptions.columnDefs.findIndex(v=>v.name == 'address');
  208. $scope.gridOptions.columnDefs.splice(index,0,{
  209. name: 'assetId',
  210. displayName: '资产',
  211. width:150
  212. })
  213. }
  214. } else if ($scope.repairMain.valueconfig == 2) {//报修主体为科室
  215. $scope.gridOptions.columnDefs = [{
  216. name: 'item',
  217. displayName: '序号',
  218. width: 50,
  219. cellTemplate: '<div>' +
  220. '<div class="ui-grid-cell-contents">{{row.entity.item}}</div>' +
  221. '</div>'
  222. },{
  223. name: 'bxcode',
  224. displayName: '报修单号',
  225. width:150,
  226. cellTemplate: '<div>' +
  227. '<div class="ui-grid-cell-contents">{{row.entity.bxcode}}</div>' +
  228. '</div>'
  229. }, {
  230. name: 'incidentDescription',
  231. displayName: '事件描述',
  232. width:150,
  233. cellTemplate: '<div>' +
  234. '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.incidentDescription}}</div>' +
  235. '</div>'
  236. },
  237. // {
  238. // name: 'incidentDescription1',
  239. // displayName: '报修科室',
  240. // width: '12%',
  241. // cellTemplate: '<div>' +
  242. // '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.incidentDescription1}}</div>' +
  243. // '</div>'
  244. // },
  245. {
  246. name: 'address',
  247. displayName: '故障地点',
  248. width:150,
  249. cellTemplate: '<div>' +
  250. '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.place.place||""}} {{row.entity.address}}</div>' +
  251. '</div>'
  252. }, {
  253. name: 'departmentDTO.dept',
  254. displayName: '报修科室',
  255. width:150,
  256. cellTemplate: '<div>' +
  257. '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.departmentDTO.dept}}</div>' +
  258. '</div>'
  259. }, {
  260. name: 'contacts',
  261. displayName: '联系人',
  262. width:150,
  263. cellTemplate: '<div>' +
  264. '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.contacts}}</div>' +
  265. '</div>'
  266. }, {
  267. name: 'contactsInformation',
  268. displayName: '联系电话',
  269. width:150,
  270. cellTemplate: '<div>' +
  271. '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.contactsInformation}}</div>' +
  272. '</div>'
  273. },
  274. // {
  275. // name: 'requester.name',
  276. // displayName: '报修人',
  277. // width: '10%',
  278. // cellTemplate: '<div>' +
  279. // '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.requester.name}}</div>' +
  280. // '</div>'
  281. // },
  282. {
  283. name: 'serviceState.name',
  284. displayName: '状态',
  285. width:150,
  286. cellTemplate: '<div>' +
  287. '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center" >{{row.entity.serviceState.name}}</div>' +
  288. '</div>'
  289. }, {
  290. name: 'createTime',
  291. displayName: '报修时间',
  292. width:150,
  293. cellTemplate: '<div>' +
  294. '<div class="ui-grid-cell-contents" style="cursor:pointer;text-align:center">{{grid.appScope.transferTime(row.entity.createTime)}}</div>' +
  295. '</div>'
  296. // },
  297. // {
  298. // name: '生成事件',
  299. // width: 80,
  300. // cellTemplate: '<div class="links cl-effect-1">' +
  301. // '<a ng-click="grid.appScope.selectRowFunction(row.entity)" tooltip="新建事件" tooltip-placement="left"><i class="fa fa-pencil-square-o"></i></a>' +
  302. // '</div>'
  303. },
  304. {
  305. name: '操作',
  306. width:200,
  307. cellTemplate: '<wechatoperator item="row.entity" colobject="col">',
  308. enableFiltering: false
  309. }
  310. ];
  311. }
  312. $scope.value = 10;
  313. $scope.decrement = function () {
  314. $scope.value = $scope.value - 1;
  315. };
  316. $scope.searchkeys = {};
  317. //点击切换
  318. $scope.onChange = function (searchType) {
  319. $scope.searchstate = searchType;
  320. // defaultFilterData = $scope.memoryfilterData;
  321. if (searchType) {
  322. $scope.fileData.wxincident.serviceState = { "id": searchType };
  323. } else {
  324. delete $scope.fileData.wxincident.serviceState
  325. }
  326. // sessionStorage.searchchart.state = searchType;
  327. $scope.refreshData('expand-right', $scope.fileData);
  328. }
  329. $scope.record = function () {
  330. api_text.record($rootScope.takes).then(function (data) {
  331. if (data.errno == 0) {
  332. $scope.busy = false;
  333. }
  334. })
  335. };
  336. $scope.transferTime = function (time) {
  337. return moment(time).format('YYYY-MM-DD HH:mm');
  338. }
  339. $scope.parameters = null;
  340. $scope.open = function ($event) {
  341. $event.preventDefault();
  342. $event.stopPropagation();
  343. $scope.opened = !$scope.opened;
  344. };
  345. $scope.endOpen = function ($event) {
  346. $event.preventDefault();
  347. $event.stopPropagation();
  348. $scope.startOpened = false;
  349. $scope.endOpened = !$scope.endOpened;
  350. };
  351. $scope.startOpen = function ($event) {
  352. $event.preventDefault();
  353. $event.stopPropagation();
  354. $scope.endOpened = false;
  355. $scope.startOpened = !$scope.startOpened;
  356. };
  357. var getUser = function (fieldatas) {
  358. api_user_data.fetchDataList('requester', fieldatas).then(function (data) {
  359. $scope.requester = data.list;
  360. });
  361. }
  362. $scope.onChangehandling = function (key) {
  363. var filuser = {
  364. "idx": 0,
  365. "sum": 10,
  366. "requester": {
  367. "name": key
  368. }
  369. }
  370. getUser(filuser);
  371. }
  372. getUser({
  373. "idx": 0,
  374. "sum": 10
  375. });
  376. //搜索
  377. $scope.chiceIncident = function (item) {
  378. // var fildata = {};
  379. // if (sessionStorage.searchincident) {
  380. // fildata = JSON.parse(sessionStorage.getItem("searchchart"));
  381. // $scope.gridOptions.paginationCurrentPage = 1;
  382. // fildata.idx = 0;
  383. // } else {
  384. // fildata = defaultFilterData;
  385. // }
  386. // if (!fildata.incident) {
  387. // fildata['wxincident'] = {};
  388. // }
  389. // if (item.createTime) {
  390. // item.createTime = moment(item.createTime).format('YYYY-MM-DD HH:mm:ss');
  391. // }
  392. // if (item.createTimeEnd) {
  393. // item.createTimeEnd = moment(new Date(item.createTimeEnd).getTime() + 86399999).format('YYYY-MM-DD HH:mm:ss');
  394. // }
  395. // angular.extend(fildata.wxincident, item)
  396. // sessionStorage['searchchart'] = angular.copy(JSON.stringify(fildata));
  397. // $scope.memoryfilterData = fildata;
  398. if ($scope.fileData.wxincident.createTime) {
  399. $scope.fileData.wxincident.createTime = moment($scope.fileData.wxincident.createTime).format('YYYY-MM-DD HH:mm:ss');
  400. }
  401. if ($scope.fileData.wxincident.createTimeEnd) {
  402. $scope.fileData.wxincident.createTimeEnd = moment($scope.fileData.wxincident.createTimeEnd).format('YYYY-MM-DD HH:mm:ss');
  403. }
  404. $scope.refreshData('expand-right', $scope.fileData);
  405. }
  406. $scope.gridOptions.onRegisterApi = function (gridApi) {
  407. $scope.gridApi = gridApi;
  408. gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
  409. var filtersData = $scope.memoryfilterData;
  410. filtersData.idx = newPage - 1;
  411. filtersData.sum = pageSize;
  412. $scope.fileData.idx = newPage - 1;
  413. $scope.fileData.sum = pageSize;
  414. $scope.refreshData('expand-right', $scope.fileData);
  415. // if (JSON.parse(sessionStorage.getItem("searchchart")).idx != filtersData.idx) {
  416. // $scope.refreshData('expand-right', filtersData);
  417. // }
  418. // $scope.refreshData('expand-right', filtersData);
  419. });
  420. $scope.selected = {
  421. items: []
  422. }
  423. };
  424. $scope.memoryfilterData = defaultFilterData = {
  425. // "assignee":$rootScope.user.id,
  426. // "candidateGroups":$rootScope.user.group[0].id,
  427. "idx": 0,
  428. "wxincident": {
  429. "serviceState": { "id": 1650 }
  430. },
  431. "sum": mun
  432. };
  433. //收集搜索数据
  434. $scope.fileData = {
  435. "idx": 0,
  436. "wxincident": {
  437. "serviceState": { "id": 1650 }
  438. },
  439. "sum": 10
  440. }
  441. $scope.selectRowFunction = function (data) {
  442. var formdata = {
  443. 'model': {
  444. 'incident': {
  445. 'requester': data.requester,
  446. 'area': data.place.area,
  447. 'place': data.place,
  448. 'houseNumber': data.address,
  449. 'contacts': data.contacts,
  450. 'contactsInformation': data.contactsInformation,
  451. // 'category': data.wxIncidentClassifyDTO.category,
  452. 'description': data.incidentDescription,
  453. 'source': {
  454. 'id': 1549
  455. },
  456. 'sourceType': data.sourceType,
  457. 'fileUrl': data.fileUrl
  458. },
  459. 'requestershow': data.requester,
  460. 'flow': data.id
  461. }
  462. }
  463. // if (data.requester.requesterTypeDTO && data.requester.requesterTypeDTO.id == 2) {
  464. // angular.extend(formdata.model.incident, { 'priority': { 'id': 2 } });
  465. // }
  466. $state.go('app.incident.chart', {
  467. 'model': JSON.stringify(formdata)
  468. });
  469. };
  470. $scope.lookFunction = function (data) {
  471. // // var data = row.entity;
  472. // var formdata = {
  473. // 'model': {
  474. // 'incident': {
  475. // 'requester': data.requester,
  476. // 'area': data.place.area.area,
  477. // 'place': data.place.place,
  478. // 'houseNumber': data.address,
  479. // 'contacts': data.contacts,
  480. // 'contactsInformation': data.contactsInformation,
  481. // // 'category': data.wxIncidentClassifyDTO.category,
  482. // 'incidentState':data.incidentState,
  483. // 'description': data.incidentDescription,
  484. // 'source': {
  485. // 'id': 1549
  486. // },
  487. // 'sourceType': data.sourceType,
  488. // 'fileUrl': data.fileUrl
  489. // },
  490. // 'requestershow': data.requester,
  491. // 'flow': data.id
  492. // }
  493. // }
  494. // var modelfile = {
  495. // model: {
  496. // incident: data
  497. // }
  498. // };
  499. // if (data.incidentState.name == "未受理") {
  500. // angular.extend(modelfile.model, {
  501. // 'gourl': 'app.incident.chart',
  502. // 'state_model': formdata
  503. // })
  504. // angular.extend(modelfile.model.incident, {
  505. // status: 1
  506. // })
  507. // } else {
  508. // angular.extend(modelfile.model.incident, {
  509. // status: 0
  510. // })
  511. // }
  512. // $state.go('app.desk.form_editor', {
  513. // formKey: 'desk_detail',
  514. // service: 'api_user_data',
  515. // model: JSON.stringify(modelfile)
  516. // });
  517. $state.go('app.desk.detail', {
  518. model: JSON.stringify(data)
  519. });
  520. };
  521. $scope.toHandleFunction = function (data) {
  522. // var data = row.entity;
  523. console.log(data)
  524. var formdata = {
  525. 'model': {
  526. 'incident': {
  527. 'requester': data.requester,
  528. // 'area': data.place.area.area,
  529. // 'place': data.place.place,
  530. 'houseNumber': data.address,
  531. 'contacts': data.contacts,
  532. 'contactsInformation': data.contactsInformation,
  533. // 'category': data.wxIncidentClassifyDTO.category,
  534. 'incidentState': data.incidentState,
  535. 'description': data.incidentDescription,
  536. 'source': {
  537. 'id': 1549
  538. },
  539. 'sourceType': data.sourceType,
  540. 'fileUrl': data.fileUrl
  541. },
  542. 'requestershow': data.requester,
  543. 'flow': data.id,
  544. 'retractReason': data.retractReason
  545. }
  546. }
  547. var modelfile = {
  548. model: {
  549. incident: data
  550. }
  551. };
  552. // if (data.incidentState.name == "未受理") {
  553. angular.extend(modelfile.model, {
  554. 'gourl': 'app.incident.chart',
  555. 'state_model': formdata
  556. })
  557. angular.extend(modelfile.model.incident, {
  558. status: 1
  559. })
  560. // } else {
  561. // angular.extend(modelfile.model.incident, {
  562. // status: 0
  563. // })
  564. // }
  565. $state.go('app.desk.form_editor', {
  566. formKey: 'desk_detail',
  567. service: 'api_user_data',
  568. model: JSON.stringify(modelfile)
  569. });
  570. };
  571. $scope.seeIncidentFunction = function (data) {
  572. // console.log(data);
  573. $state.go('app.incident.detail', {
  574. formKey: 'incident_back',
  575. pdKey: 'incident',
  576. dataId: data.incident.id,
  577. taskId: data.incident.taskId,
  578. processInstanceId: data.incident.processInstanceId,
  579. isChart: "ok"
  580. });
  581. }
  582. //重置
  583. $scope.cleanItem = function () {
  584. delete $scope.fileData.wxincident.contacts;
  585. delete $scope.fileData.wxincident.contactsInformation;
  586. delete $scope.fileData.wxincident.createTime;
  587. delete $scope.fileData.wxincident.createTimeEnd;
  588. delete $scope.fileData.wxincident.departmentDTO;
  589. $scope.ksModel = '';
  590. $scope.refreshData('expand-right', $scope.fileData);
  591. }
  592. // $scope.followFunction = function(data){
  593. // //console.log('data='+JSON.stringify(data));
  594. // $state.go('app.detail', { formKey:'statusform', pdKey:'incident', dataId: data.id,processInstanceId: data.processInstanceId});
  595. // };
  596. // $scope.onDblClick = function (row) {
  597. // var data = row.entity;
  598. // var formdata = {
  599. // 'model': {
  600. // 'incident': {
  601. // 'requester': data.requester,
  602. // 'area': data.area,
  603. // 'place': data.place,
  604. // 'houseNumber': data.address,
  605. // 'contacts': data.contacts,
  606. // 'contactsInformation': data.contactsInformation,
  607. // // 'category': data.wxIncidentClassifyDTO.category,
  608. // 'description': data.incidentDescription,
  609. // 'source': {
  610. // 'id': 4
  611. // },
  612. // 'sourceType': data.sourceType,
  613. // 'fileUrl': data.fileUrl
  614. // },
  615. // 'requestershow': data.requester,
  616. // 'flow': data.id
  617. // }
  618. // }
  619. // var modelfile = {
  620. // model: {
  621. // incident: row.entity
  622. // }
  623. // };
  624. // if (row.entity.state == "未受理") {
  625. // angular.extend(modelfile.model, {
  626. // 'gourl': 'app.incident.chart',
  627. // 'state_model': formdata
  628. // })
  629. // angular.extend(modelfile.model.incident, {
  630. // status: 1
  631. // })
  632. // } else {
  633. // angular.extend(modelfile.model.incident, {
  634. // status: 0
  635. // })
  636. // }
  637. // $state.go('app.desk.form_editor', {
  638. // formKey: 'desk_detail',
  639. // service: 'api_user_data',
  640. // model: JSON.stringify(modelfile)
  641. // });
  642. // };
  643. var defaultFilterData = {
  644. // "assignee":$rootScope.user.id,
  645. // "candidateGroups":$rootScope.user.group[0].id,
  646. "idx": 0,
  647. "wxincident": {
  648. "serviceState": { "id": 1650 }
  649. },
  650. "sum": mun
  651. };
  652. $scope.ldloading = {};
  653. $scope.refreshData = function (style, filterData) {
  654. $scope.ldloading[style.replace('-', '_')] = true;
  655. // if (angular.isUndefined(filterData)) {
  656. // filterData = defaultFilterData;
  657. // }
  658. if (angular.isUndefined(filterData)) {
  659. // if (sessionStorage.searchchart) {
  660. // filterData = JSON.parse(sessionStorage.getItem("searchchart"));
  661. // $scope.searchkeys = filterData.wxincident;
  662. // // $scope.searchstate = filterData.state;
  663. // $scope.gridOptions.paginationCurrentPage = 1 + filterData.idx;
  664. // $scope.searchstate = filterData.wxincident.searchType;
  665. // } else {
  666. filterData = defaultFilterData;
  667. // }
  668. }
  669. $scope.myData = [];
  670. $scope.gridOptions['sum'] = filterData.sum;
  671. sessionStorage['searchchart'] = angular.copy(JSON.stringify(filterData));
  672. //科室列表选中数据,请求参数判断
  673. if ($scope.repairMain.valueconfig == 2 && $scope.ksModel != '') {//报修科室且不是空字符
  674. $scope.fileData.wxincident.departmentDTO = {
  675. dept: $scope.ksModel
  676. }
  677. }
  678. //搜索接口
  679. api_bpm_data.fetchDataList("wxincident", filterData).then(function (data) {
  680. // console.log(filterData)
  681. var myData = Restangular.stripRestangular(data);
  682. for (var i = 0; i < myData.list.length; i++) {
  683. myData.list[i].createTime = moment(myData.list[i].createTime).format('YYYY-MM-DD HH:mm:ss')
  684. }
  685. $scope.gridOptions['totalItems'] = myData.totalNum;
  686. $scope.myData = myData.list;
  687. for (var i = 0; i < $scope.myData.length; i++) {
  688. $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum
  689. }
  690. // console.log($scope.myData)
  691. $scope.ldloading[style.replace('-', '_')] = false;
  692. }, function () {
  693. $scope.ldloading[style.replace('-', '_')] = false;
  694. });
  695. };
  696. $scope.refreshData2 = function (style, filterData) {
  697. $scope.ldloading[style.replace('-', '_')] = true;
  698. // if (angular.isUndefined(filterData)) {
  699. // filterData = defaultFilterData;
  700. // }
  701. if (angular.isUndefined(filterData)) {
  702. // if (sessionStorage.searchchart) {
  703. // filterData = JSON.parse(sessionStorage.getItem("searchchart"));
  704. // $scope.searchkeys = filterData.wxincident;
  705. // // $scope.searchstate = filterData.state;
  706. // $scope.gridOptions.paginationCurrentPage = 1 + filterData.idx;
  707. // $scope.searchstate = filterData.wxincident.searchType;
  708. // } else {
  709. filterData = defaultFilterData;
  710. // }
  711. }
  712. // $scope.myData = [];
  713. $scope.gridOptions['sum'] = filterData.sum;
  714. sessionStorage['searchchart'] = angular.copy(JSON.stringify(filterData));
  715. api_bpm_data.fetchDataList("wxincident", filterData).then(function (data) {
  716. console.log(222)
  717. var myData = Restangular.stripRestangular(data);
  718. for (var i = 0; i < myData.list.length; i++) {
  719. myData.list[i].createTime = moment(myData.list[i].createTime).format('YYYY-MM-DD HH:mm:ss')
  720. }
  721. $scope.gridOptions['totalItems'] = myData.totalNum;
  722. $scope.myData = myData.list;
  723. for (var i = 0; i < $scope.myData.length; i++) {
  724. $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum
  725. }
  726. // console.log($scope.myData)
  727. $scope.ldloading[style.replace('-', '_')] = false;
  728. }, function () {
  729. $scope.ldloading[style.replace('-', '_')] = false;
  730. });
  731. };
  732. $scope.timer = $interval(function () {
  733. $scope.refreshData2('expand-right', $scope.fileData);
  734. }, $rootScope.refreshTime);
  735. console.log($state.params);
  736. if($state.params.tab){
  737. if($state.params.tab == '-1'){
  738. $scope.searchstate = '';
  739. $scope.fileData.wxincident = {};
  740. }else{
  741. $scope.searchstate = $state.params.tab;
  742. $scope.fileData.wxincident.serviceState.id = $scope.searchstate;
  743. }
  744. }else{
  745. //默认未转换
  746. $scope.searchstate = 1650;
  747. if (sessionStorage.getItem('jry_data')) {
  748. $scope.searchstate = sessionStorage.getItem('jry_data');
  749. $scope.fileData.wxincident.serviceState.id = sessionStorage.getItem('jry_data');
  750. }
  751. }
  752. $scope.$on('$destroy', function () {
  753. sessionStorage.setItem('jry_data', $scope.searchstate);
  754. $interval.cancel($scope.timer)
  755. });
  756. $scope.refreshData('expand-right', $scope.fileData);
  757. }]);
  758. app.controller('Wechatoperator', ['$rootScope', '$http', '$scope', '$modal', function ($rootScope, $http, $scope, $modal) {
  759. $scope.handle = false;
  760. $scope.see = false;
  761. $scope.toHandle = false;
  762. var loginUser = $rootScope.user;
  763. $scope.chuli = false;
  764. for (var i = 0; i < loginUser.menu.length; i++) {
  765. if (loginUser.menu[i].link == "weixinbaozhang_chuli") {
  766. $scope.chuli = true
  767. }
  768. }
  769. if ($scope.item.serviceState.name == "已转换") {
  770. $scope.toHandle = true;
  771. } else {
  772. $scope.toHandle = false;
  773. }
  774. if ($scope.item.serviceState.name == "未转换") {
  775. $scope.handle = true;
  776. } else {
  777. $scope.handle = false;
  778. }
  779. if ($scope.item.serviceState.name == "已转换" || $scope.item.serviceState.name == "不受理" || $scope.item.serviceState.name == "未转换") {
  780. $scope.see = true;
  781. } else {
  782. $scope.see = false;
  783. }
  784. $scope.edit = function () {
  785. $scope.colobject.grid.appScope.selectRowFunction($scope.item);
  786. // $scope.doEdit($scope.item.id);
  787. }
  788. //查看,查看详情
  789. $scope.look = function () {
  790. $scope.colobject.grid.appScope.lookFunction($scope.item);
  791. // $scope.doEdit($scope.item.id);
  792. }
  793. //处理
  794. $scope.handleFn = function () {
  795. $scope.colobject.grid.appScope.toHandleFunction($scope.item);
  796. // $scope.doEdit($scope.item.id);
  797. }
  798. //查看事件
  799. $scope.seeIncident = function () {
  800. $scope.colobject.grid.appScope.seeIncidentFunction($scope.item);
  801. // $scope.doEdit($scope.item.id);
  802. }
  803. }]);
  804. app.directive('wechatoperator', function () {
  805. return {
  806. restrict: 'E',
  807. scope: {
  808. item: '=',
  809. colobject: '='
  810. },
  811. controller: 'Wechatoperator',
  812. template: '<div class="links cl-effect-1 ui-grid-cell-contents pull-left" >' +
  813. // '<a ng-click="edit()" ng-show="{{handle}}" tooltip="生成事件" tooltip-placement="left">生成事件</a>' +
  814. // '<a ng-click="edit()" class="bianjifont">生成事件</a>' +
  815. '<a ng-click="handleFn()" ng-show="{{handle&&chuli}}" class="bianjifont">处理</a>' +
  816. '<a ng-click="look()" ng-show="{{see}}" class="bianjifont">查看</a>' +
  817. // '<a ng-click="look()" ng-show="{{toHandle}}" class="bianjifont">查看详情</a>' +
  818. '<a ng-click="seeIncident()" ng-show="{{toHandle}}" class="bianjifont">查看事件</a>' +
  819. // '<a ng-click="look()" ng-show="{{handle}}" tooltip="查看" tooltip-placement="right"><i class="ti-eye"></i></a>' +
  820. '</div>'
  821. };
  822. });
  823. // app.factory('myFactory', function() {
  824. // //定义factory返回对象
  825. // var myServices = {};
  826. // //定义参数对象
  827. // var myObject = {};
  828. // var _set = function(data) {
  829. // myObject = data;
  830. // };
  831. // })