incidentCtrl.js 128 KB

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