incidentCtrl.js 128 KB

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