incidentCtrl.js 128 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134
  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', 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) {
  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.addressModel = '';//文本输入内容
  12. $scope.address_arr = [];//故障地点所有数据
  13. $scope.addressFlag = false;//默认下拉框列表隐藏
  14. //点击文本框
  15. $scope.addressClickHandle = function () {
  16. $scope.searchkeys.houseNumber = $scope.searchkeys.houseNumber === undefined?'':$scope.searchkeys.houseNumber;
  17. $scope.getDepartmentList();
  18. angular.element('#bx_address_ul').scrollTop(0);
  19. }
  20. //修改文字,实时监听
  21. $scope.addressChangeHandle = _.debounce(function () {
  22. $scope.getDepartmentList();
  23. angular.element('#bx_address_ul').scrollTop(0);
  24. }, 500)
  25. //获取故障地点seimin
  26. $scope.getDepartmentList = function () {
  27. api_search_area.getAreaList({ "searchKey": $scope.searchkeys.houseNumber })
  28. .then(res => {
  29. if (res.state == 200) {
  30. $scope.address_arr = res.result;
  31. $scope.addressFlag = true;//显示
  32. }
  33. })
  34. .catch(err => {
  35. console.log(err);
  36. })
  37. }
  38. //下拉框列表选中
  39. $scope.addressItemClick = function (obj) {
  40. $scope.addressFlag = false;//隐藏
  41. $scope.searchkeys.houseNumber = obj.place ? obj.area.area + obj.place : obj.area;//文本框赋值
  42. }
  43. //点击空白处隐藏
  44. angular.element(document).on('click', function (e) {
  45. if (e.target !== angular.element('#bx_address').get(0)) {
  46. $scope.addressFlag = false;//隐藏
  47. }
  48. })
  49. // -----------------分割线 end----------------
  50. // 是否逾期seimin
  51. $scope.selectType = [
  52. { id: '2', name: '是' },
  53. { id: '0', name: '否' }
  54. ];
  55. // /是否逾期
  56. $scope.langs = i18nService.getAllLangs();
  57. $scope.lang = 'zh-cn';
  58. i18nService.setCurrentLang($scope.lang);
  59. $scope.myData = [];
  60. var loginUser = $rootScope.user;
  61. console.log(loginUser);
  62. $scope.daochu = false;
  63. for (var i = 0; i < loginUser.menu.length; i++) {
  64. if (loginUser.menu[i].link == "shijianliebiao_daochu") {
  65. $scope.daochu = true
  66. }
  67. }
  68. var loginuserGroup = "";
  69. for (var i = 0; i < $rootScope.user.group.length; i++) {
  70. if (i == 0) {
  71. loginuserGroup = $rootScope.user.group[i].id;
  72. } else {
  73. loginuserGroup = loginuserGroup + "," + $rootScope.user.group[i].id;
  74. }
  75. }
  76. //新增事件seimin
  77. $scope.goToAddIncident = function () {
  78. $state.go('app.incident.editor', {});
  79. }
  80. //全部事件权限
  81. // $scope.allright = false;
  82. // $scope.allrightnot = true;
  83. // for (var obj in $rootScope.user.role) {
  84. // if ($rootScope.user.role[obj].rolecode == 'incident manager' || $rootScope.user.role[obj].rolecode == 'call center') {
  85. // $scope.allright = true;
  86. // $scope.allrightnot = false;
  87. // }
  88. // }
  89. // 处理人,受理人,转派人
  90. var acceptUser;
  91. var pdKey = $state.current.pdKey;
  92. $scope.gridOptions = {};
  93. $scope.gridOptions.data = 'myData';
  94. $scope.gridOptions.enableColumnResizing = true;
  95. $scope.gridOptions.enableFiltering = false;
  96. $scope.gridOptions.enableGridMenu = true;
  97. $scope.gridOptions.enableSelectAll = true;
  98. $scope.gridOptions.enableRowSelection = true;
  99. $scope.gridOptions.showGridFooter = true;
  100. $scope.gridOptions.showColumnFooter = false;
  101. $scope.gridOptions.fastWatch = true;
  102. $scope.gridOptions.enableSorting = true;
  103. $scope.gridOptions.useExternalSorting = true;
  104. $scope.gridOptions.useExternalFiltering = false;
  105. $scope.gridOptions.useExternalPagination = true;
  106. $scope.gridOptions.paginationPageSizes = [10, 20, 50, 100];
  107. $scope.gridOptions.paginationPageSize = 10;
  108. $scope.gridOptions.multiSelect = true;
  109. var mun = $scope.gridOptions.paginationPageSize;
  110. $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>";
  111. $scope.gridOptions.rowIdentity = function (row) {
  112. return row.id;
  113. };
  114. $scope.gridOptions.getRowIdentity = function (row) {
  115. return row.id;
  116. };
  117. $scope.states = [
  118. {
  119. id: "all",
  120. name: '全部的事件'
  121. },
  122. {
  123. id: "todo",
  124. name: '待我处理的事件'
  125. },
  126. {
  127. id: "create",
  128. name: '我创建的事件'
  129. },
  130. {
  131. id: "done",
  132. name: '我处理过的事件'
  133. }
  134. ];
  135. // for (var obj = 0; obj < $rootScope.user.role.length; obj++) {
  136. // if ($rootScope.user.role[obj].rolecode == 'incident manager' || $rootScope.user.role[obj].rolecode == 'call center') {
  137. // $scope.states = [
  138. // { id: "all", name: '全部的事件' },
  139. // { id: "todo", name: '待我处理的事件' },
  140. // { id: "create", name: '我创建的事件' },
  141. // { id: "done", name: '我处理过的事件' }
  142. // ];
  143. // }
  144. // }
  145. $scope.transferColor = function (item) {
  146. var color = "icon iconfont icon-zhengchang greenfont";
  147. if (item.colourInfo) {
  148. if (item.colourInfo.id == 1583) {
  149. color = "icon iconfont icon-yiyuqi redfont";
  150. } else if (item.colourInfo.id == 1584) {
  151. color = "iconfont icon-yuqixinxiu orangefont";
  152. }
  153. }
  154. return color;
  155. }
  156. $scope.transfertip = function (item) {
  157. var tip = "正常";
  158. if (item.colourInfo) {
  159. if (item.colourInfo.id == 1583) {
  160. tip = "已逾期";
  161. } else if (item.colourInfo.id == 1584) {
  162. tip = "即将逾期";
  163. } else if (item.colourInfo.id == 1586) {
  164. tip = "正常";
  165. }
  166. } else {
  167. // color = "white";
  168. }
  169. return tip;
  170. }
  171. $scope.transferstatus = function (item) {
  172. var statecolor = "#fc4c58";
  173. if (item.id == 2) { //待处理
  174. statecolor = "#fc4c58";
  175. } else if (item.id == 7) { //待审核
  176. statecolor = "#fcb44c";
  177. } else if (item.id == 3) { //请求重新指派
  178. statecolor = "#ebf902";
  179. } else if (item.id == 4) { //处理中
  180. statecolor = "#0aa5f5";
  181. } else if (item.id == 5) { //已解决
  182. statecolor = "#2edbb8";
  183. } else if (item.id == 6) { //已关闭
  184. statecolor = "#bbbbbb";
  185. }
  186. return statecolor;
  187. }
  188. if($scope.repairMain.valueconfig == 1){//报修人
  189. $scope.gridOptions.columnDefs = [
  190. {
  191. name: 'id',
  192. displayName: '',
  193. width: 35,
  194. cellTemplate: '<div>' +
  195. '<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>' +
  196. '</div>'
  197. },
  198. {
  199. name: 'item',
  200. displayName: '序号',
  201. width: 45,
  202. cellTemplate: '<div>' +
  203. '<div class="ui-grid-cell-contents">{{row.entity.item}}</div>' +
  204. '</div>'
  205. },
  206. {
  207. name: 'incidentsign',
  208. displayName: '事件单号',
  209. width: 120,
  210. cellTemplate: '<div>' +
  211. '<div class="ui-grid-cell-contents">{{row.entity.incidentsign}}</div>' +
  212. '</div>'
  213. },
  214. {
  215. name: 'requester.name',
  216. displayName: '报修人',
  217. width: '6%',
  218. minWidth: '90',
  219. enableSorting: false,
  220. cellTemplate: '<div>' +
  221. '<div class="ui-grid-cell-contents" >{{row.entity.requester.name}}</div>' +
  222. '</div>'
  223. },
  224. {
  225. name: 'requester.account',
  226. displayName: '学工号',
  227. width: '6%',
  228. minWidth: '90',
  229. enableSorting: false,
  230. cellTemplate: '<div>' +
  231. '<div class="ui-grid-cell-contents" >{{row.entity.requester.account}}</div>' +
  232. '</div>'
  233. },
  234. {
  235. name: 'contactsInformation',
  236. displayName: '联系电话',
  237. width: '105',
  238. cellTemplate: '<div>' +
  239. '<div class="ui-grid-cell-contents">{{row.entity.contactsInformation}}</div>' +
  240. '</div>'
  241. },
  242. {
  243. name: 'category',
  244. displayName: '事件分类',
  245. width: '10%',
  246. enableSorting: false,
  247. cellTemplate: '<div>' +
  248. '<div class="ui-grid-cell-contents">{{row.entity.category.category}}</div>' +
  249. '</div>'
  250. },
  251. {
  252. name: 'houseNumber',
  253. displayName: '区域地点',
  254. width: '14%',
  255. enableFiltering: false,
  256. cellTemplate: '<div><div class="ui-grid-cell-contents">{{grid.appScope.areaplace(row.entity)}}</div></div>'
  257. },
  258. {
  259. name: 'acceptUser.name',
  260. displayName: '受理人',
  261. width: '7%',
  262. minWidth: '80',
  263. enableSorting: false,
  264. cellTemplate: '<div>' +
  265. '<div class="ui-grid-cell-contents" >{{row.entity.acceptUser.name}}</div>' +
  266. '</div>'
  267. },
  268. {
  269. name: 'acceptDate',
  270. displayName: '登记时间',
  271. width: '10%',
  272. minWidth: '140',
  273. enableFiltering: false,
  274. cellTemplate: '<div><div class="ui-grid-cell-contents">{{grid.appScope.transferTime(row.entity.acceptDate)}}</div></div>'
  275. },
  276. {
  277. name: 'groupORHandlerUser',
  278. displayName: '处理人/组',
  279. width: '10%',
  280. enableFiltering: false,
  281. cellTemplate: '<div>' +
  282. '<div class="ui-grid-cell-contents">' +
  283. '{{row.entity.groupORHandlerUser}}</div>' +
  284. '</div>'
  285. },
  286. {
  287. name: 'state.name',
  288. displayName: '状态',
  289. width: '7%',
  290. minWidth: '70',
  291. enableSorting: false,
  292. cellTemplate: '<div>' +
  293. '<div class="ui-grid-cell-contents" >{{row.entity.state.name}}</div>' +
  294. '</div>'
  295. },
  296. {
  297. name: '操作',
  298. enableSorting: false,
  299. width: 400,
  300. cellTemplate: '<incidentoperator style="background-color:{{row.entity.colourInfo.rgb}}" item="row.entity" colobject="col">',
  301. enableFiltering: false
  302. },
  303. ];
  304. if($scope.wxIncidentWithCmdb==1){
  305. let index = $scope.gridOptions.columnDefs.findIndex(v=>v.name == 'contactsInformation');
  306. $scope.gridOptions.columnDefs.splice(index,0,{
  307. name: 'assetId',
  308. displayName: '资产',
  309. width: 120
  310. },)
  311. }
  312. }else if($scope.repairMain.valueconfig == 2){//报修科室
  313. $scope.gridOptions.columnDefs = [
  314. {
  315. name: 'id',
  316. displayName: '',
  317. width: 35,
  318. cellTemplate: '<div>' +
  319. '<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>' +
  320. '</div>'
  321. },
  322. {
  323. name: 'item',
  324. displayName: '序号',
  325. width: 45,
  326. cellTemplate: '<div>' +
  327. '<div class="ui-grid-cell-contents">{{row.entity.item}}</div>' +
  328. '</div>'
  329. },
  330. {
  331. name: 'incidentsign',
  332. displayName: '事件单号',
  333. width: 120,
  334. cellTemplate: '<div>' +
  335. '<div class="ui-grid-cell-contents">{{row.entity.incidentsign}}</div>' +
  336. '</div>'
  337. },
  338. {
  339. name: 'department.dept',
  340. displayName: '报修科室',
  341. width: '6%',
  342. minWidth: '90',
  343. enableSorting: false,
  344. cellTemplate: '<div>' +
  345. '<div class="ui-grid-cell-contents" >{{row.entity.department.dept}}</div>' +
  346. '</div>'
  347. },
  348. {
  349. name: 'department.phone',
  350. displayName: '联系电话',
  351. width: '105',
  352. cellTemplate: '<div>' +
  353. '<div class="ui-grid-cell-contents">{{row.entity.department.phone}}</div>' +
  354. '</div>'
  355. },
  356. {
  357. name: 'category',
  358. displayName: '事件分类',
  359. width: '10%',
  360. enableSorting: false,
  361. cellTemplate: '<div>' +
  362. '<div class="ui-grid-cell-contents">{{row.entity.category.category}}</div>' +
  363. '</div>'
  364. },
  365. {
  366. name: 'houseNumber',
  367. displayName: '故障地点',
  368. width: '14%',
  369. enableFiltering: false,
  370. cellTemplate: '<div><div class="ui-grid-cell-contents">{{row.entity.houseNumber}}</div></div>'
  371. },
  372. {
  373. name: 'acceptUser.name',
  374. displayName: '受理人',
  375. width: '7%',
  376. minWidth: '80',
  377. enableSorting: false,
  378. cellTemplate: '<div>' +
  379. '<div class="ui-grid-cell-contents" >{{row.entity.acceptUser.name}}</div>' +
  380. '</div>'
  381. },
  382. {
  383. name: 'acceptDate',
  384. displayName: '登记时间',
  385. width: '10%',
  386. minWidth: '140',
  387. enableFiltering: false,
  388. cellTemplate: '<div><div class="ui-grid-cell-contents">{{grid.appScope.transferTime(row.entity.acceptDate)}}</div></div>'
  389. },
  390. {
  391. name: 'groupORHandlerUser',
  392. displayName: '处理人/组',
  393. width: '10%',
  394. enableFiltering: false,
  395. cellTemplate: '<div>' +
  396. '<div class="ui-grid-cell-contents">' +
  397. '{{row.entity.groupORHandlerUser}}</div>' +
  398. '</div>'
  399. },
  400. {
  401. name: 'state.name',
  402. displayName: '状态',
  403. width: '7%',
  404. minWidth: '70',
  405. enableSorting: false,
  406. cellTemplate: '<div>' +
  407. '<div class="ui-grid-cell-contents" >{{row.entity.state.name}}</div>' +
  408. '</div>'
  409. },
  410. {
  411. name: '操作',
  412. enableSorting: false,
  413. width: 400,
  414. cellTemplate: '<incidentoperator style="background-color:{{row.entity.colourInfo.rgb}}" item="row.entity" colobject="col">',
  415. enableFiltering: false
  416. },
  417. ];
  418. }
  419. $scope.value = 10;
  420. $scope.decrement = function () {
  421. $scope.value = $scope.value - 1;
  422. };
  423. $scope.record = function () {
  424. api_text.record($rootScope.takes).then(function (data) {
  425. if (data.errno == 0) {
  426. $scope.busy = false;
  427. }
  428. })
  429. };
  430. $scope.transferTime = function (time) {
  431. return moment(time).format('YYYY-MM-DD HH:mm');
  432. }
  433. $scope.parameters = null;
  434. $scope.open = function ($event) {
  435. $event.preventDefault();
  436. $event.stopPropagation();
  437. $scope.opened = !$scope.opened;
  438. };
  439. $scope.endOpen = function ($event) {
  440. $event.preventDefault();
  441. $event.stopPropagation();
  442. $scope.startOpened = false;
  443. $scope.endOpened = !$scope.endOpened;
  444. };
  445. $scope.startOpen = function ($event) {
  446. $event.preventDefault();
  447. $event.stopPropagation();
  448. $scope.endOpened = false;
  449. $scope.startOpened = !$scope.startOpened;
  450. };
  451. $scope.othcode = {};
  452. $scope.searchkeys = {};
  453. // $scope.searchkeys = {selectType:{id:2,name:'是'}};//seimin
  454. // 事件分类
  455. var apple_selected, tree, treedata_avm, treedata_geography;
  456. $scope.my_tree_handler = function (branch) {
  457. //var _ref;
  458. var classify = $scope.classify = branch.prefix.toLowerCase() + branch.sign;
  459. api_cmdb.query({ 'sign': classify }).then(function (data) {
  460. var myData = Restangular.stripRestangular(data);
  461. // console.log(myData.data.node);
  462. if (myData.data && myData.status == 200) {
  463. var ret = myData.data;
  464. redrawSvg(myData);
  465. }
  466. });
  467. };
  468. $scope.my_data = [];
  469. function convertListToTree(data, treeMap) {
  470. var idToNodeMap = {}; //Keeps track of nodes using id as key, for fast lookup
  471. var root = null; //Initially set our loop to null
  472. var parentNode = null;
  473. //loop over data
  474. for (var i = 0; i < data.length; i++) {
  475. var datum = data[i];
  476. //each node will have children, so let's give it a "children" poperty
  477. datum.children = [];
  478. //add an entry for this node to the map so that any future children can
  479. //lookup the parent
  480. idToNodeMap[datum.id] = datum;
  481. //Does this node have a parent?
  482. if (typeof datum.parent === "undefined" || datum.parent == null) {
  483. //Doesn't look like it, so this node is the root of the tree
  484. root = datum;
  485. treeMap[datum.id] = root;
  486. } else {
  487. //This node has a parent, so let's look it up using the id
  488. parentNode = idToNodeMap[datum.parent.id];
  489. //We don't need this property, so let's delete it.
  490. delete datum.parent;
  491. //Let's add the current node as a child of the parent node.
  492. parentNode.children.push(datum);
  493. }
  494. }
  495. return root;
  496. }
  497. function convertParentToChildList(data) {
  498. var treeMap = {};
  499. var list = [];
  500. convertListToTree(data, treeMap);
  501. angular.forEach(treeMap, function (item) {
  502. list.push(item);
  503. });
  504. return list;
  505. }
  506. $scope.my_tree = tree = {};
  507. // $scope.try_async_load = function() {
  508. // $scope.my_data = [];
  509. // $scope.select_treedata = [];
  510. // $scope.doing_async = true;
  511. // api_configure_data.fetchDataList('ciclassify', { 'idx': 0, 'sum': 100 }).then(function(result) {
  512. // $scope.my_tree = result['list'];
  513. // $scope.select_treedata = $scope.my_data = convertParentToChildList(result['list']);
  514. // $scope.doing_async = false;
  515. // // tree.expand_all();
  516. // //console.log(treelist);
  517. // });
  518. // };
  519. $scope.select_treedata = [];
  520. $scope.propTypeOptions = [];
  521. // $scope.try_async_load();
  522. // $scope.onFilterCallback = function(item) {
  523. // console.log(item);
  524. // if (angular.isDefined(item.children) && item.children.length >= 1) {
  525. // //not valid
  526. // } else {
  527. // var tempclassify = (item.item?item.item.prefix.toLowerCase():item.prefix.toLowerCase()) + (item.item?item.item.sign:item.sign);
  528. // $scope.gridApi.grid.options.paginationCurrentPage = 1;
  529. // $scope.cifilter_classic = tempclassify;
  530. // var memoryfilterData = {
  531. // "sign": tempclassify,
  532. // "idx": 0,
  533. // "sum": $scope.gridOptions.paginationPageSize
  534. // }
  535. // angular.extend($scope.memoryfilterData, memoryfilterData);
  536. // $scope.fileData["sign"]=tempclassify;
  537. // // $scope.memoryfilterData=memoryfilterData;
  538. // $scope.refreshData('expand-right', $scope.fileData);
  539. // // 专有属性
  540. // api_configure_form.renderTabForm(tempclassify).then(function(data) {
  541. // var myData = Restangular.stripRestangular(data);
  542. // angular.forEach(myData, function(item, index) {
  543. // if (index == 0) {
  544. // $scope.propTypeOptions = myData[0].form.fields;
  545. // } else {
  546. // angular.forEach(item.form.fields, function(itemdata) {
  547. // $scope.propTypeOptions.push(itemdata)
  548. // })
  549. // }
  550. // })
  551. // // $scope.propTypeOptions = myData[2].form.fields;
  552. // console.log($scope.propTypeOptions)
  553. // });
  554. // }
  555. // }
  556. // 报修科室
  557. $scope.getDept = function (key) {
  558. var postData = {
  559. "idx": 0,
  560. "sum": 10
  561. }
  562. if (key) {
  563. postData.department = { dept: key }
  564. }
  565. api_user_data.fetchDataList('department', postData).then(function (response) {
  566. if (response) {
  567. if (response.status = 200) {
  568. $scope.department = response.list;
  569. }
  570. }
  571. })
  572. }
  573. $scope.getDept();
  574. var apple_selected, tree, treedata_avm, treedata_geography;
  575. $scope.my_tree_handler = function (branch) {
  576. //var _ref;
  577. var classify = $scope.classify = branch.prefix.toLowerCase() + branch.sign;
  578. api_cmdb.query({
  579. 'sign': classify
  580. }).then(function (data) {
  581. var myData = Restangular.stripRestangular(data);
  582. // console.log(myData.data.node);
  583. if (myData.data && myData.status == 200) {
  584. var ret = myData.data;
  585. redrawSvg(myData);
  586. }
  587. });
  588. };
  589. //树形图
  590. // $scope.inspecttype = {};
  591. // 将事件分类搜索结果返回的数据整理成children模式
  592. function transform(nodes) {
  593. var treeConverter = {
  594. result: null, //转化后的结果,是根节点,所有节点都是从根节点长出来的
  595. attributeName: 'id', //节点唯一标识符
  596. needFind: true, //是否查询节点在result中已经存在,为了优化效率
  597. transform: function (node) { //转化递归函数,参数:一个待插入节点
  598. if (node.parent != null) { //该节点有父节点
  599. var newNode = this.transform(node.parent); //递归进入,返回值为一个节点,用作父节点,该父节点必然存在于result中,这点由下面的算法可以控制
  600. if (this.needFind) {
  601. for (var i = 0; i < newNode.children.length; i++) { //查找要插入的node子节点是否在newNode这个父节点中存在
  602. if (newNode.children[i][this.attributeName] === node[this.attributeName]) {
  603. return newNode.children[i]; //存在的话直接返回newNode父节点内的该子节点,该子节点必然存在于result中,作为返回值它将被用作上级递归的newNode,因此newNode必然存在于result中
  604. }
  605. }
  606. }
  607. this.needFind = false; //不存在的话,关闭之后递归的循环判断,因为待插入node节点不存在于result中,故而它的子节点一定不存在于result中,不用再循环判断
  608. // delete node.parent; //删除该节点的parent属性,如果有的话
  609. node.children = []; //因为确定是要新插入的节点,没有children:[]属性,故给该节点增加children:[]属性
  610. newNode.children.push(node); //将该node节点push进newNode的子节点数组中
  611. return node; //return该新插入节点,作为递归返回值给上层,用作newNode父节点,node存在于result中故newNode存在于result中
  612. } else if (node.parent == null) { //该叶节点没有父节点,即为根节点
  613. // delete node.parent; //删除该节点的parent属性,如果有的话
  614. if (this.result == null) { //根节点不存在
  615. node.children = []; //给该节点增加children:[]属性
  616. return this.result = node; //该节点赋给result,并return根节点,作为返回值它将被用作上级递归的newNode,因此newNode必然存在于result中
  617. } else {
  618. node.children = [];
  619. // 顶级去重
  620. for (var i = 0; i < this.result.children.length; i++) {
  621. if (this.result.children[i][this.attributeName] === node[this.attributeName]) {
  622. return this.result.children[i];
  623. }
  624. }
  625. this.result.children.push(node)
  626. return node // 直接return根节点,作为返回值它将被用作上级递归的newNode,因此newNode必然存在于result中
  627. }
  628. }
  629. },
  630. getWhole: function (nodes, attributeName) { //传入整个叶子节点数组,attributeName作为节点唯一标识符属性,返回整个转化结果
  631. var _node = {};
  632. _node.children = [];
  633. this.result = _node; //重置根节点
  634. this.attributeName = attributeName == null ? 'id' : attributeName; //唯一标识符默认为“id”
  635. nodes = JSON.parse(JSON.stringify(nodes)); //复制出一个新的节点对象作为参数,保证不改变原有数据
  636. nodes.forEach(item => { //循环调用转化方法
  637. this.needFind = true; //重置开启节点是否已存在判断,保证不插入重复节点
  638. this.transform(item);
  639. })
  640. return this.result; //返回根节点
  641. }
  642. }
  643. var result = treeConverter.getWhole(nodes); //调用
  644. return result;
  645. }
  646. $scope.my_tree = {};
  647. $rootScope.bala1 = $scope.try_async_load = function (s, fn) {
  648. if (s) {
  649. var filterKeyword = s.filterKeyword;
  650. }
  651. var postData = {
  652. "idx": 0,
  653. "sum": 1000
  654. }
  655. if (filterKeyword) {
  656. postData.incidentcategory = { selectType: "pinyin_qs", category: filterKeyword }
  657. }
  658. $scope.my_data = [];
  659. $scope.doing_async = true;
  660. api_bpm_data.fetchDataList('incidentcategory', postData).then(function (response) {
  661. if (response.status == 200) {
  662. var data = response.list;
  663. if (filterKeyword) {
  664. data.forEach(e => {
  665. e.isExpanded = true;
  666. })
  667. var li = transform(data).children;
  668. console.log(li)
  669. fn(li)
  670. return;
  671. } else {
  672. var objects = [];
  673. for (var i = 0; i < data.length; i++) {
  674. var object = {};
  675. object.id = data[i].id;
  676. object.parent = data[i].parent;
  677. // if (data[i].parent && data[i].parent.id != 0) {
  678. // object.parent = data[i].parent.id;
  679. // }
  680. object.category = data[i].category;
  681. object.isExpanded = true;
  682. objects.push(object);
  683. }
  684. $scope.my_data = convertParentToChildList(objects);
  685. $scope.select_treedata = angular.copy($scope.my_data);
  686. }
  687. if ($scope.my_data.length > 0) {
  688. $scope.doing_async = false;
  689. }
  690. } else {
  691. SweetAlert.swal({
  692. title: "系统错误!",
  693. text: "请刷新重试!",
  694. type: "error"
  695. });
  696. }
  697. });
  698. };
  699. $scope.my_data = [];
  700. function convertListToTree(data, treeMap) {
  701. var idToNodeMap = {}; //Keeps track of nodes using id as key, for fast lookup
  702. var root = null; //Initially set our loop to null
  703. var parentNode = null;
  704. //loop over data
  705. for (var i = 0; i < data.length; i++) {
  706. var datum = data[i];
  707. //each node will have children, so let's give it a "children" poperty
  708. datum.children = [];
  709. //add an entry for this node to the map so that any future children can
  710. //lookup the parent
  711. idToNodeMap[datum.id] = datum;
  712. //Does this node have a parent?
  713. if (typeof datum.parent === "undefined" || datum.parent == null) {
  714. //Doesn't look like it, so this node is the root of the tree
  715. root = datum;
  716. treeMap[datum.id] = root;
  717. } else {
  718. //This node has a parent, so let's look it up using the id
  719. parentNode = idToNodeMap[datum.parent.id];
  720. //We don't need this property, so let's delete it.
  721. delete datum.parent;
  722. //Let's add the current node as a child of the parent node.
  723. parentNode.children.push(datum);
  724. }
  725. }
  726. return root;
  727. console.log(root)
  728. }
  729. function convertParentToChildList(data) {
  730. var treeMap = {};
  731. var list = [];
  732. convertListToTree(data, treeMap);
  733. angular.forEach(treeMap, function (item) {
  734. list.push(item);
  735. });
  736. return list;
  737. }
  738. $scope.try_async_load();
  739. // $scope.select_treedata = [];
  740. $scope.propTypeOptions = [];
  741. $scope.deselectItem = function (item) {
  742. console.log(item)
  743. console.log($scope)
  744. }
  745. // 事件分类
  746. $scope.onFilterCallback = function (item) {
  747. // $scope.searchkeys.category={};
  748. console.log(item);
  749. if (item.item) {
  750. $scope.searchkeys.levelCategory = item = undefined;
  751. } else {
  752. $scope.searchkeys.levelCategory = item;
  753. }
  754. // if (angular.isDefined(item.children) && item.children.length >= 1) {
  755. // //not valid
  756. // } else {
  757. // var tempclassify = item.prefix.toLowerCase() + item.sign;
  758. // $scope.gridApi.grid.options.paginationCurrentPage = 1;
  759. // $scope.cifilter_classic = tempclassify;
  760. // var memoryfilterData = {
  761. // "sign": tempclassify,
  762. // "idx": 0,
  763. // "sum": $scope.gridOptions.paginationPageSize
  764. // }
  765. // angular.extend($scope.memoryfilterData, memoryfilterData)
  766. // // $scope.memoryfilterData=memoryfilterData;
  767. // $scope.refreshData('expand-right', $scope.memoryfilterData);
  768. // // 专有属性
  769. // var postData={
  770. // idx:0,
  771. // sum:1000
  772. // }
  773. // api_bpm_data.fetchDataList('incidentcategory',postData).then(function(data){
  774. // console.log(data)
  775. // var myData = Restangular.stripRestangular(data);
  776. // $scope.propTypeOptions = myData[2].form.fields;
  777. // // console.log($scope.propTypeOptions)
  778. // });
  779. // }
  780. }
  781. //状态
  782. $scope.state = [];
  783. // api_bpm_data.fetchDataList('incidentstatus', { "idx": 0, "sum": 100 }).then(function(response) {
  784. api_wechatfile.getDictionary({
  785. "type": "list",
  786. "key": "incident_status"
  787. }).then(function (response) {
  788. if (response) {
  789. if (response.status = 200) {
  790. $scope.state = response;
  791. if (sessionStorage.searchincident && JSON.parse(sessionStorage.getItem("searchincident")).incident) {
  792. angular.forEach($scope.state, function (item) {
  793. if (item.id == JSON.parse(sessionStorage.getItem("searchincident")).incident.statusId) {
  794. $scope.othcode = {
  795. "state": item
  796. };
  797. }
  798. })
  799. }
  800. }
  801. }
  802. })
  803. if (sessionStorage.searchincident && JSON.parse(sessionStorage.getItem("searchincident")).incident) {
  804. // angular.forEach($scope.state, function(item) {
  805. // if (item.code == JSON.parse(sessionStorage.getItem("searchincident")).incident.statusId) {
  806. // $scope.othcode = item.id;
  807. // }
  808. // })
  809. // $scope.othcode = JSON.parse(sessionStorage.getItem("searchincident")).incident.statusId;
  810. if (JSON.parse(sessionStorage.getItem("searchincident")).incident) {
  811. $scope.searchkeys = JSON.parse(sessionStorage.getItem("searchincident")).incident;
  812. }
  813. if ($scope.searchkeys.acceptDate) {
  814. $scope.searchkeys.acceptDate = new Date($scope.searchkeys.acceptDate);
  815. }
  816. if ($scope.searchkeys.acceptDateEnd) {
  817. $scope.searchkeys.acceptDateEnd = new Date($scope.searchkeys.acceptDateEnd);
  818. }
  819. // $scope.gridOptions.paginationCurrentPage = 1 + JSON.parse(sessionStorage.getItem("searchincident")).idx;
  820. }
  821. $scope.clear = function () {
  822. $scope.propTypeOptions = [];
  823. $scope.searchkeys = {};
  824. $scope.searchstate = JSON.parse(sessionStorage.getItem("searchincident")).searchType;
  825. $scope.othcode = {};
  826. $scope.try_async_load();
  827. var fildata = {
  828. "assignee": loginUser.id,
  829. "candidateGroups": loginuserGroup,
  830. "searchType": JSON.parse(sessionStorage.getItem("searchincident")).searchType,
  831. "idx": JSON.parse(sessionStorage.getItem("searchincident")).idx,
  832. "sum": JSON.parse(sessionStorage.getItem("searchincident")).sum
  833. }
  834. sessionStorage.removeItem("searchincident");
  835. fildata.assignee = loginUser.id;
  836. $scope.memoryfilterData = fildata;
  837. $scope.refreshData('expand-right', fildata);
  838. $interval.cancel($scope.timer);
  839. $scope.timer = $interval(function () {
  840. $scope.jry_refresh()
  841. }, $rootScope.refreshTime);
  842. }
  843. // 刷新
  844. $scope.jry_refresh = function () {
  845. var fildata = {};
  846. if (sessionStorage.searchincident) {
  847. fildata = JSON.parse(sessionStorage.getItem("searchincident"));
  848. } else {
  849. fildata = defaultFilterData;
  850. }
  851. if (fildata.incident && fildata.incident.category) {
  852. delete fildata.incident.category
  853. }
  854. fildata.idx = $scope.jry_idx;
  855. fildata.sum = $scope.jry_sum;
  856. $scope.refreshData2('expand-right', fildata);
  857. console.log($scope.cifilter_classic);
  858. }
  859. // 搜索
  860. $scope.chiceIncident = function (item, stateid) {
  861. if (stateid && stateid.id) {
  862. item.statusId = stateid.id;
  863. } else {
  864. item.statusId = undefined;
  865. }
  866. console.log(item)
  867. var fildata = {};
  868. if (sessionStorage.searchincident) {
  869. fildata = JSON.parse(sessionStorage.getItem("searchincident"));
  870. $scope.gridOptions.paginationCurrentPage = 1;
  871. fildata.idx = 0;
  872. } else {
  873. fildata = defaultFilterData;
  874. }
  875. // $scope.memoryfilterData = fildata;
  876. if (!fildata.incident) {
  877. fildata['incident'] = {};
  878. }
  879. // $scope.gridOptions.paginationCurrentPage = 1;
  880. if (item.acceptDate) {
  881. item.acceptDate = moment(item.acceptDate).format('YYYY-MM-DD 00:00:00');
  882. }
  883. if (item.acceptDateEnd) {
  884. // item.acceptDateEnd = moment(item.acceptDateEnd).format('YYYY-MM-DD 00:00:00');
  885. item.acceptDateEnd = moment(item.acceptDateEnd).format('YYYY-MM-DD 23:59:59')
  886. }
  887. // if (parameters) {
  888. // angular.extend(fildata, { 'idx': 0, 'sum': $scope.gridOptions.paginationPageSize })
  889. // angular.extend(fildata.incident, { 'acceptDate': moment(parameters.paramDateFrom).format('YYYY-MM-DD 00:00:00'), 'acceptDateEnd': moment(parameters.paramDateTo).format('YYYY-MM-DD 23:59:59') })
  890. // }
  891. var transitiondata = angular.copy(item);
  892. angular.extend(fildata.incident, transitiondata)
  893. sessionStorage['searchincident'] = JSON.stringify(fildata);
  894. $scope.memoryfilterData = fildata;
  895. fildata.assignee = loginUser.id;
  896. // seimin
  897. if($scope.searchstate === 'all_del'){
  898. fildata.searchType = 'all';
  899. }else{
  900. fildata.searchType = $scope.searchstate;
  901. }
  902. console.log(fildata,78777);
  903. if(fildata.searchType === 'all'){
  904. if(fildata.incident&&fildata.incident.selectType){
  905. fildata.incident.selectType = fildata.incident.selectType.id;
  906. }
  907. }else{
  908. if(fildata.incident&&fildata.incident.selectType){
  909. delete fildata.incident.selectType;
  910. }
  911. }
  912. // /seimin
  913. $scope.refreshData('expand-right', fildata);
  914. $interval.cancel($scope.timer);
  915. $scope.timer = $interval(function () {
  916. $scope.jry_refresh()
  917. }, $rootScope.refreshTime);
  918. }
  919. //区域地点过滤
  920. $scope.key = {};
  921. api_user_data.fetchDataList('area', {
  922. "idx": 0,
  923. "sum": 1000
  924. }).then(function (response) {
  925. if (response) {
  926. if (response.status = 200) {
  927. $scope.outarea = response.list;
  928. }
  929. }
  930. })
  931. //报修人
  932. var getRequester = function () {
  933. api_user_data.fetchDataList('requester', {
  934. idx: 0,
  935. sum: 100
  936. }).then(function (data) {
  937. // console.log(data);
  938. $scope.requester = data.list
  939. });
  940. }
  941. getRequester();
  942. //受理人,处理人
  943. var getUser = function (fieldatas, it) {
  944. api_user_data.fetchDataList('user', fieldatas).then(function (data) {
  945. // console.log(data);
  946. if (it == 1) {
  947. $scope.acceptUser = data.list;
  948. acceptUser = $scope.acceptUser;
  949. } else if (it == 2) {
  950. $scope.handlingPersonnelUser = data.list;
  951. // } else if (it == 3) {
  952. // $scope.acceptUser = data.list;
  953. // $scope.handlingPersonnelUser = data.list;
  954. }
  955. });
  956. }
  957. //受理人过滤
  958. $scope.onChangeacceptUser = function (key) {
  959. console.log(key)
  960. var filuser = {
  961. "idx": 0,
  962. "sum": 10,
  963. "user": {
  964. "name": key,
  965. 'selectType': "pinyin_qs"
  966. }
  967. }
  968. getUser(filuser, 1);
  969. }
  970. //处理人过滤
  971. $scope.onChangehandling = function (key) {
  972. var filuser = {
  973. "idx": 0,
  974. "sum": 10,
  975. "user": {
  976. "name": key,
  977. 'selectType': "pinyin_qs"
  978. }
  979. }
  980. getUser(filuser, 2);
  981. }
  982. //报修科室过滤
  983. $scope.onChangeDept = function (key) {
  984. $scope.getDept(key)
  985. }
  986. //地点区域过滤
  987. $scope.onChangearea = function (data) {
  988. delete $scope.searchkeys.place;
  989. if ($scope.memoryfilterData.incident) {
  990. delete $scope.memoryfilterData.incident.place;
  991. }
  992. var fildata = {
  993. "idx": 0,
  994. "sum": 1000,
  995. "place": {
  996. area: {
  997. id: data.area.id
  998. }
  999. }
  1000. };
  1001. api_user_data.fetchDataList('place', fildata).then(function (response) {
  1002. if (response) {
  1003. if (response.status = 200) {
  1004. $scope.outplace = response.list;
  1005. }
  1006. }
  1007. })
  1008. };
  1009. $scope.starttime = function (data) {
  1010. return moment(new Date(data)).format('YYYY-MM-DD')
  1011. }
  1012. $scope.overtime = function (data) {
  1013. return moment(new Date(data)).format('YYYY-MM-DD HH:mm')
  1014. }
  1015. $scope.areaplace = function (data) {
  1016. // if (data.area && data.place) {
  1017. // if (data.houseNumber) {
  1018. var str = ' ';
  1019. str += ' ' + (data.place ? (data.place.area ? data.place.area.area : ' ') : ' ');
  1020. str += ' ' + (data.place ? (data.place.place ? data.place.place : ' ') : ' ');
  1021. str += ' ' + (data.houseNumber ? data.houseNumber : ' ');
  1022. return str;
  1023. // } else {
  1024. // return data.area.area + ' ' + data.place.place;
  1025. // }
  1026. // } else if (data.area && !data.place) {
  1027. // if (data.houseNumber) {
  1028. // return data.area.area + ' ' + data.houseNumber;
  1029. // } else {
  1030. // return data.area.area;
  1031. // }
  1032. // } else if (!data.area && data.place) {
  1033. // if (data.houseNumber) {
  1034. // return data.place.place + ' ' + data.houseNumber;
  1035. // } else {
  1036. // return data.place.place;
  1037. // }
  1038. // }
  1039. }
  1040. //录音
  1041. $scope.play = function (data) {
  1042. // console.log($scope.item.callID)
  1043. var modalInstance = $modal.open({
  1044. backdrop: "static",
  1045. templateUrl: 'assets/views/incident/tpl/audio.html',
  1046. controller: function ($rootScope, $scope, $modalInstance, $sce, $http, api_playservice) {
  1047. $rootScope.setbusy();
  1048. $scope.datasurl = "";
  1049. $http({
  1050. url: callIp + "/recording/recording?callID=" + data.callID,
  1051. method: 'GET',
  1052. headers: {},
  1053. }).success(function (data, status, headers, config) {
  1054. $scope.data = {
  1055. "name": "视频",
  1056. "url": $sce.trustAsResourceUrl("http://" + data.rrpath)
  1057. };
  1058. $scope.datasurl = data.rrpath;
  1059. }).error(function (data, status, headers, config) { });
  1060. $scope.download = function (contentId, filename) {
  1061. $http({
  1062. url: "http://" + $scope.datasurl,
  1063. method: 'GET',
  1064. headers: {
  1065. 'Content-type': 'application/octet-stream',
  1066. },
  1067. responseType: 'arraybuffer'
  1068. }).success(function (data, status, headers, config) {
  1069. var file = new Blob([data], {
  1070. type: 'application/octet-stream'
  1071. });
  1072. //trick to download store a file having its URL
  1073. var fileURL = URL.createObjectURL(file);
  1074. var a = document.createElement('a');
  1075. a.href = fileURL;
  1076. a.target = '_blank';
  1077. a.download = filename;
  1078. document.body.appendChild(a);
  1079. a.click();
  1080. }).error(function (data, status, headers, config) {
  1081. // console.log(data);
  1082. });
  1083. }
  1084. $scope.cancel = function () {
  1085. $modalInstance.dismiss('cancel');
  1086. };
  1087. $modalInstance.close();
  1088. }
  1089. });
  1090. modalInstance.result.then(function (result) {
  1091. // $rootScope.setidle();
  1092. }, function (reason) {
  1093. $rootScope.setidle();
  1094. });
  1095. };
  1096. $scope.jry_paging = "";
  1097. //列表排序
  1098. // sessionStorage.idx = 0;
  1099. $scope.gridOptions.onRegisterApi = function (gridApi) {
  1100. $scope.gridApi = gridApi;
  1101. var index = 0;
  1102. var oldheader = {};
  1103. gridApi.grid.sortColumn = function (gridApi) {
  1104. if (oldheader.field) {
  1105. if (oldheader.field == gridApi.field) {
  1106. // index = 0;
  1107. } else {
  1108. index = 0;
  1109. }
  1110. }
  1111. index++;
  1112. oldheader = gridApi;
  1113. var fildata = $scope.memoryfilterData;
  1114. if (index % 3 == 0) {
  1115. delete $scope.memoryfilterData.incident;
  1116. fildata = $scope.memoryfilterData;
  1117. } else if (index % 3 == 1) {
  1118. if (fildata.incident) {
  1119. if (gridApi.field == "acceptDate") {
  1120. angular.extend(fildata.incident, {
  1121. "sort": gridApi.field
  1122. });
  1123. } else {
  1124. angular.extend(fildata.incident, {
  1125. "sort": gridApi.field + " desc , _incident.acceptDate"
  1126. });
  1127. }
  1128. } else {
  1129. if (gridApi.field == "acceptDate") {
  1130. angular.extend(fildata, {
  1131. 'incident': {
  1132. "sort": gridApi.field
  1133. }
  1134. });
  1135. } else {
  1136. angular.extend(fildata, {
  1137. 'incident': {
  1138. "sort": gridApi.field + " desc , _incident.acceptDate"
  1139. }
  1140. });
  1141. }
  1142. }
  1143. } else if (index % 3 == 2) {
  1144. if (fildata.incident) {
  1145. if (gridApi.field == "acceptDate") {
  1146. angular.extend(fildata.incident, {
  1147. "sort": gridApi.field,
  1148. "order": "asc"
  1149. });
  1150. } else {
  1151. angular.extend(fildata.incident, {
  1152. "sort": gridApi.field + " asc , _incident.acceptDate"
  1153. });
  1154. }
  1155. } else {
  1156. if (gridApi.field == "acceptDate") {
  1157. angular.extend(fildata, {
  1158. 'incident': {
  1159. "sort": gridApi.field,
  1160. "order": "asc"
  1161. }
  1162. });
  1163. } else {
  1164. angular.extend(fildata.incident, {
  1165. "sort": gridApi.field + " asc , _incident.acceptDate"
  1166. });
  1167. }
  1168. }
  1169. // angular.extend(fildata, { 'incident': { "sort": gridApi.field, "order": "asc" } });
  1170. }
  1171. fildata.assignee = loginUser.id;
  1172. $scope.refreshData('expand-right', fildata);
  1173. }
  1174. $scope.jry_idx = 0;
  1175. $scope.jry_sum = 10;
  1176. gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
  1177. var filtersData = $scope.memoryfilterData;
  1178. filtersData.idx = newPage - 1;
  1179. $scope.jry_paging = newPage - 1;
  1180. $scope.jry_idx = newPage - 1;
  1181. filtersData.sum = pageSize;
  1182. $scope.jry_sum = pageSize;
  1183. if (JSON.parse(sessionStorage.getItem("searchincident")).idx != filtersData.idx || JSON.parse(sessionStorage.getItem("searchincident")).sum != filtersData.sum) {
  1184. filtersData.assignee = loginUser.id;
  1185. $scope.refreshData('expand-right', filtersData);
  1186. }
  1187. // $scope.refreshData('expand-right', {"assignee":$rootScope.user.id, "candidateGroups":$rootScope.user.group[0].id, "idx":newPage-1,"sum":pageSize});
  1188. });
  1189. // gridApi.selection.on.rowSelectionChanged($scope, function(data) {
  1190. // data.grid.appScope.selected.items = data.entity
  1191. // });
  1192. $scope.Change = function (upTypes) {
  1193. if (angular.isDefined($scope.selected.items)) {
  1194. if (angular.isDefined(upTypes) && upTypes == 'upincident') {
  1195. var data = {
  1196. cancelUrl: 'app.incident.list',
  1197. model: {
  1198. problem: {
  1199. title: $scope.selected.items.title,
  1200. des: $scope.selected.items.description,
  1201. proposePerson: $scope.selected.items.handlerUser,
  1202. source: {
  1203. id: 1,
  1204. code: 1,
  1205. name: ' 事件 '
  1206. },
  1207. incident: $scope.selected.items
  1208. }
  1209. }
  1210. }
  1211. $state.go('app.problem.incident', {
  1212. pdKey: 'incident',
  1213. dataId: $scope.selected.items.id,
  1214. processInstanceId: $scope.selected.items.processInstanceId,
  1215. 'model': JSON.stringify(data)
  1216. });
  1217. } else if (angular.isDefined(upTypes) && upTypes == 'upchange') {
  1218. var data = {
  1219. cancelUrl: 'app.incident.list',
  1220. model: {
  1221. change: {
  1222. title: $scope.selected.items.title,
  1223. description: $scope.selected.items.description,
  1224. requestingPerson: $scope.selected.items.handlerUser,
  1225. source: {
  1226. id: 1,
  1227. code: 1,
  1228. name: ' 事件 '
  1229. },
  1230. incident: $scope.selected.items
  1231. }
  1232. }
  1233. }
  1234. // var data={cancelUrl:'app.incident.list'}
  1235. $state.go('app.change.incident', {
  1236. pdKey: 'incident',
  1237. dataId: $scope.selected.items.id,
  1238. processInstanceId: $scope.selected.items.processInstanceId,
  1239. 'model': JSON.stringify(data)
  1240. });
  1241. }
  1242. }
  1243. }
  1244. $scope.selected = {
  1245. items: []
  1246. }
  1247. gridApi.core.on.filterChanged($scope, function () {
  1248. var grid = this.grid;
  1249. if ($rootScope.user.group) {
  1250. var filtersData = {
  1251. "assignee": loginUser.id,
  1252. "candidateGroups": loginuserGroup,
  1253. idx: 0,
  1254. sum: mun
  1255. };
  1256. } else {
  1257. var filtersData = {
  1258. "assignee": loginUser.id,
  1259. idx: 0,
  1260. sum: mun
  1261. };
  1262. }
  1263. angular.forEach(grid.columns, function (item) {
  1264. if (item.enableFiltering) {
  1265. if (angular.isDefined(item.filters[0].term) && item.filters[0].term != '') {
  1266. filtersData = $scope.memoryfilterData
  1267. if (angular.isUndefined(filtersData['incident'])) {
  1268. filtersData['incident'] = {};
  1269. }
  1270. if (item.field == 'department.dept') {
  1271. filtersData['incident']['department'] = {};
  1272. filtersData.incident.department['department'] = item.filters[0].term;
  1273. } else if (item.field == 'handlingPersonnelUser.name') {
  1274. filtersData['incident']['handlingPersonnelUser'] = {};
  1275. filtersData.incident.handlingPersonnelUser['name'] = item.filters[0].term;
  1276. } else if (item.field == 'requester.account') {
  1277. filtersData['incident']['requester'] = {};
  1278. filtersData.incident.requester['account'] = item.filters[0].term;
  1279. } else if (item.field == 'acceptUser.name') {
  1280. filtersData['incident']['acceptUser'] = {};
  1281. filtersData.incident.acceptUser['name'] = item.filters[0].term;
  1282. } else {
  1283. filtersData['incident'][item.field] = item.filters[0].term;
  1284. }
  1285. }
  1286. }
  1287. });
  1288. filtersData.idx = 0;
  1289. filtersData.assignee = loginUser.id;
  1290. $scope.memoryfilterData = filtersData;
  1291. $scope.refreshData('expand-right', filtersData);
  1292. });
  1293. };
  1294. //当前人是否分组
  1295. if ($rootScope.user.group) {
  1296. if ($rootScope.user.group.length == 0) {
  1297. SweetAlert.swal("访问失败!", "当前登录人未分配工作组,无权限访问,请添加工作组后重试。", "error");
  1298. } else {
  1299. $scope.memoryfilterData = defaultFilterData = {
  1300. "assignee": loginUser.id,
  1301. "candidateGroups": loginuserGroup,
  1302. "searchType": "todo",
  1303. "idx": 0,
  1304. "sum": mun
  1305. };
  1306. }
  1307. } else {
  1308. $scope.memoryfilterData = defaultFilterData = {
  1309. "assignee": loginUser.id,
  1310. "searchType": "todo",
  1311. "idx": 0,
  1312. "sum": mun
  1313. };
  1314. }
  1315. //打印
  1316. $scope.open = function (data) {
  1317. var modalInstance = $modal.open({
  1318. templateUrl: 'assets/views/incident/tpl/print.html',
  1319. controller: function ($scope, $modalInstance) {
  1320. $scope.printdata = data;
  1321. if (!data.emergency) {
  1322. data['emergency'] = {};
  1323. }
  1324. if (!data.influence) {
  1325. data['influence'] = {};
  1326. }
  1327. if (!data.place) {
  1328. data['place'] = {};
  1329. }
  1330. if (!data.influence) {
  1331. data['influence'] = {};
  1332. }
  1333. if (!data.emergency) {
  1334. data['emergency'] = {};
  1335. }
  1336. if (!data.influence) {
  1337. data['influence'] = {};
  1338. }
  1339. var height = $(".groundborder").height()
  1340. // console.log(height)
  1341. $scope.printrequest = [{
  1342. name: "事件单号",
  1343. value: data.incidentsign
  1344. },
  1345. {
  1346. name: "事件主题",
  1347. value: data.title
  1348. },
  1349. {
  1350. name: "事件分类",
  1351. value: data.category.category
  1352. },
  1353. {
  1354. name: "紧急度",
  1355. value: data.emergency.name
  1356. },
  1357. {
  1358. name: "影响度",
  1359. value: data.influence.name
  1360. },
  1361. {
  1362. name: "优先级",
  1363. value: data.priority.name
  1364. }
  1365. ];
  1366. $scope.printrequest['requester'] = [{
  1367. nameone: "用户姓名",
  1368. valueone: data.requester.name,
  1369. nametwo: "联系电话",
  1370. valuetwo: data.requester.mphone
  1371. },
  1372. {
  1373. nameone: "故障地点",
  1374. valueone: data.place.place,
  1375. nametwo: "申报时间",
  1376. valuetwo: data.acceptDate
  1377. }
  1378. ];
  1379. // $scope.printrequest['requester']=[{name:"用户姓名",value:data.requester.name},
  1380. // {name:"联系电话",value:data.requester.mphone},
  1381. // {name:"故障地点",value:data.place.place},
  1382. // {name:"申报时间",value:data.responseTime}];
  1383. $scope.printrequest['incident'] = [{
  1384. nameone: "故障工单",
  1385. valueone: data.incidentsign,
  1386. nametwo: "故障分类",
  1387. valuetwo: data.category.category
  1388. }];
  1389. $scope.printrequest['handler'] = [{
  1390. name: "故障描述",
  1391. value: data.description
  1392. },
  1393. {
  1394. name: "处理人",
  1395. value: data.handlingPersonnelUser ? data.handlingPersonnelUser.name : ''
  1396. },
  1397. // { name: "处理人", value: data.requester ? data.requester.name : '' }
  1398. ];
  1399. // {name:"处理结果",value:data.handleResult}];
  1400. // {name:"用户评价",value:''},
  1401. // {name:"满意度",value:''},
  1402. // {name:"用户签字",value:''}];
  1403. $scope.cancel = function () {
  1404. $modalInstance.dismiss('cancel');
  1405. };
  1406. },
  1407. size: 'lg'
  1408. });
  1409. }
  1410. //新建事件
  1411. $scope.newincident = function (data) {
  1412. $state.go('app.incident.editor', {});
  1413. };
  1414. //编辑
  1415. $scope.selectRowFunction = function (data) {
  1416. $state.go('app.incident.editor', {
  1417. taskId: data.taskId,
  1418. processInstanceId: data.processInstanceId,
  1419. dataId: data.id,
  1420. // type:1
  1421. });
  1422. };
  1423. // //双击查看详情
  1424. // $scope.onDblClick = function (data) {
  1425. // console.log(data);
  1426. // // console.log('data='+JSON.stringify(data));
  1427. // //$state.go('app.detail',{taskId:data.taskId,processInstanceId: data.processInstanceId});
  1428. // $state.go('app.incident.detail', {
  1429. // formKey: 'incident_back',
  1430. // pdKey: 'incident',
  1431. // dataId: data.entity.id,
  1432. // taskId: data.entity.taskId,
  1433. // processInstanceId: data.entity.processInstanceId
  1434. // });
  1435. // };
  1436. //修改
  1437. $scope.changeClick = function (data) {
  1438. $state.go('app.incident.detail', {
  1439. formKey: 'incident_change',
  1440. pdKey: 'incident',
  1441. dataId: data.id,
  1442. taskId: data.taskId,
  1443. processInstanceId: data.processInstanceId
  1444. });
  1445. };
  1446. //回访
  1447. $scope.visit = function (data) {
  1448. $state.go('app.incident.detail', {
  1449. formKey: 'incident_visit',
  1450. pdKey: 'incident',
  1451. dataId: data.id,
  1452. taskId: data.taskId,
  1453. processInstanceId: data.processInstanceId
  1454. });
  1455. };
  1456. //查看
  1457. $scope.followFunction = function (data) {
  1458. //console.log('data='+JSON.stringify(data));
  1459. console.log(data);
  1460. $state.go('app.detail', {
  1461. formKey: 'statusform',
  1462. pdKey: 'incident',
  1463. dataId: data.id,
  1464. processInstanceId: data.processInstanceId
  1465. });
  1466. };
  1467. // 升级
  1468. $scope.upgrade = function (data) {
  1469. console.log(data);
  1470. console.log('升级');
  1471. // 弹窗下拉菜单单选
  1472. } // 转派
  1473. $scope.rotate = function (data) {
  1474. console.log(data);
  1475. console.log('转派');
  1476. // 弹窗下拉菜单单选
  1477. } // 协同
  1478. $scope.cooperate = function (data) {
  1479. console.log(data);
  1480. console.log('协同');
  1481. // 弹窗下拉菜单多选
  1482. }
  1483. // 升级问题
  1484. $scope.problem = function (data) {
  1485. // console.log(data);
  1486. delete data.item;
  1487. delete data.chaozuoPower;
  1488. delete data.coordination;
  1489. delete data.listen;
  1490. // console.log(data);
  1491. $state.go('app.problem.incident', {
  1492. 'model': JSON.stringify(data)
  1493. });
  1494. }
  1495. //变更升级
  1496. $scope.configuration = function (data) {
  1497. $state.go('app.change.incident', {
  1498. 'model': JSON.stringify(data)
  1499. });
  1500. };
  1501. //协同人
  1502. $scope.coordination = function (data) {
  1503. var modalInstance = $modal.open({
  1504. templateUrl: 'assets/views/customform/tpl/checktable-modal-content.html',
  1505. controller: function ($scope, $modalInstance, i18nService, $timeout, api_bpm_domain, api_user_data) {
  1506. $scope.langs = i18nService.getAllLangs();
  1507. $scope.lang = 'zh-cn';
  1508. i18nService.setCurrentLang($scope.lang);
  1509. $scope.gridOptions = {};
  1510. $scope.gridOptions.data = 'myData';
  1511. $scope.gridOptions.enableColumnResizing = true;
  1512. $scope.gridOptions.enableFiltering = true;
  1513. $scope.gridOptions.enableGridMenu = true;
  1514. $scope.gridOptions.showGridFooter = true;
  1515. $scope.gridOptions.showColumnFooter = true;
  1516. $scope.gridOptions.fastWatch = true;
  1517. $scope.gridOptions.useExternalFiltering = true;
  1518. $scope.gridOptions.useExternalPagination = true;
  1519. $scope.gridOptions.paginationPageSizes = [10, 20, 50, 100];
  1520. $scope.gridOptions.paginationPageSize = 10;
  1521. $scope.gridOptions.multiSelect = false;
  1522. $scope.gridOptions.rowIdentity = function (row) {
  1523. return row.id;
  1524. };
  1525. $scope.gridOptions.getRowIdentity = function (row) {
  1526. return row.id;
  1527. };
  1528. $scope.gridOptions.columnDefs = [
  1529. // { name:'id', width:80, enableFiltering:false},
  1530. {
  1531. name: 'account',
  1532. displayName: '账号',
  1533. width: 140
  1534. },
  1535. {
  1536. name: 'name',
  1537. displayName: '名称',
  1538. width: 100
  1539. },
  1540. {
  1541. name: 'gender',
  1542. displayName: '性别',
  1543. width: 140,
  1544. enableFiltering: false
  1545. },
  1546. {
  1547. name: 'phone',
  1548. displayName: '电话',
  1549. width: 100,
  1550. enableFiltering: false
  1551. },
  1552. {
  1553. name: 'email',
  1554. displayName: '邮件',
  1555. width: 100,
  1556. enableFiltering: false
  1557. },
  1558. {
  1559. name: 'dept.dept',
  1560. displayName: '科室',
  1561. width: 100,
  1562. enableFiltering: false
  1563. },
  1564. {
  1565. name: 'group[0].groupName',
  1566. displayName: '职位',
  1567. width: 100,
  1568. enableFiltering: false
  1569. }
  1570. ];
  1571. $scope.gridOptions.onRegisterApi = function (gridApi) {
  1572. $scope.gridApi = gridApi;
  1573. gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
  1574. var filtersData = $scope.memoryfilterData;
  1575. filtersData.idx = newPage - 1;
  1576. filtersData.sum = pageSize;
  1577. $scope.loadData(filtersData);
  1578. // $scope.loadData({"idx":newPage-1,"sum":pageSize});
  1579. });
  1580. gridApi.selection.on.rowSelectionChanged($scope, function (scope) {
  1581. scope.grid.appScope.selected.items[0] = scope.entity;
  1582. // $scope.selected.items[0] = scope.entity;
  1583. });
  1584. gridApi.core.on.filterChanged($scope, function () {
  1585. var grid = this.grid;
  1586. var filtersData = {
  1587. idx: 0,
  1588. sum: 10,
  1589. "user": {
  1590. "roledata": {
  1591. "rolecode": options.model.currentRole
  1592. },
  1593. "selectType": "1"
  1594. }
  1595. };
  1596. angular.forEach(grid.columns, function (item) {
  1597. if (item.enableFiltering) {
  1598. //console.log("filtersData="+JSON.stringify(filtersData))
  1599. if (angular.isDefined(item.filters[0].term) && item.filters[0].term != '') {
  1600. if (angular.isUndefined(filtersData['user'])) {
  1601. filtersData['user'] = {};
  1602. }
  1603. filtersData['user'][item.field] = item.filters[0].term;
  1604. }
  1605. }
  1606. });
  1607. $scope.memoryfilterData = filtersData;
  1608. $scope.loadData(filtersData);
  1609. });
  1610. };
  1611. $scope.selected = {
  1612. items: []
  1613. }
  1614. var filterData = {
  1615. "idx": 0,
  1616. "sum": 10,
  1617. "user": {
  1618. "roledata": {
  1619. "rolecode": 'first-line support'
  1620. },
  1621. "selectType": "1"
  1622. }
  1623. }
  1624. $scope.loadData = function (filterData) {
  1625. // console.log(" filtersData['user'][item.field]=111"+JSON.stringify(filterData));
  1626. api_user_data.fetchDataList('user', filterData).then(function (data) {
  1627. var myData = Restangular.stripRestangular(data);
  1628. $scope.gridOptions.totalItems = myData.totalNum;
  1629. $scope.myData = myData.list;
  1630. });
  1631. };
  1632. $scope.loadData({
  1633. idx: 0,
  1634. sum: 10,
  1635. "user": {
  1636. "roledata": {
  1637. "rolecode": 'first-line support'
  1638. },
  1639. "selectType": "1"
  1640. }
  1641. });
  1642. $scope.ok = function () {
  1643. $modalInstance.close($scope.selected.items);
  1644. };
  1645. $scope.cancel = function () {
  1646. $modalInstance.dismiss('cancel');
  1647. };
  1648. },
  1649. size: 'lg'
  1650. });
  1651. modalInstance.result.then(function (selectedItem) {
  1652. if (selectedItem) {
  1653. var filterData = {
  1654. "assginee": selectedItem[0].id
  1655. }
  1656. api_bpm_domain.delegateTask(data.taskId, filterData).then(function (data) {
  1657. if (data && data.status == 200) {
  1658. SweetAlert.swal("添加成功!", "添加协同人成功", "success");
  1659. $scope.memoryfilterData.assignee = loginUser.id;
  1660. $scope.refreshData('expand-right', $scope.memoryfilterData);
  1661. } else {
  1662. SweetAlert.swal("添加失败!", "请稍候重试", "error");
  1663. }
  1664. // var myData = Restangular.stripRestangular(data);
  1665. // $scope.gridOptions.totalItems = myData.totalNum;
  1666. // $scope.myData = myData.list;
  1667. });
  1668. }
  1669. });
  1670. }
  1671. // $scope.onDblClick = function(row){
  1672. // console.log(row.entity);
  1673. // if($rootScope.user.id==row.entity.handlerUser.id){$state.go('app.incident.editor',{taskId:row.entity.taskId,processInstanceId: row.entity.processInstanceId});}
  1674. // else{$state.go('app.detail', { formKey:'incident_back', pdKey:'incident', dataId: row.entity.id});}
  1675. // };
  1676. /*
  1677. appScopeProvider: {
  1678. onDblClick : function(row) {
  1679. var url = '//google.com';
  1680. $window.open(url, "_blank", "height=600,width=800,toolbar=no,location=no,menubar=no,titlebar=no");
  1681. }
  1682. },
  1683. rowTemplate: "<div ng-dblclick=\"grid.appScope.onDblClick(row)\" ng-repeat=\"(colRenderIndex, col) in colContainer.renderedColumns track by col.colDef.name\" class=\"ui-grid-cell\" ng-class=\"{ 'ui-grid-row-header-cell': col.isRowHeader }\" ui-grid-cell ></div>"
  1684. */
  1685. //删除
  1686. $scope.eventDeleted = function (event) {
  1687. SweetAlert.swal({
  1688. title: "确认删除?",
  1689. text: "删除的数据不可恢复,请确认继续操作!",
  1690. type: "warning",
  1691. showCancelButton: true,
  1692. confirmButtonColor: "#DD6B55",
  1693. confirmButtonText: "继续删除",
  1694. cancelButtonText: "取消操作",
  1695. closeOnConfirm: false,
  1696. closeOnCancel: false
  1697. }, function (isConfirm) {
  1698. if (isConfirm) {
  1699. api_bpm_schedule.remove([event.id]).then(function (response) {
  1700. if (response.status == 200) {
  1701. $scope.events.splice(event.id, 1); //有修改的一行
  1702. SweetAlert.swal("操作成功!", "数据已经被删除.", "success");
  1703. } else {
  1704. SweetAlert.swal("操作失败!", "数据暂时无法被删除,请稍候重试", "error");
  1705. }
  1706. });
  1707. } else {
  1708. SweetAlert.swal("操作取消", "数据安全", "error");
  1709. }
  1710. });
  1711. };
  1712. //导出
  1713. $scope.export = function () {
  1714. // api_bpm_data.downDataModel("incident", 3, $scope.memoryfilterData).then(function(data) {
  1715. // console.log(data)
  1716. // var file = new Blob([data], {
  1717. // // type: 'application/octet-stream'
  1718. // type: 'application/vnd.ms-excel'
  1719. // });
  1720. // //trick to download store a file having its URL
  1721. // var fileURL = URL.createObjectURL(file);
  1722. // var a = document.createElement('a');
  1723. // a.href = fileURL;
  1724. // a.target = '_blank';
  1725. // a.download = '事件列表.xls';
  1726. // document.body.appendChild(a);
  1727. // a.click();
  1728. // })
  1729. // $scope.ldloading[style.replace('-', '_')] = true;
  1730. console.log($scope.memoryfilterData)
  1731. var filadata = angular.copy($scope.memoryfilterData);
  1732. filadata.sum = 10000;
  1733. console.log($scope.filadata)
  1734. $http({
  1735. url: api_bpm_data.downDataModel("incident", 3).getRequestedUrl(),
  1736. method: 'POST',
  1737. data: JSON.stringify(filadata),
  1738. headers: {
  1739. // 'Content-type': 'application/xls',
  1740. 'Accept': '*/*'
  1741. },
  1742. responseType: 'arraybuffer'
  1743. }).success(function (data, status, headers, config) {
  1744. // $scope.ldloading.zoom_in = false;
  1745. var file = new Blob([data], {
  1746. type: 'application/vnd.ms-excel'
  1747. });
  1748. //trick to download store a file having its URL
  1749. var fileURL = URL.createObjectURL(file);
  1750. var a = document.createElement('a');
  1751. a.href = fileURL;
  1752. a.target = '_blank';
  1753. a.download = '事件列表.xls';
  1754. document.body.appendChild(a);
  1755. a.click();
  1756. }).error(function (data, status, headers, config) {
  1757. // $scope.ldloading.zoom_in = false;
  1758. console.log(data);
  1759. });
  1760. }
  1761. //事件提取
  1762. $scope.acceptTaskAction = function (model) {
  1763. var modalInstance = $modal.open({
  1764. templateUrl: 'assets/views/incident/tpl/acceptTask.tpl.html',
  1765. controller: function ($scope, $modalInstance, APIService, modelData, currentUserId, Alert) {
  1766. var receiveTask = function (receive_code, modelData) {
  1767. var data = {
  1768. 'receive_code': receive_code
  1769. };
  1770. if (modelData) {
  1771. return {
  1772. taskId: modelData.taskId,
  1773. data: data
  1774. };
  1775. } else {
  1776. return 'error';
  1777. }
  1778. };
  1779. $scope.title = "提示";
  1780. $scope.connect = "确认抢单?";
  1781. $scope.ok = function () {
  1782. //接收任务//请求重新指派
  1783. var data = receiveTask($scope.receive_code, modelData);
  1784. APIService.claimAndCompletedTask(data.taskId, {
  1785. userId: currentUserId,
  1786. receive_code: "handler"
  1787. }).then(function (response) {
  1788. if (response.status == 200) {
  1789. Alert.swal({
  1790. title: "操作成功!",
  1791. confirmButtonColor: "#007AFF",
  1792. type: "success"
  1793. });
  1794. $modalInstance.close('success');
  1795. } else if (response.status == 500) {
  1796. Alert.swal({
  1797. title: "操作失败",
  1798. text: "该事件已被提取,请刷新页面!",
  1799. type: "error"
  1800. });
  1801. $modalInstance.close('success');
  1802. } else {
  1803. Alert.swal({
  1804. title: "操作失败",
  1805. text: "操作失败, 请稍后再试!",
  1806. type: "error"
  1807. });
  1808. }
  1809. });
  1810. }
  1811. $scope.cancel = function () {
  1812. $modalInstance.dismiss('cancel');
  1813. }
  1814. },
  1815. size: 'sm',
  1816. resolve: {
  1817. APIService: function () {
  1818. return api_bpm_domain;
  1819. },
  1820. modelData: function () {
  1821. return model;
  1822. },
  1823. currentUserId: function () {
  1824. return loginUser.id;
  1825. },
  1826. Alert: function () {
  1827. return SweetAlert;
  1828. }
  1829. }
  1830. });
  1831. modalInstance.result.then(function (selectedItem) {
  1832. if (selectedItem == 'success') {
  1833. defaultFilterData.assignee = loginUser.id;
  1834. $scope.refreshData('expand-right', defaultFilterData);
  1835. }
  1836. });
  1837. }
  1838. // 升级弹窗
  1839. $scope.upgrade = function (model) {
  1840. console.log(model)
  1841. var modalInstance = $modal.open({
  1842. templateUrl: 'assets/views/incident/tpl/upgrade.tpl.html',
  1843. controller: function ($scope, $modalInstance, api_bpm, modelData, currentUserId, Alert, api_user_data) {
  1844. console.log(model);
  1845. $scope.roleList = {
  1846. 'idx': 0,
  1847. 'sum': 100,
  1848. 'user': {
  1849. 'roledata': {
  1850. 'rolecode': ''
  1851. },
  1852. 'groupdata': {
  1853. 'id': ''
  1854. },
  1855. 'selectType': 1
  1856. }
  1857. }
  1858. for (var i = 0; i < loginUser.role.length; i++) {
  1859. // console.log(loginUser.role[i])
  1860. if (loginUser.role[i].role == '一线支持人员') {
  1861. $scope.roleList.user.roledata.rolecode = loginUser.role[i].rolecode;
  1862. $scope.upRole = '二线支持人员';
  1863. }
  1864. if (loginUser.role[i].role == '二线支持人员') {
  1865. $scope.roleList.user.roledata.rolecode = loginUser.role[i].rolecode;
  1866. $scope.upRole = '事件经理';
  1867. }
  1868. }
  1869. var userId = loginUser.id;
  1870. var taskId = model.taskId;
  1871. var postData = {};
  1872. var formKey = model.formKey;
  1873. var processInstanceId = model.processInstanceId;
  1874. $scope.choosUser = {};
  1875. api_configure_form.renderForm(formKey, userId, processInstanceId).then(function (data) {
  1876. postData = data.model;
  1877. })
  1878. $scope.choosUser = {};
  1879. api_user_data.fetchDataList('group', {
  1880. "idx": 0,
  1881. "sum": 100
  1882. }).then(function (data) {
  1883. $scope.group = data.list;
  1884. })
  1885. $scope.onChangeGroup = function (item) {
  1886. $scope.user = [];
  1887. console.log(item);
  1888. console.log($scope.choosUser.group)
  1889. $scope.roleList.user.groupdata.id = $scope.choosUser.group.id
  1890. console.log($scope.roleList)
  1891. if ($scope.choosUser.group) {
  1892. api_user_data.fetchDataList('user', $scope.roleList).then(function (data) {
  1893. console.log(data);
  1894. if (data.list.length == 0) {
  1895. Alert.swal({
  1896. title: "暂无处理人数据",
  1897. text: "该工作组暂无升级对象!",
  1898. type: "error"
  1899. });
  1900. return;
  1901. } else {
  1902. $scope.user = data.list;
  1903. }
  1904. })
  1905. }
  1906. }
  1907. $scope.ok = function () {
  1908. if ($scope.choosUser.handlerUser) {
  1909. postData.handler_code = 'function';
  1910. postData.incident.handlerUser = $scope.choosUser.handlerUser;
  1911. postData.incident.assignee = postData.assignee = $scope.choosUser.handlerUser.id;
  1912. console.log(postData);
  1913. } else {
  1914. Alert.swal({
  1915. title: "操作失败",
  1916. text: "请选择升级对象信息!",
  1917. type: "error"
  1918. });
  1919. return;
  1920. }
  1921. api_bpm.upgrade(postData, taskId, userId, 'completeTask').then(function (response) {
  1922. console.log(response)
  1923. if (response.status == 200) {
  1924. Alert.swal({
  1925. title: "操作成功!",
  1926. confirmButtonColor: "#007AFF",
  1927. type: "success"
  1928. });
  1929. $modalInstance.close('success');
  1930. } else if (response.status == 500) {
  1931. Alert.swal({
  1932. title: "操作失败",
  1933. text: "该事件已被提取,请刷新页面!",
  1934. type: "error"
  1935. });
  1936. $modalInstance.close('success');
  1937. } else {
  1938. Alert.swal({
  1939. title: "操作失败",
  1940. text: "操作失败, 请稍后再试!",
  1941. type: "error"
  1942. });
  1943. }
  1944. });
  1945. }
  1946. $scope.cancel = function () {
  1947. $modalInstance.dismiss('cancel');
  1948. }
  1949. },
  1950. size: 'sm',
  1951. resolve: {
  1952. api_bpm: function () {
  1953. return api_bpm;
  1954. },
  1955. modelData: function () {
  1956. return model;
  1957. },
  1958. currentUserId: function () {
  1959. return loginUser.id;
  1960. },
  1961. Alert: function () {
  1962. return SweetAlert;
  1963. },
  1964. api_user_data: function () {
  1965. return api_user_data;
  1966. }
  1967. }
  1968. });
  1969. modalInstance.result.then(function (selectedItem) {
  1970. if (selectedItem == 'success') {
  1971. defaultFilterData.assignee = loginUser.id;
  1972. $scope.refreshData('expand-right', defaultFilterData);
  1973. }
  1974. });
  1975. }
  1976. // 转派弹窗
  1977. $scope.rotate = function (model) {
  1978. console.log(model)
  1979. var modalInstance = $modal.open({
  1980. templateUrl: 'assets/views/incident/tpl/rotate.tpl.html',
  1981. controller: function ($scope, $modalInstance, api_bpm, modelData, currentUserId, Alert, api_user_data) {
  1982. console.log(model);
  1983. $scope.roleList = {
  1984. 'idx': 0,
  1985. 'sum': 100,
  1986. 'user': {
  1987. 'roledata': {
  1988. 'rolecode': ''
  1989. },
  1990. 'groupdata': {
  1991. 'id': ''
  1992. },
  1993. 'selectType': 1
  1994. }
  1995. }
  1996. for (var i = 0; i < loginUser.role.length; i++) {
  1997. // console.log(loginUser.role[i])
  1998. if (loginUser.role[i].role == '一线支持人员') {
  1999. $scope.roleList.user.roledata.rolecode = loginUser.role[i].rolecode;
  2000. $scope.upRole = loginUser.role[i].role;
  2001. }
  2002. if (loginUser.role[i].role == '二线支持人员') {
  2003. $scope.roleList.user.roledata.rolecode = loginUser.role[i].rolecode;
  2004. $scope.upRole = loginUser.role[i].role;
  2005. }
  2006. if (loginUser.role[i].role == '事件经理') {
  2007. $scope.roleList.user.roledata.rolecode = loginUser.role[i].rolecode;
  2008. $scope.upRole = loginUser.role[i].role;
  2009. }
  2010. }
  2011. var userId = loginUser.id;
  2012. var taskId = model.taskId;
  2013. var postData = {};
  2014. var formKey = model.formKey;
  2015. var processInstanceId = model.processInstanceId;
  2016. $scope.choosUser = {};
  2017. api_configure_form.renderForm(formKey, userId, processInstanceId).then(function (data) {
  2018. postData = data.model;
  2019. })
  2020. api_user_data.fetchDataList('group', {
  2021. "idx": 0,
  2022. "sum": 100
  2023. }).then(function (data) {
  2024. $scope.group = data.list;
  2025. })
  2026. $scope.onChangeGroup = function (item) {
  2027. $scope.roleList.user.groupdata.id = $scope.choosUser.group.id
  2028. console.log($scope.choosUser);
  2029. if ($scope.choosUser.group) {
  2030. api_user_data.fetchDataList('user', $scope.roleList).then(function (data) {
  2031. console.log(data);
  2032. if (data.list.length == 0) {
  2033. Alert.swal({
  2034. title: "暂无处理人数据",
  2035. text: "该工作组暂无转派对象!",
  2036. type: "error"
  2037. });
  2038. return;
  2039. } else {
  2040. $scope.user = data.list;
  2041. }
  2042. })
  2043. }
  2044. }
  2045. $scope.ok = function () {
  2046. if ($scope.choosUser.handlerUser) {
  2047. postData.handler_code = 'forward';
  2048. postData.incident.handlerUser = $scope.choosUser.handlerUser;
  2049. postData.incident.assignee = postData.assignee = $scope.choosUser.handlerUser.id;
  2050. console.log(postData);
  2051. } else {
  2052. Alert.swal({
  2053. title: "操作失败",
  2054. text: "请选择转派对象信息!",
  2055. type: "error"
  2056. });
  2057. return;
  2058. }
  2059. api_bpm.upgrade(postData, taskId, userId, 'completeTask').then(function (response) {
  2060. console.log(response)
  2061. if (response.status == 200) {
  2062. Alert.swal({
  2063. title: "操作成功!",
  2064. confirmButtonColor: "#007AFF",
  2065. type: "success"
  2066. });
  2067. $modalInstance.close('success');
  2068. } else if (response.status == 500) {
  2069. Alert.swal({
  2070. title: "操作失败",
  2071. text: "该事件已被提取,请刷新页面!",
  2072. type: "error"
  2073. });
  2074. $modalInstance.close('success');
  2075. } else {
  2076. Alert.swal({
  2077. title: "操作失败",
  2078. text: "操作失败, 请稍后再试!",
  2079. type: "error"
  2080. });
  2081. }
  2082. });
  2083. }
  2084. $scope.cancel = function () {
  2085. $modalInstance.dismiss('cancel');
  2086. }
  2087. },
  2088. size: 'sm',
  2089. resolve: {
  2090. api_bpm: function () {
  2091. return api_bpm;
  2092. },
  2093. modelData: function () {
  2094. return model;
  2095. },
  2096. currentUserId: function () {
  2097. return loginUser.id;
  2098. },
  2099. Alert: function () {
  2100. return SweetAlert;
  2101. },
  2102. api_user_data: function () {
  2103. return api_user_data;
  2104. }
  2105. }
  2106. });
  2107. modalInstance.result.then(function (selectedItem) {
  2108. if (selectedItem == 'success') {
  2109. defaultFilterData.assignee = loginUser.id;
  2110. $scope.refreshData('expand-right', defaultFilterData);
  2111. }
  2112. });
  2113. }
  2114. // 指派弹窗baba
  2115. $scope.toAssign = function (model) {
  2116. console.log(model)
  2117. var modalInstance = $modal.open({
  2118. templateUrl: 'assets/views/incident/tpl/toAssign.tpl.html',
  2119. controller: function ($scope, $modalInstance, api_bpm_domain, modelData, currentUserId, Alert, api_user_data) {
  2120. console.log(model,loginUser);
  2121. //获取组下面的用户
  2122. $scope.getUsers = function(groupId){
  2123. $scope.user = [];
  2124. var postData = {};
  2125. if(groupId){
  2126. postData = {
  2127. "idx": 0,
  2128. "sum": 100,
  2129. user: {
  2130. groupdata:{id:groupId},
  2131. roledata: { rolecode: "first-line support" },
  2132. roledata2: { rolecode: "second-line support" },
  2133. selectType: "1",
  2134. selectDetails:1
  2135. }
  2136. }
  2137. }else{
  2138. postData = {
  2139. "idx": 0,
  2140. "sum": 100,
  2141. user: {
  2142. roledata: { rolecode: "first-line support" },
  2143. roledata2: { rolecode: "second-line support" },
  2144. selectType: "1",
  2145. selectDetails:1
  2146. }
  2147. }
  2148. }
  2149. api_user_data.fetchDataList('user', postData).then(function (data) {
  2150. $scope.user = data.list;
  2151. })
  2152. }
  2153. $scope.assignUser = null;
  2154. $scope.user = [];
  2155. $scope.group = [];
  2156. $scope.getUsers();
  2157. api_user_data.fetchDataList('group', {
  2158. "idx": 0,
  2159. "sum": 100,
  2160. group: {}
  2161. }).then(function (data) {
  2162. $scope.group = data.list;
  2163. })
  2164. $scope.onChangeRotateUser = function(item){
  2165. $scope.assignUser = item.id;
  2166. }
  2167. $scope.onChangeRotateGroup = function(item){
  2168. $scope.assignGroup = item.id;
  2169. $scope.getUsers(item.id)
  2170. }
  2171. $scope.ok = function () {
  2172. if (!$scope.assignUser){
  2173. Alert.swal({
  2174. title: "操作失败",
  2175. text: "请选择转派对象信息!",
  2176. type: "error"
  2177. });
  2178. return;
  2179. }
  2180. api_bpm_domain.delegateTask(model.taskId, {assginee:$scope.assignUser}).then(function (response) {
  2181. console.log(response)
  2182. if (response.status == 200) {
  2183. Alert.swal({
  2184. title: "操作成功!",
  2185. confirmButtonColor: "#007AFF",
  2186. type: "success"
  2187. });
  2188. $modalInstance.close('success');
  2189. } else {
  2190. Alert.swal({
  2191. title: "操作失败",
  2192. text: "操作失败, 请稍后再试!",
  2193. type: "error"
  2194. });
  2195. }
  2196. });
  2197. }
  2198. $scope.cancel = function () {
  2199. $modalInstance.dismiss('cancel');
  2200. }
  2201. },
  2202. size: 'sm',
  2203. resolve: {
  2204. api_bpm: function () {
  2205. return api_bpm;
  2206. },
  2207. modelData: function () {
  2208. return model;
  2209. },
  2210. currentUserId: function () {
  2211. return loginUser.id;
  2212. },
  2213. Alert: function () {
  2214. return SweetAlert;
  2215. },
  2216. api_user_data: function () {
  2217. return api_user_data;
  2218. }
  2219. }
  2220. });
  2221. modalInstance.result.then(function (selectedItem) {
  2222. if (selectedItem == 'success') {
  2223. defaultFilterData.assignee = loginUser.id;
  2224. $scope.refreshData('expand-right', defaultFilterData);
  2225. }
  2226. });
  2227. }
  2228. // 删除事件
  2229. $scope.delSj = function(model){
  2230. console.log(model);
  2231. SweetAlert.swal({
  2232. title: "确认删除?",
  2233. text: "删除的数据不可恢复,请确认继续操作!",
  2234. type: "warning",
  2235. showCancelButton: true,
  2236. confirmButtonColor: "#DD6B55",
  2237. confirmButtonText: "继续删除",
  2238. cancelButtonText: "取消操作",
  2239. closeOnConfirm: false,
  2240. closeOnCancel: false
  2241. }, function (isConfirm) {
  2242. if (isConfirm) {
  2243. api_bpm_schedule.del(model.id).then(function (response) {
  2244. if (response.status == 200) {
  2245. SweetAlert.swal("操作成功!", "数据已经被删除.", "success");
  2246. $scope.refreshData('expand-right', JSON.parse(sessionStorage.getItem("searchincident")));
  2247. } else {
  2248. SweetAlert.swal("操作失败!", "数据暂时无法被删除,请稍候重试", "error");
  2249. }
  2250. });
  2251. } else {
  2252. SweetAlert.swal("操作取消", "数据安全", "error");
  2253. }
  2254. });
  2255. }
  2256. // 新增处理日志弹窗baba
  2257. $scope.toHandlerLog = function (model) {
  2258. console.log(model)
  2259. var modalInstance = $modal.open({
  2260. templateUrl: 'assets/views/incident/tpl/toHandlerLog.tpl.html',
  2261. controller: function ($scope, $modalInstance, api_bpm_domain,api_bpm_data, modelData, currentUserId, Alert, api_user_data) {
  2262. console.log(model,loginUser);
  2263. $scope.handlerLog = '';
  2264. $scope.user = [];
  2265. $scope.ok = function () {
  2266. if (!$scope.handlerLog.trim()){
  2267. Alert.swal({
  2268. title: "操作失败",
  2269. text: "请填写处理日志!",
  2270. type: "error"
  2271. });
  2272. return;
  2273. }
  2274. api_bpm_data.addData('operationLog',{operationLog:{opType:'handlerLog',opValue:$scope.handlerLog,extra1:model.id}}).then(function(response){
  2275. console.log(response)
  2276. if (response.status == 200) {
  2277. Alert.swal({
  2278. title: "操作成功!",
  2279. confirmButtonColor: "#007AFF",
  2280. type: "success"
  2281. });
  2282. $modalInstance.close('success');
  2283. } else {
  2284. Alert.swal({
  2285. title: "操作失败",
  2286. text: "操作失败, 请稍后再试!",
  2287. type: "error"
  2288. });
  2289. }
  2290. });
  2291. }
  2292. $scope.cancel = function () {
  2293. $modalInstance.dismiss('cancel');
  2294. }
  2295. },
  2296. size: 'sm',
  2297. resolve: {
  2298. api_bpm: function () {
  2299. return api_bpm;
  2300. },
  2301. modelData: function () {
  2302. return model;
  2303. },
  2304. currentUserId: function () {
  2305. return loginUser.id;
  2306. },
  2307. Alert: function () {
  2308. return SweetAlert;
  2309. },
  2310. api_user_data: function () {
  2311. return api_user_data;
  2312. }
  2313. }
  2314. });
  2315. modalInstance.result.then(function (selectedItem) {
  2316. if (selectedItem == 'success') {
  2317. defaultFilterData.assignee = loginUser.id;
  2318. $scope.refreshData('expand-right', defaultFilterData);
  2319. }
  2320. });
  2321. }
  2322. // 协同弹窗
  2323. $scope.cooperate = function (model) {
  2324. console.log(model)
  2325. var modalInstance = $modal.open({
  2326. templateUrl: 'assets/views/incident/tpl/cooperate.tpl.html',
  2327. controller: function ($scope, $modalInstance, APIService, modelData, currentUserId, Alert) {
  2328. var receiveTask = function (receive_code, modelData) {
  2329. var data = {
  2330. 'receive_code': receive_code
  2331. };
  2332. if (modelData) {
  2333. return {
  2334. taskId: modelData.taskId,
  2335. data: data
  2336. };
  2337. } else {
  2338. return 'error';
  2339. }
  2340. };
  2341. $scope.title = "提示";
  2342. // $scope.connect = "升级单选组件";
  2343. $scope.ok = function () {
  2344. //接收任务//请求重新指派
  2345. var data = receiveTask($scope.receive_code, modelData);
  2346. APIService.claimAndCompletedTask(data.taskId, {
  2347. userId: currentUserId,
  2348. receive_code: "handler"
  2349. }).then(function (response) {
  2350. if (response.status == 200) {
  2351. Alert.swal({
  2352. title: "操作成功!",
  2353. confirmButtonColor: "#007AFF",
  2354. type: "success"
  2355. });
  2356. $modalInstance.close('success');
  2357. } else if (response.status == 500) {
  2358. Alert.swal({
  2359. title: "操作失败",
  2360. text: "该事件已被提取,请刷新页面!",
  2361. type: "error"
  2362. });
  2363. $modalInstance.close('success');
  2364. } else {
  2365. Alert.swal({
  2366. title: "操作失败",
  2367. text: "操作失败, 请稍后再试!",
  2368. type: "error"
  2369. });
  2370. }
  2371. });
  2372. }
  2373. $scope.cancel = function () {
  2374. $modalInstance.dismiss('cancel');
  2375. }
  2376. },
  2377. size: 'sm',
  2378. resolve: {
  2379. APIService: function () {
  2380. return api_bpm_domain;
  2381. },
  2382. modelData: function () {
  2383. return model;
  2384. },
  2385. currentUserId: function () {
  2386. return loginUser.id;
  2387. },
  2388. Alert: function () {
  2389. return SweetAlert;
  2390. }
  2391. }
  2392. });
  2393. modalInstance.result.then(function (selectedItem) {
  2394. if (selectedItem == 'success') {
  2395. defaultFilterData.assignee = loginUser.id;
  2396. $scope.refreshData('expand-right', defaultFilterData);
  2397. }
  2398. });
  2399. }
  2400. if ($stateParams.model) {
  2401. if (JSON.parse($stateParams.model).searchType && JSON.parse($stateParams.model).searchType != null) {
  2402. $scope.searchType = JSON.parse($stateParams.model).searchType;
  2403. } else {
  2404. $scope.searchType = "todo";
  2405. }
  2406. } else {
  2407. $scope.searchType = "todo";
  2408. }
  2409. // if (JSON.parse($stateParams.model).searchType) {
  2410. // if ($rootScope.user.group) {
  2411. // var defaultFilterData = {
  2412. // "assignee": $rootScope.user.id,
  2413. // "candidateGroups": loginuserGroup,
  2414. // "searchType": JSON.parse($stateParams.model).searchType,
  2415. // "idx": 0,
  2416. // "sum": mun
  2417. // };
  2418. // } else {
  2419. // var defaultFilterData = {
  2420. // "assignee": $rootScope.user.id,
  2421. // "searchType": JSON.parse($stateParams.model).searchType,
  2422. // "idx": 0,
  2423. // "sum": mun
  2424. // };
  2425. // }
  2426. // } else {
  2427. if ($rootScope.user.group) {
  2428. var defaultFilterData = {
  2429. "assignee": loginUser.id,
  2430. "candidateGroups": loginuserGroup,
  2431. "searchType": "todo",
  2432. "idx": 0,
  2433. "sum": mun
  2434. };
  2435. } else {
  2436. var defaultFilterData = {
  2437. "assignee": $rootScope.user.id,
  2438. "searchType": "todo",
  2439. "idx": 0,
  2440. "sum": mun
  2441. };
  2442. }
  2443. // }
  2444. // var defaultFilterData = {
  2445. // "assignee":$rootScope.user.id,
  2446. // "candidateGroups":$rootScope.user.group[0].id,
  2447. // "idx":0,
  2448. // "sum":mun
  2449. // };
  2450. if (angular.isDefined($rootScope.search) && angular.isDefined($rootScope.search.incident)) {
  2451. defaultFilterData['searchType'] = $rootScope.search.incident;
  2452. $scope.searchType = $rootScope.search.incident;
  2453. }
  2454. // if ($rootScope['cmdbs'] != 'incident') { $rootScope.idx = 1 }
  2455. // if (angular.isDefined($rootScope.idx) && $rootScope.cmdbs != "false") {
  2456. // $rootScope['cmdbs'] = 'incident';
  2457. // defaultFilterData.idx = $rootScope.idx - 1;
  2458. // } else { $rootScope.cmdbs = ""; }
  2459. $scope.ldloading = {};
  2460. // $scope.Change= function(upTypes){
  2461. // if(angular.isDefined(upTypes)&&upTypes=='upincident'){
  2462. // $state.go('app.problem.incident',{});
  2463. // }
  2464. // else if(angular.isDefined(upTypes)&&upTypes=='upchange'){
  2465. // $state.go('app.change.incident',{});
  2466. // }
  2467. // }
  2468. //事件类型筛选
  2469. console.log($state);
  2470. if($state.params.tab){
  2471. $scope.searchstate = $state.params.tab;
  2472. }else{
  2473. $scope.searchstate = 'todo';//baba
  2474. }
  2475. $scope.onChange = function (searchType) {
  2476. if(searchType === 'all_del'){
  2477. var obj = $scope.state.find(function(v){return v.id == 1708});
  2478. $scope.othcode = {state:obj};
  2479. $scope.isDisabledState = true;
  2480. }else{
  2481. $scope.isDisabledState = false;
  2482. }
  2483. $scope.searchstate = searchType;
  2484. $scope.chiceIncident($scope.searchkeys,$scope.othcode.state);
  2485. // console.log(defaultFilterData,'fanbu')
  2486. // if(defaultFilterData.incident){
  2487. // var lsObject = defaultFilterData.incident;
  2488. // }
  2489. // defaultFilterData = $scope.memoryfilterData;
  2490. // defaultFilterData.incident = lsObject;
  2491. // defaultFilterData['searchType'] = searchType;
  2492. // defaultFilterData.assignee = loginUser.id;
  2493. // // -----------seimin-------------
  2494. // if(searchType!=='all'){
  2495. // $scope.searchkeys = {selectType:{}};//seimin
  2496. // }
  2497. // if(searchType!== 'all'&&defaultFilterData.incident&&defaultFilterData.incident.selectType){
  2498. // delete defaultFilterData.incident.selectType;
  2499. // }
  2500. // if(searchType== 'all'){
  2501. // if(!defaultFilterData.incident||!defaultFilterData.incident.selectType){
  2502. // $scope.searchkeys = {selectType:{id:'0',name:'否'}};//seimin
  2503. // }
  2504. // }
  2505. // if(Object.prototype.toString.call(defaultFilterData.incident) == "[object Object]"&&Object.keys(defaultFilterData.incident).length == 0){
  2506. // delete defaultFilterData.incident;
  2507. // }
  2508. // if($scope.othcode.state){
  2509. // if(Object.prototype.toString.call(defaultFilterData.incident) == "[object Object]"){
  2510. // defaultFilterData.incident.statusId = $scope.othcode.state.id;
  2511. // }else{
  2512. // defaultFilterData.incident = {statusId:$scope.othcode.state.id};
  2513. // }
  2514. // }
  2515. // // -----------seimin-------------
  2516. // $scope.refreshData('expand-right', defaultFilterData);
  2517. // $interval.cancel($scope.timer);
  2518. // $scope.timer = $interval(function () {
  2519. // $scope.jry_refresh()
  2520. // }, $rootScope.refreshTime);
  2521. }
  2522. // 是否逾期下拉框选择seimin
  2523. $scope.selectTypeChange = function(){
  2524. console.log($scope.searchkeys.selectType,66666);
  2525. if(window.sessionStorage.getItem('isGoyuqi') == 'yes'){
  2526. $scope.searchkeys.selectType = {id:'2',name:'是'};
  2527. // window.sessionStorage.removeItem('isGoyuqi');//seimin
  2528. }
  2529. var ids = $scope.searchkeys.selectType.id
  2530. if(defaultFilterData.incident){
  2531. defaultFilterData.incident.selectType = ids;//seimin
  2532. }else{
  2533. defaultFilterData.incident = {
  2534. selectType:ids
  2535. };
  2536. }
  2537. defaultFilterData.searchType = 'all';
  2538. console.log(defaultFilterData,2222)
  2539. $scope.onChange('all');
  2540. }
  2541. //获取列表数据
  2542. $scope.refreshData = function (style, filterData) {
  2543. console.log(filterData,9090)
  2544. if (filterData && filterData.incident && filterData.incident.area) {
  2545. filterData.incident.place = {
  2546. id: filterData.incident.place ? filterData.incident.place.id : '',
  2547. area: filterData.incident.area
  2548. }
  2549. delete filterData.incident.area
  2550. }
  2551. $scope.ldloading[style.replace('-', '_')] = true;
  2552. if (angular.isUndefined(filterData)) {
  2553. if (sessionStorage.searchincident) {
  2554. filterData = JSON.parse(sessionStorage.getItem("searchincident"));
  2555. if ($scope.searchType) {
  2556. filterData.searchType = $scope.searchType;
  2557. }
  2558. $scope.gridOptions.paginationCurrentPage = 1 + filterData.idx;
  2559. if($state.params.tab){
  2560. $scope.searchstate = $state.params.tab;
  2561. filterData.searchType = $state.params.tab;
  2562. sessionStorage.setItem('searchincident',JSON.stringify(filterData));
  2563. }else{
  2564. $scope.searchstate = filterData.searchType;
  2565. }
  2566. if($state.params.date == 'today'){
  2567. $scope.othcode = {};
  2568. $scope.searchkeys.acceptDate = new Date();
  2569. $scope.searchkeys.acceptDateEnd = new Date();
  2570. filterData.incident = {acceptDate:moment().format('YYYY-MM-DD 00:00:00'),acceptDateEnd:moment().format('YYYY-MM-DD 23:59:59')};
  2571. sessionStorage.setItem("searchincident",JSON.stringify(filterData));
  2572. }
  2573. if($state.params.state){
  2574. $scope.searchkeys.acceptDate = null;
  2575. $scope.searchkeys.acceptDateEnd = null;
  2576. var obj = $scope.state.find(function(v){return $state.params.state == v.id});
  2577. $scope.othcode = {state:obj};
  2578. filterData.incident = {statusId: $state.params.state};
  2579. sessionStorage.setItem("searchincident",JSON.stringify(filterData));
  2580. }
  2581. if (filterData.incident && filterData.incident.category) {
  2582. delete filterData.incident.category
  2583. }
  2584. } else {
  2585. filterData = defaultFilterData;
  2586. if ($scope.searchType) {
  2587. filterData.searchType = $scope.searchType;
  2588. if (filterData.searchType == 'overDate') {
  2589. $scope.searchstate = 'overDate';
  2590. }
  2591. }
  2592. if($state.params.tab){
  2593. $scope.searchstate = $state.params.tab;
  2594. filterData.searchType = $state.params.tab;
  2595. sessionStorage.setItem('searchincident',JSON.stringify(filterData));
  2596. }else{
  2597. $scope.searchstate = filterData.searchType;
  2598. }
  2599. if($state.params.date == 'today'){
  2600. $scope.othcode = {};
  2601. $scope.searchkeys.acceptDate = new Date();
  2602. $scope.searchkeys.acceptDateEnd = new Date();
  2603. filterData.incident = {acceptDate:moment().format('YYYY-MM-DD 00:00:00'),acceptDateEnd:moment().format('YYYY-MM-DD 23:59:59')};
  2604. sessionStorage.setItem("searchincident",JSON.stringify(filterData));
  2605. }
  2606. if($state.params.state){
  2607. $scope.searchkeys.acceptDate = null;
  2608. $scope.searchkeys.acceptDateEnd = null;
  2609. var obj = $scope.state.find(function(v){return $state.params.state == v.id});
  2610. $scope.othcode = {state:obj};
  2611. filterData.incident = {statusId: $state.params.state};
  2612. sessionStorage.setItem("searchincident",JSON.stringify(filterData));
  2613. }
  2614. }
  2615. }
  2616. // if (angular.isDefined($scope.searchTypes)) {
  2617. // $rootScope['search'] = {};
  2618. // filterData['searchType'] = $scope.searchTypes;
  2619. // $rootScope['search']['incident'] = $scope.searchTypes;
  2620. // }
  2621. // if (sessionStorage.idx) {
  2622. // filterData.idx = Number(sessionStorage.idx);
  2623. // $scope.gridOptions.idx = Number(sessionStorage.idx) + 1;
  2624. // }
  2625. console.log(filterData,11111);
  2626. if(window.sessionStorage.getItem('isGoyuqi') == 'yes'){
  2627. $scope.searchkeys.selectType = {id:'2',name:'是'};
  2628. if(filterData.incident&&filterData.incident.selectType){
  2629. filterData.incident.selectType = '2';
  2630. }else{
  2631. filterData.incident = {
  2632. selectType : '2'
  2633. }
  2634. }
  2635. window.sessionStorage.removeItem('isGoyuqi');//seimin
  2636. }
  2637. $scope.myData = [];
  2638. sessionStorage['searchincident'] = angular.copy(JSON.stringify(filterData));
  2639. // $scope.gridOptions.paginationCurrentPage = 1 + filterData.idx;
  2640. //var start = new Date();
  2641. //var sec = $interval(function () {
  2642. //$scope.callsPending++;
  2643. $scope.memoryfilterData = filterData;
  2644. $scope.gridOptions['sum'] = filterData.sum;
  2645. api_bpm_domain.fetchtask(pdKey, filterData).then(function (data) {
  2646. if (data.data) {
  2647. // if(filterData.searchType == 'all'){
  2648. // //跳到全部seimin
  2649. // $scope.searchstate = 'all';
  2650. // }
  2651. var myData = Restangular.stripRestangular(data);
  2652. var list = [];
  2653. $scope.gridOptions['totalItems'] = myData.resultCount;
  2654. $scope.myData = myData.data;
  2655. for (var i = 0; i < $scope.myData.length; i++) {
  2656. $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum
  2657. }
  2658. } else {
  2659. SweetAlert.swal({
  2660. title: "系统错误",
  2661. text: "请稍后再试!",
  2662. type: "error"
  2663. });
  2664. }
  2665. $scope.ldloading[style.replace('-', '_')] = false;
  2666. }, function () {
  2667. $scope.ldloading[style.replace('-', '_')] = false;
  2668. });
  2669. };
  2670. $scope.refreshData2 = function (style, filterData) {
  2671. $scope.ldloading[style.replace('-', '_')] = true;
  2672. if (angular.isUndefined(filterData)) {
  2673. if (sessionStorage.searchincident) {
  2674. filterData = JSON.parse(sessionStorage.getItem("searchincident"));
  2675. if ($scope.searchType) {
  2676. filterData.searchType = $scope.searchType;
  2677. }
  2678. $scope.gridOptions.paginationCurrentPage = 1 + filterData.idx;
  2679. // $scope.searchstate = filterData.searchType;
  2680. if($state.params.tab){
  2681. $scope.searchstate = $state.params.tab;
  2682. filterData.searchType = $state.params.tab;
  2683. sessionStorage.setItem('searchincident',JSON.stringify(filterData));
  2684. }else{
  2685. $scope.searchstate = filterData.searchType;
  2686. }
  2687. if($state.params.date == 'today'){
  2688. $scope.othcode = {};
  2689. $scope.searchkeys.acceptDate = new Date();
  2690. $scope.searchkeys.acceptDateEnd = new Date();
  2691. filterData.incident = {acceptDate:moment().format('YYYY-MM-DD 00:00:00'),acceptDateEnd:moment().format('YYYY-MM-DD 23:59:59')};
  2692. sessionStorage.setItem("searchincident",JSON.stringify(filterData));
  2693. }
  2694. if($state.params.state){
  2695. $scope.searchkeys.acceptDate = null;
  2696. $scope.searchkeys.acceptDateEnd = null;
  2697. var obj = $scope.state.find(function(v){return $state.params.state == v.id});
  2698. $scope.othcode = {state:obj};
  2699. filterData.incident = {statusId: $state.params.state};
  2700. sessionStorage.setItem("searchincident",JSON.stringify(filterData));
  2701. }
  2702. if (filterData.incident && filterData.incident.category) {
  2703. delete filterData.incident.category
  2704. }
  2705. } else {
  2706. filterData = defaultFilterData;
  2707. if ($scope.searchType) {
  2708. filterData.searchType = $scope.searchType;
  2709. if (filterData.searchType == 'overDate') {
  2710. $scope.searchstate = 'overDate';
  2711. }
  2712. }
  2713. }
  2714. }
  2715. // if (angular.isDefined($scope.searchTypes)) {
  2716. // $rootScope['search'] = {};
  2717. // filterData['searchType'] = $scope.searchTypes;
  2718. // $rootScope['search']['incident'] = $scope.searchTypes;
  2719. // }
  2720. // if (sessionStorage.idx) {
  2721. // filterData.idx = Number(sessionStorage.idx);
  2722. // $scope.gridOptions.idx = Number(sessionStorage.idx) + 1;
  2723. // }
  2724. // $scope.myData = [];
  2725. sessionStorage['searchincident'] = angular.copy(JSON.stringify(filterData));
  2726. // $scope.gridOptions.paginationCurrentPage = 1 + filterData.idx;
  2727. //var start = new Date();
  2728. //var sec = $interval(function () {
  2729. //$scope.callsPending++;
  2730. $scope.memoryfilterData = filterData;
  2731. $scope.gridOptions['sum'] = filterData.sum;
  2732. api_bpm_domain.fetchtask(pdKey, filterData).then(function (data) {
  2733. if (data.data) {
  2734. var myData = Restangular.stripRestangular(data);
  2735. var list = [];
  2736. $scope.gridOptions['totalItems'] = myData.resultCount;
  2737. $scope.myData = myData.data;
  2738. for (var i = 0; i < $scope.myData.length; i++) {
  2739. $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum
  2740. }
  2741. } else {
  2742. SweetAlert.swal({
  2743. title: "系统错误",
  2744. text: "请稍后再试!",
  2745. type: "error"
  2746. });
  2747. }
  2748. $scope.ldloading[style.replace('-', '_')] = false;
  2749. }, function () {
  2750. $scope.ldloading[style.replace('-', '_')] = false;
  2751. });
  2752. };
  2753. // 进入页面时111
  2754. if(window.sessionStorage.getItem('searchincident')){
  2755. var varLin = JSON.parse(window.sessionStorage.getItem('searchincident'));
  2756. if(varLin.incident&&varLin.incident.selectType){
  2757. if(varLin.incident.selectType == '2'){
  2758. console.log(defaultFilterData)
  2759. $scope.searchkeys.selectType = {id:'2',name:'是'};
  2760. }else if(varLin.incident.selectType == '0'){
  2761. console.log(defaultFilterData)
  2762. $scope.searchkeys.selectType = {id:'0',name:'否'};
  2763. }
  2764. }
  2765. }
  2766. if(window.sessionStorage.getItem('isGoyuqi') === 'yes'){
  2767. $scope.selectTypeChange();
  2768. }else{
  2769. if(sessionStorage.getItem("searchincident")){
  2770. var ss = JSON.parse(sessionStorage.getItem("searchincident"));
  2771. delete ss.incident;
  2772. sessionStorage.setItem("searchincident",JSON.stringify(ss));
  2773. }
  2774. $scope.refreshData('expand-right');
  2775. }
  2776. $scope.timer = $interval(function () {
  2777. $scope.jry_refresh()
  2778. }, $rootScope.refreshTime);
  2779. $scope.$on('$destroy', function () {
  2780. $interval.cancel($scope.timer)
  2781. });
  2782. }]);
  2783. //操作按钮权限控制
  2784. app.controller('IncidentOperCtrl', ['$rootScope', '$http', '$scope', '$modal', '$state', 'api_bpm_data', function ($rootScope, $http, $scope, $modal, $state, api_bpm_data) {
  2785. // console.log('$rootScope.user3='+JSON.stringify($scope.item));
  2786. // console.log($scope.item)
  2787. var loginUser = $rootScope.user;
  2788. console.log(loginUser.role)
  2789. $scope.chuli = false;
  2790. $scope.qiangdan = false;
  2791. $scope.dayin = false;
  2792. $scope.huifang = false;
  2793. $scope.assign = false;
  2794. $scope.delFlag = false;
  2795. if(loginUser.role.length){
  2796. $scope.assign = loginUser.role.some(function(v){
  2797. return v.rolecode === "incident-category-manager"||v.rolecode === 'incident manager';
  2798. })
  2799. }
  2800. for (var i = 0; i < loginUser.menu.length; i++) {
  2801. if (loginUser.menu[i].link == "shijianliebiao_chuli") {
  2802. $scope.chuli = true
  2803. }
  2804. if (loginUser.menu[i].link == "shijianliebiao_qiangdan") {
  2805. $scope.qiangdan = true
  2806. }
  2807. if (loginUser.menu[i].link == "shijianliebiao_dayin") {
  2808. $scope.dayin = true
  2809. }
  2810. if (loginUser.menu[i].link == "shijianliebiao_huifang") {
  2811. $scope.huifang = true
  2812. }
  2813. if (loginUser.menu[i].link == "shijianliebiao_del") {
  2814. $scope.delFlag = true
  2815. }
  2816. }
  2817. $scope.up = true;
  2818. $scope.fuwutaiRenYuan = false;//服务台人员
  2819. for (var i = 0; i < $rootScope.user.role.length; i++) {
  2820. // console.log($rootScope.user.role[i])
  2821. if ($rootScope.user.role[i].role == '事件经理') {
  2822. $scope.up = false;
  2823. }
  2824. if ($rootScope.user.role[i].id == 29701) {
  2825. $scope.fuwutaiRenYuan = true;
  2826. }
  2827. }
  2828. if ($scope.item.state.id != null && $scope.item.handlerUser != null) {
  2829. // 当前登陆人和当前处理人相同,并且状态非已关闭
  2830. if ($rootScope.user.id == $scope.item.handlerUser.id && $scope.item.state.id != 1546) {
  2831. $scope.item.chaozuoPower = true;
  2832. // if ($scope.item.state.id == 1544) {
  2833. // $scope.item.coordination = true;
  2834. // }
  2835. }
  2836. }
  2837. $rootScope.callid = $scope.item.callID;
  2838. if ($scope.item.callID) {
  2839. $scope.item.listen = true;
  2840. } else {
  2841. $scope.item.listen = false;
  2842. }
  2843. // 抢单操作权限
  2844. // if ($scope.item.state.id != 1546 && $scope.item.handlerUser == null) {
  2845. // angular.forEach($rootScope.user.group, function (item) {
  2846. // if (item.id == $scope.item.candidateGroups) {
  2847. // $scope.item.tiquPower = true;
  2848. // }
  2849. // })
  2850. $rootScope.user.group.forEach(function (item, v) {
  2851. if (item.id == $scope.item.candidateGroups) {
  2852. $scope.item.tiquPower = true;
  2853. }
  2854. })
  2855. // }
  2856. //修改页面显示判断
  2857. $scope.jry_modify = function (item) {
  2858. console.log(item)
  2859. var jry_role = false;
  2860. for (var i = 0; i < $rootScope.user.role.length; i++) {
  2861. if ($rootScope.user.role[i].rolecode == "call center") {
  2862. jry_role = true
  2863. }
  2864. }
  2865. var arrFlag = ['reassign','assigned','pending','handler','storage'];
  2866. var stateFlag = arrFlag.includes(item.state.value)
  2867. return jry_role && stateFlag;
  2868. }
  2869. // 回访操作权限
  2870. for (var obj in $rootScope.user.role) {
  2871. // console.log($rootScope.user.role[obj].rolecode)
  2872. if ($rootScope.user.role[obj].rolecode == 'call center') {
  2873. if ($scope.item.state.id == 1546) {
  2874. $scope.item.huifang = true;
  2875. } else {
  2876. // $scope.item.xiugai = true;
  2877. }
  2878. }
  2879. }
  2880. // 评价操作权限
  2881. $scope.jry_evaluateShow = function () {
  2882. var jry_role = false;
  2883. for (var i = 0; i < $rootScope.user.role.length; i++) {
  2884. if ($rootScope.user.role[i].role == "事件经理" && $rootScope.user.role[i].rolecode == "incident manager") {
  2885. jry_role = true
  2886. }
  2887. }
  2888. // if($scope.item.groupScore!=undefined){
  2889. if ($scope.item.state.id == 1546 && jry_role && $scope.item.groupScore.id == 220) {
  2890. return true
  2891. } else {
  2892. return false
  2893. }
  2894. // }
  2895. }
  2896. $scope.coordination = function () {
  2897. $scope.colobject.grid.appScope.coordination($scope.item);
  2898. }
  2899. $scope.look = function () {
  2900. //$state.go('app.detail', { formKey:'incident_back', pdKey:'incident', dataId: $scope.item.id});
  2901. $scope.colobject.grid.appScope.lookFunction($scope.item);
  2902. // console.log('$scope.item='+JSON.stringify($scope.item));
  2903. //$scope.doEdit($scope.item.id);
  2904. }
  2905. $scope.edit = function () {
  2906. // console.log($scope.item)
  2907. $scope.colobject.grid.appScope.selectRowFunction($scope.item);
  2908. // console.log('$scope.item='+JSON.stringify($scope.item));
  2909. // $scope.doEdit($scope.item.id);
  2910. }
  2911. $scope.configuration = function () {
  2912. console.log($scope.item);
  2913. $scope.colobject.grid.appScope.configuration($scope.item)
  2914. }
  2915. $scope.changeCenter = function () {
  2916. $scope.colobject.grid.appScope.changeClick($scope.item);
  2917. }
  2918. $scope.visit = function () {
  2919. $scope.colobject.grid.appScope.visit($scope.item);
  2920. }
  2921. $scope.print = function () { //print
  2922. api_bpm_data.fetchData('incident', $scope.item.id).then(function (res) {
  2923. $scope.colobject.grid.appScope.open(res.data);
  2924. })
  2925. // $scope.colobject.grid.appScope.open($scope.item);
  2926. }
  2927. // 升级
  2928. $scope.upgrade = function () { //print
  2929. $scope.colobject.grid.appScope.upgrade($scope.item);
  2930. // $scope.doEdit($scope.item.id);
  2931. }
  2932. // 转派
  2933. $scope.rotate = function () { //print
  2934. $scope.colobject.grid.appScope.rotate($scope.item);
  2935. // $scope.doEdit($scope.item.id);
  2936. }
  2937. // 指派
  2938. $scope.toAssign = function () { //print
  2939. $scope.colobject.grid.appScope.toAssign($scope.item);
  2940. // $scope.doEdit($scope.item.id);
  2941. }
  2942. // 删除事件
  2943. $scope.delSj = function () {
  2944. $scope.colobject.grid.appScope.delSj($scope.item);
  2945. }
  2946. // 新增处理日志
  2947. $scope.toHandlerLog = function () { //print
  2948. $scope.colobject.grid.appScope.toHandlerLog($scope.item);
  2949. // $scope.doEdit($scope.item.id);
  2950. }
  2951. // 协同
  2952. $scope.cooperate = function () { //print
  2953. $scope.colobject.grid.appScope.cooperate($scope.item);
  2954. // $scope.doEdit($scope.item.id);
  2955. }
  2956. // 升级问题
  2957. $scope.problem = function () {
  2958. console.log($scope.item)
  2959. console.log($scope.colobject.grid.appScope)
  2960. $scope.colobject.grid.appScope.problem($scope.item)
  2961. }
  2962. $scope.record = function () { //record
  2963. $scope.colobject.grid.appScope.play($scope.item);
  2964. // $scope.doEdit($scope.item.id);
  2965. }
  2966. $scope.handler = function () {
  2967. $scope.colobject.grid.appScope.acceptTaskAction($scope.item);
  2968. $scope.doComment($scope.item.id);
  2969. }
  2970. $scope.follow = function () {
  2971. $scope.colobject.grid.appScope.followFunction($scope.item);
  2972. }
  2973. //查看
  2974. $scope.toDetail = function (data) {
  2975. //console.log('data='+JSON.stringify(data));
  2976. console.log(data,$rootScope.isFuwutai);
  2977. if($rootScope.isFuwutai){
  2978. //角色是服务台人员
  2979. $state.go('app.incident.detail', {
  2980. formKey: 'incident_back',
  2981. pdKey: 'incident',
  2982. dataId: data.id,
  2983. taskId: data.taskId,
  2984. processInstanceId: data.processInstanceId
  2985. });
  2986. }else{
  2987. window.open(location.origin+'/#/app/incident/detail/incident_back/incident/'+data.id+'/'+data.taskId+'/'+data.processInstanceId+'//');
  2988. }
  2989. };
  2990. // $scope.play = function() {
  2991. // // console.log($scope.item.callID)
  2992. // var modalInstance = $modal.open({
  2993. // templateUrl: 'assets/views/incident/tpl/audio.html',
  2994. // controller: function($scope, $modalInstance,$sce){
  2995. // $scope.data={
  2996. // "name":"视频",
  2997. // "url":"http://192.168.3.69:8088/recording/recording?callID="+$rootScope.callid
  2998. // };
  2999. // $scope.data.url = $sce.trustAsResourceUrl($scope.data.url);
  3000. // // $scope.audiourl={url:$sce.trustAsResourceUrl("http://192.168.3.69:8088/recording/recording?callID=218147232")};
  3001. // $scope.cancel = function() {
  3002. // $modalInstance.dismiss('cancel');
  3003. // };
  3004. // $modalInstance.close();
  3005. // }
  3006. // });
  3007. // };
  3008. }]);
  3009. //操作按钮
  3010. app.directive('incidentoperator', function () {
  3011. return {
  3012. restrict: 'E',
  3013. scope: {
  3014. item: '=',
  3015. colobject: '='
  3016. },
  3017. controller: 'IncidentOperCtrl',
  3018. template: '<div><div class="cl-effect-1 ui-grid-cell-contents pull-left" >' +
  3019. // '<a ng-click="look()" tooltip="查看" tooltip-placement="left"><i class="ti-eye"></i></a>'+
  3020. '<a ng-click="handler()" ng-show="{{item.state.id != 1546 &&!item.handlerUser&&item.tiquPower&&qiangdan}}" class="bianjifont" >抢单</a>' +
  3021. '<a ng-click="changeCenter()" ng-show="jry_modify(item)" class="luyinfont">修改</a>' +
  3022. '<a ng-click="edit()" ng-show="{{item.chaozuoPower&&chuli}}" class="bianjifont">处理</a>' +
  3023. '<a ng-click="visit()" ng-show="{{item.huifang&&huifang}}" class="bianjifont">回访</a>' +
  3024. '<a ng-click="print()" ng-show="dayin" class="bianjifont" >打印</a>' +
  3025. '<a ng-click="toDetail(item)" class="bianjifont" >查看</a>' +
  3026. // '<a ng-click="jry_evaluate()" ng-show="jry_evaluateShow()" class="luyinfont" >评价</a>' +
  3027. // '<a ng-click="record()" ng-show="{{item.listen}}" class="luyinfont" >录音</a>' +
  3028. // '<a ng-click="rotate()" ng-show="{{item.state.id==4}}" class="rotate" >转派</a>' +
  3029. '<a ng-click="toAssign()" ng-show="{{(item.state.id==1543||item.state.id==1544)&&assign&&item.assignee}}" class="assign" >指派</a>' +
  3030. '<a ng-click="toHandlerLog()" ng-show="{{item.state.id==1544}}" class="assign" >新增处理日志</a>' +
  3031. '<a ng-click="delSj()" ng-show="{{delFlag&&item.state.value!== \'deleted\'}}" class="assign" >删除</a>' +
  3032. // '<a ng-click="upgrade()" ng-show="{{up&&item.state.id==4&&item.currentRole!=' + "'incident manager'" + '}}" class="upgrade" >升级</a>' +
  3033. // '<a ng-click="problem()" ng-show="{{item.state.id==5&&item.currentRole!=' + "'incident manager'" + '}}" class="upgrade" >问题升级</a>' +
  3034. // '<a ng-click="configuration()" ng-show="{{item.state.id==5}}" class="bianjifont">变更升级</a>' +
  3035. // '<a ng-click="cooperate()" ng-show="{{item.state.id==4}}" class="cooperate" >协同</a>' +
  3036. // '<a ng-click="coordination()" ng-show="{{item.coordination}}" tooltip="添加协同人" tooltip-placement="left"><i class="icon iconfont icon-tianjiarenyuan adduserfont"></i></a>' +
  3037. // '<a class="ui-grid-cell-contents" ng-click="grid.appScope.open(row.entity)" tooltip="打印" tooltip-placement="left"><i class="ti-printer"></i></a>'+
  3038. // '<a ng-click="grid.appScope.play(row.entity)"ng-if="row.entity.callID" tooltip="播放录音" tooltip-placement="left"><i class="ti-microphone"></i></a>'+
  3039. // '<a ng-click="follow()" tooltip="状态跟踪" tooltip-placement="left"><i class="fa fa-location-arrow"></i></a>'+
  3040. '</div></div>'
  3041. };
  3042. });