chartCtrl.js 33 KB

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