incidentCtrl.js 125 KB

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