incidentCtrl.js 104 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582
  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. $scope.dropfile = function (
  1066. APIService,
  1067. processInstanceId,
  1068. taskId,
  1069. userId
  1070. ) {
  1071. uploader.onBeforeUploadItem = function (item) {
  1072. angular.extend(item.headers, $rootScope.getSession());
  1073. item.url = APIService.addFile(
  1074. processInstanceId,
  1075. taskId,
  1076. userId
  1077. ).getRequestedUrl();
  1078. item.formData.push({
  1079. fileName: item.file.name,
  1080. });
  1081. console.info("onBeforeUploadItem", item);
  1082. };
  1083. uploader.uploadAll();
  1084. };
  1085. // CALLBACKS
  1086. uploader.onWhenAddingFileFailed = function (
  1087. item /*{File|FileLikeObject}*/,
  1088. filter,
  1089. options
  1090. ) {
  1091. console.info("onWhenAddingFileFailed", item, filter, options);
  1092. };
  1093. uploader.onAfterAddingFile = function (fileItem) {
  1094. console.info("onAfterAddingFile", fileItem);
  1095. };
  1096. uploader.onAfterAddingAll = function (addedFileItems) {
  1097. console.info("onAfterAddingAll", addedFileItems);
  1098. };
  1099. uploader.onBeforeUploadItem = function (item) {
  1100. console.info("onBeforeUploadItem", item);
  1101. };
  1102. uploader.onProgressItem = function (fileItem, progress) {
  1103. console.info("onProgressItem", fileItem, progress);
  1104. };
  1105. uploader.onProgressAll = function (progress) {
  1106. console.info("onProgressAll", progress);
  1107. };
  1108. uploader.onSuccessItem = function (
  1109. fileItem,
  1110. response,
  1111. status,
  1112. headers
  1113. ) {
  1114. console.info("onSuccessItem", fileItem, response, status, headers);
  1115. };
  1116. uploader.onErrorItem = function (fileItem, response, status, headers) {
  1117. console.info("onErrorItem", fileItem, response, status, headers);
  1118. };
  1119. uploader.onCancelItem = function (fileItem, response, status, headers) {
  1120. console.info("onCancelItem", fileItem, response, status, headers);
  1121. };
  1122. uploader.onCompleteItem = function (
  1123. fileItem,
  1124. response,
  1125. status,
  1126. headers
  1127. ) {
  1128. console.info("onCompleteItem", fileItem, response, status, headers);
  1129. };
  1130. uploader.onCompleteAll = function () {
  1131. console.info("onCompleteAll");
  1132. };
  1133. // 附件上传--end
  1134. // 获取处理方式
  1135. $scope.getIncidentHandleCategory = function(){
  1136. api_wechatfile.getDictionary({"key":"incident_handleCategory","type":"list"}).then(function (data) {
  1137. $scope.incidentHandleCategoryList = data || [];
  1138. if(!$scope.postData.handleCategory){
  1139. let handleCategory = $scope.incidentHandleCategoryList.find(v => v.value == 'SUPPORT');
  1140. $scope.postData.handleCategory = handleCategory || undefined;
  1141. }
  1142. })
  1143. }
  1144. // 获取处理结果
  1145. $scope.getIncidentClosecode = function(){
  1146. api_wechatfile.getDictionary({"key":"incident_closecode","type":"list"}).then(function (data) {
  1147. $scope.incidentClosecodeList = data || [];
  1148. if(!$scope.postData.closecode){
  1149. let closecode = $scope.incidentClosecodeList.find(v => v.value == '060');
  1150. $scope.postData.closecode = closecode || undefined;
  1151. }
  1152. })
  1153. }
  1154. // 获取协同人
  1155. $scope.getSynergeticList = function(keyword = ''){
  1156. let postData = {
  1157. "idx":0,
  1158. "sum":10,
  1159. "user":{
  1160. currentDuty: model.duty ? model.duty.id : undefined,
  1161. name: keyword,
  1162. selectType: "pinyin_qs",
  1163. engineer: 1,
  1164. roledata: {
  1165. "rolecode": "first-line support"
  1166. },
  1167. }
  1168. };
  1169. api_simple.fetchDataList("user", postData).then(result => {
  1170. if(result.status == 200){
  1171. $scope.synergeticList = result.list || [];
  1172. }else{
  1173. $scope.synergeticList = [];
  1174. }
  1175. })
  1176. }
  1177. // 初始化
  1178. $scope.getIncidentHandleCategory();
  1179. $scope.getIncidentClosecode();
  1180. $scope.getSynergeticList();
  1181. $scope.ok = function () {
  1182. if (!$scope.postData.handleCategory){
  1183. Alert.swal({
  1184. title: "操作失败",
  1185. text: "请选择处理方式!",
  1186. type: "error"
  1187. });
  1188. return;
  1189. }
  1190. if ($scope.model.category.hasSimple != 1 &&!$scope.postData.closecode){
  1191. Alert.swal({
  1192. title: "操作失败",
  1193. text: "请选择处理结果!",
  1194. type: "error"
  1195. });
  1196. return;
  1197. }
  1198. if ($scope.model.category.hasSimple != 1 &&!$scope.postData.handleDescription){
  1199. Alert.swal({
  1200. title: "操作失败",
  1201. text: "请填写处理方案!",
  1202. type: "error"
  1203. });
  1204. return;
  1205. }
  1206. let postData = {incident: {...model, ...{
  1207. handleCategory: $scope.postData.handleCategory,
  1208. closecode: $scope.postData.closecode,
  1209. handleDescription: $scope.postData.handleDescription,
  1210. synergetic: $scope.postData.synergetic.length ? $scope.postData.synergetic : undefined,
  1211. }}};
  1212. $rootScope.isMask = true;
  1213. api_flow.accept("doing", postData).then(function (response) {
  1214. console.log(response)
  1215. $rootScope.isMask = false;
  1216. if (response.state == 200) {
  1217. Alert.swal({
  1218. title: "操作成功!",
  1219. confirmButtonColor: "#007AFF",
  1220. type: "success"
  1221. });
  1222. $modalInstance.close('success');
  1223. } else {
  1224. Alert.swal({
  1225. title: "操作失败",
  1226. text: "操作失败, 请稍后再试!",
  1227. type: "error"
  1228. });
  1229. }
  1230. });
  1231. }
  1232. $scope.cancel = function () {
  1233. $modalInstance.dismiss('cancel');
  1234. }
  1235. },
  1236. size: 'sm',
  1237. resolve: {
  1238. api_bpm: function () {
  1239. return api_bpm;
  1240. },
  1241. modelData: function () {
  1242. return model;
  1243. },
  1244. currentUserId: function () {
  1245. return loginUser.id;
  1246. },
  1247. Alert: function () {
  1248. return SweetAlert;
  1249. },
  1250. api_user_data: function () {
  1251. return api_user_data;
  1252. }
  1253. }
  1254. });
  1255. modalInstance.result.then(function (selectedItem) {
  1256. if (selectedItem == 'success') {
  1257. $scope.refreshData('expand-right', defaultFilterData);
  1258. }
  1259. });
  1260. };
  1261. //修改
  1262. $scope.changeClick = function (data) {
  1263. // $state.go('app.incident.detail', {
  1264. // formKey: 'incident_change',
  1265. // pdKey: 'incident',
  1266. // dataId: data.id,
  1267. // taskId: data.taskId,
  1268. // processInstanceId: data.processInstanceId
  1269. // });
  1270. $rootScope.newOrder({
  1271. incident: data,
  1272. },'edit')
  1273. };
  1274. //回访
  1275. $scope.visit = function (model) {
  1276. console.log(model)
  1277. var modalInstance = $modal.open({
  1278. backdrop: false,
  1279. templateUrl: 'assets/views/incident/tpl/callback.tpl.html',
  1280. controller: function ($scope,$rootScope, $modalInstance, api_bpm_domain, modelData, currentUserId, Alert, api_user_data,api_category) {
  1281. console.log(model,loginUser);
  1282. $scope.model = model;
  1283. $scope.postData = {
  1284. degree: undefined,
  1285. visitRemarks: '',
  1286. }
  1287. $scope.degreeList = [];
  1288. // 获取满意度评价
  1289. $scope.getDegree = function(){
  1290. api_wechatfile.getDictionary({"key":"incident_degree","type":"list"}).then(function (data) {
  1291. $scope.degreeList = data || [];
  1292. })
  1293. }
  1294. // 获取结果类型
  1295. $scope.getHandleResult = function(){
  1296. api_wechatfile.getDictionary({"key":"incident_handleresult","type":"list"}).then(function (data) {
  1297. $scope.handleResultList = data || [];
  1298. })
  1299. }
  1300. // 初始化
  1301. $scope.getDegree();
  1302. $scope.getHandleResult();
  1303. $scope.ok = function () {
  1304. if (!$scope.postData.degree){
  1305. Alert.swal({
  1306. title: "操作失败",
  1307. text: "请选择满意度评价!",
  1308. type: "error"
  1309. });
  1310. return;
  1311. }
  1312. if (!$scope.postData.handleResult){
  1313. Alert.swal({
  1314. title: "操作失败",
  1315. text: "请选择结果类型!",
  1316. type: "error"
  1317. });
  1318. return;
  1319. }
  1320. let postData = {incident: {...model, ...{
  1321. degree: $scope.postData.degree,
  1322. handleResult: $scope.postData.handleResult,
  1323. visitRemarks: $scope.postData.visitRemarks,
  1324. }}};
  1325. $rootScope.isMask = true;
  1326. api_flow.accept("callback", postData).then(function (response) {
  1327. console.log(response)
  1328. $rootScope.isMask = false;
  1329. if (response.state == 200) {
  1330. Alert.swal({
  1331. title: "操作成功!",
  1332. confirmButtonColor: "#007AFF",
  1333. type: "success"
  1334. });
  1335. $modalInstance.close('success');
  1336. } else {
  1337. Alert.swal({
  1338. title: "操作失败",
  1339. text: "操作失败, 请稍后再试!",
  1340. type: "error"
  1341. });
  1342. }
  1343. });
  1344. }
  1345. $scope.cancel = function () {
  1346. $modalInstance.dismiss('cancel');
  1347. }
  1348. },
  1349. size: 'sm',
  1350. resolve: {
  1351. api_bpm: function () {
  1352. return api_bpm;
  1353. },
  1354. modelData: function () {
  1355. return model;
  1356. },
  1357. currentUserId: function () {
  1358. return loginUser.id;
  1359. },
  1360. Alert: function () {
  1361. return SweetAlert;
  1362. },
  1363. api_user_data: function () {
  1364. return api_user_data;
  1365. }
  1366. }
  1367. });
  1368. modalInstance.result.then(function (selectedItem) {
  1369. if (selectedItem == 'success') {
  1370. $scope.refreshData('expand-right', defaultFilterData);
  1371. }
  1372. });
  1373. };
  1374. //导出
  1375. $scope.export = function () {
  1376. $rootScope.isMask = true;
  1377. console.log($scope.memoryfilterData)
  1378. var filadata = angular.copy($scope.memoryfilterData);
  1379. filadata.sum = 10000;
  1380. console.log($scope.filadata)
  1381. $http({
  1382. url: api_bpm_data.downDataModel("incident", 3).getRequestedUrl(),
  1383. method: 'POST',
  1384. data: JSON.stringify(filadata),
  1385. headers: {
  1386. 'Accept': '*/*'
  1387. },
  1388. responseType: 'arraybuffer'
  1389. }).success(function (data, status, headers, config) {
  1390. $rootScope.isMask = false;
  1391. var file = new Blob([data], {
  1392. type: 'application/vnd.ms-excel'
  1393. });
  1394. //trick to download store a file having its URL
  1395. var fileURL = URL.createObjectURL(file);
  1396. var a = document.createElement('a');
  1397. a.href = fileURL;
  1398. a.target = '_blank';
  1399. a.download = '工单列表.xls';
  1400. document.body.appendChild(a);
  1401. a.click();
  1402. }).error(function (data, status, headers, config) {
  1403. // $scope.ldloading.zoom_in = false;
  1404. console.log(data);
  1405. $rootScope.isMask = false;
  1406. });
  1407. }
  1408. //接单
  1409. $scope.acceptTaskAction = function (model) {
  1410. var modalInstance = $modal.open({
  1411. templateUrl: 'assets/views/incident/tpl/acceptTask.tpl.html',
  1412. controller: function ($scope, $modalInstance, modelData, currentUserId, Alert) {
  1413. $scope.title = "提示";
  1414. $scope.connect = "确认接单?";
  1415. $scope.ok = function () {
  1416. console.log(model);
  1417. $rootScope.isMask = true;
  1418. api_flow.accept("receive", {incident: model}).then(function (response) {
  1419. $rootScope.isMask = false;
  1420. if (response.state == 200) {
  1421. Alert.swal({
  1422. title: "操作成功!",
  1423. confirmButtonColor: "#007AFF",
  1424. type: "success"
  1425. });
  1426. $modalInstance.close('success');
  1427. } else {
  1428. Alert.swal({
  1429. title: "操作失败",
  1430. text: "操作失败, 请稍后再试!",
  1431. type: "error"
  1432. });
  1433. }
  1434. });
  1435. }
  1436. $scope.cancel = function () {
  1437. $modalInstance.dismiss('cancel');
  1438. }
  1439. },
  1440. size: 'sm',
  1441. resolve: {
  1442. modelData: function () {
  1443. return model;
  1444. },
  1445. currentUserId: function () {
  1446. return loginUser.id;
  1447. },
  1448. Alert: function () {
  1449. return SweetAlert;
  1450. }
  1451. }
  1452. });
  1453. modalInstance.result.then(function (selectedItem) {
  1454. if (selectedItem == 'success') {
  1455. $scope.refreshData('expand-right', defaultFilterData);
  1456. }
  1457. });
  1458. }
  1459. // 指派弹窗
  1460. $scope.toAssign = function (model) {
  1461. console.log(model)
  1462. var modalInstance = $modal.open({
  1463. backdrop: false,
  1464. templateUrl: 'assets/views/incident/tpl/toAssign.tpl.html',
  1465. controller: function ($scope,$rootScope, $modalInstance, api_bpm_domain, modelData, currentUserId, Alert, api_user_data,api_category) {
  1466. console.log(model,loginUser);
  1467. //获取组下面的用户
  1468. $scope.getUsers = function(groupId){
  1469. $scope.user = [];
  1470. var postData = {};
  1471. if(groupId){
  1472. postData = {
  1473. "idx": 0,
  1474. "sum": 100,
  1475. user: {
  1476. groupdata:{id:groupId},
  1477. roledata: { rolecode: "first-line support" },
  1478. roledata2: { rolecode: "second-line support" },
  1479. selectType: "1",
  1480. selectDetails:1,
  1481. simple: true,
  1482. }
  1483. }
  1484. }else{
  1485. postData = {
  1486. "idx": 0,
  1487. "sum": 100,
  1488. user: {
  1489. roledata: { rolecode: "first-line support" },
  1490. roledata2: { rolecode: "second-line support" },
  1491. selectType: "1",
  1492. selectDetails:1,
  1493. simple: true,
  1494. engineer: 1,
  1495. }
  1496. }
  1497. }
  1498. api_user_data.fetchDataList('user', postData).then(function (data) {
  1499. $scope.user = data.list;
  1500. })
  1501. }
  1502. $scope.assign = {
  1503. branch:undefined,
  1504. duty:undefined,
  1505. user:undefined,
  1506. group:undefined,
  1507. isRadioUser: 0,
  1508. }
  1509. $scope.hospitalList = [];
  1510. $scope.dutyDeptList = [];
  1511. $scope.user = [];
  1512. $scope.group = [];
  1513. $scope.isShowRadioUser = false;
  1514. // 修改是否指派到人
  1515. $scope.changeRadioUser = function(){
  1516. $scope.assign.user = undefined;
  1517. }
  1518. // 获取院区
  1519. $scope.getHospitals = function(){
  1520. //跨科室转派
  1521. api_user_data.fetchDataList('branch', {
  1522. "idx": 0,
  1523. "sum": 100
  1524. }).then(function (data) {
  1525. if(data.status == 200){
  1526. $scope.hospitalList = data.list;
  1527. if($scope.assign.duty){
  1528. $scope.assign.branch = $scope.hospitalList.find(v=>v.id == $scope.assign.duty.branch);
  1529. }else{
  1530. if($rootScope.user.duty){
  1531. // 当前的所属责任科室
  1532. $scope.assign.branch = $scope.hospitalList.find(v=>v.id == $rootScope.user.duty.branch);
  1533. $scope.assign.duty = $rootScope.user.duty;
  1534. $scope.changeDuty();
  1535. }else if($rootScope.user.branch){
  1536. // 当前的所属院区
  1537. $scope.assign.branch = $scope.hospitalList.find(v=>v.id == $rootScope.user.branch.id);
  1538. }
  1539. }
  1540. }else{
  1541. SweetAlert.swal({
  1542. title: "系统错误!",
  1543. text: "请刷新重试!",
  1544. type: "error"
  1545. });
  1546. }
  1547. })
  1548. }
  1549. $scope.getHospitals();
  1550. // 修改院区
  1551. $scope.changeBranch = function(keyword){
  1552. if(keyword === undefined){
  1553. $scope.assign.duty = undefined;
  1554. $scope.dutyDeptList = [];
  1555. $scope.assign.group = undefined;
  1556. $scope.group = [];
  1557. $scope.assign.user = undefined;
  1558. $scope.user = [];
  1559. }
  1560. if(!$scope.assign.branch){
  1561. $scope.dutyDeptList = [];
  1562. return;
  1563. }
  1564. api_user_data.fetchDataList('dutyDepartment', {
  1565. "idx": 0,
  1566. "sum": 100,
  1567. "dutyDepartment":{
  1568. branch:$scope.assign.branch.id,
  1569. dept:keyword,
  1570. selectType: "pinyin_qs"
  1571. }
  1572. }).then(function (data) {
  1573. if(data.status == 200){
  1574. $scope.dutyDeptList = data.list;
  1575. }else{
  1576. SweetAlert.swal({
  1577. title: "系统错误!",
  1578. text: "请刷新重试!",
  1579. type: "error"
  1580. });
  1581. }
  1582. })
  1583. }
  1584. // 修改责任科室
  1585. $scope.changeDuty = function(keyword){
  1586. if(keyword === undefined){
  1587. $scope.assign.user = undefined;
  1588. $scope.user = [];
  1589. $scope.assign.group = undefined;
  1590. $scope.group = [];
  1591. }
  1592. api_user_data.fetchDataList('group', {
  1593. "idx": 0,
  1594. "sum": 9999,
  1595. "group":{
  1596. duty:$scope.assign.duty,
  1597. selectType: "nouser"
  1598. }
  1599. }).then(function (data) {
  1600. if(data.status == 200){
  1601. $scope.group = data.list;
  1602. }else{
  1603. SweetAlert.swal({
  1604. title: "系统错误!",
  1605. text: "请刷新重试!",
  1606. type: "error"
  1607. });
  1608. }
  1609. })
  1610. }
  1611. $scope.changeGroup = function(item){
  1612. // $scope.assign.group = item.id;
  1613. $scope.assign.user = undefined;
  1614. $scope.user = [];
  1615. $scope.getUsers(item.id)
  1616. }
  1617. $scope.ok = function () {
  1618. if ($scope.assign.isRadioUser == 1 && !$scope.assign.user){
  1619. Alert.swal({
  1620. title: "操作失败",
  1621. text: "请选择转派对象信息!",
  1622. type: "error"
  1623. });
  1624. return;
  1625. }
  1626. if ($scope.assign.isRadioUser == 0 && !$scope.assign.group){
  1627. Alert.swal({
  1628. title: "操作失败",
  1629. text: "请选择工作组!",
  1630. type: "error"
  1631. });
  1632. return;
  1633. }
  1634. let postData = {};
  1635. if($scope.assign.user && $scope.assign.user.id){
  1636. // 派人
  1637. postData ={ incident: {...model, ...{assignee: $scope.assign.user.id, duty: $scope.assign.duty}} };
  1638. } else if($scope.assign.group && $scope.assign.group.id){
  1639. // 派组
  1640. postData ={ incident: {...model, ...{candidateGroups: $scope.assign.group.id, duty: $scope.assign.duty}} };
  1641. }
  1642. $rootScope.isMask = true;
  1643. api_flow.accept("assign", postData).then(function (response) {
  1644. console.log(response)
  1645. $rootScope.isMask = false;
  1646. if (response.state == 200) {
  1647. Alert.swal({
  1648. title: "操作成功!",
  1649. confirmButtonColor: "#007AFF",
  1650. type: "success"
  1651. });
  1652. $modalInstance.close('success');
  1653. } else {
  1654. Alert.swal({
  1655. title: "操作失败",
  1656. text: "操作失败, 请稍后再试!",
  1657. type: "error"
  1658. });
  1659. }
  1660. });
  1661. }
  1662. $scope.cancel = function () {
  1663. $modalInstance.dismiss('cancel');
  1664. }
  1665. },
  1666. size: 'sm',
  1667. resolve: {
  1668. api_bpm: function () {
  1669. return api_bpm;
  1670. },
  1671. modelData: function () {
  1672. return model;
  1673. },
  1674. currentUserId: function () {
  1675. return loginUser.id;
  1676. },
  1677. Alert: function () {
  1678. return SweetAlert;
  1679. },
  1680. api_user_data: function () {
  1681. return api_user_data;
  1682. }
  1683. }
  1684. });
  1685. modalInstance.result.then(function (selectedItem) {
  1686. if (selectedItem == 'success') {
  1687. $scope.refreshData('expand-right', defaultFilterData);
  1688. }
  1689. });
  1690. }
  1691. // 转派弹窗
  1692. $scope.toTransfer = function (model) {
  1693. console.log(model)
  1694. var modalInstance = $modal.open({
  1695. backdrop: false,
  1696. templateUrl: 'assets/views/incident/tpl/toTransfer.tpl.html',
  1697. controller: function ($scope,$rootScope, $modalInstance, api_bpm_domain, modelData, currentUserId, Alert, api_user_data,api_category) {
  1698. console.log(model,loginUser);
  1699. $scope.assign = {
  1700. duty:model.duty,
  1701. user:undefined,
  1702. group:undefined,
  1703. isRadioGroup: 0,
  1704. }
  1705. $scope.user = [];
  1706. $scope.group = [];
  1707. //获取责任科室下面的用户
  1708. $scope.getUsers = function(){
  1709. $scope.user = [];
  1710. var postData = {
  1711. "idx": 0,
  1712. "sum": 9999,
  1713. user: {
  1714. currentDuty: $scope.assign.duty.id,
  1715. roledata: { rolecode: "first-line support" },
  1716. roledata2: { rolecode: "second-line support" },
  1717. selectType: "1",
  1718. selectDetails:1,
  1719. simple: true,
  1720. engineer: 1,
  1721. }
  1722. }
  1723. api_user_data.fetchDataList('user', postData).then(function (data) {
  1724. $scope.user = data.list;
  1725. })
  1726. }
  1727. $scope.getUsers();
  1728. //获取责任科室下面的组
  1729. $scope.getGroups = function(){
  1730. $scope.group = [];
  1731. var postData = {
  1732. "idx": 0,
  1733. "sum": 9999,
  1734. group: {
  1735. duty: $scope.assign.duty,
  1736. selectType: "nouser",
  1737. }
  1738. }
  1739. api_user_data.fetchDataList('group', postData).then(function (data) {
  1740. $scope.group = data.list;
  1741. })
  1742. }
  1743. $scope.getGroups();
  1744. // 修改是否转派到组
  1745. $scope.changeRadioGroup = function(){
  1746. $scope.assign.group = undefined;
  1747. $scope.assign.user = undefined;
  1748. }
  1749. $scope.ok = function () {
  1750. if ($scope.assign.isRadioGroup == 0 && !$scope.assign.user){
  1751. Alert.swal({
  1752. title: "操作失败",
  1753. text: "请选择转派对象信息!",
  1754. type: "error"
  1755. });
  1756. return;
  1757. }
  1758. if ($scope.assign.isRadioGroup == 1 && !$scope.assign.group){
  1759. Alert.swal({
  1760. title: "操作失败",
  1761. text: "请选择工作组!",
  1762. type: "error"
  1763. });
  1764. return;
  1765. }
  1766. let postData = {};
  1767. if($scope.assign.user && $scope.assign.user.id){
  1768. // 派人
  1769. postData ={ incident: {...model, ...{assignee: $scope.assign.user.id}} };
  1770. } else if($scope.assign.group && $scope.assign.group.id){
  1771. // 派组
  1772. postData ={ incident: {...model, ...{candidateGroups: $scope.assign.group.id}} };
  1773. }
  1774. $rootScope.isMask = true;
  1775. api_flow.accept("redeploy", postData).then(function (response) {
  1776. console.log(response)
  1777. $rootScope.isMask = false;
  1778. if (response.state == 200) {
  1779. Alert.swal({
  1780. title: "操作成功!",
  1781. confirmButtonColor: "#007AFF",
  1782. type: "success"
  1783. });
  1784. $modalInstance.close('success');
  1785. } else {
  1786. Alert.swal({
  1787. title: "操作失败",
  1788. text: "操作失败, 请稍后再试!",
  1789. type: "error"
  1790. });
  1791. }
  1792. });
  1793. }
  1794. $scope.cancel = function () {
  1795. $modalInstance.dismiss('cancel');
  1796. }
  1797. },
  1798. size: 'sm',
  1799. resolve: {
  1800. api_bpm: function () {
  1801. return api_bpm;
  1802. },
  1803. modelData: function () {
  1804. return model;
  1805. },
  1806. currentUserId: function () {
  1807. return loginUser.id;
  1808. },
  1809. Alert: function () {
  1810. return SweetAlert;
  1811. },
  1812. api_user_data: function () {
  1813. return api_user_data;
  1814. }
  1815. }
  1816. });
  1817. modalInstance.result.then(function (selectedItem) {
  1818. if (selectedItem == 'success') {
  1819. $scope.refreshData('expand-right', defaultFilterData);
  1820. }
  1821. });
  1822. }
  1823. // 删除事件
  1824. $scope.delSj = function(model){
  1825. console.log(model);
  1826. SweetAlert.swal({
  1827. title: "确认删除?",
  1828. text: "删除的数据不可恢复,请确认继续操作!",
  1829. type: "warning",
  1830. showCancelButton: true,
  1831. confirmButtonColor: "#DD6B55",
  1832. confirmButtonText: "继续删除",
  1833. cancelButtonText: "取消操作",
  1834. closeOnConfirm: false,
  1835. closeOnCancel: false
  1836. }, function (isConfirm) {
  1837. if (isConfirm) {
  1838. api_bpm_schedule.del(model.id).then(function (response) {
  1839. if (response.status == 200) {
  1840. SweetAlert.swal("操作成功!", "数据已经被删除.", "success");
  1841. $scope.refreshData('expand-right');
  1842. } else {
  1843. SweetAlert.swal("操作失败!", "数据暂时无法被删除,请稍候重试", "error");
  1844. }
  1845. });
  1846. } else {
  1847. SweetAlert.swal("操作取消", "数据安全", "error");
  1848. }
  1849. });
  1850. }
  1851. // 继续创建
  1852. $scope.storageSj = function(model){
  1853. console.log(model);
  1854. $rootScope.newOrder({incident: model});
  1855. }
  1856. // 新增延期处理弹窗
  1857. $scope.toHandlerLog = function (model) {
  1858. console.log(model)
  1859. var modalInstance = $modal.open({
  1860. backdrop: false,
  1861. templateUrl: 'assets/views/incident/tpl/toHandlerLog.tpl.html',
  1862. controller: function ($scope, $modalInstance, api_bpm_domain,api_bpm_data, modelData, currentUserId, Alert, api_user_data,api_statistic) {
  1863. console.log(model,loginUser);
  1864. $scope.f = {
  1865. maintenanceMode: '',
  1866. estimatedNumberOfDays: ''
  1867. }
  1868. $scope.handlerLog = '';
  1869. $scope.user = [];
  1870. $scope.logs = [];
  1871. $scope.modes = [];
  1872. $scope.getModes=function(){
  1873. var data={
  1874. "idx":0,
  1875. "sum":999,
  1876. dictionary:{key:'repair_type'}
  1877. }
  1878. api_statistic.tableData(data,"dictionary").then(function(res){
  1879. $scope.modes=res.list
  1880. })
  1881. }
  1882. $scope.getModes();
  1883. $scope.getLogs=function(){
  1884. var data={
  1885. "idx":0,
  1886. "sum":999,
  1887. dictionary:{key:'processingLog'}
  1888. }
  1889. api_statistic.tableData(data,"dictionary").then(function(res){
  1890. $scope.logs=res.list
  1891. })
  1892. }
  1893. $scope.getLogs();
  1894. $scope.copyTo = function(value){
  1895. $scope.handlerLog += value;
  1896. }
  1897. $scope.ok = function () {
  1898. if (!$scope.f.maintenanceMode){
  1899. Alert.swal({
  1900. title: "操作失败",
  1901. text: "请选择延期原因!",
  1902. type: "error"
  1903. });
  1904. return;
  1905. }
  1906. if (!$scope.f.estimatedNumberOfDays){
  1907. Alert.swal({
  1908. title: "操作失败",
  1909. text: "请选择延期天数!",
  1910. type: "error"
  1911. });
  1912. return;
  1913. }
  1914. if (!$scope.handlerLog.trim()){
  1915. Alert.swal({
  1916. title: "操作失败",
  1917. text: "请填写延期说明!",
  1918. type: "error"
  1919. });
  1920. return;
  1921. }
  1922. $rootScope.isMask = true;
  1923. api_flow.accept("overtime", {
  1924. incident: {
  1925. ...model,
  1926. ...{
  1927. currentLog: {
  1928. remark: $scope.handlerLog,
  1929. extra1: $scope.f.maintenanceMode.id,
  1930. extra2: $scope.f.estimatedNumberOfDays,
  1931. }
  1932. }
  1933. }
  1934. }).then(function(response){
  1935. console.log(response)
  1936. $rootScope.isMask = false;
  1937. if (response.state == 200) {
  1938. Alert.swal({
  1939. title: "操作成功!",
  1940. confirmButtonColor: "#007AFF",
  1941. type: "success"
  1942. });
  1943. $modalInstance.close('success');
  1944. } else {
  1945. Alert.swal({
  1946. title: "操作失败",
  1947. text: "操作失败, 请稍后再试!",
  1948. type: "error"
  1949. });
  1950. }
  1951. });
  1952. }
  1953. $scope.cancel = function () {
  1954. $modalInstance.dismiss('cancel');
  1955. }
  1956. },
  1957. size: 'lg',
  1958. resolve: {
  1959. api_bpm: function () {
  1960. return api_bpm;
  1961. },
  1962. modelData: function () {
  1963. return model;
  1964. },
  1965. currentUserId: function () {
  1966. return loginUser.id;
  1967. },
  1968. Alert: function () {
  1969. return SweetAlert;
  1970. },
  1971. api_user_data: function () {
  1972. return api_user_data;
  1973. },
  1974. api_statistic: function () {
  1975. return api_statistic;
  1976. }
  1977. }
  1978. });
  1979. modalInstance.result.then(function (selectedItem) {
  1980. if (selectedItem == 'success') {
  1981. $scope.refreshData('expand-right', defaultFilterData);
  1982. }
  1983. });
  1984. }
  1985. // 设置责任科室
  1986. $scope.setDuty = function (model) {
  1987. console.log(model)
  1988. var modalInstance = $modal.open({
  1989. backdrop: false,
  1990. templateUrl: 'assets/views/incident/tpl/setDuty.tpl.html',
  1991. controller: function ($scope,$rootScope, $modalInstance, api_bpm_domain, modelData, currentUserId, Alert, api_user_data,api_category) {
  1992. console.log(model,loginUser);
  1993. $scope.assign = {
  1994. branch:undefined,
  1995. duty:undefined,
  1996. }
  1997. $scope.hospitalList = [];
  1998. $scope.dutyDeptList = [];
  1999. // 获取院区
  2000. $scope.getHospitals = function(){
  2001. //跨科室转派
  2002. api_user_data.fetchDataList('branch', {
  2003. "idx": 0,
  2004. "sum": 100
  2005. }).then(function (data) {
  2006. if(data.status == 200){
  2007. $scope.hospitalList = data.list;
  2008. if($scope.assign.duty){
  2009. $scope.assign.branch = $scope.hospitalList.find(v=>v.id == $scope.assign.duty.branch);
  2010. }else{
  2011. if($rootScope.user.duty){
  2012. // 当前的所属责任科室
  2013. $scope.assign.branch = $scope.hospitalList.find(v=>v.id == $rootScope.user.duty.branch);
  2014. $scope.assign.duty = $rootScope.user.duty;
  2015. }else if($rootScope.user.branch){
  2016. // 当前的所属院区
  2017. $scope.assign.branch = $scope.hospitalList.find(v=>v.id == $rootScope.user.branch.id);
  2018. }
  2019. }
  2020. }else{
  2021. SweetAlert.swal({
  2022. title: "系统错误!",
  2023. text: "请刷新重试!",
  2024. type: "error"
  2025. });
  2026. }
  2027. })
  2028. }
  2029. $scope.getHospitals();
  2030. // 修改院区
  2031. $scope.changeBranch = function(keyword){
  2032. if(keyword === undefined){
  2033. $scope.assign.duty = undefined;
  2034. $scope.dutyDeptList = [];
  2035. }
  2036. if(!$scope.assign.branch){
  2037. $scope.dutyDeptList = [];
  2038. return;
  2039. }
  2040. api_user_data.fetchDataList('dutyDepartment', {
  2041. "idx": 0,
  2042. "sum": 100,
  2043. "dutyDepartment":{
  2044. branch:$scope.assign.branch.id,
  2045. dept:keyword,
  2046. selectType: "pinyin_qs"
  2047. }
  2048. }).then(function (data) {
  2049. if(data.status == 200){
  2050. $scope.dutyDeptList = data.list;
  2051. }else{
  2052. SweetAlert.swal({
  2053. title: "系统错误!",
  2054. text: "请刷新重试!",
  2055. type: "error"
  2056. });
  2057. }
  2058. })
  2059. }
  2060. $scope.ok = function () {
  2061. if (!$scope.assign.duty){
  2062. Alert.swal({
  2063. title: "操作失败",
  2064. text: "请选择责任科室!",
  2065. type: "error"
  2066. });
  2067. return;
  2068. }
  2069. $rootScope.isMask = true;
  2070. api_bpm_domain.changeIncidentDuty({orderId: model.id, dutyId: $scope.assign.duty.id}).then(function (response) {
  2071. console.log(response)
  2072. $rootScope.isMask = false;
  2073. if (response.status == 200) {
  2074. Alert.swal({
  2075. title: "操作成功!",
  2076. confirmButtonColor: "#007AFF",
  2077. type: "success"
  2078. });
  2079. $modalInstance.close('success');
  2080. } else {
  2081. Alert.swal({
  2082. title: "操作失败",
  2083. text: "操作失败, 请稍后再试!",
  2084. type: "error"
  2085. });
  2086. }
  2087. });
  2088. }
  2089. $scope.cancel = function () {
  2090. $modalInstance.dismiss('cancel');
  2091. }
  2092. },
  2093. size: 'sm',
  2094. resolve: {
  2095. api_bpm: function () {
  2096. return api_bpm;
  2097. },
  2098. modelData: function () {
  2099. return model;
  2100. },
  2101. currentUserId: function () {
  2102. return loginUser.id;
  2103. },
  2104. Alert: function () {
  2105. return SweetAlert;
  2106. },
  2107. api_user_data: function () {
  2108. return api_user_data;
  2109. }
  2110. }
  2111. });
  2112. modalInstance.result.then(function (selectedItem) {
  2113. if (selectedItem == 'success') {
  2114. $scope.refreshData('expand-right', defaultFilterData);
  2115. }
  2116. });
  2117. }
  2118. if ($stateParams.model) {
  2119. if (JSON.parse($stateParams.model).searchType && JSON.parse($stateParams.model).searchType != null) {
  2120. $scope.searchstate = JSON.parse($stateParams.model).searchType;
  2121. } else {
  2122. $scope.searchstate = "todo";
  2123. }
  2124. } else {
  2125. $scope.searchstate = "todo";
  2126. }
  2127. if ($rootScope.user.group) {
  2128. var defaultFilterData = {
  2129. "idx": 0,
  2130. "sum": mun
  2131. };
  2132. } else {
  2133. var defaultFilterData = {
  2134. "idx": 0,
  2135. "sum": mun
  2136. };
  2137. }
  2138. if (angular.isDefined($rootScope.search) && angular.isDefined($rootScope.search.incident)) {
  2139. $scope.searchstate = $rootScope.search.incident;
  2140. }
  2141. $scope.ldloading = {};
  2142. //事件类型筛选
  2143. console.log($state);
  2144. if($state.params.tab){
  2145. $scope.searchstate = $state.params.tab;
  2146. }else{
  2147. $scope.searchstate = 'todo';
  2148. }
  2149. $scope.onChange = function (searchstate, isInit) {
  2150. $scope.isDisabledState = false;
  2151. $scope.searchstate = searchstate;
  2152. $scope.chiceIncident($scope.searchkeys,$scope.othcode.state, isInit);
  2153. }
  2154. // 是否逾期下拉框选择
  2155. $scope.selectTypeChange = function(isInit){
  2156. console.log($scope.searchkeys.selectType,66666);
  2157. if(window.sessionStorage.getItem('isGoyuqi') == 'yes'){
  2158. $scope.searchkeys.selectType = $scope.selectType.find(v => v.value == 'unresolved');
  2159. }
  2160. var ids = $scope.searchkeys.selectType.id
  2161. if(defaultFilterData.incident){
  2162. defaultFilterData.incident.selectType = ids;
  2163. }else{
  2164. defaultFilterData.incident = {
  2165. selectType:ids
  2166. };
  2167. }
  2168. console.log(defaultFilterData,2222)
  2169. $scope.onChange('all', isInit);
  2170. }
  2171. //获取列表数据
  2172. $scope.refreshData = _.debounce(function (style, filterData, isInit) {
  2173. $scope.ldloading[style.replace('-', '_')] = true;
  2174. if (angular.isUndefined(filterData)) {
  2175. filterData = defaultFilterData;
  2176. if(isInit){
  2177. if($state.params.tab){
  2178. $scope.searchstate = $state.params.tab;
  2179. filterData.idx = 0;
  2180. $scope.gridOptions.paginationCurrentPage = 1 + filterData.idx;
  2181. }
  2182. if($state.params.date == 'today'){
  2183. $scope.othcode = {};
  2184. $scope.searchkeys.acceptDate = new Date();
  2185. $scope.searchkeys.acceptDateEnd = new Date();
  2186. if(filterData.incident){
  2187. filterData.incident.acceptDate = moment().format('YYYY-MM-DD 00:00:00');
  2188. filterData.incident.acceptDateEnd = moment().format('YYYY-MM-DD 23:59:59');
  2189. }else{
  2190. filterData.incident = {
  2191. acceptDate: moment().format('YYYY-MM-DD 00:00:00'),
  2192. acceptDateEnd: moment().format('YYYY-MM-DD 23:59:59'),
  2193. }
  2194. }
  2195. }else{
  2196. $scope.searchkeys.acceptDate = undefined;
  2197. $scope.searchkeys.acceptDateEnd = undefined;
  2198. }
  2199. if($state.params.state){
  2200. var obj = $scope.state.find(function(v){return $state.params.state == v.id});
  2201. $scope.othcode = {state:obj};
  2202. if(filterData.incident){
  2203. filterData.incident.statusId = $state.params.state;
  2204. }else{
  2205. filterData.incident = {
  2206. statusId: $state.params.state,
  2207. }
  2208. }
  2209. }
  2210. }
  2211. }
  2212. $scope.myData = [];
  2213. $scope.memoryfilterData = filterData;
  2214. $scope.gridOptions['sum'] = filterData.sum;
  2215. // 请求参数调整
  2216. if(!filterData.incident){
  2217. filterData.incident = {};
  2218. }
  2219. if($scope.searchstate === 'all' || $scope.searchstate === 'callback'){
  2220. if($rootScope.user.duty){
  2221. // 当前的所属责任科室
  2222. filterData.incident.duty = $rootScope.user.duty;
  2223. }else if($rootScope.user.branch){
  2224. // 当前的所属院区
  2225. filterData.incident.branch = $rootScope.user.branch.id;
  2226. }
  2227. }else{
  2228. delete filterData.incident.duty;
  2229. delete filterData.incident.branch;
  2230. }
  2231. filterData.incident.queryTask = $scope.searchstate;
  2232. filterData.incident.assignee = loginUser.id;
  2233. if($scope.searchstate === 'todo' || $scope.searchstate === 'owns'){
  2234. filterData.incident.candidateGroups = loginuserGroup;
  2235. }else{
  2236. delete filterData.incident.candidateGroups;
  2237. }
  2238. // 调用接口-查列表
  2239. api_user_data.fetchDataList('incident', filterData).then(function (data) {
  2240. if (data.list) {
  2241. var myData = Restangular.stripRestangular(data);
  2242. $scope.gridOptions['totalItems'] = myData.totalNum;
  2243. $scope.myData = myData.list;
  2244. for (var i = 0; i < $scope.myData.length; i++) {
  2245. $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum
  2246. }
  2247. } else {
  2248. SweetAlert.swal({
  2249. title: "系统错误",
  2250. text: "请稍后再试!",
  2251. type: "error"
  2252. });
  2253. }
  2254. $scope.ldloading[style.replace('-', '_')] = false;
  2255. }, function () {
  2256. $scope.ldloading[style.replace('-', '_')] = false;
  2257. });
  2258. // 获取数量
  2259. $scope.count(filterData.incident, isInit);
  2260. }, 500);
  2261. // 调用接口-查数量
  2262. $scope.count = function (incident = {}){
  2263. let postData = {
  2264. incidentList: [],
  2265. }
  2266. $scope.tabs.forEach(v => {
  2267. postData.incidentList.push({...incident, ...{queryTask: v.key}});
  2268. })
  2269. postData.incidentList.forEach(incident => {
  2270. // 请求参数调整
  2271. if(!incident){
  2272. incident = {};
  2273. }
  2274. if(incident.queryTask === 'all' || incident.queryTask === 'callback'){
  2275. if($rootScope.user.duty){
  2276. // 当前的所属责任科室
  2277. incident.duty = $rootScope.user.duty;
  2278. }else if($rootScope.user.branch){
  2279. // 当前的所属院区
  2280. incident.branch = $rootScope.user.branch.id;
  2281. }
  2282. }else{
  2283. delete incident.duty;
  2284. delete incident.branch;
  2285. }
  2286. incident.assignee = loginUser.id;
  2287. if(incident.queryTask === 'todo' || incident.queryTask === 'owns'){
  2288. incident.candidateGroups = loginuserGroup;
  2289. }else{
  2290. delete incident.candidateGroups;
  2291. }
  2292. })
  2293. api_flow.count(postData).then(function (data) {
  2294. if (data.state == 200) {
  2295. let myData = data.data || {};
  2296. $scope.tabs.forEach(v => {
  2297. v.num = myData[v.key];
  2298. })
  2299. } else {
  2300. SweetAlert.swal({
  2301. title: "系统错误",
  2302. text: "请稍后再试!",
  2303. type: "error"
  2304. });
  2305. }
  2306. });
  2307. }
  2308. // 进入页面时
  2309. $scope.getIncidentStatus();
  2310. $scope.timer = $interval(function () {
  2311. $scope.jry_refresh()
  2312. }, $rootScope.refreshTime);
  2313. $scope.$on('$destroy', function () {
  2314. $interval.cancel($scope.timer)
  2315. });
  2316. }]);
  2317. //操作按钮权限控制
  2318. app.controller('IncidentOperCtrl', ['$rootScope', '$scope', '$state', function ($rootScope, $scope, $state) {
  2319. var loginUser = $rootScope.user;
  2320. $scope.user = $rootScope.user;
  2321. $scope.chuli = false;
  2322. $scope.allFlag = false;
  2323. $scope.qiangdan = false;
  2324. $scope.huifang = false;
  2325. $scope.delFlag = false;
  2326. $scope.storageFlag = false;
  2327. $scope.editFlag = false;//编辑
  2328. $scope.assignFlag = false;//指派
  2329. $scope.transferFlag = false;//转派
  2330. $scope.shijianliebiao_duty = false;//设置责任科室
  2331. for (var i = 0; i < loginUser.menu.length; i++) {
  2332. if (loginUser.menu[i].link == "shijianliebiao_all") {
  2333. $scope.allFlag = true
  2334. }
  2335. if (loginUser.menu[i].link == "shijianliebiao_chuli") {
  2336. $scope.chuli = true
  2337. }
  2338. if (loginUser.menu[i].link == "shijianliebiao_qiangdan") {
  2339. $scope.qiangdan = true
  2340. }
  2341. if (loginUser.menu[i].link == "shijianliebiao_huifang") {
  2342. $scope.huifang = true
  2343. }
  2344. if (loginUser.menu[i].link == "shijianliebiao_del") {
  2345. $scope.delFlag = true
  2346. }
  2347. if (loginUser.menu[i].link == "shijianliebiao_build") {
  2348. $scope.storageFlag = true
  2349. }
  2350. if (loginUser.menu[i].link == "shijianliebiao_edit") {
  2351. $scope.editFlag = true
  2352. }
  2353. if (loginUser.menu[i].link == "shijianliebiao_assign") {
  2354. $scope.assignFlag = true
  2355. }
  2356. if (loginUser.menu[i].link == "shijianliebiao_transfer") {
  2357. $scope.transferFlag = true
  2358. }
  2359. if (loginUser.menu[i].link == "shijianliebiao_duty") {
  2360. $scope.shijianliebiao_duty = true
  2361. }
  2362. }
  2363. $scope.up = true;
  2364. $scope.fuwutaiRenYuan = false;//服务台人员
  2365. for (var i = 0; i < $rootScope.user.role.length; i++) {
  2366. if ($rootScope.user.role[i].role == '事件经理') {
  2367. $scope.up = false;
  2368. }
  2369. if ($rootScope.user.role[i].id == 29701) {
  2370. $scope.fuwutaiRenYuan = true;
  2371. }
  2372. }
  2373. $rootScope.callid = $scope.item.callID;
  2374. if ($scope.item.callID) {
  2375. $scope.item.listen = true;
  2376. } else {
  2377. $scope.item.listen = false;
  2378. }
  2379. $rootScope.user.group.forEach(function (item, v) {
  2380. if($scope.item.currentLog){
  2381. if (item.id == $scope.item.currentLog.groupId) {
  2382. $scope.item.tiquPower = true;
  2383. }
  2384. }
  2385. })
  2386. //修改页面显示判断
  2387. $scope.jry_modify = function (item, user) {
  2388. // 待接单的时候,处理人或处理组
  2389. let flag1 = item.state && item.state.value == 'pending' && ((item.currentLog && item.currentLog.workerId == user.id) || item.tiquPower);
  2390. // 处理中的时候,处理人或处理组
  2391. let flag2 = item.state && item.state.value == 'handler' && item.handlingPersonnelUser && item.handlingPersonnelUser.id == user.id;
  2392. // 不是已关闭,且不是已删除,且不是暂存
  2393. let flag3 = item.deleteFlag !== 1 && item.state.value !== 'close' && item.state.value !== 'storage';
  2394. return flag3 && (($scope.editFlag && $scope.allFlag) || flag1 || flag2 || (item.acceptUser ? item.acceptUser.id == user.id : false));
  2395. }
  2396. // 回访操作权限
  2397. for (var obj in $rootScope.user.role) {
  2398. if ($rootScope.user.role[obj].rolecode == 'call center') {
  2399. if ($scope.item.state && $scope.item.state.value == 'close') {
  2400. $scope.item.huifang = true;
  2401. } else {}
  2402. }
  2403. }
  2404. $scope.edit = function () {
  2405. $scope.colobject.grid.appScope.selectRowFunction($scope.item);
  2406. }
  2407. $scope.changeCenter = function () {
  2408. $scope.colobject.grid.appScope.changeClick($scope.item);
  2409. }
  2410. $scope.visit = function () {
  2411. $scope.colobject.grid.appScope.visit($scope.item);
  2412. }
  2413. // 指派
  2414. $scope.toAssign = function () {
  2415. $scope.colobject.grid.appScope.toAssign($scope.item);
  2416. }
  2417. // 转派
  2418. $scope.toTransfer = function () {
  2419. $scope.colobject.grid.appScope.toTransfer($scope.item);
  2420. }
  2421. // 删除事件
  2422. $scope.delSj = function () {
  2423. $scope.colobject.grid.appScope.delSj($scope.item);
  2424. }
  2425. // 继续创建
  2426. $scope.storageSj = function () {
  2427. $scope.colobject.grid.appScope.storageSj($scope.item);
  2428. }
  2429. // 新增延期处理
  2430. $scope.toHandlerLog = function () {
  2431. $scope.colobject.grid.appScope.toHandlerLog($scope.item);
  2432. }
  2433. // 设置责任科室
  2434. $scope.setDuty = function () {
  2435. $scope.colobject.grid.appScope.setDuty($scope.item);
  2436. }
  2437. $scope.play = function () { //record
  2438. $scope.colobject.grid.appScope.play($scope.item);
  2439. }
  2440. $scope.handler = function () {
  2441. $scope.colobject.grid.appScope.acceptTaskAction($scope.item);
  2442. }
  2443. //查看
  2444. $scope.toDetail = function (data) {
  2445. console.log(data,$rootScope.isFuwutai);
  2446. if($rootScope.isFuwutai){
  2447. //角色是服务台人员
  2448. $state.go('app.incident.incidentDetail', {
  2449. id: data.id,
  2450. });
  2451. }else{
  2452. window.open(location.origin+'/#/app/incident/incidentDetail/'+data.id);
  2453. }
  2454. };
  2455. }]);
  2456. //操作按钮
  2457. app.directive('incidentoperator', function () {
  2458. return {
  2459. restrict: 'E',
  2460. scope: {
  2461. item: '=',
  2462. colobject: '='
  2463. },
  2464. controller: 'IncidentOperCtrl',
  2465. template: '<div><div class="cl-effect-1 ui-grid-cell-contents pull-left" style="text-align:left;">' +
  2466. '<a ng-click="toDetail(item)" class="bianjifont" >查看</a>' +
  2467. '<a ng-click="changeCenter()" ng-show="jry_modify(item, user)" class="luyinfont">编辑</a>' +
  2468. '<a ng-click="delSj()" ng-show="{{delFlag && item.deleteFlag !== 1}}" class="assign" >删除</a>' +
  2469. '<a ng-click="storageSj()" ng-show="{{storageFlag && item.state.value === \'storage\' && item.deleteFlag !== 1}}" class="assign" >继续创建</a><br>' +
  2470. '<a ng-click="edit()" ng-show="{{item.state.value == \'handler\' && item.handlingPersonnelUser && item.handlingPersonnelUser.id == user.id && chuli && item.deleteFlag !== 1}}" class="bianjifont">处理</a>' +
  2471. '<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>' +
  2472. '<a ng-click="visit()" ng-show="{{item.state.value == \'close\' && huifang && item.deleteFlag !== 1}}" class="bianjifont">回访</a>' +
  2473. '<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>' +
  2474. '<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>' +
  2475. '<a ng-click="toHandlerLog()" ng-show="{{item.state.value == \'handler\' && item.handlingPersonnelUser && item.handlingPersonnelUser.id == user.id && item.deleteFlag !== 1}}" class="assign" >延期处理</a>' +
  2476. '<a ng-click="setDuty()" ng-show="{{shijianliebiao_duty && (item.state.value == \'resolved\' || item.state.value == \'close\') && item.deleteFlag !== 1}}" class="assign" >设置责任科室</a>' +
  2477. '</div></div>'
  2478. };
  2479. });