incidentCtrl.js 124 KB

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