incidentCtrl.js 125 KB

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