incidentCtrl.js 147 KB

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