incidentCtrl.js 129 KB

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