incidentCtrl.js 105 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590
  1. 'use strict';
  2. app.controller('incidentListCtrl', ["$scope", "$http", "i18nService", "$rootScope", "$state", "$timeout", "moment", "$interval", "$modal", "$stateParams", "SweetAlert", "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_bpm_domain", "api_text", "api_bpm_data", "api_user_data", "api_configure_data", '$parse', "$injector", "$aside", 'toaster', "api_configure_form", "api_cmdb", 'api_bpm', 'api_wechatfile','api_search_area','api_bpm_schedule','api_statistic','api_flow', 'api_simple', function ($scope, $http, i18nService, $rootScope, $state, $timeout, moment, $interval, $modal, $stateParams, SweetAlert, uiGridConstants, uiGridGroupingConstants, Restangular, api_bpm_domain, api_text, api_bpm_data, api_user_data, api_configure_data, $parse, $injector, $aside, toaster, api_configure_form, api_cmdb, api_bpm, api_wechatfile,api_search_area,api_bpm_schedule,api_statistic,api_flow,api_simple) {
  3. //保存报修主体
  4. $scope.repairMain = JSON.parse(sessionStorage.getItem("repair_main"));
  5. $scope.wxIncidentWithCmdb = JSON.parse(sessionStorage.getItem("wxIncidentWithCmdb"));//资产
  6. $scope.incidentWithConsumable = JSON.parse(sessionStorage.getItem("incidentWithConsumable"));//耗材
  7. $rootScope.isFuwutai = JSON.parse(localStorage.getItem("isFuwutai")) ? true : false;
  8. // ----------------分割线 start-----------------
  9. console.log($state)
  10. // 显示隐藏
  11. $scope.isDeployment = false;
  12. $scope.deploymentHandler = function(){
  13. $scope.isDeployment = !$scope.isDeployment;
  14. console.log($('#filterSearch .incidentsearch:gt(7)'));
  15. if($scope.isDeployment){
  16. $('#filterSearch .incidentsearch:gt(7)').css('display', 'inline-block');
  17. }else{
  18. $('#filterSearch .incidentsearch:gt(7)').css('display', 'none');
  19. }
  20. }
  21. // -----------------分割线 end----------------
  22. // 是否逾期seimin
  23. $scope.selectType = [
  24. // { id: '2', name: '是' },
  25. // { id: '0', name: '否' }
  26. ];
  27. $scope.getOverdueState = function () {
  28. var data = {
  29. key: "overdue_state",
  30. type: "list",
  31. };
  32. api_wechatfile.getDictionary(data).then(function (res) {
  33. $scope.selectType = res;
  34. });
  35. };
  36. $scope.getOverdueState();
  37. $scope.tabs = [
  38. // {key: 'all', value: '全部事件', num: ''},
  39. {key: 'todo', value: '待我接单', num: ''},
  40. {key: 'doing', value: '待我处理', num: ''},
  41. // {key: 'reassign', value: '重新指派', num: ''},
  42. // {key: 'callback', value: '待我回访', num: ''},
  43. {key: 'resolve', value: '由我解决', num: ''},
  44. {key: 'owns', value: '与我关联', num: ''},
  45. {key: 'storage', value: '暂存', num: ''},
  46. ]
  47. // /是否逾期
  48. $scope.langs = i18nService.getAllLangs();
  49. $scope.lang = 'zh-cn';
  50. i18nService.setCurrentLang($scope.lang);
  51. $scope.myData = [];
  52. var loginUser = $rootScope.user;
  53. $scope.allFlag = false;//全部事件
  54. $scope.daochu = false;//导出
  55. $scope.huifang = false;//回访
  56. for (var i = 0; i < loginUser.menu.length; i++) {
  57. if (loginUser.menu[i].link == "shijianliebiao_all") {
  58. $scope.allFlag = true;
  59. $scope.tabs.splice(0, 0 , {key: 'all', value: '全部事件', num: ''});
  60. }
  61. if (loginUser.menu[i].link == "shijianliebiao_huifang") {
  62. $scope.huifang = true;
  63. let index = $scope.tabs.findIndex(v => v.key == 'resolve');
  64. $scope.tabs.splice(index, 0 , {key: 'callback', value: '待我回访', num: ''});
  65. }
  66. if (loginUser.menu[i].link == "shijianliebiao_reassign") {
  67. $scope.huifang = true;
  68. let index = $scope.tabs.findIndex(v => v.key == 'doing');
  69. $scope.tabs.splice(index + 1, 0 , {key: 'reassign', value: '重新指派', num: ''});
  70. }
  71. if (loginUser.menu[i].link == "shijianliebiao_daochu") {
  72. $scope.daochu = true
  73. }
  74. }
  75. var loginuserGroup = "";
  76. for (var i = 0; i < $rootScope.user.group.length; i++) {
  77. if (i == 0) {
  78. loginuserGroup = $rootScope.user.group[i].id;
  79. } else {
  80. loginuserGroup = loginuserGroup + "," + $rootScope.user.group[i].id;
  81. }
  82. }
  83. // 处理人,受理人,转派人
  84. var pdKey = $state.current.pdKey;
  85. $scope.gridOptions = {};
  86. $scope.gridOptions.data = 'myData';
  87. $scope.gridOptions.rowHeight = 54;
  88. $scope.gridOptions.enableColumnResizing = true;
  89. $scope.gridOptions.enableFiltering = false;
  90. $scope.gridOptions.enableGridMenu = true;
  91. $scope.gridOptions.enableSelectAll = true;
  92. $scope.gridOptions.enableRowSelection = true;
  93. $scope.gridOptions.showGridFooter = true;
  94. $scope.gridOptions.showColumnFooter = false;
  95. $scope.gridOptions.fastWatch = true;
  96. $scope.gridOptions.enableSorting = true;
  97. $scope.gridOptions.useExternalSorting = true;
  98. $scope.gridOptions.useExternalFiltering = false;
  99. $scope.gridOptions.useExternalPagination = true;
  100. $scope.gridOptions.paginationPageSizes = [10, 20, 50, 100];
  101. $scope.gridOptions.paginationPageSize = 10;
  102. $scope.gridOptions.multiSelect = true;
  103. var mun = $scope.gridOptions.paginationPageSize;
  104. $scope.gridOptions.rowTemplate = "<div ng-click=\"onDblClick(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>";
  105. $scope.gridOptions.rowIdentity = function (row) {
  106. return row.id;
  107. };
  108. $scope.gridOptions.getRowIdentity = function (row) {
  109. return row.id;
  110. };
  111. $scope.transferColor = function (item) {
  112. var color = "icon iconfont icon-zhengchang greenfont";
  113. if (item.colourInfo) {
  114. if (item.colourInfo.id == 1583) {
  115. color = "icon iconfont icon-yiyuqi redfont";
  116. } else if (item.colourInfo.id == 1584) {
  117. color = "iconfont icon-yuqixinxiu orangefont";
  118. }
  119. }
  120. return color;
  121. }
  122. $scope.transfertip = function (item) {
  123. var tip = "正常";
  124. if (item.colourInfo) {
  125. if (item.colourInfo.id == 1583) {
  126. tip = "已逾期";
  127. } else if (item.colourInfo.id == 1584) {
  128. tip = "即将逾期";
  129. } else if (item.colourInfo.id == 1586) {
  130. tip = "正常";
  131. }
  132. }
  133. return tip;
  134. }
  135. $scope.transferstatus = function (item) {
  136. var statecolor = "#fc4c58";
  137. if (item.id == 2) { //待处理
  138. statecolor = "#fc4c58";
  139. } else if (item.id == 7) { //待审核
  140. statecolor = "#fcb44c";
  141. } else if (item.id == 3) { //请求重新指派
  142. statecolor = "#ebf902";
  143. } else if (item.id == 4) { //处理中
  144. statecolor = "#0aa5f5";
  145. } else if (item.id == 5) { //已解决
  146. statecolor = "#2edbb8";
  147. } else if (item.id == 6) { //已关闭
  148. statecolor = "#bbbbbb";
  149. }
  150. return statecolor;
  151. }
  152. if($scope.repairMain.valueconfig == 1){//报修人
  153. $scope.gridOptions.columnDefs = [
  154. {
  155. name: 'id',
  156. displayName: '',
  157. width: 35,
  158. cellTemplate: '<div>' +
  159. '<div class="ui-grid-cell-contents" tooltip={{grid.appScope.transfertip(row.entity)}} tooltip-placement="right"><i style="font-size: 18px !important;" class="{{grid.appScope.transferColor(row.entity)}}"></i></div></div>' +
  160. '</div>'
  161. },
  162. {
  163. name: 'item',
  164. displayName: '序号',
  165. width: 45,
  166. cellTemplate: '<div>' +
  167. '<div class="ui-grid-cell-contents">{{row.entity.item}}</div>' +
  168. '</div>'
  169. },
  170. {
  171. name: 'incidentsign',
  172. displayName: '事件单号',
  173. width: 120,
  174. cellTemplate: '<div>' +
  175. '<div class="ui-grid-cell-contents">{{row.entity.incidentsign}}</div>' +
  176. '</div>'
  177. },
  178. {
  179. name: 'requester.name',
  180. displayName: '报修人',
  181. width: '6%',
  182. minWidth: '90',
  183. enableSorting: false,
  184. cellTemplate: '<div>' +
  185. '<div class="ui-grid-cell-contents" >{{row.entity.requester.name}}</div>' +
  186. '</div>'
  187. },
  188. {
  189. name: 'requester.account',
  190. displayName: '学工号',
  191. width: '6%',
  192. minWidth: '90',
  193. enableSorting: false,
  194. cellTemplate: '<div>' +
  195. '<div class="ui-grid-cell-contents" >{{row.entity.requester.account}}</div>' +
  196. '</div>'
  197. },
  198. {
  199. name: 'contactsInformation',
  200. displayName: '联系电话',
  201. width: '105',
  202. cellTemplate: '<div>' +
  203. '<div class="ui-grid-cell-contents">{{row.entity.contactsInformation}}</div>' +
  204. '</div>'
  205. },
  206. {
  207. name: 'category',
  208. displayName: '故障现象',
  209. width: '10%',
  210. enableSorting: false,
  211. cellTemplate: '<div>' +
  212. '<div class="ui-grid-cell-contents">{{row.entity.category.category}}</div>' +
  213. '</div>'
  214. },
  215. {
  216. name: 'houseNumber',
  217. displayName: '区域地点',
  218. width: '14%',
  219. enableFiltering: false,
  220. cellTemplate: '<div><div class="ui-grid-cell-contents" ng-bind-html="grid.appScope.areaplace(row.entity)"></div></div>'
  221. },
  222. {
  223. name: 'acceptUser.name',
  224. displayName: '受理人',
  225. width: '7%',
  226. minWidth: '80',
  227. enableSorting: false,
  228. cellTemplate: '<div>' +
  229. '<div class="ui-grid-cell-contents" >{{row.entity.acceptUser.name}}</div>' +
  230. '</div>'
  231. },
  232. {
  233. name: 'acceptDate',
  234. displayName: '登记时间',
  235. width: '10%',
  236. minWidth: '140',
  237. enableFiltering: false,
  238. cellTemplate: '<div><div class="ui-grid-cell-contents">{{grid.appScope.transferTime(row.entity.acceptDate)}}</div></div>'
  239. },
  240. {
  241. name: 'groupORHandlerUser',
  242. displayName: '处理人/组',
  243. width: '10%',
  244. enableFiltering: false,
  245. cellTemplate: '<div>' +
  246. '<div class="ui-grid-cell-contents">' +
  247. '{{row.entity.groupORHandlerUser}}</div>' +
  248. '</div>'
  249. },
  250. {
  251. name: 'state.name',
  252. displayName: '状态',
  253. width: '7%',
  254. minWidth: '70',
  255. enableSorting: false,
  256. cellTemplate: '<div>' +
  257. '<div class="ui-grid-cell-contents" >{{row.entity.state.name}}</div>' +
  258. '</div>'
  259. },
  260. {
  261. name: '操作',
  262. enableSorting: false,
  263. width: 500,
  264. cellTemplate: '<incidentoperator style="background-color:{{row.entity.colourInfo.rgb}}" item="row.entity" colobject="col">',
  265. enableFiltering: false
  266. },
  267. ];
  268. if($scope.wxIncidentWithCmdb==1){
  269. let index = $scope.gridOptions.columnDefs.findIndex(v=>v.name == 'contactsInformation');
  270. $scope.gridOptions.columnDefs.splice(index,0,{
  271. name: 'assetId',
  272. displayName: '资产',
  273. width: 120
  274. },)
  275. }
  276. }else if($scope.repairMain.valueconfig == 2){//报修科室
  277. $scope.gridOptions.columnDefs = [
  278. {
  279. name: 'id',
  280. displayName: '',
  281. width: 35,
  282. cellTemplate: '<div style="width: 100%;">' +
  283. '<div class="ui-grid-cell-contents" tooltip={{grid.appScope.transfertip(row.entity)}} tooltip-placement="right"><i style="font-size: 18px !important;" class="{{grid.appScope.transferColor(row.entity)}}"></i></div></div>' +
  284. '</div>'
  285. },
  286. {
  287. name: 'row1',
  288. displayName: '序号',
  289. width: 45,
  290. cellTemplate: '<div style="width: 100%;">' +
  291. '<div class="ui-grid-cell-contents">{{row.entity.item}}</div>' +
  292. '</div>'
  293. },
  294. {
  295. name: 'row2',
  296. displayName: '单号|报修科室',
  297. width: 150,
  298. cellTemplate: '<div style="width: 100%;">' +
  299. '<div class="ui-grid-cell-contents">{{row.entity.incidentsign || "无"}}<br>{{row.entity.department ? row.entity.department.dept : "无"}}</div>' +
  300. '</div>'
  301. },
  302. {
  303. name: 'row3',
  304. displayName: '报修人|来电电话',
  305. width: 150,
  306. cellTemplate: '<div style="width: 100%;">' +
  307. '<div class="ui-grid-cell-contents">{{row.entity.requester ? row.entity.requester.name : "无"}}<br>{{row.entity.incomingPhone || "无"}}<a ng-click="grid.appScope.play(row.entity)" ng-if="row.entity.callID" tooltip="播放录音" tooltip-placement="left"><i class="ti-microphone"></i></a></div>' +
  308. '</div>'
  309. },
  310. {
  311. name: 'row5',
  312. displayName: '故障现象|区域地点',
  313. width: 350,
  314. cellTemplate: '<div style="width: 100%;">' +
  315. '<div class="ui-grid-cell-contents"><span title="{{row.entity.description}}">{{row.entity.description}}</span><br><span ng-bind-html="grid.appScope.areaplace(row.entity)"></span></div>' +
  316. '</div>'
  317. },
  318. {
  319. name: 'row6',
  320. displayName: '受理人|处理人/组',
  321. width: 150,
  322. cellTemplate: '<div style="width: 100%;">' +
  323. '<div class="ui-grid-cell-contents">{{row.entity.acceptUser ? row.entity.acceptUser.name : "无"}}<br><span tooltip="{{grid.appScope.transferSynergetic(row.entity)}}" tooltip-placement="top">{{grid.appScope.transferSynergetic(row.entity)}}</span></div>' +
  324. '</div>'
  325. },
  326. {
  327. name: 'row7',
  328. displayName: '登记时间|接单时间',
  329. width: 150,
  330. cellTemplate: '<div style="width: 100%;">' +
  331. '<div class="ui-grid-cell-contents">{{grid.appScope.transferTime(row.entity.acceptDate)}}<br>{{grid.appScope.transferTime(row.entity.responseHandleTime)}}</div>' +
  332. '</div>'
  333. },
  334. {
  335. name: 'row9',
  336. displayName: '状态|解决时间',
  337. width: 150,
  338. cellTemplate: '<div style="width: 100%;">' +
  339. '<div class="ui-grid-cell-contents" ><span ng-switch="row.entity.state.value"><span ng-switch-when="pending" style="color:orange;">{{row.entity.state.name}}</span><span ng-switch-when="resolved" style="color:green;">{{row.entity.state.name}}</span><span ng-switch-when="handler" style="font-weight:bold;">{{row.entity.state.name}}</span><span ng-switch-default>{{row.entity.state.name}}</span></span><br>{{grid.appScope.transferTime(row.entity.handleTime)}}</div>' +
  340. '</div>'
  341. },
  342. {
  343. name: 'row10',
  344. displayName: '最近维修记录',
  345. width: 140,
  346. cellTemplate: '<div style="width: 100%;">' +
  347. '<div class="ui-grid-cell-contents" ng-bind-html="grid.appScope.transferHandlerLog(row.entity.currentLog)"></div>' +
  348. '</div>'
  349. },
  350. {
  351. name: '操作',
  352. enableSorting: false,
  353. width: 196,
  354. cellTemplate: '<incidentoperator style="background-color:{{row.entity.colourInfo.rgb}}" item="row.entity" colobject="col">',
  355. enableFiltering: false
  356. },
  357. ];
  358. }
  359. $scope.transferTime = function (time) {
  360. if(time){
  361. return moment(time).format('YYYY-MM-DD HH:mm');
  362. }else{
  363. return '无';
  364. }
  365. }
  366. // 转换协同人
  367. $scope.transferSynergetic = function(incidentData){
  368. let str = incidentData.groupORHandlerUser || "";
  369. if(incidentData.synergetic && incidentData.synergetic.length){
  370. str += ',' + incidentData.synergetic.map(v => v.name).join(',');
  371. }
  372. return str;
  373. }
  374. $scope.transferHandlerLog = function (currentLog) {
  375. if(!currentLog){
  376. return '无';
  377. }
  378. currentLog = angular.copy(currentLog);
  379. if(currentLog.extra1DTO && currentLog.extra2 && currentLog.startTime){
  380. return currentLog.extra1DTO.name+"<br>"+ moment(currentLog.startTime).add(+currentLog.extra2, 'days').format('MM月DD日前完成');
  381. }else{
  382. return '无';
  383. }
  384. }
  385. $scope.endOpen = function ($event) {
  386. $event.preventDefault();
  387. $event.stopPropagation();
  388. $scope.startOpened = false;
  389. $scope.endOpened = !$scope.endOpened;
  390. };
  391. $scope.startOpen = function ($event) {
  392. $event.preventDefault();
  393. $event.stopPropagation();
  394. $scope.endOpened = false;
  395. $scope.startOpened = !$scope.startOpened;
  396. };
  397. $scope.othcode = {};
  398. $scope.searchkeys = {};
  399. // 是否选择已删除
  400. $scope.selectDeleted = function(e){
  401. console.log($scope.searchkeys.deleteFlag);
  402. $scope.chiceIncident($scope.searchkeys,$scope.othcode.state);
  403. }
  404. $scope.my_data = [];
  405. function convertListToTree(data, treeMap) {
  406. var idToNodeMap = {}; //Keeps track of nodes using id as key, for fast lookup
  407. var root = null; //Initially set our loop to null
  408. var parentNode = null;
  409. //loop over data
  410. for (var i = 0; i < data.length; i++) {
  411. var datum = data[i];
  412. //each node will have children, so let's give it a "children" poperty
  413. datum.children = [];
  414. //add an entry for this node to the map so that any future children can
  415. //lookup the parent
  416. idToNodeMap[datum.id] = datum;
  417. //Does this node have a parent?
  418. if (typeof datum.parent === "undefined" || datum.parent == null) {
  419. //Doesn't look like it, so this node is the root of the tree
  420. root = datum;
  421. treeMap[datum.id] = root;
  422. } else {
  423. //This node has a parent, so let's look it up using the id
  424. parentNode = idToNodeMap[datum.parent.id];
  425. //We don't need this property, so let's delete it.
  426. delete datum.parent;
  427. //Let's add the current node as a child of the parent node.
  428. parentNode.children.push(datum);
  429. }
  430. }
  431. return root;
  432. }
  433. function convertParentToChildList(data) {
  434. var treeMap = {};
  435. var list = [];
  436. convertListToTree(data, treeMap);
  437. angular.forEach(treeMap, function (item) {
  438. list.push(item);
  439. });
  440. return list;
  441. }
  442. $scope.my_tree = {};
  443. $scope.select_treedata = [];
  444. // 报修科室
  445. $scope.getDept = function (key) {
  446. var postData = {
  447. "idx": 0,
  448. "sum": 10
  449. }
  450. if (key) {
  451. postData.department = { dept: key }
  452. }
  453. api_user_data.fetchDataList('department', postData).then(function (response) {
  454. if (response) {
  455. if (response.status = 200) {
  456. $scope.department = response.list;
  457. }
  458. }
  459. })
  460. }
  461. $scope.getDept();
  462. //树形图
  463. // 将故障现象搜索结果返回的数据整理成children模式
  464. function transform(nodes) {
  465. var treeConverter = {
  466. result: null, //转化后的结果,是根节点,所有节点都是从根节点长出来的
  467. attributeName: 'id', //节点唯一标识符
  468. needFind: true, //是否查询节点在result中已经存在,为了优化效率
  469. transform: function (node) { //转化递归函数,参数:一个待插入节点
  470. if (node.parent != null) { //该节点有父节点
  471. var newNode = this.transform(node.parent); //递归进入,返回值为一个节点,用作父节点,该父节点必然存在于result中,这点由下面的算法可以控制
  472. if (this.needFind) {
  473. for (var i = 0; i < newNode.children.length; i++) { //查找要插入的node子节点是否在newNode这个父节点中存在
  474. if (newNode.children[i][this.attributeName] === node[this.attributeName]) {
  475. return newNode.children[i]; //存在的话直接返回newNode父节点内的该子节点,该子节点必然存在于result中,作为返回值它将被用作上级递归的newNode,因此newNode必然存在于result中
  476. }
  477. }
  478. }
  479. this.needFind = false; //不存在的话,关闭之后递归的循环判断,因为待插入node节点不存在于result中,故而它的子节点一定不存在于result中,不用再循环判断
  480. // delete node.parent; //删除该节点的parent属性,如果有的话
  481. node.children = []; //因为确定是要新插入的节点,没有children:[]属性,故给该节点增加children:[]属性
  482. newNode.children.push(node); //将该node节点push进newNode的子节点数组中
  483. return node; //return该新插入节点,作为递归返回值给上层,用作newNode父节点,node存在于result中故newNode存在于result中
  484. } else if (node.parent == null) { //该叶节点没有父节点,即为根节点
  485. // delete node.parent; //删除该节点的parent属性,如果有的话
  486. if (this.result == null) { //根节点不存在
  487. node.children = []; //给该节点增加children:[]属性
  488. return this.result = node; //该节点赋给result,并return根节点,作为返回值它将被用作上级递归的newNode,因此newNode必然存在于result中
  489. } else {
  490. node.children = [];
  491. // 顶级去重
  492. for (var i = 0; i < this.result.children.length; i++) {
  493. if (this.result.children[i][this.attributeName] === node[this.attributeName]) {
  494. return this.result.children[i];
  495. }
  496. }
  497. this.result.children.push(node)
  498. return node // 直接return根节点,作为返回值它将被用作上级递归的newNode,因此newNode必然存在于result中
  499. }
  500. }
  501. },
  502. getWhole: function (nodes, attributeName) { //传入整个叶子节点数组,attributeName作为节点唯一标识符属性,返回整个转化结果
  503. var _node = {};
  504. _node.children = [];
  505. this.result = _node; //重置根节点
  506. this.attributeName = attributeName == null ? 'id' : attributeName; //唯一标识符默认为“id”
  507. nodes = JSON.parse(JSON.stringify(nodes)); //复制出一个新的节点对象作为参数,保证不改变原有数据
  508. nodes.forEach(item => { //循环调用转化方法
  509. this.needFind = true; //重置开启节点是否已存在判断,保证不插入重复节点
  510. this.transform(item);
  511. })
  512. return this.result; //返回根节点
  513. }
  514. }
  515. var result = treeConverter.getWhole(nodes); //调用
  516. return result;
  517. }
  518. $scope.my_tree = {};
  519. $rootScope.bala1 = $scope.try_async_load = function (s, fn) {
  520. if (s) {
  521. var filterKeyword = s.filterKeyword;
  522. }
  523. var postData = {
  524. "idx": 0,
  525. "sum": 1000,
  526. "incidentcategory": {},
  527. }
  528. if (filterKeyword) {
  529. postData.incidentcategory = { selectType: "pinyin_qs", category: filterKeyword }
  530. }
  531. // 当前所属院区或责任科室
  532. if($rootScope.user.duty){
  533. postData.incidentcategory.duty = $rootScope.user.duty.id;
  534. }else if($rootScope.user.branch){
  535. postData.incidentcategory.branch = $rootScope.user.branch.id;
  536. }
  537. $scope.my_data = [];
  538. $scope.doing_async = true;
  539. api_bpm_data.fetchDataList('incidentcategory', postData).then(function (response) {
  540. if (response.status == 200) {
  541. var data = response.list;
  542. if (filterKeyword) {
  543. data.forEach(e => {
  544. e.isExpanded = true;
  545. })
  546. var li = transform(data).children;
  547. console.log(li)
  548. fn(li)
  549. return;
  550. } else {
  551. var objects = [];
  552. for (var i = 0; i < data.length; i++) {
  553. var object = {};
  554. object.id = data[i].id;
  555. object.parent = data[i].parent;
  556. object.category = data[i].category;
  557. object.isExpanded = true;
  558. objects.push(object);
  559. }
  560. $scope.my_data = convertParentToChildList(objects);
  561. $scope.select_treedata = angular.copy($scope.my_data);
  562. }
  563. if ($scope.my_data.length > 0) {
  564. $scope.doing_async = false;
  565. }
  566. } else {
  567. SweetAlert.swal({
  568. title: "系统错误!",
  569. text: "请刷新重试!",
  570. type: "error"
  571. });
  572. }
  573. });
  574. };
  575. $scope.my_data = [];
  576. function convertListToTree(data, treeMap) {
  577. var idToNodeMap = {}; //Keeps track of nodes using id as key, for fast lookup
  578. var root = null; //Initially set our loop to null
  579. var parentNode = null;
  580. //loop over data
  581. for (var i = 0; i < data.length; i++) {
  582. var datum = data[i];
  583. //each node will have children, so let's give it a "children" poperty
  584. datum.children = [];
  585. //add an entry for this node to the map so that any future children can
  586. //lookup the parent
  587. idToNodeMap[datum.id] = datum;
  588. //Does this node have a parent?
  589. if (typeof datum.parent === "undefined" || datum.parent == null) {
  590. //Doesn't look like it, so this node is the root of the tree
  591. root = datum;
  592. treeMap[datum.id] = root;
  593. } else {
  594. //This node has a parent, so let's look it up using the id
  595. parentNode = idToNodeMap[datum.parent.id];
  596. //We don't need this property, so let's delete it.
  597. delete datum.parent;
  598. //Let's add the current node as a child of the parent node.
  599. parentNode.children.push(datum);
  600. }
  601. }
  602. return root;
  603. }
  604. function convertParentToChildList(data) {
  605. var treeMap = {};
  606. var list = [];
  607. convertListToTree(data, treeMap);
  608. angular.forEach(treeMap, function (item) {
  609. list.push(item);
  610. });
  611. return list;
  612. }
  613. $scope.try_async_load();
  614. // 故障现象
  615. $scope.onFilterCallback = function (item) {
  616. console.log(item);
  617. if (item.item) {
  618. $scope.searchkeys.levelCategory = item = undefined;
  619. } else {
  620. $scope.searchkeys.levelCategory = item;
  621. }
  622. }
  623. //状态
  624. $scope.state = [];
  625. $scope.getIncidentStatus = function(){
  626. api_wechatfile.getDictionary({
  627. "type": "list",
  628. "key": "incident_status"
  629. }).then(function (response) {
  630. $scope.state = response || [];
  631. if(window.sessionStorage.getItem('isGoyuqi') === 'yes'){
  632. $scope.selectTypeChange(true);
  633. }else{
  634. $scope.refreshData('expand-right', undefined, true);
  635. }
  636. })
  637. }
  638. $scope.clear = function () {
  639. $scope.searchkeys = {};
  640. $scope.othcode = {};
  641. $scope.try_async_load();
  642. defaultFilterData = {
  643. idx: 0,
  644. sum: mun
  645. }
  646. $scope.refreshData('expand-right');
  647. $interval.cancel($scope.timer);
  648. $scope.timer = $interval(function () {
  649. $scope.jry_refresh()
  650. }, $rootScope.refreshTime);
  651. }
  652. // 刷新
  653. $scope.jry_refresh = function () {
  654. var fildata = defaultFilterData;
  655. if (fildata.incident && fildata.incident.category) {
  656. delete fildata.incident.category
  657. }
  658. fildata.idx = $scope.jry_idx;
  659. fildata.sum = $scope.jry_sum;
  660. $scope.refreshData('expand-right', fildata);
  661. console.log($scope.cifilter_classic);
  662. }
  663. // 搜索
  664. $scope.chiceIncident = function (item, stateid, isInit) {
  665. if (stateid && stateid.id) {
  666. item.statusId = stateid.id;
  667. } else {
  668. item.statusId = undefined;
  669. }
  670. console.log(item)
  671. var fildata = defaultFilterData;
  672. if (!fildata.incident) {
  673. fildata['incident'] = {};
  674. }
  675. if (item.acceptDate) {
  676. item.acceptDate = moment(item.acceptDate).format('YYYY-MM-DD 00:00:00');
  677. }
  678. if (item.acceptDateEnd) {
  679. item.acceptDateEnd = moment(item.acceptDateEnd).format('YYYY-MM-DD 23:59:59')
  680. }
  681. var transitiondata = angular.copy(item);
  682. angular.extend(fildata.incident, transitiondata)
  683. $scope.memoryfilterData = fildata;
  684. console.log(fildata,78777);
  685. // if($scope.searchstate === 'all'){
  686. // if(fildata.incident&&fildata.incident.selectType){
  687. // fildata.incident.selectType = fildata.incident.selectType.id;
  688. // }
  689. // }else{
  690. // if(fildata.incident&&fildata.incident.selectType){
  691. // delete fildata.incident.selectType;
  692. // }
  693. // }
  694. if(fildata.incident&&fildata.incident.selectType){
  695. fildata.incident.selectType = fildata.incident.selectType.id;
  696. }
  697. // /seimin
  698. $scope.refreshData('expand-right', fildata, isInit);
  699. $interval.cancel($scope.timer);
  700. $scope.timer = $interval(function () {
  701. $scope.jry_refresh()
  702. }, $rootScope.refreshTime);
  703. }
  704. //区域地点过滤
  705. api_user_data.fetchDataList('area', {
  706. "idx": 0,
  707. "sum": 1000
  708. }).then(function (response) {
  709. if (response) {
  710. if (response.status = 200) {
  711. $scope.outarea = response.list;
  712. }
  713. }
  714. })
  715. //报修人
  716. var getRequester = function () {
  717. api_user_data.fetchDataList('user', {
  718. idx: 0,
  719. sum: 100,
  720. user:{
  721. engineer: undefined,
  722. }
  723. }).then(function (data) {
  724. // console.log(data);
  725. $scope.requester = data.list
  726. });
  727. }
  728. $scope.repairMain.valueconfig == 1 && getRequester();
  729. //受理人,处理人
  730. var getUser = function (fieldatas, it) {
  731. api_user_data.fetchDataList('user', fieldatas).then(function (data) {
  732. if (it == 1) {
  733. $scope.acceptUser = data.list;
  734. } else if (it == 2) {
  735. $scope.handlingPersonnelUser = data.list;
  736. }
  737. });
  738. }
  739. //受理人过滤
  740. $scope.onChangeacceptUser = function (key) {
  741. console.log(key)
  742. var filuser = {
  743. "idx": 0,
  744. "sum": 10,
  745. "user": {
  746. "name": key,
  747. 'selectType': "pinyin_qs",
  748. engineer: 1,
  749. }
  750. }
  751. getUser(filuser, 1);
  752. }
  753. //处理人过滤
  754. $scope.onChangehandling = function (key) {
  755. var filuser = {
  756. "idx": 0,
  757. "sum": 10,
  758. "user": {
  759. "name": key,
  760. 'selectType': "pinyin_qs",
  761. engineer: 1,
  762. }
  763. }
  764. getUser(filuser, 2);
  765. }
  766. //报修科室过滤
  767. $scope.onChangeDept = function (key) {
  768. $scope.getDept(key)
  769. }
  770. //地点区域过滤
  771. $scope.onChangearea = function (data) {
  772. delete $scope.searchkeys.place;
  773. if ($scope.memoryfilterData.incident) {
  774. delete $scope.memoryfilterData.incident.place;
  775. }
  776. var fildata = {
  777. "idx": 0,
  778. "sum": 1000,
  779. "place": {
  780. area: {
  781. id: data.area.id
  782. }
  783. }
  784. };
  785. api_user_data.fetchDataList('place', fildata).then(function (response) {
  786. if (response) {
  787. if (response.status = 200) {
  788. $scope.outplace = response.list;
  789. }
  790. }
  791. })
  792. };
  793. $scope.starttime = function (data) {
  794. return moment(new Date(data)).format('YYYY-MM-DD')
  795. }
  796. $scope.overtime = function (data) {
  797. return moment(new Date(data)).format('YYYY-MM-DD HH:mm')
  798. }
  799. $scope.areaplace = function (data) {
  800. var str = '';
  801. str += '<strong>' + data.branchName + '</strong>';
  802. str += (data.place ? (data.place.area ? data.place.area.area : '') : '');
  803. str += (data.place ? (data.place.place ? data.place.place : '') : '');
  804. str += (data.houseNumber ? data.houseNumber : '');
  805. return str || '无';
  806. }
  807. //录音
  808. $scope.play = function (data) {
  809. console.log(data.callID)
  810. var modalInstance = $modal.open({
  811. backdrop: "static",
  812. templateUrl: 'assets/views/incident/tpl/audio.html',
  813. controller: function ($rootScope, $scope, $modalInstance, $sce, $http, api_bpm_data) {
  814. // $rootScope.setbusy();
  815. $scope.datasurl = "";
  816. api_bpm_data.fetchDataList("callrecord", {idx: 0, sum: 1, callrecord: {callAccept: data.callID}}).then(function(data) {
  817. if(data.status == 200){
  818. data.list = data.list || [];
  819. if(data.list.length){
  820. $scope.audioUrl = $sce.trustAsResourceUrl(callIp+data.list[0].recordingFileName);
  821. }
  822. }
  823. });
  824. $scope.download = function (contentId, filename) {
  825. $http({
  826. url: "http://" + $scope.datasurl,
  827. method: 'GET',
  828. headers: {
  829. 'Content-type': 'application/octet-stream',
  830. },
  831. responseType: 'arraybuffer'
  832. }).success(function (data, status, headers, config) {
  833. var file = new Blob([data], {
  834. type: 'application/octet-stream'
  835. });
  836. //trick to download store a file having its URL
  837. var fileURL = URL.createObjectURL(file);
  838. var a = document.createElement('a');
  839. a.href = fileURL;
  840. a.target = '_blank';
  841. a.download = filename;
  842. document.body.appendChild(a);
  843. a.click();
  844. }).error(function (data, status, headers, config) {
  845. // console.log(data);
  846. });
  847. }
  848. $scope.cancel = function () {
  849. $modalInstance.dismiss('cancel');
  850. };
  851. $modalInstance.close();
  852. },
  853. });
  854. modalInstance.result.then(function (result) {}, function (reason) {});
  855. };
  856. //列表排序
  857. $scope.gridOptions.onRegisterApi = function (gridApi) {
  858. $scope.gridApi = gridApi;
  859. var index = 0;
  860. var oldheader = {};
  861. gridApi.grid.sortColumn = function (gridApi) {
  862. if (oldheader.field) {
  863. if (oldheader.field == gridApi.field) {
  864. } else {
  865. index = 0;
  866. }
  867. }
  868. index++;
  869. oldheader = gridApi;
  870. var fildata = $scope.memoryfilterData;
  871. if (index % 3 == 0) {
  872. delete $scope.memoryfilterData.incident;
  873. fildata = $scope.memoryfilterData;
  874. } else if (index % 3 == 1) {
  875. if (fildata.incident) {
  876. if (gridApi.field == "acceptDate") {
  877. angular.extend(fildata.incident, {
  878. "sort": gridApi.field
  879. });
  880. } else {
  881. angular.extend(fildata.incident, {
  882. "sort": gridApi.field + " desc , _incident.acceptDate"
  883. });
  884. }
  885. } else {
  886. if (gridApi.field == "acceptDate") {
  887. angular.extend(fildata, {
  888. 'incident': {
  889. "sort": gridApi.field
  890. }
  891. });
  892. } else {
  893. angular.extend(fildata, {
  894. 'incident': {
  895. "sort": gridApi.field + " desc , _incident.acceptDate"
  896. }
  897. });
  898. }
  899. }
  900. } else if (index % 3 == 2) {
  901. if (fildata.incident) {
  902. if (gridApi.field == "acceptDate") {
  903. angular.extend(fildata.incident, {
  904. "sort": gridApi.field,
  905. "order": "asc"
  906. });
  907. } else {
  908. angular.extend(fildata.incident, {
  909. "sort": gridApi.field + " asc , _incident.acceptDate"
  910. });
  911. }
  912. } else {
  913. if (gridApi.field == "acceptDate") {
  914. angular.extend(fildata, {
  915. 'incident': {
  916. "sort": gridApi.field,
  917. "order": "asc"
  918. }
  919. });
  920. } else {
  921. angular.extend(fildata.incident, {
  922. "sort": gridApi.field + " asc , _incident.acceptDate"
  923. });
  924. }
  925. }
  926. }
  927. $scope.refreshData('expand-right', fildata);
  928. }
  929. $scope.jry_idx = 0;
  930. $scope.jry_sum = 10;
  931. gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
  932. var filtersData = $scope.memoryfilterData;
  933. filtersData.idx = newPage - 1;
  934. $scope.jry_idx = newPage - 1;
  935. filtersData.sum = pageSize;
  936. $scope.jry_sum = pageSize;
  937. $scope.refreshData('expand-right', filtersData);
  938. });
  939. $scope.Change = function (upTypes) {
  940. if (angular.isDefined($scope.selected.items)) {
  941. if (angular.isDefined(upTypes) && upTypes == 'upincident') {
  942. var data = {
  943. cancelUrl: 'app.incident.list',
  944. model: {
  945. problem: {
  946. title: $scope.selected.items.title,
  947. des: $scope.selected.items.description,
  948. proposePerson: $scope.selected.items.handlerUser,
  949. source: {
  950. id: 1,
  951. code: 1,
  952. name: ' 事件 '
  953. },
  954. incident: $scope.selected.items
  955. }
  956. }
  957. }
  958. $state.go('app.problem.incident', {
  959. pdKey: 'incident',
  960. dataId: $scope.selected.items.id,
  961. processInstanceId: $scope.selected.items.processInstanceId,
  962. 'model': JSON.stringify(data)
  963. });
  964. } else if (angular.isDefined(upTypes) && upTypes == 'upchange') {
  965. var data = {
  966. cancelUrl: 'app.incident.list',
  967. model: {
  968. change: {
  969. title: $scope.selected.items.title,
  970. description: $scope.selected.items.description,
  971. requestingPerson: $scope.selected.items.handlerUser,
  972. source: {
  973. id: 1,
  974. code: 1,
  975. name: ' 事件 '
  976. },
  977. incident: $scope.selected.items
  978. }
  979. }
  980. }
  981. // var data={cancelUrl:'app.incident.list'}
  982. $state.go('app.change.incident', {
  983. pdKey: 'incident',
  984. dataId: $scope.selected.items.id,
  985. processInstanceId: $scope.selected.items.processInstanceId,
  986. 'model': JSON.stringify(data)
  987. });
  988. }
  989. }
  990. }
  991. $scope.selected = {
  992. items: []
  993. }
  994. gridApi.core.on.filterChanged($scope, function () {
  995. var grid = this.grid;
  996. if ($rootScope.user.group) {
  997. var filtersData = {
  998. idx: 0,
  999. sum: mun
  1000. };
  1001. } else {
  1002. var filtersData = {
  1003. idx: 0,
  1004. sum: mun
  1005. };
  1006. }
  1007. angular.forEach(grid.columns, function (item) {
  1008. if (item.enableFiltering) {
  1009. if (angular.isDefined(item.filters[0].term) && item.filters[0].term != '') {
  1010. filtersData = $scope.memoryfilterData
  1011. if (angular.isUndefined(filtersData['incident'])) {
  1012. filtersData['incident'] = {};
  1013. }
  1014. if (item.field == 'department.dept') {
  1015. filtersData['incident']['department'] = {};
  1016. filtersData.incident.department['department'] = item.filters[0].term;
  1017. } else if (item.field == 'handlingPersonnelUser.name') {
  1018. filtersData['incident']['handlingPersonnelUser'] = {};
  1019. filtersData.incident.handlingPersonnelUser['name'] = item.filters[0].term;
  1020. } else if (item.field == 'requester.account') {
  1021. filtersData['incident']['requester'] = {};
  1022. filtersData.incident.requester['account'] = item.filters[0].term;
  1023. } else if (item.field == 'acceptUser.name') {
  1024. filtersData['incident']['acceptUser'] = {};
  1025. filtersData.incident.acceptUser['name'] = item.filters[0].term;
  1026. } else {
  1027. filtersData['incident'][item.field] = item.filters[0].term;
  1028. }
  1029. }
  1030. }
  1031. });
  1032. filtersData.idx = 0;
  1033. $scope.memoryfilterData = filtersData;
  1034. $scope.refreshData('expand-right', filtersData);
  1035. });
  1036. };
  1037. //处理
  1038. $scope.selectRowFunction = function (model) {
  1039. console.log(model)
  1040. var modalInstance = $modal.open({
  1041. backdrop: false,
  1042. templateUrl: 'assets/views/incident/tpl/doing.tpl.html',
  1043. controller: function ($scope,$rootScope, $modalInstance,FileUploader, api_bpm_domain, modelData, currentUserId, Alert, api_user_data,api_category) {
  1044. console.log(model,loginUser);
  1045. $scope.model = model;
  1046. $scope.postData = {
  1047. handleCategory: undefined,
  1048. closecode: undefined,
  1049. handleDescription: '',
  1050. synergetic: [],
  1051. }
  1052. $scope.incidentHandleCategoryList = [];
  1053. $scope.incidentClosecodeList = [];
  1054. $scope.synergeticList = [];
  1055. // 附件上传--start
  1056. //附件上传数据
  1057. let uploader = ($scope.uploader = new FileUploader({url: "/uploader"}));
  1058. // FILTERS
  1059. uploader.filters.push({
  1060. name: "customFilter",
  1061. fn: function (item /*{File|FileLikeObject}*/, options) {
  1062. return this.queue.length < 10;
  1063. },
  1064. });
  1065. // CALLBACKS
  1066. uploader.onWhenAddingFileFailed = function (
  1067. item /*{File|FileLikeObject}*/,
  1068. filter,
  1069. options
  1070. ) {
  1071. console.info("onWhenAddingFileFailed", item, filter, options);
  1072. };
  1073. uploader.onAfterAddingFile = function (fileItem) {
  1074. console.log(fileItem.file)
  1075. console.info("onAfterAddingFile", fileItem);
  1076. if (fileItem.file.size >= 1024 * 1024 * 10) {
  1077. alert("文件不能大于10MB");
  1078. fileItem.uploader.queue.pop();
  1079. console.log($scope);
  1080. }
  1081. if (
  1082. fileItem.file.type !== 'text/plain'
  1083. && fileItem.file.type !== 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
  1084. && fileItem.file.type !== 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
  1085. && fileItem.file.type !== 'application/pdf'
  1086. && fileItem.file.type !== 'application/vnd.ms-excel'
  1087. && fileItem.file.type !== 'application/msword'
  1088. ) {
  1089. alert("只能上传word,excel,pdf,txt");
  1090. fileItem.uploader.queue.pop();
  1091. console.log($scope);
  1092. }
  1093. };
  1094. uploader.onAfterAddingAll = function (addedFileItems) {
  1095. console.info("onAfterAddingAll", addedFileItems);
  1096. };
  1097. uploader.onBeforeUploadItem = function (item) {
  1098. console.info("onBeforeUploadItem", item);
  1099. };
  1100. uploader.onProgressItem = function (fileItem, progress) {
  1101. console.info("onProgressItem", fileItem, progress);
  1102. };
  1103. uploader.onProgressAll = function (progress) {
  1104. console.info("onProgressAll", progress);
  1105. };
  1106. uploader.onSuccessItem = function (
  1107. fileItem,
  1108. response,
  1109. status,
  1110. headers
  1111. ) {
  1112. console.info("onSuccessItem", fileItem, response, status, headers);
  1113. };
  1114. uploader.onErrorItem = function (fileItem, response, status, headers) {
  1115. console.info("onErrorItem", fileItem, response, status, headers);
  1116. };
  1117. uploader.onCancelItem = function (fileItem, response, status, headers) {
  1118. console.info("onCancelItem", fileItem, response, status, headers);
  1119. };
  1120. uploader.onCompleteItem = function (
  1121. fileItem,
  1122. response,
  1123. status,
  1124. headers
  1125. ) {
  1126. console.info("onCompleteItem", fileItem, response, status, headers);
  1127. };
  1128. uploader.onCompleteAll = function () {
  1129. console.info("onCompleteAll");
  1130. };
  1131. // 附件上传--end
  1132. // 获取处理方式
  1133. $scope.getIncidentHandleCategory = function(){
  1134. api_wechatfile.getDictionary({"key":"incident_handleCategory","type":"list"}).then(function (data) {
  1135. $scope.incidentHandleCategoryList = data || [];
  1136. if(!$scope.postData.handleCategory){
  1137. let handleCategory = $scope.incidentHandleCategoryList.find(v => v.value == 'SUPPORT');
  1138. $scope.postData.handleCategory = handleCategory || undefined;
  1139. }
  1140. })
  1141. }
  1142. // 获取处理结果
  1143. $scope.getIncidentClosecode = function(){
  1144. api_wechatfile.getDictionary({"key":"incident_closecode","type":"list"}).then(function (data) {
  1145. $scope.incidentClosecodeList = data || [];
  1146. if(!$scope.postData.closecode){
  1147. let closecode = $scope.incidentClosecodeList.find(v => v.value == '060');
  1148. $scope.postData.closecode = closecode || undefined;
  1149. }
  1150. })
  1151. }
  1152. // 获取协同人
  1153. $scope.getSynergeticList = function(keyword = ''){
  1154. let postData = {
  1155. "idx":0,
  1156. "sum":10,
  1157. "user":{
  1158. currentDuty: model.duty ? model.duty.id : undefined,
  1159. name: keyword,
  1160. selectType: "pinyin_qs",
  1161. engineer: 1,
  1162. roledata: {
  1163. "rolecode": "first-line support"
  1164. },
  1165. }
  1166. };
  1167. api_simple.fetchDataList("user", postData).then(result => {
  1168. if(result.status == 200){
  1169. $scope.synergeticList = result.list || [];
  1170. }else{
  1171. $scope.synergeticList = [];
  1172. }
  1173. })
  1174. }
  1175. // 初始化
  1176. $scope.getIncidentHandleCategory();
  1177. $scope.getIncidentClosecode();
  1178. $scope.getSynergeticList();
  1179. $scope.ok = function () {
  1180. if (!$scope.postData.handleCategory){
  1181. Alert.swal({
  1182. title: "操作失败",
  1183. text: "请选择处理方式!",
  1184. type: "error"
  1185. });
  1186. return;
  1187. }
  1188. if ($scope.model.category.hasSimple != 1 &&!$scope.postData.closecode){
  1189. Alert.swal({
  1190. title: "操作失败",
  1191. text: "请选择处理结果!",
  1192. type: "error"
  1193. });
  1194. return;
  1195. }
  1196. if ($scope.model.category.hasSimple != 1 &&!$scope.postData.handleDescription){
  1197. Alert.swal({
  1198. title: "操作失败",
  1199. text: "请填写处理方案!",
  1200. type: "error"
  1201. });
  1202. return;
  1203. }
  1204. let postData = {incident: {...model, ...{
  1205. handleCategory: $scope.postData.handleCategory,
  1206. closecode: $scope.postData.closecode,
  1207. handleDescription: $scope.postData.handleDescription,
  1208. synergetic: $scope.postData.synergetic.length ? $scope.postData.synergetic : undefined,
  1209. }}};
  1210. $rootScope.isMask = true;
  1211. api_flow.accept("doing", postData).then(function (response) {
  1212. console.log(response)
  1213. $rootScope.isMask = false;
  1214. if (response.state == 200) {
  1215. uploader.onBeforeUploadItem = function (item) {
  1216. angular.extend(item.headers, $rootScope.getSession());
  1217. item.url = api_bpm_domain.uploadAttachmentJryModel("handleAttachment", response.data.id).getRequestedUrl();
  1218. item.formData.push({ 'fileName': item.file.name });
  1219. console.info('onBeforeUploadItem', item);
  1220. };
  1221. uploader.uploadAll();
  1222. Alert.swal({
  1223. title: "操作成功!",
  1224. confirmButtonColor: "#007AFF",
  1225. type: "success"
  1226. });
  1227. $modalInstance.close('success');
  1228. } else {
  1229. Alert.swal({
  1230. title: "操作失败",
  1231. text: "操作失败, 请稍后再试!",
  1232. type: "error"
  1233. });
  1234. }
  1235. });
  1236. }
  1237. $scope.cancel = function () {
  1238. $modalInstance.dismiss('cancel');
  1239. }
  1240. },
  1241. size: 'sm',
  1242. resolve: {
  1243. api_bpm: function () {
  1244. return api_bpm;
  1245. },
  1246. modelData: function () {
  1247. return model;
  1248. },
  1249. currentUserId: function () {
  1250. return loginUser.id;
  1251. },
  1252. Alert: function () {
  1253. return SweetAlert;
  1254. },
  1255. api_user_data: function () {
  1256. return api_user_data;
  1257. }
  1258. }
  1259. });
  1260. modalInstance.result.then(function (selectedItem) {
  1261. if (selectedItem == 'success') {
  1262. $scope.refreshData('expand-right', defaultFilterData);
  1263. }
  1264. });
  1265. };
  1266. //修改
  1267. $scope.changeClick = function (data) {
  1268. // $state.go('app.incident.detail', {
  1269. // formKey: 'incident_change',
  1270. // pdKey: 'incident',
  1271. // dataId: data.id,
  1272. // taskId: data.taskId,
  1273. // processInstanceId: data.processInstanceId
  1274. // });
  1275. $rootScope.newOrder({
  1276. incident: data,
  1277. },'edit')
  1278. };
  1279. //回访
  1280. $scope.visit = function (model) {
  1281. console.log(model)
  1282. var modalInstance = $modal.open({
  1283. backdrop: false,
  1284. templateUrl: 'assets/views/incident/tpl/callback.tpl.html',
  1285. controller: function ($scope,$rootScope, $modalInstance, api_bpm_domain, modelData, currentUserId, Alert, api_user_data,api_category) {
  1286. console.log(model,loginUser);
  1287. $scope.model = model;
  1288. $scope.postData = {
  1289. degree: undefined,
  1290. visitRemarks: '',
  1291. }
  1292. $scope.degreeList = [];
  1293. // 获取满意度评价
  1294. $scope.getDegree = function(){
  1295. api_wechatfile.getDictionary({"key":"incident_degree","type":"list"}).then(function (data) {
  1296. $scope.degreeList = data || [];
  1297. })
  1298. }
  1299. // 获取结果类型
  1300. $scope.getHandleResult = function(){
  1301. api_wechatfile.getDictionary({"key":"incident_handleresult","type":"list"}).then(function (data) {
  1302. $scope.handleResultList = data || [];
  1303. })
  1304. }
  1305. // 初始化
  1306. $scope.getDegree();
  1307. $scope.getHandleResult();
  1308. $scope.ok = function () {
  1309. if (!$scope.postData.degree){
  1310. Alert.swal({
  1311. title: "操作失败",
  1312. text: "请选择满意度评价!",
  1313. type: "error"
  1314. });
  1315. return;
  1316. }
  1317. if (!$scope.postData.handleResult){
  1318. Alert.swal({
  1319. title: "操作失败",
  1320. text: "请选择结果类型!",
  1321. type: "error"
  1322. });
  1323. return;
  1324. }
  1325. let postData = {incident: {...model, ...{
  1326. degree: $scope.postData.degree,
  1327. handleResult: $scope.postData.handleResult,
  1328. visitRemarks: $scope.postData.visitRemarks,
  1329. }}};
  1330. $rootScope.isMask = true;
  1331. api_flow.accept("callback", postData).then(function (response) {
  1332. console.log(response)
  1333. $rootScope.isMask = false;
  1334. if (response.state == 200) {
  1335. Alert.swal({
  1336. title: "操作成功!",
  1337. confirmButtonColor: "#007AFF",
  1338. type: "success"
  1339. });
  1340. $modalInstance.close('success');
  1341. } else {
  1342. Alert.swal({
  1343. title: "操作失败",
  1344. text: "操作失败, 请稍后再试!",
  1345. type: "error"
  1346. });
  1347. }
  1348. });
  1349. }
  1350. $scope.cancel = function () {
  1351. $modalInstance.dismiss('cancel');
  1352. }
  1353. },
  1354. size: 'sm',
  1355. resolve: {
  1356. api_bpm: function () {
  1357. return api_bpm;
  1358. },
  1359. modelData: function () {
  1360. return model;
  1361. },
  1362. currentUserId: function () {
  1363. return loginUser.id;
  1364. },
  1365. Alert: function () {
  1366. return SweetAlert;
  1367. },
  1368. api_user_data: function () {
  1369. return api_user_data;
  1370. }
  1371. }
  1372. });
  1373. modalInstance.result.then(function (selectedItem) {
  1374. if (selectedItem == 'success') {
  1375. $scope.refreshData('expand-right', defaultFilterData);
  1376. }
  1377. });
  1378. };
  1379. //导出
  1380. $scope.export = function () {
  1381. $rootScope.isMask = true;
  1382. console.log($scope.memoryfilterData)
  1383. var filadata = angular.copy($scope.memoryfilterData);
  1384. filadata.sum = 10000;
  1385. console.log($scope.filadata)
  1386. $http({
  1387. url: api_bpm_data.downDataModel("incident", 3).getRequestedUrl(),
  1388. method: 'POST',
  1389. data: JSON.stringify(filadata),
  1390. headers: {
  1391. 'Accept': '*/*'
  1392. },
  1393. responseType: 'arraybuffer'
  1394. }).success(function (data, status, headers, config) {
  1395. $rootScope.isMask = false;
  1396. var file = new Blob([data], {
  1397. type: 'application/vnd.ms-excel'
  1398. });
  1399. //trick to download store a file having its URL
  1400. var fileURL = URL.createObjectURL(file);
  1401. var a = document.createElement('a');
  1402. a.href = fileURL;
  1403. a.target = '_blank';
  1404. a.download = '工单列表.xls';
  1405. document.body.appendChild(a);
  1406. a.click();
  1407. }).error(function (data, status, headers, config) {
  1408. // $scope.ldloading.zoom_in = false;
  1409. console.log(data);
  1410. $rootScope.isMask = false;
  1411. });
  1412. }
  1413. //接单
  1414. $scope.acceptTaskAction = function (model) {
  1415. var modalInstance = $modal.open({
  1416. templateUrl: 'assets/views/incident/tpl/acceptTask.tpl.html',
  1417. controller: function ($scope, $modalInstance, modelData, currentUserId, Alert) {
  1418. $scope.title = "提示";
  1419. $scope.connect = "确认接单?";
  1420. $scope.ok = function () {
  1421. console.log(model);
  1422. $rootScope.isMask = true;
  1423. api_flow.accept("receive", {incident: model}).then(function (response) {
  1424. $rootScope.isMask = false;
  1425. if (response.state == 200) {
  1426. Alert.swal({
  1427. title: "操作成功!",
  1428. confirmButtonColor: "#007AFF",
  1429. type: "success"
  1430. });
  1431. $modalInstance.close('success');
  1432. } else {
  1433. Alert.swal({
  1434. title: "操作失败",
  1435. text: "操作失败, 请稍后再试!",
  1436. type: "error"
  1437. });
  1438. }
  1439. });
  1440. }
  1441. $scope.cancel = function () {
  1442. $modalInstance.dismiss('cancel');
  1443. }
  1444. },
  1445. size: 'sm',
  1446. resolve: {
  1447. modelData: function () {
  1448. return model;
  1449. },
  1450. currentUserId: function () {
  1451. return loginUser.id;
  1452. },
  1453. Alert: function () {
  1454. return SweetAlert;
  1455. }
  1456. }
  1457. });
  1458. modalInstance.result.then(function (selectedItem) {
  1459. if (selectedItem == 'success') {
  1460. $scope.refreshData('expand-right', defaultFilterData);
  1461. }
  1462. });
  1463. }
  1464. // 指派弹窗
  1465. $scope.toAssign = function (model) {
  1466. console.log(model)
  1467. var modalInstance = $modal.open({
  1468. backdrop: false,
  1469. templateUrl: 'assets/views/incident/tpl/toAssign.tpl.html',
  1470. controller: function ($scope,$rootScope, $modalInstance, api_bpm_domain, modelData, currentUserId, Alert, api_user_data,api_category) {
  1471. console.log(model,loginUser);
  1472. //获取组下面的用户
  1473. $scope.getUsers = function(groupId){
  1474. $scope.user = [];
  1475. var postData = {};
  1476. if(groupId){
  1477. postData = {
  1478. "idx": 0,
  1479. "sum": 100,
  1480. user: {
  1481. groupdata:{id:groupId},
  1482. roledata: { rolecode: "first-line support" },
  1483. roledata2: { rolecode: "second-line support" },
  1484. selectType: "1",
  1485. selectDetails:1,
  1486. simple: true,
  1487. }
  1488. }
  1489. }else{
  1490. postData = {
  1491. "idx": 0,
  1492. "sum": 100,
  1493. user: {
  1494. roledata: { rolecode: "first-line support" },
  1495. roledata2: { rolecode: "second-line support" },
  1496. selectType: "1",
  1497. selectDetails:1,
  1498. simple: true,
  1499. engineer: 1,
  1500. }
  1501. }
  1502. }
  1503. api_user_data.fetchDataList('user', postData).then(function (data) {
  1504. $scope.user = data.list;
  1505. })
  1506. }
  1507. $scope.assign = {
  1508. branch:undefined,
  1509. duty:undefined,
  1510. user:undefined,
  1511. group:undefined,
  1512. isRadioUser: 0,
  1513. }
  1514. $scope.hospitalList = [];
  1515. $scope.dutyDeptList = [];
  1516. $scope.user = [];
  1517. $scope.group = [];
  1518. $scope.isShowRadioUser = false;
  1519. // 修改是否指派到人
  1520. $scope.changeRadioUser = function(){
  1521. $scope.assign.user = undefined;
  1522. }
  1523. // 获取院区
  1524. $scope.getHospitals = function(){
  1525. //跨科室转派
  1526. api_user_data.fetchDataList('branch', {
  1527. "idx": 0,
  1528. "sum": 100
  1529. }).then(function (data) {
  1530. if(data.status == 200){
  1531. $scope.hospitalList = data.list;
  1532. if($scope.assign.duty){
  1533. $scope.assign.branch = $scope.hospitalList.find(v=>v.id == $scope.assign.duty.branch);
  1534. }else{
  1535. if($rootScope.user.duty){
  1536. // 当前的所属责任科室
  1537. $scope.assign.branch = $scope.hospitalList.find(v=>v.id == $rootScope.user.duty.branch);
  1538. $scope.assign.duty = $rootScope.user.duty;
  1539. $scope.changeDuty();
  1540. }else if($rootScope.user.branch){
  1541. // 当前的所属院区
  1542. $scope.assign.branch = $scope.hospitalList.find(v=>v.id == $rootScope.user.branch.id);
  1543. }
  1544. }
  1545. }else{
  1546. SweetAlert.swal({
  1547. title: "系统错误!",
  1548. text: "请刷新重试!",
  1549. type: "error"
  1550. });
  1551. }
  1552. })
  1553. }
  1554. $scope.getHospitals();
  1555. // 修改院区
  1556. $scope.changeBranch = function(keyword){
  1557. if(keyword === undefined){
  1558. $scope.assign.duty = undefined;
  1559. $scope.dutyDeptList = [];
  1560. $scope.assign.group = undefined;
  1561. $scope.group = [];
  1562. $scope.assign.user = undefined;
  1563. $scope.user = [];
  1564. }
  1565. if(!$scope.assign.branch){
  1566. $scope.dutyDeptList = [];
  1567. return;
  1568. }
  1569. api_user_data.fetchDataList('dutyDepartment', {
  1570. "idx": 0,
  1571. "sum": 100,
  1572. "dutyDepartment":{
  1573. branch:$scope.assign.branch.id,
  1574. dept:keyword,
  1575. selectType: "pinyin_qs"
  1576. }
  1577. }).then(function (data) {
  1578. if(data.status == 200){
  1579. $scope.dutyDeptList = data.list;
  1580. }else{
  1581. SweetAlert.swal({
  1582. title: "系统错误!",
  1583. text: "请刷新重试!",
  1584. type: "error"
  1585. });
  1586. }
  1587. })
  1588. }
  1589. // 修改责任科室
  1590. $scope.changeDuty = function(keyword){
  1591. if(keyword === undefined){
  1592. $scope.assign.user = undefined;
  1593. $scope.user = [];
  1594. $scope.assign.group = undefined;
  1595. $scope.group = [];
  1596. }
  1597. api_user_data.fetchDataList('group', {
  1598. "idx": 0,
  1599. "sum": 9999,
  1600. "group":{
  1601. duty:$scope.assign.duty,
  1602. selectType: "nouser"
  1603. }
  1604. }).then(function (data) {
  1605. if(data.status == 200){
  1606. $scope.group = data.list;
  1607. }else{
  1608. SweetAlert.swal({
  1609. title: "系统错误!",
  1610. text: "请刷新重试!",
  1611. type: "error"
  1612. });
  1613. }
  1614. })
  1615. }
  1616. $scope.changeGroup = function(item){
  1617. // $scope.assign.group = item.id;
  1618. $scope.assign.user = undefined;
  1619. $scope.user = [];
  1620. $scope.getUsers(item.id)
  1621. }
  1622. $scope.ok = function () {
  1623. if ($scope.assign.isRadioUser == 1 && !$scope.assign.user){
  1624. Alert.swal({
  1625. title: "操作失败",
  1626. text: "请选择转派对象信息!",
  1627. type: "error"
  1628. });
  1629. return;
  1630. }
  1631. if ($scope.assign.isRadioUser == 0 && !$scope.assign.group){
  1632. Alert.swal({
  1633. title: "操作失败",
  1634. text: "请选择工作组!",
  1635. type: "error"
  1636. });
  1637. return;
  1638. }
  1639. let postData = {};
  1640. if($scope.assign.user && $scope.assign.user.id){
  1641. // 派人
  1642. postData ={ incident: {...model, ...{assignee: $scope.assign.user.id, duty: $scope.assign.duty}} };
  1643. } else if($scope.assign.group && $scope.assign.group.id){
  1644. // 派组
  1645. postData ={ incident: {...model, ...{candidateGroups: $scope.assign.group.id, duty: $scope.assign.duty}} };
  1646. }
  1647. $rootScope.isMask = true;
  1648. api_flow.accept("assign", postData).then(function (response) {
  1649. console.log(response)
  1650. $rootScope.isMask = false;
  1651. if (response.state == 200) {
  1652. Alert.swal({
  1653. title: "操作成功!",
  1654. confirmButtonColor: "#007AFF",
  1655. type: "success"
  1656. });
  1657. $modalInstance.close('success');
  1658. } else {
  1659. Alert.swal({
  1660. title: "操作失败",
  1661. text: "操作失败, 请稍后再试!",
  1662. type: "error"
  1663. });
  1664. }
  1665. });
  1666. }
  1667. $scope.cancel = function () {
  1668. $modalInstance.dismiss('cancel');
  1669. }
  1670. },
  1671. size: 'sm',
  1672. resolve: {
  1673. api_bpm: function () {
  1674. return api_bpm;
  1675. },
  1676. modelData: function () {
  1677. return model;
  1678. },
  1679. currentUserId: function () {
  1680. return loginUser.id;
  1681. },
  1682. Alert: function () {
  1683. return SweetAlert;
  1684. },
  1685. api_user_data: function () {
  1686. return api_user_data;
  1687. }
  1688. }
  1689. });
  1690. modalInstance.result.then(function (selectedItem) {
  1691. if (selectedItem == 'success') {
  1692. $scope.refreshData('expand-right', defaultFilterData);
  1693. }
  1694. });
  1695. }
  1696. // 转派弹窗
  1697. $scope.toTransfer = function (model) {
  1698. console.log(model)
  1699. var modalInstance = $modal.open({
  1700. backdrop: false,
  1701. templateUrl: 'assets/views/incident/tpl/toTransfer.tpl.html',
  1702. controller: function ($scope,$rootScope, $modalInstance, api_bpm_domain, modelData, currentUserId, Alert, api_user_data,api_category) {
  1703. console.log(model,loginUser);
  1704. $scope.assign = {
  1705. duty:model.duty,
  1706. user:undefined,
  1707. group:undefined,
  1708. isRadioGroup: 0,
  1709. }
  1710. $scope.user = [];
  1711. $scope.group = [];
  1712. //获取责任科室下面的用户
  1713. $scope.getUsers = function(){
  1714. $scope.user = [];
  1715. var postData = {
  1716. "idx": 0,
  1717. "sum": 9999,
  1718. user: {
  1719. currentDuty: $scope.assign.duty.id,
  1720. roledata: { rolecode: "first-line support" },
  1721. roledata2: { rolecode: "second-line support" },
  1722. selectType: "1",
  1723. selectDetails:1,
  1724. simple: true,
  1725. engineer: 1,
  1726. }
  1727. }
  1728. api_user_data.fetchDataList('user', postData).then(function (data) {
  1729. $scope.user = data.list;
  1730. })
  1731. }
  1732. $scope.getUsers();
  1733. //获取责任科室下面的组
  1734. $scope.getGroups = function(){
  1735. $scope.group = [];
  1736. var postData = {
  1737. "idx": 0,
  1738. "sum": 9999,
  1739. group: {
  1740. duty: $scope.assign.duty,
  1741. selectType: "nouser",
  1742. }
  1743. }
  1744. api_user_data.fetchDataList('group', postData).then(function (data) {
  1745. $scope.group = data.list;
  1746. })
  1747. }
  1748. $scope.getGroups();
  1749. // 修改是否转派到组
  1750. $scope.changeRadioGroup = function(){
  1751. $scope.assign.group = undefined;
  1752. $scope.assign.user = undefined;
  1753. }
  1754. $scope.ok = function () {
  1755. if ($scope.assign.isRadioGroup == 0 && !$scope.assign.user){
  1756. Alert.swal({
  1757. title: "操作失败",
  1758. text: "请选择转派对象信息!",
  1759. type: "error"
  1760. });
  1761. return;
  1762. }
  1763. if ($scope.assign.isRadioGroup == 1 && !$scope.assign.group){
  1764. Alert.swal({
  1765. title: "操作失败",
  1766. text: "请选择工作组!",
  1767. type: "error"
  1768. });
  1769. return;
  1770. }
  1771. let postData = {};
  1772. if($scope.assign.user && $scope.assign.user.id){
  1773. // 派人
  1774. postData ={ incident: {...model, ...{assignee: $scope.assign.user.id}} };
  1775. } else if($scope.assign.group && $scope.assign.group.id){
  1776. // 派组
  1777. postData ={ incident: {...model, ...{candidateGroups: $scope.assign.group.id}} };
  1778. }
  1779. $rootScope.isMask = true;
  1780. api_flow.accept("redeploy", postData).then(function (response) {
  1781. console.log(response)
  1782. $rootScope.isMask = false;
  1783. if (response.state == 200) {
  1784. Alert.swal({
  1785. title: "操作成功!",
  1786. confirmButtonColor: "#007AFF",
  1787. type: "success"
  1788. });
  1789. $modalInstance.close('success');
  1790. } else {
  1791. Alert.swal({
  1792. title: "操作失败",
  1793. text: "操作失败, 请稍后再试!",
  1794. type: "error"
  1795. });
  1796. }
  1797. });
  1798. }
  1799. $scope.cancel = function () {
  1800. $modalInstance.dismiss('cancel');
  1801. }
  1802. },
  1803. size: 'sm',
  1804. resolve: {
  1805. api_bpm: function () {
  1806. return api_bpm;
  1807. },
  1808. modelData: function () {
  1809. return model;
  1810. },
  1811. currentUserId: function () {
  1812. return loginUser.id;
  1813. },
  1814. Alert: function () {
  1815. return SweetAlert;
  1816. },
  1817. api_user_data: function () {
  1818. return api_user_data;
  1819. }
  1820. }
  1821. });
  1822. modalInstance.result.then(function (selectedItem) {
  1823. if (selectedItem == 'success') {
  1824. $scope.refreshData('expand-right', defaultFilterData);
  1825. }
  1826. });
  1827. }
  1828. // 删除事件
  1829. $scope.delSj = function(model){
  1830. console.log(model);
  1831. SweetAlert.swal({
  1832. title: "确认删除?",
  1833. text: "删除的数据不可恢复,请确认继续操作!",
  1834. type: "warning",
  1835. showCancelButton: true,
  1836. confirmButtonColor: "#DD6B55",
  1837. confirmButtonText: "继续删除",
  1838. cancelButtonText: "取消操作",
  1839. closeOnConfirm: false,
  1840. closeOnCancel: false
  1841. }, function (isConfirm) {
  1842. if (isConfirm) {
  1843. api_bpm_schedule.del(model.id).then(function (response) {
  1844. if (response.status == 200) {
  1845. SweetAlert.swal("操作成功!", "数据已经被删除.", "success");
  1846. $scope.refreshData('expand-right');
  1847. } else {
  1848. SweetAlert.swal("操作失败!", "数据暂时无法被删除,请稍候重试", "error");
  1849. }
  1850. });
  1851. } else {
  1852. SweetAlert.swal("操作取消", "数据安全", "error");
  1853. }
  1854. });
  1855. }
  1856. // 继续创建
  1857. $scope.storageSj = function(model){
  1858. console.log(model);
  1859. $rootScope.newOrder({incident: model});
  1860. }
  1861. // 新增延期处理弹窗
  1862. $scope.toHandlerLog = function (model) {
  1863. console.log(model)
  1864. var modalInstance = $modal.open({
  1865. backdrop: false,
  1866. templateUrl: 'assets/views/incident/tpl/toHandlerLog.tpl.html',
  1867. controller: function ($scope, $modalInstance, api_bpm_domain,api_bpm_data, modelData, currentUserId, Alert, api_user_data,api_statistic) {
  1868. console.log(model,loginUser);
  1869. $scope.f = {
  1870. maintenanceMode: '',
  1871. estimatedNumberOfDays: ''
  1872. }
  1873. $scope.handlerLog = '';
  1874. $scope.user = [];
  1875. $scope.logs = [];
  1876. $scope.modes = [];
  1877. $scope.getModes=function(){
  1878. var data={
  1879. "idx":0,
  1880. "sum":999,
  1881. dictionary:{key:'repair_type'}
  1882. }
  1883. api_statistic.tableData(data,"dictionary").then(function(res){
  1884. $scope.modes=res.list
  1885. })
  1886. }
  1887. $scope.getModes();
  1888. $scope.getLogs=function(){
  1889. var data={
  1890. "idx":0,
  1891. "sum":999,
  1892. dictionary:{key:'processingLog'}
  1893. }
  1894. api_statistic.tableData(data,"dictionary").then(function(res){
  1895. $scope.logs=res.list
  1896. })
  1897. }
  1898. $scope.getLogs();
  1899. $scope.copyTo = function(value){
  1900. $scope.handlerLog += value;
  1901. }
  1902. $scope.ok = function () {
  1903. if (!$scope.f.maintenanceMode){
  1904. Alert.swal({
  1905. title: "操作失败",
  1906. text: "请选择延期原因!",
  1907. type: "error"
  1908. });
  1909. return;
  1910. }
  1911. if (!$scope.f.estimatedNumberOfDays){
  1912. Alert.swal({
  1913. title: "操作失败",
  1914. text: "请选择延期天数!",
  1915. type: "error"
  1916. });
  1917. return;
  1918. }
  1919. if (!$scope.handlerLog.trim()){
  1920. Alert.swal({
  1921. title: "操作失败",
  1922. text: "请填写延期说明!",
  1923. type: "error"
  1924. });
  1925. return;
  1926. }
  1927. $rootScope.isMask = true;
  1928. api_flow.accept("overtime", {
  1929. incident: {
  1930. ...model,
  1931. ...{
  1932. currentLog: {
  1933. remark: $scope.handlerLog,
  1934. extra1: $scope.f.maintenanceMode.id,
  1935. extra2: $scope.f.estimatedNumberOfDays,
  1936. }
  1937. }
  1938. }
  1939. }).then(function(response){
  1940. console.log(response)
  1941. $rootScope.isMask = false;
  1942. if (response.state == 200) {
  1943. Alert.swal({
  1944. title: "操作成功!",
  1945. confirmButtonColor: "#007AFF",
  1946. type: "success"
  1947. });
  1948. $modalInstance.close('success');
  1949. } else {
  1950. Alert.swal({
  1951. title: "操作失败",
  1952. text: "操作失败, 请稍后再试!",
  1953. type: "error"
  1954. });
  1955. }
  1956. });
  1957. }
  1958. $scope.cancel = function () {
  1959. $modalInstance.dismiss('cancel');
  1960. }
  1961. },
  1962. size: 'lg',
  1963. resolve: {
  1964. api_bpm: function () {
  1965. return api_bpm;
  1966. },
  1967. modelData: function () {
  1968. return model;
  1969. },
  1970. currentUserId: function () {
  1971. return loginUser.id;
  1972. },
  1973. Alert: function () {
  1974. return SweetAlert;
  1975. },
  1976. api_user_data: function () {
  1977. return api_user_data;
  1978. },
  1979. api_statistic: function () {
  1980. return api_statistic;
  1981. }
  1982. }
  1983. });
  1984. modalInstance.result.then(function (selectedItem) {
  1985. if (selectedItem == 'success') {
  1986. $scope.refreshData('expand-right', defaultFilterData);
  1987. }
  1988. });
  1989. }
  1990. // 设置责任科室
  1991. $scope.setDuty = function (model) {
  1992. console.log(model)
  1993. var modalInstance = $modal.open({
  1994. backdrop: false,
  1995. templateUrl: 'assets/views/incident/tpl/setDuty.tpl.html',
  1996. controller: function ($scope,$rootScope, $modalInstance, api_bpm_domain, modelData, currentUserId, Alert, api_user_data,api_category) {
  1997. console.log(model,loginUser);
  1998. $scope.assign = {
  1999. branch:undefined,
  2000. duty:undefined,
  2001. }
  2002. $scope.hospitalList = [];
  2003. $scope.dutyDeptList = [];
  2004. // 获取院区
  2005. $scope.getHospitals = function(){
  2006. //跨科室转派
  2007. api_user_data.fetchDataList('branch', {
  2008. "idx": 0,
  2009. "sum": 100
  2010. }).then(function (data) {
  2011. if(data.status == 200){
  2012. $scope.hospitalList = data.list;
  2013. if($scope.assign.duty){
  2014. $scope.assign.branch = $scope.hospitalList.find(v=>v.id == $scope.assign.duty.branch);
  2015. }else{
  2016. if($rootScope.user.duty){
  2017. // 当前的所属责任科室
  2018. $scope.assign.branch = $scope.hospitalList.find(v=>v.id == $rootScope.user.duty.branch);
  2019. $scope.assign.duty = $rootScope.user.duty;
  2020. }else if($rootScope.user.branch){
  2021. // 当前的所属院区
  2022. $scope.assign.branch = $scope.hospitalList.find(v=>v.id == $rootScope.user.branch.id);
  2023. }
  2024. }
  2025. }else{
  2026. SweetAlert.swal({
  2027. title: "系统错误!",
  2028. text: "请刷新重试!",
  2029. type: "error"
  2030. });
  2031. }
  2032. })
  2033. }
  2034. $scope.getHospitals();
  2035. // 修改院区
  2036. $scope.changeBranch = function(keyword){
  2037. if(keyword === undefined){
  2038. $scope.assign.duty = undefined;
  2039. $scope.dutyDeptList = [];
  2040. }
  2041. if(!$scope.assign.branch){
  2042. $scope.dutyDeptList = [];
  2043. return;
  2044. }
  2045. api_user_data.fetchDataList('dutyDepartment', {
  2046. "idx": 0,
  2047. "sum": 100,
  2048. "dutyDepartment":{
  2049. branch:$scope.assign.branch.id,
  2050. dept:keyword,
  2051. selectType: "pinyin_qs"
  2052. }
  2053. }).then(function (data) {
  2054. if(data.status == 200){
  2055. $scope.dutyDeptList = data.list;
  2056. }else{
  2057. SweetAlert.swal({
  2058. title: "系统错误!",
  2059. text: "请刷新重试!",
  2060. type: "error"
  2061. });
  2062. }
  2063. })
  2064. }
  2065. $scope.ok = function () {
  2066. if (!$scope.assign.duty){
  2067. Alert.swal({
  2068. title: "操作失败",
  2069. text: "请选择责任科室!",
  2070. type: "error"
  2071. });
  2072. return;
  2073. }
  2074. $rootScope.isMask = true;
  2075. api_bpm_domain.changeIncidentDuty({orderId: model.id, dutyId: $scope.assign.duty.id}).then(function (response) {
  2076. console.log(response)
  2077. $rootScope.isMask = false;
  2078. if (response.status == 200) {
  2079. Alert.swal({
  2080. title: "操作成功!",
  2081. confirmButtonColor: "#007AFF",
  2082. type: "success"
  2083. });
  2084. $modalInstance.close('success');
  2085. } else {
  2086. Alert.swal({
  2087. title: "操作失败",
  2088. text: "操作失败, 请稍后再试!",
  2089. type: "error"
  2090. });
  2091. }
  2092. });
  2093. }
  2094. $scope.cancel = function () {
  2095. $modalInstance.dismiss('cancel');
  2096. }
  2097. },
  2098. size: 'sm',
  2099. resolve: {
  2100. api_bpm: function () {
  2101. return api_bpm;
  2102. },
  2103. modelData: function () {
  2104. return model;
  2105. },
  2106. currentUserId: function () {
  2107. return loginUser.id;
  2108. },
  2109. Alert: function () {
  2110. return SweetAlert;
  2111. },
  2112. api_user_data: function () {
  2113. return api_user_data;
  2114. }
  2115. }
  2116. });
  2117. modalInstance.result.then(function (selectedItem) {
  2118. if (selectedItem == 'success') {
  2119. $scope.refreshData('expand-right', defaultFilterData);
  2120. }
  2121. });
  2122. }
  2123. if ($stateParams.model) {
  2124. if (JSON.parse($stateParams.model).searchType && JSON.parse($stateParams.model).searchType != null) {
  2125. $scope.searchstate = JSON.parse($stateParams.model).searchType;
  2126. } else {
  2127. $scope.searchstate = "todo";
  2128. }
  2129. } else {
  2130. $scope.searchstate = "todo";
  2131. }
  2132. if ($rootScope.user.group) {
  2133. var defaultFilterData = {
  2134. "idx": 0,
  2135. "sum": mun
  2136. };
  2137. } else {
  2138. var defaultFilterData = {
  2139. "idx": 0,
  2140. "sum": mun
  2141. };
  2142. }
  2143. if (angular.isDefined($rootScope.search) && angular.isDefined($rootScope.search.incident)) {
  2144. $scope.searchstate = $rootScope.search.incident;
  2145. }
  2146. $scope.ldloading = {};
  2147. //事件类型筛选
  2148. console.log($state);
  2149. if($state.params.tab){
  2150. $scope.searchstate = $state.params.tab;
  2151. }else{
  2152. $scope.searchstate = 'todo';
  2153. }
  2154. $scope.onChange = function (searchstate, isInit) {
  2155. $scope.isDisabledState = false;
  2156. $scope.searchstate = searchstate;
  2157. $scope.chiceIncident($scope.searchkeys,$scope.othcode.state, isInit);
  2158. }
  2159. // 是否逾期下拉框选择
  2160. $scope.selectTypeChange = function(isInit){
  2161. console.log($scope.searchkeys.selectType,66666);
  2162. if(window.sessionStorage.getItem('isGoyuqi') == 'yes'){
  2163. $scope.searchkeys.selectType = $scope.selectType.find(v => v.value == 'unresolved');
  2164. }
  2165. var ids = $scope.searchkeys.selectType.id
  2166. if(defaultFilterData.incident){
  2167. defaultFilterData.incident.selectType = ids;
  2168. }else{
  2169. defaultFilterData.incident = {
  2170. selectType:ids
  2171. };
  2172. }
  2173. console.log(defaultFilterData,2222)
  2174. $scope.onChange('all', isInit);
  2175. }
  2176. //获取列表数据
  2177. $scope.refreshData = _.debounce(function (style, filterData, isInit) {
  2178. $scope.ldloading[style.replace('-', '_')] = true;
  2179. if (angular.isUndefined(filterData)) {
  2180. filterData = defaultFilterData;
  2181. if(isInit){
  2182. if($state.params.tab){
  2183. $scope.searchstate = $state.params.tab;
  2184. filterData.idx = 0;
  2185. $scope.gridOptions.paginationCurrentPage = 1 + filterData.idx;
  2186. }
  2187. if($state.params.date == 'today'){
  2188. $scope.othcode = {};
  2189. $scope.searchkeys.acceptDate = new Date();
  2190. $scope.searchkeys.acceptDateEnd = new Date();
  2191. if(filterData.incident){
  2192. filterData.incident.acceptDate = moment().format('YYYY-MM-DD 00:00:00');
  2193. filterData.incident.acceptDateEnd = moment().format('YYYY-MM-DD 23:59:59');
  2194. }else{
  2195. filterData.incident = {
  2196. acceptDate: moment().format('YYYY-MM-DD 00:00:00'),
  2197. acceptDateEnd: moment().format('YYYY-MM-DD 23:59:59'),
  2198. }
  2199. }
  2200. }else{
  2201. $scope.searchkeys.acceptDate = undefined;
  2202. $scope.searchkeys.acceptDateEnd = undefined;
  2203. }
  2204. if($state.params.state){
  2205. var obj = $scope.state.find(function(v){return $state.params.state == v.id});
  2206. $scope.othcode = {state:obj};
  2207. if(filterData.incident){
  2208. filterData.incident.statusId = $state.params.state;
  2209. }else{
  2210. filterData.incident = {
  2211. statusId: $state.params.state,
  2212. }
  2213. }
  2214. }
  2215. }
  2216. }
  2217. $scope.myData = [];
  2218. $scope.memoryfilterData = filterData;
  2219. $scope.gridOptions['sum'] = filterData.sum;
  2220. // 请求参数调整
  2221. if(!filterData.incident){
  2222. filterData.incident = {};
  2223. }
  2224. if($scope.searchstate === 'all' || $scope.searchstate === 'callback'){
  2225. if($rootScope.user.duty){
  2226. // 当前的所属责任科室
  2227. filterData.incident.duty = $rootScope.user.duty;
  2228. }else if($rootScope.user.branch){
  2229. // 当前的所属院区
  2230. filterData.incident.branch = $rootScope.user.branch.id;
  2231. }
  2232. }else{
  2233. delete filterData.incident.duty;
  2234. delete filterData.incident.branch;
  2235. }
  2236. filterData.incident.queryTask = $scope.searchstate;
  2237. filterData.incident.assignee = loginUser.id;
  2238. if($scope.searchstate === 'todo' || $scope.searchstate === 'owns'){
  2239. filterData.incident.candidateGroups = loginuserGroup;
  2240. }else{
  2241. delete filterData.incident.candidateGroups;
  2242. }
  2243. // 调用接口-查列表
  2244. api_user_data.fetchDataList('incident', filterData).then(function (data) {
  2245. if (data.list) {
  2246. var myData = Restangular.stripRestangular(data);
  2247. $scope.gridOptions['totalItems'] = myData.totalNum;
  2248. $scope.myData = myData.list;
  2249. for (var i = 0; i < $scope.myData.length; i++) {
  2250. $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum
  2251. }
  2252. } else {
  2253. SweetAlert.swal({
  2254. title: "系统错误",
  2255. text: "请稍后再试!",
  2256. type: "error"
  2257. });
  2258. }
  2259. $scope.ldloading[style.replace('-', '_')] = false;
  2260. }, function () {
  2261. $scope.ldloading[style.replace('-', '_')] = false;
  2262. });
  2263. // 获取数量
  2264. $scope.count(filterData.incident, isInit);
  2265. }, 500);
  2266. // 调用接口-查数量
  2267. $scope.count = function (incident = {}){
  2268. let postData = {
  2269. incidentList: [],
  2270. }
  2271. $scope.tabs.forEach(v => {
  2272. postData.incidentList.push({...incident, ...{queryTask: v.key}});
  2273. })
  2274. postData.incidentList.forEach(incident => {
  2275. // 请求参数调整
  2276. if(!incident){
  2277. incident = {};
  2278. }
  2279. if(incident.queryTask === 'all' || incident.queryTask === 'callback'){
  2280. if($rootScope.user.duty){
  2281. // 当前的所属责任科室
  2282. incident.duty = $rootScope.user.duty;
  2283. }else if($rootScope.user.branch){
  2284. // 当前的所属院区
  2285. incident.branch = $rootScope.user.branch.id;
  2286. }
  2287. }else{
  2288. delete incident.duty;
  2289. delete incident.branch;
  2290. }
  2291. incident.assignee = loginUser.id;
  2292. if(incident.queryTask === 'todo' || incident.queryTask === 'owns'){
  2293. incident.candidateGroups = loginuserGroup;
  2294. }else{
  2295. delete incident.candidateGroups;
  2296. }
  2297. })
  2298. api_flow.count(postData).then(function (data) {
  2299. if (data.state == 200) {
  2300. let myData = data.data || {};
  2301. $scope.tabs.forEach(v => {
  2302. v.num = myData[v.key];
  2303. })
  2304. } else {
  2305. SweetAlert.swal({
  2306. title: "系统错误",
  2307. text: "请稍后再试!",
  2308. type: "error"
  2309. });
  2310. }
  2311. });
  2312. }
  2313. // 进入页面时
  2314. $scope.getIncidentStatus();
  2315. $scope.timer = $interval(function () {
  2316. $scope.jry_refresh()
  2317. }, $rootScope.refreshTime);
  2318. $scope.$on('$destroy', function () {
  2319. $interval.cancel($scope.timer)
  2320. });
  2321. }]);
  2322. //操作按钮权限控制
  2323. app.controller('IncidentOperCtrl', ['$rootScope', '$scope', '$state', function ($rootScope, $scope, $state) {
  2324. var loginUser = $rootScope.user;
  2325. $scope.user = $rootScope.user;
  2326. $scope.chuli = false;
  2327. $scope.allFlag = false;
  2328. $scope.qiangdan = false;
  2329. $scope.huifang = false;
  2330. $scope.delFlag = false;
  2331. $scope.storageFlag = false;
  2332. $scope.editFlag = false;//编辑
  2333. $scope.assignFlag = false;//指派
  2334. $scope.transferFlag = false;//转派
  2335. $scope.shijianliebiao_duty = false;//设置责任科室
  2336. for (var i = 0; i < loginUser.menu.length; i++) {
  2337. if (loginUser.menu[i].link == "shijianliebiao_all") {
  2338. $scope.allFlag = true
  2339. }
  2340. if (loginUser.menu[i].link == "shijianliebiao_chuli") {
  2341. $scope.chuli = true
  2342. }
  2343. if (loginUser.menu[i].link == "shijianliebiao_qiangdan") {
  2344. $scope.qiangdan = true
  2345. }
  2346. if (loginUser.menu[i].link == "shijianliebiao_huifang") {
  2347. $scope.huifang = true
  2348. }
  2349. if (loginUser.menu[i].link == "shijianliebiao_del") {
  2350. $scope.delFlag = true
  2351. }
  2352. if (loginUser.menu[i].link == "shijianliebiao_build") {
  2353. $scope.storageFlag = true
  2354. }
  2355. if (loginUser.menu[i].link == "shijianliebiao_edit") {
  2356. $scope.editFlag = true
  2357. }
  2358. if (loginUser.menu[i].link == "shijianliebiao_assign") {
  2359. $scope.assignFlag = true
  2360. }
  2361. if (loginUser.menu[i].link == "shijianliebiao_transfer") {
  2362. $scope.transferFlag = true
  2363. }
  2364. if (loginUser.menu[i].link == "shijianliebiao_duty") {
  2365. $scope.shijianliebiao_duty = true
  2366. }
  2367. }
  2368. $scope.up = true;
  2369. $scope.fuwutaiRenYuan = false;//服务台人员
  2370. for (var i = 0; i < $rootScope.user.role.length; i++) {
  2371. if ($rootScope.user.role[i].role == '事件经理') {
  2372. $scope.up = false;
  2373. }
  2374. if ($rootScope.user.role[i].id == 29701) {
  2375. $scope.fuwutaiRenYuan = true;
  2376. }
  2377. }
  2378. $rootScope.callid = $scope.item.callID;
  2379. if ($scope.item.callID) {
  2380. $scope.item.listen = true;
  2381. } else {
  2382. $scope.item.listen = false;
  2383. }
  2384. $rootScope.user.group.forEach(function (item, v) {
  2385. if($scope.item.currentLog){
  2386. if (item.id == $scope.item.currentLog.groupId) {
  2387. $scope.item.tiquPower = true;
  2388. }
  2389. }
  2390. })
  2391. //修改页面显示判断
  2392. $scope.jry_modify = function (item, user) {
  2393. // 待接单的时候,处理人或处理组
  2394. let flag1 = item.state && item.state.value == 'pending' && ((item.currentLog && item.currentLog.workerId == user.id) || item.tiquPower);
  2395. // 处理中的时候,处理人或处理组
  2396. let flag2 = item.state && item.state.value == 'handler' && item.handlingPersonnelUser && item.handlingPersonnelUser.id == user.id;
  2397. // 不是已关闭,且不是已删除,且不是暂存
  2398. let flag3 = item.deleteFlag !== 1 && item.state.value !== 'close' && item.state.value !== 'storage';
  2399. return flag3 && (($scope.editFlag && $scope.allFlag) || flag1 || flag2 || (item.acceptUser ? item.acceptUser.id == user.id : false));
  2400. }
  2401. // 回访操作权限
  2402. for (var obj in $rootScope.user.role) {
  2403. if ($rootScope.user.role[obj].rolecode == 'call center') {
  2404. if ($scope.item.state && $scope.item.state.value == 'close') {
  2405. $scope.item.huifang = true;
  2406. } else {}
  2407. }
  2408. }
  2409. $scope.edit = function () {
  2410. $scope.colobject.grid.appScope.selectRowFunction($scope.item);
  2411. }
  2412. $scope.changeCenter = function () {
  2413. $scope.colobject.grid.appScope.changeClick($scope.item);
  2414. }
  2415. $scope.visit = function () {
  2416. $scope.colobject.grid.appScope.visit($scope.item);
  2417. }
  2418. // 指派
  2419. $scope.toAssign = function () {
  2420. $scope.colobject.grid.appScope.toAssign($scope.item);
  2421. }
  2422. // 转派
  2423. $scope.toTransfer = function () {
  2424. $scope.colobject.grid.appScope.toTransfer($scope.item);
  2425. }
  2426. // 删除事件
  2427. $scope.delSj = function () {
  2428. $scope.colobject.grid.appScope.delSj($scope.item);
  2429. }
  2430. // 继续创建
  2431. $scope.storageSj = function () {
  2432. $scope.colobject.grid.appScope.storageSj($scope.item);
  2433. }
  2434. // 新增延期处理
  2435. $scope.toHandlerLog = function () {
  2436. $scope.colobject.grid.appScope.toHandlerLog($scope.item);
  2437. }
  2438. // 设置责任科室
  2439. $scope.setDuty = function () {
  2440. $scope.colobject.grid.appScope.setDuty($scope.item);
  2441. }
  2442. $scope.play = function () { //record
  2443. $scope.colobject.grid.appScope.play($scope.item);
  2444. }
  2445. $scope.handler = function () {
  2446. $scope.colobject.grid.appScope.acceptTaskAction($scope.item);
  2447. }
  2448. //查看
  2449. $scope.toDetail = function (data) {
  2450. console.log(data,$rootScope.isFuwutai);
  2451. if($rootScope.isFuwutai){
  2452. //角色是服务台人员
  2453. $state.go('app.incident.incidentDetail', {
  2454. id: data.id,
  2455. });
  2456. }else{
  2457. window.open(location.origin+'/#/app/incident/incidentDetail/'+data.id);
  2458. }
  2459. };
  2460. }]);
  2461. //操作按钮
  2462. app.directive('incidentoperator', function () {
  2463. return {
  2464. restrict: 'E',
  2465. scope: {
  2466. item: '=',
  2467. colobject: '='
  2468. },
  2469. controller: 'IncidentOperCtrl',
  2470. template: '<div><div class="cl-effect-1 ui-grid-cell-contents pull-left" style="text-align:left;">' +
  2471. '<a ng-click="toDetail(item)" class="bianjifont" >查看</a>' +
  2472. '<a ng-click="changeCenter()" ng-show="jry_modify(item, user)" class="luyinfont">编辑</a>' +
  2473. '<a ng-click="delSj()" ng-show="{{delFlag && item.deleteFlag !== 1}}" class="assign" >删除</a>' +
  2474. '<a ng-click="storageSj()" ng-show="{{storageFlag && item.state.value === \'storage\' && item.deleteFlag !== 1}}" class="assign" >继续创建</a><br>' +
  2475. '<a ng-click="edit()" ng-show="{{item.state.value == \'handler\' && item.handlingPersonnelUser && item.handlingPersonnelUser.id == user.id && chuli && item.deleteFlag !== 1}}" class="bianjifont">处理</a>' +
  2476. '<a ng-click="handler()" ng-show="{{item.state.value == \'pending\' && ((item.currentLog && item.currentLog.workerId == user.id) || item.tiquPower) && qiangdan && item.deleteFlag !== 1}}" class="bianjifont" >接单</a>' +
  2477. '<a ng-click="visit()" ng-show="{{item.state.value == \'close\' && huifang && item.deleteFlag !== 1}}" class="bianjifont">回访</a>' +
  2478. '<a ng-click="toAssign()" ng-show="{{(item.state.value == \'pending\' || item.state.value == \'handler\' || item.state.value == \'reassign\') && assignFlag && item.deleteFlag !== 1}}" class="assign" >指派</a>' +
  2479. '<a ng-click="toTransfer()" ng-show="{{item.state.value == \'handler\' && item.handlingPersonnelUser && item.handlingPersonnelUser.id == user.id && !assignFlag && transferFlag && item.deleteFlag !== 1}}" class="assign" >转派</a>' +
  2480. '<a ng-click="toHandlerLog()" ng-show="{{item.state.value == \'handler\' && item.handlingPersonnelUser && item.handlingPersonnelUser.id == user.id && item.deleteFlag !== 1}}" class="assign" >延期处理</a>' +
  2481. '<a ng-click="setDuty()" ng-show="{{shijianliebiao_duty && (item.state.value == \'resolved\' || item.state.value == \'close\') && item.deleteFlag !== 1}}" class="assign" >设置责任科室</a>' +
  2482. '</div></div>'
  2483. };
  2484. });