12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149 |
- 'use strict';
- app.controller('incidentListCtrl', ["$scope", "$http", "i18nService", "$rootScope", "$state", "$timeout", "moment", "$interval", "$modal", "$stateParams", "SweetAlert", "uiGridConstants", "uiGridGroupingConstants", "Restangular", "api_bpm_domain", "api_text", "api_bpm_data", "api_user_data", "api_configure_data", '$parse', "$injector", "$aside", 'toaster', "api_configure_form", "api_cmdb", 'api_bpm', 'api_wechatfile','api_search_area','api_bpm_schedule', function ($scope, $http, i18nService, $rootScope, $state, $timeout, moment, $interval, $modal, $stateParams, SweetAlert, uiGridConstants, uiGridGroupingConstants, Restangular, api_bpm_domain, api_text, api_bpm_data, api_user_data, api_configure_data, $parse, $injector, $aside, toaster, api_configure_form, api_cmdb, api_bpm, api_wechatfile,api_search_area,api_bpm_schedule) {
- //保存报修主体
- $scope.repairMain = JSON.parse(sessionStorage.getItem("repair_main"));
- $scope.wxIncidentWithCmdb = JSON.parse(sessionStorage.getItem("wxIncidentWithCmdb"));//资产
- $scope.incidentWithConsumable = JSON.parse(sessionStorage.getItem("incidentWithConsumable"));//耗材
- $rootScope.isFuwutai = JSON.parse(localStorage.getItem("isFuwutai")) ? true : false;
- $scope.delFlagTab = false;
- for (var i = 0; i < $rootScope.user.menu.length; i++) {
- if ($rootScope.user.menu[i].link == "shijianliebiao_del") {
- $scope.delFlagTab = true
- }
- }
- // ----------------分割线 start-----------------
- console.log($state)
- // 故障地点下拉
- // $scope.addressModel = '';//文本输入内容
- $scope.address_arr = [];//故障地点所有数据
- $scope.addressFlag = false;//默认下拉框列表隐藏
- //点击文本框
- $scope.addressClickHandle = function () {
- $scope.searchkeys.houseNumber = $scope.searchkeys.houseNumber === undefined?'':$scope.searchkeys.houseNumber;
- $scope.getDepartmentList();
- angular.element('#bx_address_ul').scrollTop(0);
- }
- //修改文字,实时监听
- $scope.addressChangeHandle = _.debounce(function () {
- $scope.getDepartmentList();
- angular.element('#bx_address_ul').scrollTop(0);
- }, 500)
- //获取故障地点seimin
- $scope.getDepartmentList = function () {
- api_search_area.getAreaList({ "searchKey": $scope.searchkeys.houseNumber })
- .then(res => {
- if (res.state == 200) {
- $scope.address_arr = res.result;
- $scope.addressFlag = true;//显示
- }
- })
- .catch(err => {
- console.log(err);
- })
- }
- //下拉框列表选中
- $scope.addressItemClick = function (obj) {
- $scope.addressFlag = false;//隐藏
- $scope.searchkeys.houseNumber = obj.place ? obj.area.area + obj.place : obj.area;//文本框赋值
- }
- //点击空白处隐藏
- angular.element(document).on('click', function (e) {
- if (e.target !== angular.element('#bx_address').get(0)) {
- $scope.addressFlag = false;//隐藏
- }
- })
- // -----------------分割线 end----------------
- // 是否逾期seimin
- $scope.selectType = [
- { id: '2', name: '是' },
- { id: '0', name: '否' }
- ];
- // /是否逾期
- $scope.langs = i18nService.getAllLangs();
- $scope.lang = 'zh-cn';
- i18nService.setCurrentLang($scope.lang);
- $scope.myData = [];
- var loginUser = $rootScope.user;
- console.log(loginUser);
- $scope.daochu = false;
- for (var i = 0; i < loginUser.menu.length; i++) {
- if (loginUser.menu[i].link == "shijianliebiao_daochu") {
- $scope.daochu = true
- }
- }
- var loginuserGroup = "";
- for (var i = 0; i < $rootScope.user.group.length; i++) {
- if (i == 0) {
- loginuserGroup = $rootScope.user.group[i].id;
- } else {
- loginuserGroup = loginuserGroup + "," + $rootScope.user.group[i].id;
- }
- }
- //新增事件seimin
- $scope.goToAddIncident = function () {
- $state.go('app.incident.editor', {});
- }
- //全部事件权限
- // $scope.allright = false;
- // $scope.allrightnot = true;
- // for (var obj in $rootScope.user.role) {
- // if ($rootScope.user.role[obj].rolecode == 'incident manager' || $rootScope.user.role[obj].rolecode == 'call center') {
- // $scope.allright = true;
- // $scope.allrightnot = false;
- // }
- // }
- // 处理人,受理人,转派人
- var acceptUser;
- var pdKey = $state.current.pdKey;
- $scope.gridOptions = {};
- $scope.gridOptions.data = 'myData';
- $scope.gridOptions.enableColumnResizing = true;
- $scope.gridOptions.enableFiltering = false;
- $scope.gridOptions.enableGridMenu = true;
- $scope.gridOptions.enableSelectAll = true;
- $scope.gridOptions.enableRowSelection = true;
- $scope.gridOptions.showGridFooter = true;
- $scope.gridOptions.showColumnFooter = false;
- $scope.gridOptions.fastWatch = true;
- $scope.gridOptions.enableSorting = true;
- $scope.gridOptions.useExternalSorting = true;
- $scope.gridOptions.useExternalFiltering = false;
- $scope.gridOptions.useExternalPagination = true;
- $scope.gridOptions.paginationPageSizes = [10, 20, 50, 100];
- $scope.gridOptions.paginationPageSize = 10;
- $scope.gridOptions.multiSelect = true;
- var mun = $scope.gridOptions.paginationPageSize;
- $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>";
- $scope.gridOptions.rowIdentity = function (row) {
- return row.id;
- };
- $scope.gridOptions.getRowIdentity = function (row) {
- return row.id;
- };
- $scope.states = [
- {
- id: "all",
- name: '全部的事件'
- },
- {
- id: "todo",
- name: '待我处理的事件'
- },
- {
- id: "create",
- name: '我创建的事件'
- },
- {
- id: "done",
- name: '我处理过的事件'
- }
- ];
- // for (var obj = 0; obj < $rootScope.user.role.length; obj++) {
- // if ($rootScope.user.role[obj].rolecode == 'incident manager' || $rootScope.user.role[obj].rolecode == 'call center') {
- // $scope.states = [
- // { id: "all", name: '全部的事件' },
- // { id: "todo", name: '待我处理的事件' },
- // { id: "create", name: '我创建的事件' },
- // { id: "done", name: '我处理过的事件' }
- // ];
- // }
- // }
- $scope.transferColor = function (item) {
- var color = "icon iconfont icon-zhengchang greenfont";
- if (item.colourInfo) {
- if (item.colourInfo.id == 1583) {
- color = "icon iconfont icon-yiyuqi redfont";
- } else if (item.colourInfo.id == 1584) {
- color = "iconfont icon-yuqixinxiu orangefont";
- }
- }
- return color;
- }
- $scope.transfertip = function (item) {
- var tip = "正常";
- if (item.colourInfo) {
- if (item.colourInfo.id == 1583) {
- tip = "已逾期";
- } else if (item.colourInfo.id == 1584) {
- tip = "即将逾期";
- } else if (item.colourInfo.id == 1586) {
- tip = "正常";
- }
- } else {
- // color = "white";
- }
- return tip;
- }
- $scope.transferstatus = function (item) {
- var statecolor = "#fc4c58";
- if (item.id == 2) { //待处理
- statecolor = "#fc4c58";
- } else if (item.id == 7) { //待审核
- statecolor = "#fcb44c";
- } else if (item.id == 3) { //请求重新指派
- statecolor = "#ebf902";
- } else if (item.id == 4) { //处理中
- statecolor = "#0aa5f5";
- } else if (item.id == 5) { //已解决
- statecolor = "#2edbb8";
- } else if (item.id == 6) { //已关闭
- statecolor = "#bbbbbb";
- }
- return statecolor;
- }
- if($scope.repairMain.valueconfig == 1){//报修人
- $scope.gridOptions.columnDefs = [
- {
- name: 'id',
- displayName: '',
- width: 35,
- cellTemplate: '<div>' +
- '<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>' +
- '</div>'
- },
- {
- name: 'item',
- displayName: '序号',
- width: 45,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents">{{row.entity.item}}</div>' +
- '</div>'
- },
- {
- name: 'incidentsign',
- displayName: '事件单号',
- width: 120,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents">{{row.entity.incidentsign}}</div>' +
- '</div>'
- },
- {
- name: 'requester.name',
- displayName: '报修人',
- width: '6%',
- minWidth: '90',
- enableSorting: false,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" >{{row.entity.requester.name}}</div>' +
- '</div>'
- },
- {
- name: 'requester.account',
- displayName: '学工号',
- width: '6%',
- minWidth: '90',
- enableSorting: false,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" >{{row.entity.requester.account}}</div>' +
- '</div>'
- },
- {
- name: 'contactsInformation',
- displayName: '联系电话',
- width: '105',
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents">{{row.entity.contactsInformation}}</div>' +
- '</div>'
- },
- {
- name: 'category',
- displayName: '事件分类',
- width: '10%',
- enableSorting: false,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents">{{row.entity.category.category}}</div>' +
- '</div>'
- },
- {
- name: 'houseNumber',
- displayName: '区域地点',
- width: '14%',
- enableFiltering: false,
- cellTemplate: '<div><div class="ui-grid-cell-contents">{{grid.appScope.areaplace(row.entity)}}</div></div>'
- },
- {
- name: 'acceptUser.name',
- displayName: '受理人',
- width: '7%',
- minWidth: '80',
- enableSorting: false,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" >{{row.entity.acceptUser.name}}</div>' +
- '</div>'
- },
- {
- name: 'acceptDate',
- displayName: '登记时间',
- width: '10%',
- minWidth: '140',
- enableFiltering: false,
- cellTemplate: '<div><div class="ui-grid-cell-contents">{{grid.appScope.transferTime(row.entity.acceptDate)}}</div></div>'
- },
- {
- name: 'groupORHandlerUser',
- displayName: '处理人/组',
- width: '10%',
- enableFiltering: false,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents">' +
- '{{row.entity.groupORHandlerUser}}</div>' +
- '</div>'
- },
- {
- name: 'state.name',
- displayName: '状态',
- width: '7%',
- minWidth: '70',
- enableSorting: false,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" >{{row.entity.state.name}}</div>' +
- '</div>'
- },
- {
- name: '操作',
- enableSorting: false,
- width: 500,
- cellTemplate: '<incidentoperator style="background-color:{{row.entity.colourInfo.rgb}}" item="row.entity" colobject="col">',
- enableFiltering: false
- },
- ];
- if($scope.wxIncidentWithCmdb==1){
- let index = $scope.gridOptions.columnDefs.findIndex(v=>v.name == 'contactsInformation');
- $scope.gridOptions.columnDefs.splice(index,0,{
- name: 'assetId',
- displayName: '资产',
- width: 120
- },)
- }
- }else if($scope.repairMain.valueconfig == 2){//报修科室
- $scope.gridOptions.columnDefs = [
- {
- name: 'id',
- displayName: '',
- width: 35,
- cellTemplate: '<div>' +
- '<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>' +
- '</div>'
- },
- {
- name: 'item',
- displayName: '序号',
- width: 45,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents">{{row.entity.item}}</div>' +
- '</div>'
- },
- {
- name: 'incidentsign',
- displayName: '事件单号',
- width: 120,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents">{{row.entity.incidentsign}}</div>' +
- '</div>'
- },
- {
- name: 'department.dept',
- displayName: '报修科室',
- width: '6%',
- minWidth: '90',
- enableSorting: false,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" >{{row.entity.department.dept}}</div>' +
- '</div>'
- },
- {
- name: 'department.phone',
- displayName: '联系电话',
- width: '105',
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents">{{row.entity.department.phone}}</div>' +
- '</div>'
- },
- {
- name: 'category',
- displayName: '事件分类',
- width: '10%',
- enableSorting: false,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents">{{row.entity.category.category}}</div>' +
- '</div>'
- },
- {
- name: 'houseNumber',
- displayName: '故障地点',
- width: '14%',
- enableFiltering: false,
- cellTemplate: '<div><div class="ui-grid-cell-contents">{{row.entity.houseNumber}}</div></div>'
- },
- {
- name: 'acceptUser.name',
- displayName: '受理人',
- width: '7%',
- minWidth: '80',
- enableSorting: false,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" >{{row.entity.acceptUser.name}}</div>' +
- '</div>'
- },
- {
- name: 'acceptDate',
- displayName: '登记时间',
- width: '10%',
- minWidth: '140',
- enableFiltering: false,
- cellTemplate: '<div><div class="ui-grid-cell-contents">{{grid.appScope.transferTime(row.entity.acceptDate)}}</div></div>'
- },
- {
- name: 'groupORHandlerUser',
- displayName: '处理人/组',
- width: '10%',
- enableFiltering: false,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents">' +
- '{{row.entity.groupORHandlerUser}}</div>' +
- '</div>'
- },
- {
- name: 'state.name',
- displayName: '状态',
- width: '7%',
- minWidth: '70',
- enableSorting: false,
- cellTemplate: '<div>' +
- '<div class="ui-grid-cell-contents" >{{row.entity.state.name}}</div>' +
- '</div>'
- },
- {
- name: '操作',
- enableSorting: false,
- width: 600,
- cellTemplate: '<incidentoperator style="background-color:{{row.entity.colourInfo.rgb}}" item="row.entity" colobject="col">',
- enableFiltering: false
- },
- ];
- }
- $scope.value = 10;
- $scope.decrement = function () {
- $scope.value = $scope.value - 1;
- };
- $scope.record = function () {
- api_text.record($rootScope.takes).then(function (data) {
- if (data.errno == 0) {
- $scope.busy = false;
- }
- })
- };
- $scope.transferTime = function (time) {
- return moment(time).format('YYYY-MM-DD HH:mm');
- }
- $scope.parameters = null;
- $scope.open = function ($event) {
- $event.preventDefault();
- $event.stopPropagation();
- $scope.opened = !$scope.opened;
- };
- $scope.endOpen = function ($event) {
- $event.preventDefault();
- $event.stopPropagation();
- $scope.startOpened = false;
- $scope.endOpened = !$scope.endOpened;
- };
- $scope.startOpen = function ($event) {
- $event.preventDefault();
- $event.stopPropagation();
- $scope.endOpened = false;
- $scope.startOpened = !$scope.startOpened;
- };
- $scope.othcode = {};
- $scope.searchkeys = {};
- // $scope.searchkeys = {selectType:{id:2,name:'是'}};//seimin
- // 事件分类
- var apple_selected, tree, treedata_avm, treedata_geography;
- $scope.my_tree_handler = function (branch) {
- //var _ref;
- var classify = $scope.classify = branch.prefix.toLowerCase() + branch.sign;
- api_cmdb.query({ 'sign': classify }).then(function (data) {
- var myData = Restangular.stripRestangular(data);
- // console.log(myData.data.node);
- if (myData.data && myData.status == 200) {
- var ret = myData.data;
- redrawSvg(myData);
- }
- });
- };
- $scope.my_data = [];
- function convertListToTree(data, treeMap) {
- var idToNodeMap = {}; //Keeps track of nodes using id as key, for fast lookup
- var root = null; //Initially set our loop to null
- var parentNode = null;
- //loop over data
- for (var i = 0; i < data.length; i++) {
- var datum = data[i];
- //each node will have children, so let's give it a "children" poperty
- datum.children = [];
- //add an entry for this node to the map so that any future children can
- //lookup the parent
- idToNodeMap[datum.id] = datum;
- //Does this node have a parent?
- if (typeof datum.parent === "undefined" || datum.parent == null) {
- //Doesn't look like it, so this node is the root of the tree
- root = datum;
- treeMap[datum.id] = root;
- } else {
- //This node has a parent, so let's look it up using the id
- parentNode = idToNodeMap[datum.parent.id];
- //We don't need this property, so let's delete it.
- delete datum.parent;
- //Let's add the current node as a child of the parent node.
- parentNode.children.push(datum);
- }
- }
- return root;
- }
- function convertParentToChildList(data) {
- var treeMap = {};
- var list = [];
- convertListToTree(data, treeMap);
- angular.forEach(treeMap, function (item) {
- list.push(item);
- });
- return list;
- }
- $scope.my_tree = tree = {};
- // $scope.try_async_load = function() {
- // $scope.my_data = [];
- // $scope.select_treedata = [];
- // $scope.doing_async = true;
- // api_configure_data.fetchDataList('ciclassify', { 'idx': 0, 'sum': 100 }).then(function(result) {
- // $scope.my_tree = result['list'];
- // $scope.select_treedata = $scope.my_data = convertParentToChildList(result['list']);
- // $scope.doing_async = false;
- // // tree.expand_all();
- // //console.log(treelist);
- // });
- // };
- $scope.select_treedata = [];
- $scope.propTypeOptions = [];
- // $scope.try_async_load();
- // $scope.onFilterCallback = function(item) {
- // console.log(item);
- // if (angular.isDefined(item.children) && item.children.length >= 1) {
- // //not valid
- // } else {
- // var tempclassify = (item.item?item.item.prefix.toLowerCase():item.prefix.toLowerCase()) + (item.item?item.item.sign:item.sign);
- // $scope.gridApi.grid.options.paginationCurrentPage = 1;
- // $scope.cifilter_classic = tempclassify;
- // var memoryfilterData = {
- // "sign": tempclassify,
- // "idx": 0,
- // "sum": $scope.gridOptions.paginationPageSize
- // }
- // angular.extend($scope.memoryfilterData, memoryfilterData);
- // $scope.fileData["sign"]=tempclassify;
- // // $scope.memoryfilterData=memoryfilterData;
- // $scope.refreshData('expand-right', $scope.fileData);
- // // 专有属性
- // api_configure_form.renderTabForm(tempclassify).then(function(data) {
- // var myData = Restangular.stripRestangular(data);
- // angular.forEach(myData, function(item, index) {
- // if (index == 0) {
- // $scope.propTypeOptions = myData[0].form.fields;
- // } else {
- // angular.forEach(item.form.fields, function(itemdata) {
- // $scope.propTypeOptions.push(itemdata)
- // })
- // }
- // })
- // // $scope.propTypeOptions = myData[2].form.fields;
- // console.log($scope.propTypeOptions)
- // });
- // }
- // }
- // 报修科室
- $scope.getDept = function (key) {
- var postData = {
- "idx": 0,
- "sum": 10
- }
- if (key) {
- postData.department = { dept: key }
- }
- api_user_data.fetchDataList('department', postData).then(function (response) {
- if (response) {
- if (response.status = 200) {
- $scope.department = response.list;
- }
- }
- })
- }
- $scope.getDept();
- var apple_selected, tree, treedata_avm, treedata_geography;
- $scope.my_tree_handler = function (branch) {
- //var _ref;
- var classify = $scope.classify = branch.prefix.toLowerCase() + branch.sign;
- api_cmdb.query({
- 'sign': classify
- }).then(function (data) {
- var myData = Restangular.stripRestangular(data);
- // console.log(myData.data.node);
- if (myData.data && myData.status == 200) {
- var ret = myData.data;
- redrawSvg(myData);
- }
- });
- };
- //树形图
- // $scope.inspecttype = {};
- // 将事件分类搜索结果返回的数据整理成children模式
- function transform(nodes) {
- var treeConverter = {
- result: null, //转化后的结果,是根节点,所有节点都是从根节点长出来的
- attributeName: 'id', //节点唯一标识符
- needFind: true, //是否查询节点在result中已经存在,为了优化效率
- transform: function (node) { //转化递归函数,参数:一个待插入节点
- if (node.parent != null) { //该节点有父节点
- var newNode = this.transform(node.parent); //递归进入,返回值为一个节点,用作父节点,该父节点必然存在于result中,这点由下面的算法可以控制
- if (this.needFind) {
- for (var i = 0; i < newNode.children.length; i++) { //查找要插入的node子节点是否在newNode这个父节点中存在
- if (newNode.children[i][this.attributeName] === node[this.attributeName]) {
- return newNode.children[i]; //存在的话直接返回newNode父节点内的该子节点,该子节点必然存在于result中,作为返回值它将被用作上级递归的newNode,因此newNode必然存在于result中
- }
- }
- }
- this.needFind = false; //不存在的话,关闭之后递归的循环判断,因为待插入node节点不存在于result中,故而它的子节点一定不存在于result中,不用再循环判断
- // delete node.parent; //删除该节点的parent属性,如果有的话
- node.children = []; //因为确定是要新插入的节点,没有children:[]属性,故给该节点增加children:[]属性
- newNode.children.push(node); //将该node节点push进newNode的子节点数组中
- return node; //return该新插入节点,作为递归返回值给上层,用作newNode父节点,node存在于result中故newNode存在于result中
- } else if (node.parent == null) { //该叶节点没有父节点,即为根节点
- // delete node.parent; //删除该节点的parent属性,如果有的话
- if (this.result == null) { //根节点不存在
- node.children = []; //给该节点增加children:[]属性
- return this.result = node; //该节点赋给result,并return根节点,作为返回值它将被用作上级递归的newNode,因此newNode必然存在于result中
- } else {
- node.children = [];
- // 顶级去重
- for (var i = 0; i < this.result.children.length; i++) {
- if (this.result.children[i][this.attributeName] === node[this.attributeName]) {
- return this.result.children[i];
- }
- }
- this.result.children.push(node)
- return node // 直接return根节点,作为返回值它将被用作上级递归的newNode,因此newNode必然存在于result中
- }
- }
- },
- getWhole: function (nodes, attributeName) { //传入整个叶子节点数组,attributeName作为节点唯一标识符属性,返回整个转化结果
- var _node = {};
- _node.children = [];
- this.result = _node; //重置根节点
- this.attributeName = attributeName == null ? 'id' : attributeName; //唯一标识符默认为“id”
- nodes = JSON.parse(JSON.stringify(nodes)); //复制出一个新的节点对象作为参数,保证不改变原有数据
- nodes.forEach(item => { //循环调用转化方法
- this.needFind = true; //重置开启节点是否已存在判断,保证不插入重复节点
- this.transform(item);
- })
- return this.result; //返回根节点
- }
- }
- var result = treeConverter.getWhole(nodes); //调用
- return result;
- }
- $scope.my_tree = {};
- $rootScope.bala1 = $scope.try_async_load = function (s, fn) {
- if (s) {
- var filterKeyword = s.filterKeyword;
- }
- var postData = {
- "idx": 0,
- "sum": 1000
- }
- if (filterKeyword) {
- postData.incidentcategory = { selectType: "pinyin_qs", category: filterKeyword }
- }
- $scope.my_data = [];
- $scope.doing_async = true;
- api_bpm_data.fetchDataList('incidentcategory', postData).then(function (response) {
- if (response.status == 200) {
- var data = response.list;
- if (filterKeyword) {
- data.forEach(e => {
- e.isExpanded = true;
- })
- var li = transform(data).children;
- console.log(li)
- fn(li)
- return;
- } else {
- var objects = [];
- for (var i = 0; i < data.length; i++) {
- var object = {};
- object.id = data[i].id;
- object.parent = data[i].parent;
- // if (data[i].parent && data[i].parent.id != 0) {
- // object.parent = data[i].parent.id;
- // }
- object.category = data[i].category;
- object.isExpanded = true;
- objects.push(object);
- }
- $scope.my_data = convertParentToChildList(objects);
- $scope.select_treedata = angular.copy($scope.my_data);
- }
- if ($scope.my_data.length > 0) {
- $scope.doing_async = false;
- }
- } else {
- SweetAlert.swal({
- title: "系统错误!",
- text: "请刷新重试!",
- type: "error"
- });
- }
- });
- };
- $scope.my_data = [];
- function convertListToTree(data, treeMap) {
- var idToNodeMap = {}; //Keeps track of nodes using id as key, for fast lookup
- var root = null; //Initially set our loop to null
- var parentNode = null;
- //loop over data
- for (var i = 0; i < data.length; i++) {
- var datum = data[i];
- //each node will have children, so let's give it a "children" poperty
- datum.children = [];
- //add an entry for this node to the map so that any future children can
- //lookup the parent
- idToNodeMap[datum.id] = datum;
- //Does this node have a parent?
- if (typeof datum.parent === "undefined" || datum.parent == null) {
- //Doesn't look like it, so this node is the root of the tree
- root = datum;
- treeMap[datum.id] = root;
- } else {
- //This node has a parent, so let's look it up using the id
- parentNode = idToNodeMap[datum.parent.id];
- //We don't need this property, so let's delete it.
- delete datum.parent;
- //Let's add the current node as a child of the parent node.
- parentNode.children.push(datum);
- }
- }
- return root;
- console.log(root)
- }
- function convertParentToChildList(data) {
- var treeMap = {};
- var list = [];
- convertListToTree(data, treeMap);
- angular.forEach(treeMap, function (item) {
- list.push(item);
- });
- return list;
- }
- $scope.try_async_load();
- // $scope.select_treedata = [];
- $scope.propTypeOptions = [];
- $scope.deselectItem = function (item) {
- console.log(item)
- console.log($scope)
- }
- // 事件分类
- $scope.onFilterCallback = function (item) {
- // $scope.searchkeys.category={};
- console.log(item);
- if (item.item) {
- $scope.searchkeys.levelCategory = item = undefined;
- } else {
- $scope.searchkeys.levelCategory = item;
- }
- // if (angular.isDefined(item.children) && item.children.length >= 1) {
- // //not valid
- // } else {
- // var tempclassify = item.prefix.toLowerCase() + item.sign;
- // $scope.gridApi.grid.options.paginationCurrentPage = 1;
- // $scope.cifilter_classic = tempclassify;
- // var memoryfilterData = {
- // "sign": tempclassify,
- // "idx": 0,
- // "sum": $scope.gridOptions.paginationPageSize
- // }
- // angular.extend($scope.memoryfilterData, memoryfilterData)
- // // $scope.memoryfilterData=memoryfilterData;
- // $scope.refreshData('expand-right', $scope.memoryfilterData);
- // // 专有属性
- // var postData={
- // idx:0,
- // sum:1000
- // }
- // api_bpm_data.fetchDataList('incidentcategory',postData).then(function(data){
- // console.log(data)
- // var myData = Restangular.stripRestangular(data);
- // $scope.propTypeOptions = myData[2].form.fields;
- // // console.log($scope.propTypeOptions)
- // });
- // }
- }
- //状态
- $scope.state = [];
- // api_bpm_data.fetchDataList('incidentstatus', { "idx": 0, "sum": 100 }).then(function(response) {
- api_wechatfile.getDictionary({
- "type": "list",
- "key": "incident_status"
- }).then(function (response) {
- if (response) {
- if (response.status = 200) {
- $scope.state = response;
- if (sessionStorage.searchincident && JSON.parse(sessionStorage.getItem("searchincident")).incident) {
- angular.forEach($scope.state, function (item) {
- if (item.id == JSON.parse(sessionStorage.getItem("searchincident")).incident.statusId) {
- $scope.othcode = {
- "state": item
- };
- }
- })
- }
- }
- }
- })
- if (sessionStorage.searchincident && JSON.parse(sessionStorage.getItem("searchincident")).incident) {
- // angular.forEach($scope.state, function(item) {
- // if (item.code == JSON.parse(sessionStorage.getItem("searchincident")).incident.statusId) {
- // $scope.othcode = item.id;
- // }
- // })
- // $scope.othcode = JSON.parse(sessionStorage.getItem("searchincident")).incident.statusId;
- if (JSON.parse(sessionStorage.getItem("searchincident")).incident) {
- $scope.searchkeys = JSON.parse(sessionStorage.getItem("searchincident")).incident;
- }
- if ($scope.searchkeys.acceptDate) {
- $scope.searchkeys.acceptDate = new Date($scope.searchkeys.acceptDate);
- }
- if ($scope.searchkeys.acceptDateEnd) {
- $scope.searchkeys.acceptDateEnd = new Date($scope.searchkeys.acceptDateEnd);
- }
- // $scope.gridOptions.paginationCurrentPage = 1 + JSON.parse(sessionStorage.getItem("searchincident")).idx;
- }
- $scope.clear = function () {
- $scope.propTypeOptions = [];
- $scope.searchkeys = {};
- $scope.searchstate = JSON.parse(sessionStorage.getItem("searchincident")).searchType;
- $scope.othcode = {};
- $scope.try_async_load();
- var fildata = {
- "assignee": loginUser.id,
- "candidateGroups": loginuserGroup,
- "searchType": JSON.parse(sessionStorage.getItem("searchincident")).searchType,
- "idx": JSON.parse(sessionStorage.getItem("searchincident")).idx,
- "sum": JSON.parse(sessionStorage.getItem("searchincident")).sum
- }
- sessionStorage.removeItem("searchincident");
- fildata.assignee = loginUser.id;
- $scope.memoryfilterData = fildata;
- $scope.refreshData('expand-right', fildata);
- $interval.cancel($scope.timer);
- $scope.timer = $interval(function () {
- $scope.jry_refresh()
- }, $rootScope.refreshTime);
- }
- // 刷新
- $scope.jry_refresh = function () {
- var fildata = {};
- if (sessionStorage.searchincident) {
- fildata = JSON.parse(sessionStorage.getItem("searchincident"));
- } else {
- fildata = defaultFilterData;
- }
- if (fildata.incident && fildata.incident.category) {
- delete fildata.incident.category
- }
- fildata.idx = $scope.jry_idx;
- fildata.sum = $scope.jry_sum;
- $scope.refreshData2('expand-right', fildata);
- console.log($scope.cifilter_classic);
- }
- // 搜索
- $scope.chiceIncident = function (item, stateid) {
- if (stateid && stateid.id) {
- item.statusId = stateid.id;
- } else {
- item.statusId = undefined;
- }
- console.log(item)
-
- var fildata = {};
- if (sessionStorage.searchincident) {
- fildata = JSON.parse(sessionStorage.getItem("searchincident"));
- $scope.gridOptions.paginationCurrentPage = 1;
- fildata.idx = 0;
- } else {
- fildata = defaultFilterData;
- }
- // $scope.memoryfilterData = fildata;
- if (!fildata.incident) {
- fildata['incident'] = {};
- }
- // $scope.gridOptions.paginationCurrentPage = 1;
- if (item.acceptDate) {
- item.acceptDate = moment(item.acceptDate).format('YYYY-MM-DD 00:00:00');
- }
- if (item.acceptDateEnd) {
- // item.acceptDateEnd = moment(item.acceptDateEnd).format('YYYY-MM-DD 00:00:00');
- item.acceptDateEnd = moment(item.acceptDateEnd).format('YYYY-MM-DD 23:59:59')
- }
- // if (parameters) {
- // angular.extend(fildata, { 'idx': 0, 'sum': $scope.gridOptions.paginationPageSize })
- // 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') })
- // }
-
- var transitiondata = angular.copy(item);
- angular.extend(fildata.incident, transitiondata)
- sessionStorage['searchincident'] = JSON.stringify(fildata);
- $scope.memoryfilterData = fildata;
- fildata.assignee = loginUser.id;
- // seimin
- if($scope.searchstate === 'all_del'){
- fildata.searchType = 'all';
- }else{
- fildata.searchType = $scope.searchstate;
- }
- console.log(fildata,78777);
- if(fildata.searchType === 'all'){
- if(fildata.incident&&fildata.incident.selectType){
- fildata.incident.selectType = fildata.incident.selectType.id;
- }
- }else{
- if(fildata.incident&&fildata.incident.selectType){
- delete fildata.incident.selectType;
- }
- }
- // /seimin
- $scope.refreshData('expand-right', fildata);
- $interval.cancel($scope.timer);
- $scope.timer = $interval(function () {
- $scope.jry_refresh()
- }, $rootScope.refreshTime);
- }
- //区域地点过滤
- $scope.key = {};
- api_user_data.fetchDataList('area', {
- "idx": 0,
- "sum": 1000
- }).then(function (response) {
- if (response) {
- if (response.status = 200) {
- $scope.outarea = response.list;
- }
- }
- })
- //报修人
- var getRequester = function () {
- api_user_data.fetchDataList('requester', {
- idx: 0,
- sum: 100
- }).then(function (data) {
- // console.log(data);
- $scope.requester = data.list
- });
- }
- getRequester();
- //受理人,处理人
- var getUser = function (fieldatas, it) {
- api_user_data.fetchDataList('user', fieldatas).then(function (data) {
- // console.log(data);
- if (it == 1) {
- $scope.acceptUser = data.list;
- acceptUser = $scope.acceptUser;
- } else if (it == 2) {
- $scope.handlingPersonnelUser = data.list;
- // } else if (it == 3) {
- // $scope.acceptUser = data.list;
- // $scope.handlingPersonnelUser = data.list;
- }
- });
- }
- //受理人过滤
- $scope.onChangeacceptUser = function (key) {
- console.log(key)
- var filuser = {
- "idx": 0,
- "sum": 10,
- "user": {
- "name": key,
- 'selectType': "pinyin_qs"
- }
- }
- getUser(filuser, 1);
- }
- //处理人过滤
- $scope.onChangehandling = function (key) {
- var filuser = {
- "idx": 0,
- "sum": 10,
- "user": {
- "name": key,
- 'selectType': "pinyin_qs"
- }
- }
- getUser(filuser, 2);
- }
- //报修科室过滤
- $scope.onChangeDept = function (key) {
- $scope.getDept(key)
- }
- //地点区域过滤
- $scope.onChangearea = function (data) {
- delete $scope.searchkeys.place;
- if ($scope.memoryfilterData.incident) {
- delete $scope.memoryfilterData.incident.place;
- }
- var fildata = {
- "idx": 0,
- "sum": 1000,
- "place": {
- area: {
- id: data.area.id
- }
- }
- };
- api_user_data.fetchDataList('place', fildata).then(function (response) {
- if (response) {
- if (response.status = 200) {
- $scope.outplace = response.list;
- }
- }
- })
- };
- $scope.starttime = function (data) {
- return moment(new Date(data)).format('YYYY-MM-DD')
- }
- $scope.overtime = function (data) {
- return moment(new Date(data)).format('YYYY-MM-DD HH:mm')
- }
- $scope.areaplace = function (data) {
- // if (data.area && data.place) {
- // if (data.houseNumber) {
- var str = ' ';
- str += ' ' + (data.place ? (data.place.area ? data.place.area.area : ' ') : ' ');
- str += ' ' + (data.place ? (data.place.place ? data.place.place : ' ') : ' ');
- str += ' ' + (data.houseNumber ? data.houseNumber : ' ');
- return str;
- // } else {
- // return data.area.area + ' ' + data.place.place;
- // }
- // } else if (data.area && !data.place) {
- // if (data.houseNumber) {
- // return data.area.area + ' ' + data.houseNumber;
- // } else {
- // return data.area.area;
- // }
- // } else if (!data.area && data.place) {
- // if (data.houseNumber) {
- // return data.place.place + ' ' + data.houseNumber;
- // } else {
- // return data.place.place;
- // }
- // }
- }
- //录音
- $scope.play = function (data) {
- // console.log($scope.item.callID)
- var modalInstance = $modal.open({
- backdrop: "static",
- templateUrl: 'assets/views/incident/tpl/audio.html',
- controller: function ($rootScope, $scope, $modalInstance, $sce, $http, api_playservice) {
- $rootScope.setbusy();
- $scope.datasurl = "";
- $http({
- url: callIp + "/recording/recording?callID=" + data.callID,
- method: 'GET',
- headers: {},
- }).success(function (data, status, headers, config) {
- $scope.data = {
- "name": "视频",
- "url": $sce.trustAsResourceUrl("http://" + data.rrpath)
- };
- $scope.datasurl = data.rrpath;
- }).error(function (data, status, headers, config) { });
- $scope.download = function (contentId, filename) {
- $http({
- url: "http://" + $scope.datasurl,
- method: 'GET',
- headers: {
- 'Content-type': 'application/octet-stream',
- },
- responseType: 'arraybuffer'
- }).success(function (data, status, headers, config) {
- var file = new Blob([data], {
- type: 'application/octet-stream'
- });
- //trick to download store a file having its URL
- var fileURL = URL.createObjectURL(file);
- var a = document.createElement('a');
- a.href = fileURL;
- a.target = '_blank';
- a.download = filename;
- document.body.appendChild(a);
- a.click();
- }).error(function (data, status, headers, config) {
- // console.log(data);
- });
- }
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- };
- $modalInstance.close();
- }
- });
- modalInstance.result.then(function (result) {
- // $rootScope.setidle();
- }, function (reason) {
- $rootScope.setidle();
- });
- };
- $scope.jry_paging = "";
- //列表排序
- // sessionStorage.idx = 0;
- $scope.gridOptions.onRegisterApi = function (gridApi) {
- $scope.gridApi = gridApi;
- var index = 0;
- var oldheader = {};
- gridApi.grid.sortColumn = function (gridApi) {
- if (oldheader.field) {
- if (oldheader.field == gridApi.field) {
- // index = 0;
- } else {
- index = 0;
- }
- }
- index++;
- oldheader = gridApi;
- var fildata = $scope.memoryfilterData;
- if (index % 3 == 0) {
- delete $scope.memoryfilterData.incident;
- fildata = $scope.memoryfilterData;
- } else if (index % 3 == 1) {
- if (fildata.incident) {
- if (gridApi.field == "acceptDate") {
- angular.extend(fildata.incident, {
- "sort": gridApi.field
- });
- } else {
- angular.extend(fildata.incident, {
- "sort": gridApi.field + " desc , _incident.acceptDate"
- });
- }
- } else {
- if (gridApi.field == "acceptDate") {
- angular.extend(fildata, {
- 'incident': {
- "sort": gridApi.field
- }
- });
- } else {
- angular.extend(fildata, {
- 'incident': {
- "sort": gridApi.field + " desc , _incident.acceptDate"
- }
- });
- }
- }
- } else if (index % 3 == 2) {
- if (fildata.incident) {
- if (gridApi.field == "acceptDate") {
- angular.extend(fildata.incident, {
- "sort": gridApi.field,
- "order": "asc"
- });
- } else {
- angular.extend(fildata.incident, {
- "sort": gridApi.field + " asc , _incident.acceptDate"
- });
- }
- } else {
- if (gridApi.field == "acceptDate") {
- angular.extend(fildata, {
- 'incident': {
- "sort": gridApi.field,
- "order": "asc"
- }
- });
- } else {
- angular.extend(fildata.incident, {
- "sort": gridApi.field + " asc , _incident.acceptDate"
- });
- }
- }
- // angular.extend(fildata, { 'incident': { "sort": gridApi.field, "order": "asc" } });
- }
- fildata.assignee = loginUser.id;
- $scope.refreshData('expand-right', fildata);
- }
- $scope.jry_idx = 0;
- $scope.jry_sum = 10;
- gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
- var filtersData = $scope.memoryfilterData;
- filtersData.idx = newPage - 1;
- $scope.jry_paging = newPage - 1;
- $scope.jry_idx = newPage - 1;
- filtersData.sum = pageSize;
- $scope.jry_sum = pageSize;
- if (JSON.parse(sessionStorage.getItem("searchincident")).idx != filtersData.idx || JSON.parse(sessionStorage.getItem("searchincident")).sum != filtersData.sum) {
- filtersData.assignee = loginUser.id;
- $scope.refreshData('expand-right', filtersData);
- }
- // $scope.refreshData('expand-right', {"assignee":$rootScope.user.id, "candidateGroups":$rootScope.user.group[0].id, "idx":newPage-1,"sum":pageSize});
- });
- // gridApi.selection.on.rowSelectionChanged($scope, function(data) {
- // data.grid.appScope.selected.items = data.entity
- // });
- $scope.Change = function (upTypes) {
- if (angular.isDefined($scope.selected.items)) {
- if (angular.isDefined(upTypes) && upTypes == 'upincident') {
- var data = {
- cancelUrl: 'app.incident.list',
- model: {
- problem: {
- title: $scope.selected.items.title,
- des: $scope.selected.items.description,
- proposePerson: $scope.selected.items.handlerUser,
- source: {
- id: 1,
- code: 1,
- name: ' 事件 '
- },
- incident: $scope.selected.items
- }
- }
- }
- $state.go('app.problem.incident', {
- pdKey: 'incident',
- dataId: $scope.selected.items.id,
- processInstanceId: $scope.selected.items.processInstanceId,
- 'model': JSON.stringify(data)
- });
- } else if (angular.isDefined(upTypes) && upTypes == 'upchange') {
- var data = {
- cancelUrl: 'app.incident.list',
- model: {
- change: {
- title: $scope.selected.items.title,
- description: $scope.selected.items.description,
- requestingPerson: $scope.selected.items.handlerUser,
- source: {
- id: 1,
- code: 1,
- name: ' 事件 '
- },
- incident: $scope.selected.items
- }
- }
- }
- // var data={cancelUrl:'app.incident.list'}
- $state.go('app.change.incident', {
- pdKey: 'incident',
- dataId: $scope.selected.items.id,
- processInstanceId: $scope.selected.items.processInstanceId,
- 'model': JSON.stringify(data)
- });
- }
- }
- }
- $scope.selected = {
- items: []
- }
- gridApi.core.on.filterChanged($scope, function () {
- var grid = this.grid;
- if ($rootScope.user.group) {
- var filtersData = {
- "assignee": loginUser.id,
- "candidateGroups": loginuserGroup,
- idx: 0,
- sum: mun
- };
- } else {
- var filtersData = {
- "assignee": loginUser.id,
- idx: 0,
- sum: mun
- };
- }
- angular.forEach(grid.columns, function (item) {
- if (item.enableFiltering) {
- if (angular.isDefined(item.filters[0].term) && item.filters[0].term != '') {
- filtersData = $scope.memoryfilterData
- if (angular.isUndefined(filtersData['incident'])) {
- filtersData['incident'] = {};
- }
- if (item.field == 'department.dept') {
- filtersData['incident']['department'] = {};
- filtersData.incident.department['department'] = item.filters[0].term;
- } else if (item.field == 'handlingPersonnelUser.name') {
- filtersData['incident']['handlingPersonnelUser'] = {};
- filtersData.incident.handlingPersonnelUser['name'] = item.filters[0].term;
- } else if (item.field == 'requester.account') {
- filtersData['incident']['requester'] = {};
- filtersData.incident.requester['account'] = item.filters[0].term;
- } else if (item.field == 'acceptUser.name') {
- filtersData['incident']['acceptUser'] = {};
- filtersData.incident.acceptUser['name'] = item.filters[0].term;
- } else {
- filtersData['incident'][item.field] = item.filters[0].term;
- }
- }
- }
- });
- filtersData.idx = 0;
- filtersData.assignee = loginUser.id;
- $scope.memoryfilterData = filtersData;
- $scope.refreshData('expand-right', filtersData);
- });
- };
- //当前人是否分组
- if ($rootScope.user.group) {
- if ($rootScope.user.group.length == 0) {
- SweetAlert.swal("访问失败!", "当前登录人未分配工作组,无权限访问,请添加工作组后重试。", "error");
- } else {
- $scope.memoryfilterData = defaultFilterData = {
- "assignee": loginUser.id,
- "candidateGroups": loginuserGroup,
- "searchType": "todo",
- "idx": 0,
- "sum": mun
- };
- }
- } else {
- $scope.memoryfilterData = defaultFilterData = {
- "assignee": loginUser.id,
- "searchType": "todo",
- "idx": 0,
- "sum": mun
- };
- }
- //打印
- $scope.open = function (data) {
- var modalInstance = $modal.open({
- templateUrl: 'assets/views/incident/tpl/print.html',
- controller: function ($scope, $modalInstance) {
- $scope.printdata = data;
- if (!data.emergency) {
- data['emergency'] = {};
- }
- if (!data.influence) {
- data['influence'] = {};
- }
- if (!data.place) {
- data['place'] = {};
- }
- if (!data.influence) {
- data['influence'] = {};
- }
- if (!data.emergency) {
- data['emergency'] = {};
- }
- if (!data.influence) {
- data['influence'] = {};
- }
- var height = $(".groundborder").height()
- // console.log(height)
- $scope.printrequest = [{
- name: "事件单号",
- value: data.incidentsign
- },
- {
- name: "事件主题",
- value: data.title
- },
- {
- name: "事件分类",
- value: data.category.category
- },
- {
- name: "紧急度",
- value: data.emergency.name
- },
- {
- name: "影响度",
- value: data.influence.name
- },
- {
- name: "优先级",
- value: data.priority.name
- }
- ];
- $scope.printrequest['requester'] = [{
- nameone: "用户姓名",
- valueone: data.requester.name,
- nametwo: "联系电话",
- valuetwo: data.requester.mphone
- },
- {
- nameone: "故障地点",
- valueone: data.place.place,
- nametwo: "申报时间",
- valuetwo: data.acceptDate
- }
- ];
- // $scope.printrequest['requester']=[{name:"用户姓名",value:data.requester.name},
- // {name:"联系电话",value:data.requester.mphone},
- // {name:"故障地点",value:data.place.place},
- // {name:"申报时间",value:data.responseTime}];
- $scope.printrequest['incident'] = [{
- nameone: "故障工单",
- valueone: data.incidentsign,
- nametwo: "故障分类",
- valuetwo: data.category.category
- }];
- $scope.printrequest['handler'] = [{
- name: "故障描述",
- value: data.description
- },
- {
- name: "处理人",
- value: data.handlingPersonnelUser ? data.handlingPersonnelUser.name : ''
- },
- // { name: "处理人", value: data.requester ? data.requester.name : '' }
- ];
- // {name:"处理结果",value:data.handleResult}];
- // {name:"用户评价",value:''},
- // {name:"满意度",value:''},
- // {name:"用户签字",value:''}];
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- };
- },
- size: 'lg'
- });
- }
- //新建事件
- $scope.newincident = function (data) {
- $state.go('app.incident.editor', {});
- };
- //编辑
- $scope.selectRowFunction = function (data) {
- $state.go('app.incident.editor', {
- taskId: data.taskId,
- processInstanceId: data.processInstanceId,
- dataId: data.id,
- // type:1
- });
- };
- // //双击查看详情
- // $scope.onDblClick = function (data) {
- // console.log(data);
- // // console.log('data='+JSON.stringify(data));
- // //$state.go('app.detail',{taskId:data.taskId,processInstanceId: data.processInstanceId});
- // $state.go('app.incident.detail', {
- // formKey: 'incident_back',
- // pdKey: 'incident',
- // dataId: data.entity.id,
- // taskId: data.entity.taskId,
- // processInstanceId: data.entity.processInstanceId
- // });
- // };
- //修改
- $scope.changeClick = function (data) {
- $state.go('app.incident.detail', {
- formKey: 'incident_change',
- pdKey: 'incident',
- dataId: data.id,
- taskId: data.taskId,
- processInstanceId: data.processInstanceId
- });
- };
- //回访
- $scope.visit = function (data) {
- $state.go('app.incident.detail', {
- formKey: 'incident_visit',
- pdKey: 'incident',
- dataId: data.id,
- taskId: data.taskId,
- processInstanceId: data.processInstanceId
- });
- };
- //查看
- $scope.followFunction = function (data) {
- //console.log('data='+JSON.stringify(data));
- console.log(data);
- $state.go('app.detail', {
- formKey: 'statusform',
- pdKey: 'incident',
- dataId: data.id,
- processInstanceId: data.processInstanceId
- });
- };
- // 升级
- $scope.upgrade = function (data) {
- console.log(data);
- console.log('升级');
- // 弹窗下拉菜单单选
- } // 转派
- $scope.rotate = function (data) {
- console.log(data);
- console.log('转派');
- // 弹窗下拉菜单单选
- } // 协同
- $scope.cooperate = function (data) {
- console.log(data);
- console.log('协同');
- // 弹窗下拉菜单多选
- }
- // 升级问题
- $scope.problem = function (data) {
- // console.log(data);
- delete data.item;
- delete data.chaozuoPower;
- delete data.coordination;
- delete data.listen;
- // console.log(data);
- $state.go('app.problem.incident', {
- 'model': JSON.stringify(data)
- });
- }
- //变更升级
- $scope.configuration = function (data) {
- $state.go('app.change.incident', {
- 'model': JSON.stringify(data)
- });
- };
- //协同人
- $scope.coordination = function (data) {
- var modalInstance = $modal.open({
- templateUrl: 'assets/views/customform/tpl/checktable-modal-content.html',
- controller: function ($scope, $modalInstance, i18nService, $timeout, api_bpm_domain, api_user_data) {
- $scope.langs = i18nService.getAllLangs();
- $scope.lang = 'zh-cn';
- i18nService.setCurrentLang($scope.lang);
- $scope.gridOptions = {};
- $scope.gridOptions.data = 'myData';
- $scope.gridOptions.enableColumnResizing = true;
- $scope.gridOptions.enableFiltering = true;
- $scope.gridOptions.enableGridMenu = true;
- $scope.gridOptions.showGridFooter = true;
- $scope.gridOptions.showColumnFooter = true;
- $scope.gridOptions.fastWatch = true;
- $scope.gridOptions.useExternalFiltering = true;
- $scope.gridOptions.useExternalPagination = true;
- $scope.gridOptions.paginationPageSizes = [10, 20, 50, 100];
- $scope.gridOptions.paginationPageSize = 10;
- $scope.gridOptions.multiSelect = false;
- $scope.gridOptions.rowIdentity = function (row) {
- return row.id;
- };
- $scope.gridOptions.getRowIdentity = function (row) {
- return row.id;
- };
- $scope.gridOptions.columnDefs = [
- // { name:'id', width:80, enableFiltering:false},
- {
- name: 'account',
- displayName: '账号',
- width: 140
- },
- {
- name: 'name',
- displayName: '名称',
- width: 100
- },
- {
- name: 'gender',
- displayName: '性别',
- width: 140,
- enableFiltering: false
- },
- {
- name: 'phone',
- displayName: '电话',
- width: 100,
- enableFiltering: false
- },
- {
- name: 'email',
- displayName: '邮件',
- width: 100,
- enableFiltering: false
- },
- {
- name: 'dept.dept',
- displayName: '科室',
- width: 100,
- enableFiltering: false
- },
- {
- name: 'group[0].groupName',
- displayName: '职位',
- width: 100,
- enableFiltering: false
- }
- ];
- $scope.gridOptions.onRegisterApi = function (gridApi) {
- $scope.gridApi = gridApi;
- gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
- var filtersData = $scope.memoryfilterData;
- filtersData.idx = newPage - 1;
- filtersData.sum = pageSize;
- $scope.loadData(filtersData);
- // $scope.loadData({"idx":newPage-1,"sum":pageSize});
- });
- gridApi.selection.on.rowSelectionChanged($scope, function (scope) {
- scope.grid.appScope.selected.items[0] = scope.entity;
- // $scope.selected.items[0] = scope.entity;
- });
- gridApi.core.on.filterChanged($scope, function () {
- var grid = this.grid;
- var filtersData = {
- idx: 0,
- sum: 10,
- "user": {
- "roledata": {
- "rolecode": options.model.currentRole
- },
- "selectType": "1"
- }
- };
- angular.forEach(grid.columns, function (item) {
- if (item.enableFiltering) {
- //console.log("filtersData="+JSON.stringify(filtersData))
- if (angular.isDefined(item.filters[0].term) && item.filters[0].term != '') {
- if (angular.isUndefined(filtersData['user'])) {
- filtersData['user'] = {};
- }
- filtersData['user'][item.field] = item.filters[0].term;
- }
- }
- });
- $scope.memoryfilterData = filtersData;
- $scope.loadData(filtersData);
- });
- };
- $scope.selected = {
- items: []
- }
- var filterData = {
- "idx": 0,
- "sum": 10,
- "user": {
- "roledata": {
- "rolecode": 'first-line support'
- },
- "selectType": "1"
- }
- }
- $scope.loadData = function (filterData) {
- // console.log(" filtersData['user'][item.field]=111"+JSON.stringify(filterData));
- api_user_data.fetchDataList('user', filterData).then(function (data) {
- var myData = Restangular.stripRestangular(data);
- $scope.gridOptions.totalItems = myData.totalNum;
- $scope.myData = myData.list;
- });
- };
- $scope.loadData({
- idx: 0,
- sum: 10,
- "user": {
- "roledata": {
- "rolecode": 'first-line support'
- },
- "selectType": "1"
- }
- });
- $scope.ok = function () {
- $modalInstance.close($scope.selected.items);
- };
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- };
- },
- size: 'lg'
- });
- modalInstance.result.then(function (selectedItem) {
- if (selectedItem) {
- var filterData = {
- "assginee": selectedItem[0].id
- }
- api_bpm_domain.delegateTask(data.taskId, filterData).then(function (data) {
- if (data && data.status == 200) {
- SweetAlert.swal("添加成功!", "添加协同人成功", "success");
- $scope.memoryfilterData.assignee = loginUser.id;
- $scope.refreshData('expand-right', $scope.memoryfilterData);
- } else {
- SweetAlert.swal("添加失败!", "请稍候重试", "error");
- }
- // var myData = Restangular.stripRestangular(data);
- // $scope.gridOptions.totalItems = myData.totalNum;
- // $scope.myData = myData.list;
- });
- }
- });
- }
- // $scope.onDblClick = function(row){
- // console.log(row.entity);
- // if($rootScope.user.id==row.entity.handlerUser.id){$state.go('app.incident.editor',{taskId:row.entity.taskId,processInstanceId: row.entity.processInstanceId});}
- // else{$state.go('app.detail', { formKey:'incident_back', pdKey:'incident', dataId: row.entity.id});}
- // };
- /*
- appScopeProvider: {
- onDblClick : function(row) {
- var url = '//google.com';
- $window.open(url, "_blank", "height=600,width=800,toolbar=no,location=no,menubar=no,titlebar=no");
- }
- },
- 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>"
- */
- //删除
- $scope.eventDeleted = function (event) {
- SweetAlert.swal({
- title: "确认删除?",
- text: "删除的数据不可恢复,请确认继续操作!",
- type: "warning",
- showCancelButton: true,
- confirmButtonColor: "#DD6B55",
- confirmButtonText: "继续删除",
- cancelButtonText: "取消操作",
- closeOnConfirm: false,
- closeOnCancel: false
- }, function (isConfirm) {
- if (isConfirm) {
- api_bpm_schedule.remove([event.id]).then(function (response) {
- if (response.status == 200) {
- $scope.events.splice(event.id, 1); //有修改的一行
- SweetAlert.swal("操作成功!", "数据已经被删除.", "success");
- } else {
- SweetAlert.swal("操作失败!", "数据暂时无法被删除,请稍候重试", "error");
- }
- });
- } else {
- SweetAlert.swal("操作取消", "数据安全", "error");
- }
- });
- };
- //导出
- $scope.export = function () {
- // api_bpm_data.downDataModel("incident", 3, $scope.memoryfilterData).then(function(data) {
- // console.log(data)
- // var file = new Blob([data], {
- // // type: 'application/octet-stream'
- // type: 'application/vnd.ms-excel'
- // });
- // //trick to download store a file having its URL
- // var fileURL = URL.createObjectURL(file);
- // var a = document.createElement('a');
- // a.href = fileURL;
- // a.target = '_blank';
- // a.download = '事件列表.xls';
- // document.body.appendChild(a);
- // a.click();
- // })
- // $scope.ldloading[style.replace('-', '_')] = true;
- console.log($scope.memoryfilterData)
- var filadata = angular.copy($scope.memoryfilterData);
- filadata.sum = 10000;
- console.log($scope.filadata)
- $http({
- url: api_bpm_data.downDataModel("incident", 3).getRequestedUrl(),
- method: 'POST',
- data: JSON.stringify(filadata),
- headers: {
- // 'Content-type': 'application/xls',
- 'Accept': '*/*'
- },
- responseType: 'arraybuffer'
- }).success(function (data, status, headers, config) {
- // $scope.ldloading.zoom_in = false;
- var file = new Blob([data], {
- type: 'application/vnd.ms-excel'
- });
- //trick to download store a file having its URL
- var fileURL = URL.createObjectURL(file);
- var a = document.createElement('a');
- a.href = fileURL;
- a.target = '_blank';
- a.download = '事件列表.xls';
- document.body.appendChild(a);
- a.click();
- }).error(function (data, status, headers, config) {
- // $scope.ldloading.zoom_in = false;
- console.log(data);
- });
- }
- //事件提取
- $scope.acceptTaskAction = function (model) {
- var modalInstance = $modal.open({
- templateUrl: 'assets/views/incident/tpl/acceptTask.tpl.html',
- controller: function ($scope, $modalInstance, APIService, modelData, currentUserId, Alert) {
- var receiveTask = function (receive_code, modelData) {
- var data = {
- 'receive_code': receive_code
- };
- if (modelData) {
- return {
- taskId: modelData.taskId,
- data: data
- };
- } else {
- return 'error';
- }
- };
- $scope.title = "提示";
- $scope.connect = "确认抢单?";
- $scope.ok = function () {
- //接收任务//请求重新指派
- var data = receiveTask($scope.receive_code, modelData);
- APIService.claimAndCompletedTask(data.taskId, {
- userId: currentUserId,
- receive_code: "handler"
- }).then(function (response) {
- if (response.status == 200) {
- Alert.swal({
- title: "操作成功!",
- confirmButtonColor: "#007AFF",
- type: "success"
- });
- $modalInstance.close('success');
- } else if (response.status == 500) {
- Alert.swal({
- title: "操作失败",
- text: "该事件已被提取,请刷新页面!",
- type: "error"
- });
- $modalInstance.close('success');
- } else {
- Alert.swal({
- title: "操作失败",
- text: "操作失败, 请稍后再试!",
- type: "error"
- });
- }
- });
- }
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- }
- },
- size: 'sm',
- resolve: {
- APIService: function () {
- return api_bpm_domain;
- },
- modelData: function () {
- return model;
- },
- currentUserId: function () {
- return loginUser.id;
- },
- Alert: function () {
- return SweetAlert;
- }
- }
- });
- modalInstance.result.then(function (selectedItem) {
- if (selectedItem == 'success') {
- defaultFilterData.assignee = loginUser.id;
- $scope.refreshData('expand-right', defaultFilterData);
- }
- });
- }
- // 升级弹窗
- $scope.upgrade = function (model) {
- console.log(model)
- var modalInstance = $modal.open({
- templateUrl: 'assets/views/incident/tpl/upgrade.tpl.html',
- controller: function ($scope, $modalInstance, api_bpm, modelData, currentUserId, Alert, api_user_data) {
- console.log(model);
- $scope.roleList = {
- 'idx': 0,
- 'sum': 100,
- 'user': {
- 'roledata': {
- 'rolecode': ''
- },
- 'groupdata': {
- 'id': ''
- },
- 'selectType': 1
- }
- }
- for (var i = 0; i < loginUser.role.length; i++) {
- // console.log(loginUser.role[i])
- if (loginUser.role[i].role == '一线支持人员') {
- $scope.roleList.user.roledata.rolecode = loginUser.role[i].rolecode;
- $scope.upRole = '二线支持人员';
- }
- if (loginUser.role[i].role == '二线支持人员') {
- $scope.roleList.user.roledata.rolecode = loginUser.role[i].rolecode;
- $scope.upRole = '事件经理';
- }
- }
- var userId = loginUser.id;
- var taskId = model.taskId;
- var postData = {};
- var formKey = model.formKey;
- var processInstanceId = model.processInstanceId;
- $scope.choosUser = {};
- api_configure_form.renderForm(formKey, userId, processInstanceId).then(function (data) {
- postData = data.model;
- })
- $scope.choosUser = {};
- api_user_data.fetchDataList('group', {
- "idx": 0,
- "sum": 100
- }).then(function (data) {
- $scope.group = data.list;
- })
- $scope.onChangeGroup = function (item) {
- $scope.user = [];
- console.log(item);
- console.log($scope.choosUser.group)
- $scope.roleList.user.groupdata.id = $scope.choosUser.group.id
- console.log($scope.roleList)
- if ($scope.choosUser.group) {
- api_user_data.fetchDataList('user', $scope.roleList).then(function (data) {
- console.log(data);
- if (data.list.length == 0) {
- Alert.swal({
- title: "暂无处理人数据",
- text: "该工作组暂无升级对象!",
- type: "error"
- });
- return;
- } else {
- $scope.user = data.list;
- }
- })
- }
- }
- $scope.ok = function () {
- if ($scope.choosUser.handlerUser) {
- postData.handler_code = 'function';
- postData.incident.handlerUser = $scope.choosUser.handlerUser;
- postData.incident.assignee = postData.assignee = $scope.choosUser.handlerUser.id;
- console.log(postData);
- } else {
- Alert.swal({
- title: "操作失败",
- text: "请选择升级对象信息!",
- type: "error"
- });
- return;
- }
- api_bpm.upgrade(postData, taskId, userId, 'completeTask').then(function (response) {
- console.log(response)
- if (response.status == 200) {
- Alert.swal({
- title: "操作成功!",
- confirmButtonColor: "#007AFF",
- type: "success"
- });
- $modalInstance.close('success');
- } else if (response.status == 500) {
- Alert.swal({
- title: "操作失败",
- text: "该事件已被提取,请刷新页面!",
- type: "error"
- });
- $modalInstance.close('success');
- } else {
- Alert.swal({
- title: "操作失败",
- text: "操作失败, 请稍后再试!",
- type: "error"
- });
- }
- });
- }
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- }
- },
- size: 'sm',
- resolve: {
- api_bpm: function () {
- return api_bpm;
- },
- modelData: function () {
- return model;
- },
- currentUserId: function () {
- return loginUser.id;
- },
- Alert: function () {
- return SweetAlert;
- },
- api_user_data: function () {
- return api_user_data;
- }
- }
- });
- modalInstance.result.then(function (selectedItem) {
- if (selectedItem == 'success') {
- defaultFilterData.assignee = loginUser.id;
- $scope.refreshData('expand-right', defaultFilterData);
- }
- });
- }
- // 转派弹窗
- $scope.rotate = function (model) {
- console.log(model)
- var modalInstance = $modal.open({
- templateUrl: 'assets/views/incident/tpl/rotate.tpl.html',
- controller: function ($scope, $modalInstance, api_bpm, modelData, currentUserId, Alert, api_user_data) {
- console.log(model);
- $scope.roleList = {
- 'idx': 0,
- 'sum': 100,
- 'user': {
- 'roledata': {
- 'rolecode': ''
- },
- 'groupdata': {
- 'id': ''
- },
- 'selectType': 1
- }
- }
- for (var i = 0; i < loginUser.role.length; i++) {
- // console.log(loginUser.role[i])
- if (loginUser.role[i].role == '一线支持人员') {
- $scope.roleList.user.roledata.rolecode = loginUser.role[i].rolecode;
- $scope.upRole = loginUser.role[i].role;
- }
- if (loginUser.role[i].role == '二线支持人员') {
- $scope.roleList.user.roledata.rolecode = loginUser.role[i].rolecode;
- $scope.upRole = loginUser.role[i].role;
- }
- if (loginUser.role[i].role == '事件经理') {
- $scope.roleList.user.roledata.rolecode = loginUser.role[i].rolecode;
- $scope.upRole = loginUser.role[i].role;
- }
- }
- var userId = loginUser.id;
- var taskId = model.taskId;
- var postData = {};
- var formKey = model.formKey;
- var processInstanceId = model.processInstanceId;
- $scope.choosUser = {};
- api_configure_form.renderForm(formKey, userId, processInstanceId).then(function (data) {
- postData = data.model;
- })
- api_user_data.fetchDataList('group', {
- "idx": 0,
- "sum": 100
- }).then(function (data) {
- $scope.group = data.list;
- })
- $scope.onChangeGroup = function (item) {
- $scope.roleList.user.groupdata.id = $scope.choosUser.group.id
- console.log($scope.choosUser);
- if ($scope.choosUser.group) {
- api_user_data.fetchDataList('user', $scope.roleList).then(function (data) {
- console.log(data);
- if (data.list.length == 0) {
- Alert.swal({
- title: "暂无处理人数据",
- text: "该工作组暂无转派对象!",
- type: "error"
- });
- return;
- } else {
- $scope.user = data.list;
- }
- })
- }
- }
- $scope.ok = function () {
- if ($scope.choosUser.handlerUser) {
- postData.handler_code = 'forward';
- postData.incident.handlerUser = $scope.choosUser.handlerUser;
- postData.incident.assignee = postData.assignee = $scope.choosUser.handlerUser.id;
- console.log(postData);
- } else {
- Alert.swal({
- title: "操作失败",
- text: "请选择转派对象信息!",
- type: "error"
- });
- return;
- }
- api_bpm.upgrade(postData, taskId, userId, 'completeTask').then(function (response) {
- console.log(response)
- if (response.status == 200) {
- Alert.swal({
- title: "操作成功!",
- confirmButtonColor: "#007AFF",
- type: "success"
- });
- $modalInstance.close('success');
- } else if (response.status == 500) {
- Alert.swal({
- title: "操作失败",
- text: "该事件已被提取,请刷新页面!",
- type: "error"
- });
- $modalInstance.close('success');
- } else {
- Alert.swal({
- title: "操作失败",
- text: "操作失败, 请稍后再试!",
- type: "error"
- });
- }
- });
- }
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- }
- },
- size: 'sm',
- resolve: {
- api_bpm: function () {
- return api_bpm;
- },
- modelData: function () {
- return model;
- },
- currentUserId: function () {
- return loginUser.id;
- },
- Alert: function () {
- return SweetAlert;
- },
- api_user_data: function () {
- return api_user_data;
- }
- }
- });
- modalInstance.result.then(function (selectedItem) {
- if (selectedItem == 'success') {
- defaultFilterData.assignee = loginUser.id;
- $scope.refreshData('expand-right', defaultFilterData);
- }
- });
- }
- // 指派弹窗baba
- $scope.toAssign = function (model) {
- console.log(model)
- var modalInstance = $modal.open({
- templateUrl: 'assets/views/incident/tpl/toAssign.tpl.html',
- controller: function ($scope, $modalInstance, api_bpm_domain, modelData, currentUserId, Alert, api_user_data) {
- console.log(model,loginUser);
- //获取组下面的用户
- $scope.getUsers = function(groupId){
- $scope.user = [];
- var postData = {};
- if(groupId){
- postData = {
- "idx": 0,
- "sum": 100,
- user: {
- groupdata:{id:groupId},
- roledata: { rolecode: "first-line support" },
- roledata2: { rolecode: "second-line support" },
- selectType: "1",
- selectDetails:1
- }
- }
- }else{
- postData = {
- "idx": 0,
- "sum": 100,
- user: {
- roledata: { rolecode: "first-line support" },
- roledata2: { rolecode: "second-line support" },
- selectType: "1",
- selectDetails:1
- }
- }
- }
- api_user_data.fetchDataList('user', postData).then(function (data) {
- $scope.user = data.list;
- })
- }
- $scope.assignUser = null;
- $scope.user = [];
- $scope.group = [];
- $scope.getUsers();
- api_user_data.fetchDataList('group', {
- "idx": 0,
- "sum": 100,
- group: {'selectType':'nouser'}
- }).then(function (data) {
- $scope.group = data.list;
- })
- $scope.onChangeRotateUser = function(item){
- $scope.assignUser = item.id;
- }
- $scope.onChangeRotateGroup = function(item){
- $scope.assignGroup = item.id;
- $scope.getUsers(item.id)
- }
-
- $scope.ok = function () {
- if (!$scope.assignUser){
- Alert.swal({
- title: "操作失败",
- text: "请选择转派对象信息!",
- type: "error"
- });
- return;
- }
- api_bpm_domain.delegateTask(model.taskId, {assginee:$scope.assignUser}).then(function (response) {
- console.log(response)
- if (response.status == 200) {
- Alert.swal({
- title: "操作成功!",
- confirmButtonColor: "#007AFF",
- type: "success"
- });
- $modalInstance.close('success');
- } else {
- Alert.swal({
- title: "操作失败",
- text: "操作失败, 请稍后再试!",
- type: "error"
- });
- }
- });
- }
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- }
- },
- size: 'sm',
- resolve: {
- api_bpm: function () {
- return api_bpm;
- },
- modelData: function () {
- return model;
- },
- currentUserId: function () {
- return loginUser.id;
- },
- Alert: function () {
- return SweetAlert;
- },
- api_user_data: function () {
- return api_user_data;
- }
- }
- });
- modalInstance.result.then(function (selectedItem) {
- if (selectedItem == 'success') {
- defaultFilterData.assignee = loginUser.id;
- $scope.refreshData('expand-right', defaultFilterData);
- }
- });
- }
- // 删除事件
- $scope.delSj = function(model){
- console.log(model);
- SweetAlert.swal({
- title: "确认删除?",
- text: "删除的数据不可恢复,请确认继续操作!",
- type: "warning",
- showCancelButton: true,
- confirmButtonColor: "#DD6B55",
- confirmButtonText: "继续删除",
- cancelButtonText: "取消操作",
- closeOnConfirm: false,
- closeOnCancel: false
- }, function (isConfirm) {
- if (isConfirm) {
- api_bpm_schedule.del(model.id).then(function (response) {
- if (response.status == 200) {
- SweetAlert.swal("操作成功!", "数据已经被删除.", "success");
- $scope.refreshData('expand-right', JSON.parse(sessionStorage.getItem("searchincident")));
- } else {
- SweetAlert.swal("操作失败!", "数据暂时无法被删除,请稍候重试", "error");
- }
- });
- } else {
- SweetAlert.swal("操作取消", "数据安全", "error");
- }
- });
- }
- // 新增处理日志弹窗baba
- $scope.toHandlerLog = function (model) {
- console.log(model)
- var modalInstance = $modal.open({
- templateUrl: 'assets/views/incident/tpl/toHandlerLog.tpl.html',
- controller: function ($scope, $modalInstance, api_bpm_domain,api_bpm_data, modelData, currentUserId, Alert, api_user_data) {
- console.log(model,loginUser);
- $scope.handlerLog = '';
- $scope.user = [];
- $scope.ok = function () {
- if (!$scope.handlerLog.trim()){
- Alert.swal({
- title: "操作失败",
- text: "请填写处理日志!",
- type: "error"
- });
- return;
- }
- api_bpm_data.addData('operationLog',{operationLog:{opType:'handlerLog',opValue:$scope.handlerLog,extra1:model.id}}).then(function(response){
- console.log(response)
- if (response.status == 200) {
- Alert.swal({
- title: "操作成功!",
- confirmButtonColor: "#007AFF",
- type: "success"
- });
- $modalInstance.close('success');
- } else {
- Alert.swal({
- title: "操作失败",
- text: "操作失败, 请稍后再试!",
- type: "error"
- });
- }
- });
- }
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- }
- },
- size: 'sm',
- resolve: {
- api_bpm: function () {
- return api_bpm;
- },
- modelData: function () {
- return model;
- },
- currentUserId: function () {
- return loginUser.id;
- },
- Alert: function () {
- return SweetAlert;
- },
- api_user_data: function () {
- return api_user_data;
- }
- }
- });
- modalInstance.result.then(function (selectedItem) {
- if (selectedItem == 'success') {
- defaultFilterData.assignee = loginUser.id;
- $scope.refreshData('expand-right', defaultFilterData);
- }
- });
- }
- // 协同弹窗
- $scope.cooperate = function (model) {
- console.log(model)
- var modalInstance = $modal.open({
- templateUrl: 'assets/views/incident/tpl/cooperate.tpl.html',
- controller: function ($scope, $modalInstance, APIService, modelData, currentUserId, Alert) {
- var receiveTask = function (receive_code, modelData) {
- var data = {
- 'receive_code': receive_code
- };
- if (modelData) {
- return {
- taskId: modelData.taskId,
- data: data
- };
- } else {
- return 'error';
- }
- };
- $scope.title = "提示";
- // $scope.connect = "升级单选组件";
- $scope.ok = function () {
- //接收任务//请求重新指派
- var data = receiveTask($scope.receive_code, modelData);
- APIService.claimAndCompletedTask(data.taskId, {
- userId: currentUserId,
- receive_code: "handler"
- }).then(function (response) {
- if (response.status == 200) {
- Alert.swal({
- title: "操作成功!",
- confirmButtonColor: "#007AFF",
- type: "success"
- });
- $modalInstance.close('success');
- } else if (response.status == 500) {
- Alert.swal({
- title: "操作失败",
- text: "该事件已被提取,请刷新页面!",
- type: "error"
- });
- $modalInstance.close('success');
- } else {
- Alert.swal({
- title: "操作失败",
- text: "操作失败, 请稍后再试!",
- type: "error"
- });
- }
- });
- }
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- }
- },
- size: 'sm',
- resolve: {
- APIService: function () {
- return api_bpm_domain;
- },
- modelData: function () {
- return model;
- },
- currentUserId: function () {
- return loginUser.id;
- },
- Alert: function () {
- return SweetAlert;
- }
- }
- });
- modalInstance.result.then(function (selectedItem) {
- if (selectedItem == 'success') {
- defaultFilterData.assignee = loginUser.id;
- $scope.refreshData('expand-right', defaultFilterData);
- }
- });
- }
- if ($stateParams.model) {
- if (JSON.parse($stateParams.model).searchType && JSON.parse($stateParams.model).searchType != null) {
- $scope.searchType = JSON.parse($stateParams.model).searchType;
- } else {
- $scope.searchType = "todo";
- }
- } else {
- $scope.searchType = "todo";
- }
- // if (JSON.parse($stateParams.model).searchType) {
- // if ($rootScope.user.group) {
- // var defaultFilterData = {
- // "assignee": $rootScope.user.id,
- // "candidateGroups": loginuserGroup,
- // "searchType": JSON.parse($stateParams.model).searchType,
- // "idx": 0,
- // "sum": mun
- // };
- // } else {
- // var defaultFilterData = {
- // "assignee": $rootScope.user.id,
- // "searchType": JSON.parse($stateParams.model).searchType,
- // "idx": 0,
- // "sum": mun
- // };
- // }
- // } else {
- if ($rootScope.user.group) {
- var defaultFilterData = {
- "assignee": loginUser.id,
- "candidateGroups": loginuserGroup,
- "searchType": "todo",
- "idx": 0,
- "sum": mun
- };
- } else {
- var defaultFilterData = {
- "assignee": $rootScope.user.id,
- "searchType": "todo",
- "idx": 0,
- "sum": mun
- };
- }
- // }
- // var defaultFilterData = {
- // "assignee":$rootScope.user.id,
- // "candidateGroups":$rootScope.user.group[0].id,
- // "idx":0,
- // "sum":mun
- // };
- if (angular.isDefined($rootScope.search) && angular.isDefined($rootScope.search.incident)) {
- defaultFilterData['searchType'] = $rootScope.search.incident;
- $scope.searchType = $rootScope.search.incident;
- }
- // if ($rootScope['cmdbs'] != 'incident') { $rootScope.idx = 1 }
- // if (angular.isDefined($rootScope.idx) && $rootScope.cmdbs != "false") {
- // $rootScope['cmdbs'] = 'incident';
- // defaultFilterData.idx = $rootScope.idx - 1;
- // } else { $rootScope.cmdbs = ""; }
- $scope.ldloading = {};
- // $scope.Change= function(upTypes){
- // if(angular.isDefined(upTypes)&&upTypes=='upincident'){
- // $state.go('app.problem.incident',{});
- // }
- // else if(angular.isDefined(upTypes)&&upTypes=='upchange'){
- // $state.go('app.change.incident',{});
- // }
- // }
- //事件类型筛选
- console.log($state);
- if($state.params.tab){
- $scope.searchstate = $state.params.tab;
- }else{
- $scope.searchstate = 'todo';//baba
- }
- $scope.onChange = function (searchType) {
- if(searchType === 'all_del'){
- var obj = $scope.state.find(function(v){return v.id == 1708});
- $scope.othcode = {state:obj};
- $scope.isDisabledState = true;
- }else{
- $scope.isDisabledState = false;
- }
- $scope.searchstate = searchType;
- $scope.chiceIncident($scope.searchkeys,$scope.othcode.state);
- // console.log(defaultFilterData,'fanbu')
- // if(defaultFilterData.incident){
- // var lsObject = defaultFilterData.incident;
- // }
- // defaultFilterData = $scope.memoryfilterData;
- // defaultFilterData.incident = lsObject;
- // defaultFilterData['searchType'] = searchType;
- // defaultFilterData.assignee = loginUser.id;
- // // -----------seimin-------------
- // if(searchType!=='all'){
- // $scope.searchkeys = {selectType:{}};//seimin
- // }
- // if(searchType!== 'all'&&defaultFilterData.incident&&defaultFilterData.incident.selectType){
- // delete defaultFilterData.incident.selectType;
- // }
- // if(searchType== 'all'){
- // if(!defaultFilterData.incident||!defaultFilterData.incident.selectType){
- // $scope.searchkeys = {selectType:{id:'0',name:'否'}};//seimin
- // }
- // }
- // if(Object.prototype.toString.call(defaultFilterData.incident) == "[object Object]"&&Object.keys(defaultFilterData.incident).length == 0){
- // delete defaultFilterData.incident;
- // }
- // if($scope.othcode.state){
- // if(Object.prototype.toString.call(defaultFilterData.incident) == "[object Object]"){
- // defaultFilterData.incident.statusId = $scope.othcode.state.id;
- // }else{
- // defaultFilterData.incident = {statusId:$scope.othcode.state.id};
- // }
- // }
- // // -----------seimin-------------
-
- // $scope.refreshData('expand-right', defaultFilterData);
- // $interval.cancel($scope.timer);
- // $scope.timer = $interval(function () {
- // $scope.jry_refresh()
- // }, $rootScope.refreshTime);
- }
- // 是否逾期下拉框选择seimin
- $scope.selectTypeChange = function(){
- console.log($scope.searchkeys.selectType,66666);
- if(window.sessionStorage.getItem('isGoyuqi') == 'yes'){
- $scope.searchkeys.selectType = {id:'2',name:'是'};
- // window.sessionStorage.removeItem('isGoyuqi');//seimin
- }
- var ids = $scope.searchkeys.selectType.id
- if(defaultFilterData.incident){
- defaultFilterData.incident.selectType = ids;//seimin
- }else{
- defaultFilterData.incident = {
- selectType:ids
- };
- }
- defaultFilterData.searchType = 'all';
- console.log(defaultFilterData,2222)
- $scope.onChange('all');
- }
- //获取列表数据
- $scope.refreshData = function (style, filterData) {
- console.log(filterData,9090)
- if (filterData && filterData.incident && filterData.incident.area) {
- filterData.incident.place = {
- id: filterData.incident.place ? filterData.incident.place.id : '',
- area: filterData.incident.area
- }
- delete filterData.incident.area
- }
- $scope.ldloading[style.replace('-', '_')] = true;
- if (angular.isUndefined(filterData)) {
- if (sessionStorage.searchincident) {
- filterData = JSON.parse(sessionStorage.getItem("searchincident"));
- if ($scope.searchType) {
- filterData.searchType = $scope.searchType;
- }
- $scope.gridOptions.paginationCurrentPage = 1 + filterData.idx;
- if($state.params.tab){
- $scope.searchstate = $state.params.tab;
- filterData.searchType = $state.params.tab;
- sessionStorage.setItem('searchincident',JSON.stringify(filterData));
- }else{
- $scope.searchstate = filterData.searchType;
- }
- if($state.params.date == 'today'){
- $scope.othcode = {};
- $scope.searchkeys.acceptDate = new Date();
- $scope.searchkeys.acceptDateEnd = new Date();
- filterData.incident = {acceptDate:moment().format('YYYY-MM-DD 00:00:00'),acceptDateEnd:moment().format('YYYY-MM-DD 23:59:59')};
- sessionStorage.setItem("searchincident",JSON.stringify(filterData));
- }
- if($state.params.state){
- $scope.searchkeys.acceptDate = null;
- $scope.searchkeys.acceptDateEnd = null;
- var obj = $scope.state.find(function(v){return $state.params.state == v.id});
- $scope.othcode = {state:obj};
- filterData.incident = {statusId: $state.params.state};
- sessionStorage.setItem("searchincident",JSON.stringify(filterData));
- }
- if (filterData.incident && filterData.incident.category) {
- delete filterData.incident.category
- }
- } else {
- filterData = defaultFilterData;
- if ($scope.searchType) {
- filterData.searchType = $scope.searchType;
- if (filterData.searchType == 'overDate') {
- $scope.searchstate = 'overDate';
- }
- }
- if($state.params.tab){
- $scope.searchstate = $state.params.tab;
- filterData.searchType = $state.params.tab;
- sessionStorage.setItem('searchincident',JSON.stringify(filterData));
- }else{
- $scope.searchstate = filterData.searchType;
- }
- if($state.params.date == 'today'){
- $scope.othcode = {};
- $scope.searchkeys.acceptDate = new Date();
- $scope.searchkeys.acceptDateEnd = new Date();
- filterData.incident = {acceptDate:moment().format('YYYY-MM-DD 00:00:00'),acceptDateEnd:moment().format('YYYY-MM-DD 23:59:59')};
- sessionStorage.setItem("searchincident",JSON.stringify(filterData));
- }
- if($state.params.state){
- $scope.searchkeys.acceptDate = null;
- $scope.searchkeys.acceptDateEnd = null;
- var obj = $scope.state.find(function(v){return $state.params.state == v.id});
- $scope.othcode = {state:obj};
- filterData.incident = {statusId: $state.params.state};
- sessionStorage.setItem("searchincident",JSON.stringify(filterData));
- }
- }
- }
- // if (angular.isDefined($scope.searchTypes)) {
- // $rootScope['search'] = {};
- // filterData['searchType'] = $scope.searchTypes;
- // $rootScope['search']['incident'] = $scope.searchTypes;
- // }
- // if (sessionStorage.idx) {
- // filterData.idx = Number(sessionStorage.idx);
- // $scope.gridOptions.idx = Number(sessionStorage.idx) + 1;
- // }
- console.log(filterData,11111);
- if(window.sessionStorage.getItem('isGoyuqi') == 'yes'){
- $scope.searchkeys.selectType = {id:'2',name:'是'};
- if(filterData.incident&&filterData.incident.selectType){
- filterData.incident.selectType = '2';
- }else{
- filterData.incident = {
- selectType : '2'
- }
- }
- window.sessionStorage.removeItem('isGoyuqi');//seimin
- }
- $scope.myData = [];
- sessionStorage['searchincident'] = angular.copy(JSON.stringify(filterData));
- // $scope.gridOptions.paginationCurrentPage = 1 + filterData.idx;
- //var start = new Date();
- //var sec = $interval(function () {
- //$scope.callsPending++;
- $scope.memoryfilterData = filterData;
- $scope.gridOptions['sum'] = filterData.sum;
-
- api_bpm_domain.fetchtask(pdKey, filterData).then(function (data) {
- if (data.data) {
- // if(filterData.searchType == 'all'){
- // //跳到全部seimin
- // $scope.searchstate = 'all';
- // }
- var myData = Restangular.stripRestangular(data);
- var list = [];
- $scope.gridOptions['totalItems'] = myData.resultCount;
- $scope.myData = myData.data;
- for (var i = 0; i < $scope.myData.length; i++) {
- $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum
- }
- } else {
- SweetAlert.swal({
- title: "系统错误",
- text: "请稍后再试!",
- type: "error"
- });
- }
- $scope.ldloading[style.replace('-', '_')] = false;
-
- }, function () {
- $scope.ldloading[style.replace('-', '_')] = false;
- });
- };
- $scope.refreshData2 = function (style, filterData) {
- $scope.ldloading[style.replace('-', '_')] = true;
- if (angular.isUndefined(filterData)) {
- if (sessionStorage.searchincident) {
- filterData = JSON.parse(sessionStorage.getItem("searchincident"));
- if ($scope.searchType) {
- filterData.searchType = $scope.searchType;
- }
- $scope.gridOptions.paginationCurrentPage = 1 + filterData.idx;
- // $scope.searchstate = filterData.searchType;
- if($state.params.tab){
- $scope.searchstate = $state.params.tab;
- filterData.searchType = $state.params.tab;
- sessionStorage.setItem('searchincident',JSON.stringify(filterData));
- }else{
- $scope.searchstate = filterData.searchType;
- }
- if($state.params.date == 'today'){
- $scope.othcode = {};
- $scope.searchkeys.acceptDate = new Date();
- $scope.searchkeys.acceptDateEnd = new Date();
- filterData.incident = {acceptDate:moment().format('YYYY-MM-DD 00:00:00'),acceptDateEnd:moment().format('YYYY-MM-DD 23:59:59')};
- sessionStorage.setItem("searchincident",JSON.stringify(filterData));
- }
- if($state.params.state){
- $scope.searchkeys.acceptDate = null;
- $scope.searchkeys.acceptDateEnd = null;
- var obj = $scope.state.find(function(v){return $state.params.state == v.id});
- $scope.othcode = {state:obj};
- filterData.incident = {statusId: $state.params.state};
- sessionStorage.setItem("searchincident",JSON.stringify(filterData));
- }
- if (filterData.incident && filterData.incident.category) {
- delete filterData.incident.category
- }
- } else {
- filterData = defaultFilterData;
- if ($scope.searchType) {
- filterData.searchType = $scope.searchType;
- if (filterData.searchType == 'overDate') {
- $scope.searchstate = 'overDate';
- }
- }
- }
- }
- // if (angular.isDefined($scope.searchTypes)) {
- // $rootScope['search'] = {};
- // filterData['searchType'] = $scope.searchTypes;
- // $rootScope['search']['incident'] = $scope.searchTypes;
- // }
- // if (sessionStorage.idx) {
- // filterData.idx = Number(sessionStorage.idx);
- // $scope.gridOptions.idx = Number(sessionStorage.idx) + 1;
- // }
- // $scope.myData = [];
- sessionStorage['searchincident'] = angular.copy(JSON.stringify(filterData));
- // $scope.gridOptions.paginationCurrentPage = 1 + filterData.idx;
- //var start = new Date();
- //var sec = $interval(function () {
- //$scope.callsPending++;
- $scope.memoryfilterData = filterData;
- $scope.gridOptions['sum'] = filterData.sum;
- api_bpm_domain.fetchtask(pdKey, filterData).then(function (data) {
- if (data.data) {
- var myData = Restangular.stripRestangular(data);
- var list = [];
- $scope.gridOptions['totalItems'] = myData.resultCount;
- $scope.myData = myData.data;
- for (var i = 0; i < $scope.myData.length; i++) {
- $scope.myData[i]['item'] = i + 1 + filterData.idx * filterData.sum
- }
- } else {
- SweetAlert.swal({
- title: "系统错误",
- text: "请稍后再试!",
- type: "error"
- });
- }
- $scope.ldloading[style.replace('-', '_')] = false;
- }, function () {
- $scope.ldloading[style.replace('-', '_')] = false;
- });
- };
- // 进入页面时111
- if(window.sessionStorage.getItem('searchincident')){
- var varLin = JSON.parse(window.sessionStorage.getItem('searchincident'));
- if(varLin.incident&&varLin.incident.selectType){
- if(varLin.incident.selectType == '2'){
- console.log(defaultFilterData)
- $scope.searchkeys.selectType = {id:'2',name:'是'};
- }else if(varLin.incident.selectType == '0'){
- console.log(defaultFilterData)
- $scope.searchkeys.selectType = {id:'0',name:'否'};
- }
- }
- }
- if(window.sessionStorage.getItem('isGoyuqi') === 'yes'){
- $scope.selectTypeChange();
- }else{
- if(sessionStorage.getItem("searchincident")){
- var ss = JSON.parse(sessionStorage.getItem("searchincident"));
- delete ss.incident;
- sessionStorage.setItem("searchincident",JSON.stringify(ss));
- }
- $scope.refreshData('expand-right');
- }
-
- $scope.timer = $interval(function () {
- $scope.jry_refresh()
- }, $rootScope.refreshTime);
- $scope.$on('$destroy', function () {
- $interval.cancel($scope.timer)
- });
- }]);
- //操作按钮权限控制
- app.controller('IncidentOperCtrl', ['$rootScope', '$http', '$scope', '$modal', '$state', 'api_bpm_data', function ($rootScope, $http, $scope, $modal, $state, api_bpm_data) {
- // console.log('$rootScope.user3='+JSON.stringify($scope.item));
- // console.log($scope.item)
- var loginUser = $rootScope.user;
- console.log(loginUser.role)
- $scope.chuli = false;
- $scope.qiangdan = false;
- $scope.dayin = false;
- $scope.huifang = false;
- // $scope.assign = false;
- $scope.delFlag = false;
- $scope.editFlag = false;//编辑
- $scope.assignFlag = false;//指派
- // if(loginUser.role.length){
- // $scope.assign = loginUser.role.some(function(v){
- // return v.rolecode === "incident-category-manager"||v.rolecode === 'incident manager';
- // })
- // }
- for (var i = 0; i < loginUser.menu.length; i++) {
- if (loginUser.menu[i].link == "shijianliebiao_chuli") {
- $scope.chuli = true
- }
- if (loginUser.menu[i].link == "shijianliebiao_qiangdan") {
- $scope.qiangdan = true
- }
- if (loginUser.menu[i].link == "shijianliebiao_dayin") {
- $scope.dayin = true
- }
- if (loginUser.menu[i].link == "shijianliebiao_huifang") {
- $scope.huifang = true
- }
- if (loginUser.menu[i].link == "shijianliebiao_del") {
- $scope.delFlag = true
- }
- if (loginUser.menu[i].link == "shijianliebiao_edit") {
- $scope.editFlag = true
- }
- if (loginUser.menu[i].link == "shijianliebiao_assign") {
- $scope.assignFlag = true
- }
- }
- $scope.up = true;
- $scope.fuwutaiRenYuan = false;//服务台人员
- for (var i = 0; i < $rootScope.user.role.length; i++) {
- // console.log($rootScope.user.role[i])
- if ($rootScope.user.role[i].role == '事件经理') {
- $scope.up = false;
- }
- if ($rootScope.user.role[i].id == 29701) {
- $scope.fuwutaiRenYuan = true;
- }
- }
- if ($scope.item.state.id != null && $scope.item.handlerUser != null) {
- // 当前登陆人和当前处理人相同,并且状态非已关闭
- if ($rootScope.user.id == $scope.item.handlerUser.id && $scope.item.state.id != 1546) {
- $scope.item.chaozuoPower = true;
- // if ($scope.item.state.id == 1544) {
- // $scope.item.coordination = true;
- // }
- }
- }
- $rootScope.callid = $scope.item.callID;
- if ($scope.item.callID) {
- $scope.item.listen = true;
- } else {
- $scope.item.listen = false;
- }
- // 抢单操作权限
- // if ($scope.item.state.id != 1546 && $scope.item.handlerUser == null) {
- // angular.forEach($rootScope.user.group, function (item) {
- // if (item.id == $scope.item.candidateGroups) {
- // $scope.item.tiquPower = true;
- // }
- // })
- $rootScope.user.group.forEach(function (item, v) {
- if (item.id == $scope.item.candidateGroups) {
- $scope.item.tiquPower = true;
- }
- })
- // }
- //修改页面显示判断
- $scope.jry_modify = function (item) {
- console.log(item)
- // var jry_role = false;
- // for (var i = 0; i < $rootScope.user.role.length; i++) {
- // if ($rootScope.user.role[i].rolecode == "call center") {
- // jry_role = true
- // }
- // }
- var arrFlag = ['pending','handler'];
- var stateFlag = arrFlag.includes(item.state.value)
- // return jry_role && stateFlag;
- return stateFlag && $scope.editFlag;
- }
- // 回访操作权限
- for (var obj in $rootScope.user.role) {
- // console.log($rootScope.user.role[obj].rolecode)
- if ($rootScope.user.role[obj].rolecode == 'call center') {
- if ($scope.item.state.id == 1546) {
- $scope.item.huifang = true;
- } else {
- // $scope.item.xiugai = true;
- }
- }
- }
- // 评价操作权限
- $scope.jry_evaluateShow = function () {
- var jry_role = false;
- for (var i = 0; i < $rootScope.user.role.length; i++) {
- if ($rootScope.user.role[i].role == "事件经理" && $rootScope.user.role[i].rolecode == "incident manager") {
- jry_role = true
- }
- }
- // if($scope.item.groupScore!=undefined){
- if ($scope.item.state.id == 1546 && jry_role && $scope.item.groupScore.id == 220) {
- return true
- } else {
- return false
- }
- // }
- }
- $scope.coordination = function () {
- $scope.colobject.grid.appScope.coordination($scope.item);
- }
- $scope.look = function () {
- //$state.go('app.detail', { formKey:'incident_back', pdKey:'incident', dataId: $scope.item.id});
- $scope.colobject.grid.appScope.lookFunction($scope.item);
- // console.log('$scope.item='+JSON.stringify($scope.item));
- //$scope.doEdit($scope.item.id);
- }
- $scope.edit = function () {
- // console.log($scope.item)
- $scope.colobject.grid.appScope.selectRowFunction($scope.item);
- // console.log('$scope.item='+JSON.stringify($scope.item));
- // $scope.doEdit($scope.item.id);
- }
- $scope.configuration = function () {
- console.log($scope.item);
- $scope.colobject.grid.appScope.configuration($scope.item)
- }
- $scope.changeCenter = function () {
- $scope.colobject.grid.appScope.changeClick($scope.item);
- }
- $scope.visit = function () {
- $scope.colobject.grid.appScope.visit($scope.item);
- }
- $scope.print = function () { //print
- api_bpm_data.fetchData('incident', $scope.item.id).then(function (res) {
- $scope.colobject.grid.appScope.open(res.data);
- })
- // $scope.colobject.grid.appScope.open($scope.item);
- }
- // 升级
- $scope.upgrade = function () { //print
- $scope.colobject.grid.appScope.upgrade($scope.item);
- // $scope.doEdit($scope.item.id);
- }
- // 转派
- $scope.rotate = function () { //print
- $scope.colobject.grid.appScope.rotate($scope.item);
- // $scope.doEdit($scope.item.id);
- }
- // 指派
- $scope.toAssign = function () { //print
- $scope.colobject.grid.appScope.toAssign($scope.item);
- // $scope.doEdit($scope.item.id);
- }
- // 删除事件
- $scope.delSj = function () {
- $scope.colobject.grid.appScope.delSj($scope.item);
- }
- // 新增处理日志
- $scope.toHandlerLog = function () { //print
- $scope.colobject.grid.appScope.toHandlerLog($scope.item);
- // $scope.doEdit($scope.item.id);
- }
- // 协同
- $scope.cooperate = function () { //print
- $scope.colobject.grid.appScope.cooperate($scope.item);
- // $scope.doEdit($scope.item.id);
- }
- // 升级问题
- $scope.problem = function () {
- console.log($scope.item)
- console.log($scope.colobject.grid.appScope)
- $scope.colobject.grid.appScope.problem($scope.item)
- }
- $scope.record = function () { //record
- $scope.colobject.grid.appScope.play($scope.item);
- // $scope.doEdit($scope.item.id);
- }
- $scope.handler = function () {
- $scope.colobject.grid.appScope.acceptTaskAction($scope.item);
- $scope.doComment($scope.item.id);
- }
- $scope.follow = function () {
- $scope.colobject.grid.appScope.followFunction($scope.item);
- }
- //查看
- $scope.toDetail = function (data) {
- //console.log('data='+JSON.stringify(data));
- console.log(data,$rootScope.isFuwutai);
- if($rootScope.isFuwutai){
- //角色是服务台人员
- $state.go('app.incident.detail', {
- formKey: 'incident_back',
- pdKey: 'incident',
- dataId: data.id,
- taskId: data.taskId,
- processInstanceId: data.processInstanceId
- });
- }else{
- window.open(location.origin+'/#/app/incident/detail/incident_back/incident/'+data.id+'/'+data.taskId+'/'+data.processInstanceId+'//');
- }
- };
- // $scope.play = function() {
- // // console.log($scope.item.callID)
- // var modalInstance = $modal.open({
- // templateUrl: 'assets/views/incident/tpl/audio.html',
- // controller: function($scope, $modalInstance,$sce){
- // $scope.data={
- // "name":"视频",
- // "url":"http://192.168.3.69:8088/recording/recording?callID="+$rootScope.callid
- // };
- // $scope.data.url = $sce.trustAsResourceUrl($scope.data.url);
- // // $scope.audiourl={url:$sce.trustAsResourceUrl("http://192.168.3.69:8088/recording/recording?callID=218147232")};
- // $scope.cancel = function() {
- // $modalInstance.dismiss('cancel');
- // };
- // $modalInstance.close();
- // }
- // });
- // };
- }]);
- //操作按钮
- app.directive('incidentoperator', function () {
- return {
- restrict: 'E',
- scope: {
- item: '=',
- colobject: '='
- },
- controller: 'IncidentOperCtrl',
- template: '<div><div class="cl-effect-1 ui-grid-cell-contents pull-left" >' +
- // '<a ng-click="look()" tooltip="查看" tooltip-placement="left"><i class="ti-eye"></i></a>'+
- '<a ng-click="toDetail(item)" class="bianjifont" >查看</a>' +
- '<a ng-click="edit()" ng-show="{{item.chaozuoPower&&chuli}}" class="bianjifont">处理</a>' +
- '<a ng-click="handler()" ng-show="{{item.state.id != 1546 &&!item.handlerUser&&item.tiquPower&&qiangdan}}" class="bianjifont" >抢单</a>' +
- '<a ng-click="visit()" ng-show="{{item.huifang&&huifang}}" class="bianjifont">回访</a>' +
- '<a ng-click="changeCenter()" ng-show="jry_modify(item)" class="luyinfont">编辑</a>' +
- '<a ng-click="toAssign()" ng-show="{{(item.state.id==1543||item.state.id==1544)&&assignFlag&&item.assignee}}" class="assign" >指派</a>' +
- '<a ng-click="toHandlerLog()" ng-show="{{item.state.id==1544}}" class="assign" >新增处理日志</a>' +
- '<a ng-click="delSj()" ng-show="{{delFlag&&item.state.value!== \'deleted\'}}" class="assign" >删除</a>' +
- '<a ng-click="print()" ng-show="dayin" class="bianjifont" >打印</a>' +
- // '<a ng-click="jry_evaluate()" ng-show="jry_evaluateShow()" class="luyinfont" >评价</a>' +
- // '<a ng-click="record()" ng-show="{{item.listen}}" class="luyinfont" >录音</a>' +
- // '<a ng-click="rotate()" ng-show="{{item.state.id==4}}" class="rotate" >转派</a>' +
- // '<a ng-click="upgrade()" ng-show="{{up&&item.state.id==4&&item.currentRole!=' + "'incident manager'" + '}}" class="upgrade" >升级</a>' +
- // '<a ng-click="problem()" ng-show="{{item.state.id==5&&item.currentRole!=' + "'incident manager'" + '}}" class="upgrade" >问题升级</a>' +
- // '<a ng-click="configuration()" ng-show="{{item.state.id==5}}" class="bianjifont">变更升级</a>' +
- // '<a ng-click="cooperate()" ng-show="{{item.state.id==4}}" class="cooperate" >协同</a>' +
- // '<a ng-click="coordination()" ng-show="{{item.coordination}}" tooltip="添加协同人" tooltip-placement="left"><i class="icon iconfont icon-tianjiarenyuan adduserfont"></i></a>' +
- // '<a class="ui-grid-cell-contents" ng-click="grid.appScope.open(row.entity)" tooltip="打印" tooltip-placement="left"><i class="ti-printer"></i></a>'+
- // '<a ng-click="grid.appScope.play(row.entity)"ng-if="row.entity.callID" tooltip="播放录音" tooltip-placement="left"><i class="ti-microphone"></i></a>'+
- // '<a ng-click="follow()" tooltip="状态跟踪" tooltip-placement="left"><i class="fa fa-location-arrow"></i></a>'+
- '</div></div>'
- };
- });
|