incidentCtrl.js 124 KB

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