chartCtrl.js 31 KB

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