chartCtrl.js 32 KB

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