incidentCtrl.js 126 KB

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