1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807 |
- app.controller('incidentSetUp', ["$rootScope", "$scope", "$state", "$timeout", "$interval", "SweetAlert", "$modal", "Restangular", "api_bpm_data", "api_solution", "api_user_data","api_wechatfile","api_sysinfo","api_statistic","api_bpm","jry_api_bpm", function($rootScope, $scope, $state, $timeout, $interval, SweetAlert, $modal, Restangular, api_bpm_data, api_solution, api_user_data,api_wechatfile,api_sysinfo,api_statistic,api_bpm,jry_api_bpm) {
- var loginUser = $rootScope.user;
- $scope.xinzeng=false;
- $scope.shanchu=false;
- $scope.bianji=false;
- for(var i=0;i<loginUser.menu.length;i++){
- if(loginUser.menu[i].link=="shijianshezhi_xinzeng"){
- $scope.xinzeng=true
- }
- if(loginUser.menu[i].link=="shijianshezhi_shanchu"){
- $scope.shanchu=true
- }
- if(loginUser.menu[i].link=="shijianshezhi_bianji"){
- $scope.bianji=true
- }
- }
- $scope.listData=[
- // {"name":"故障现象"},
- {"name":"巡检范围"},
- {"name":"事件紧急度"},
- {"name":"事件影响度"},
- {"name":"事件优先级"},
- {"name":"优先级规则"},
- {"name":"工时"},
- {"name":"服务级别协议"},
- {"name":"事件来源"},
- {"name":"关闭代码"},
- {"name":"事件状态"},
- {"name":"满意度评价"},
- {"name":"结果类型"},
- {"name":"维修记录"},
- {"name":"维修方式"},
- ]
- $scope.leftListIdx=0;
- $scope.leftListName="巡检范围";
- $scope.leftListCli=function(idx,data){
- $scope.leftListIdx=idx;
- $scope.leftListName=data.name
- }
- // 故障现象开始
- // $scope.langs=i18nService.getAllLangs();
- // $scope.lang = 'zh-cn';
- var loginUser = $rootScope.user;
- //组
- api_user_data.fetchDataList('group', { "idx": 0, "sum": 1000 }).then(function(data) {
- $scope.group = data.list;
- });
- //优先级
- // api_bpm_data.fetchDataList('priority', { "idx": 0, "sum": 10 }).then(function(data) {
- // $scope.priority = data.list;
- // });
- api_wechatfile.getDictionary({"key":"incident_priority","type":"list"}).then(function(data){
- $scope.priority=data
- })
- // 工时
- api_wechatfile.getDictionary({"key":"incident_complexity","type":"list"}).then(function(data){
- $scope.complexity=data
- })
- /* ----- tree----- */
- var apple_selected, tree, treedata_avm, treedata_geography;
- //$scope.selectedTreeNode = {};ssss
- var i = 0;
- $scope.out = [];
- $scope.outdata = [];
- var systemtype = [];
- $scope.subdata={};
- $scope.sub1data={};
- $scope.addcate = false;
- $scope.add1cate = false;
- $scope.changecate = false;
- // $scope.refreshListData = function(){
- // var data ={"idx":0,"sum":1000};
- // api_bpm_data.fetchDataList('incidentcategory',data).then(function(response){
- // if(response){
- // if(response.status=200){
- // $scope.outdata = response.list;
- // }
- // }
- // })
- // }
- // $scope.refreshListData();
- $scope.filterTree = function (data,id) {
- data = angular.copy(data);
- var newTree = data.filter(x => x.id !== id)
- newTree.forEach(x => x.children && (x.children = $scope.filterTree(x.children,id)))
- return newTree
- }
- var childdata = {};
- $scope.thisParent={};//当前点击节点的父节点
- $scope.userOrGroupType={type:0};//当前节点运维组/运维人员
- $scope.dataSave = [];//储存$scope.tree_data
- $scope.my_tree_handler = function(branch) {
- console.log($scope.dataSave)
- if($scope.dataSave.length === 0){
- $scope.dataSave = angular.copy($scope.tree_data);
- }
- console.log(branch)
- if(branch.parent){
- $scope.tree_data = $scope.filterTree($scope.dataSave,branch.id);
- console.log($scope.tree_data,'过滤后');
- }
- $scope.changecate = true;
- $scope.addcate = false;
- filterData.treeIds = branch.id;
- // $scope.selectedTreeNode = branch;
- $scope.output = branch;
- $scope.thisParent=branch.parent||null;
- if($scope.thisParent){
- $scope.thisParent.label=$scope.thisParent.category;
- $scope.thisParent.isExpanded=true;
- $scope.thisParent.selected=true;
- $scope.subdata['parent']=$scope.thisParent
- };
- // console.log($scope.thisParent,$scope.subdata)
- if(branch.hasPlace==1){
- $scope.subdata.hasPlace=true
- }else{
- $scope.subdata.hasPlace=false
- }
- convertchildToTree(branch,'故障现象');
- console.log(branch)
- if(branch.managerUser){
- $scope.subdata.managerUser = branch.managerUser
- }
- if(branch.userOrGroupType){
- $scope.userOrGroupType['type']=branch.userOrGroupType;
- $scope.userGroupChecked['groupCheck']=branch.group||{};
- $scope.userGroupChecked['userCheck']=branch.handleUser||{};
- }else{
- $scope.userOrGroupType['type']=0;
- $scope.userGroupChecked={}
- }
- // $scope.subdata=branch;
- $scope.subdata.category=branch.label;
- var eqflag = false;
- angular.forEach($scope.outdata, function(item) {
- if (item.id == $scope.output.id) eqflag = true;
- });
- if (eqflag) {
- } else {
- $scope.outdata.push({
- 'name': $scope.output.label,
- 'id': $scope.output.id
- });
- var postData = {
- typeList: []
- };
- if ($scope.outdata.length > 0) {
- angular.forEach($scope.outdata, function(data) {
- postData.typeList.push({ id: data.id });
- })
- }
- // api_solution.findSolutionTypesUser(postData).then(function(response){
- // //Restangular.
- // $scope.userdata = response.data;
- // });
- }
- };
- $scope.thisParent={};//当前点击节点的父节点
- // $scope.userOrGroupType1={};//当前节点运维组/运维人员
- $scope.group_user = {
- // offlineGroup:{},//线下组
- // onlineUser:{}//线上人
- }
- $scope.dataSave1 = [];//储存$scope.tree_data
- $scope.my_tree_1handler = function(branch) {
- console.log($scope.dataSave1)
- if($scope.dataSave1.length === 0){
- $scope.dataSave1 = angular.copy($scope.tree_1data);
- }
- console.log(branch)
- if(branch.parent){
- $scope.tree_1data = $scope.filterTree($scope.dataSave1,branch.id);
- console.log($scope.tree_1data,'过滤后');
- }
- $scope.changecate = true;
- $scope.add1cate = false;
- filterData.treeIds = branch.id;
- // $scope.selectedTreeNode = branch;
- $scope.output = branch;
- $scope.thisParent=branch.parent||null;
- if($scope.thisParent){
- $scope.thisParent.label=$scope.thisParent.type;
- $scope.thisParent.isExpanded=true;
- $scope.thisParent.selected=true;
- $scope.sub1data['parent']=$scope.thisParent
- };
- convertchildToTree(branch,'巡检范围');//2022年5月27日,暂存,明明
- console.log(branch);
- if(branch.user){
- $scope.group_user['onlineUser']=branch.user||{};
- }else{
- $scope.group_user['onlineUser']={}
- }
- if(branch.group){
- $scope.group_user['offlineGroup']=branch.group||{};
- }else{
- $scope.group_user['offlineGroup']={}
- }
- $scope.sub1data.type=branch.label;
- var eqflag = false;
- angular.forEach($scope.outdata, function(item) {
- if (item.id == $scope.output.id) eqflag = true;
- });
- if (eqflag) {
- } else {
- $scope.outdata.push({
- 'name': $scope.output.label,
- 'id': $scope.output.id
- });
- var postData = {
- typeList: []
- };
- if ($scope.outdata.length > 0) {
- angular.forEach($scope.outdata, function(data) {
- postData.typeList.push({ id: data.id });
- })
- }
- }
- };
- $scope.addType = function(element) {
- $scope.tree_data = $scope.dataSave.length?angular.copy($scope.dataSave):$scope.tree_data;
- $scope.addcate = true
- $scope.changecate = false
- // var modalInstance = $modal.open({
- // templateUrl: 'assets/views/system/tpl/systemclose.html',
- // controller: function($scope, $modalInstance, api_bpm_data){
- // // api_bpm_data.fetchDataList('closecode',filterData).then(function(data){
- // // var myData = Restangular.stripRestangular(data);
- // // }
- // }
- // });
- }
- $scope.addType1 = function(element) {
- $scope.tree_1data = $scope.dataSave1.length?angular.copy($scope.dataSave1):$scope.tree_1data;
- $scope.add1cate = true
- $scope.changecate = false
- }
- /* -----start remove incidet category----- */
- $scope.remove = function(element) {
- var modalInstance = $modal.open({
- templateUrl: 'assets/views/delete.html',
- controller: function($scope, scope, $modalInstance, api_bpm_data) {
- // $scope.title = '优先级删除';
- // $scope.connect = '确定要删除此优先级?';
- $scope.title = "故障现象删除?";
- $scope.connect = "确定要删除此故障现象?";
- $scope.ok = function() {
- $modalInstance.close(element);
- };
- $scope.cancel = function() {
- $modalInstance.dismiss('cancel');
- };
- },
- size: 'sm',
- resolve: {
- scope: function() {
- return $scope;
- }
- }
- });
- modalInstance.result.then(function(selectedItem) {
- if (selectedItem) {
- var rmvList = [];
- rmvList.push(selectedItem.id);
- if (selectedItem.children.length > 0) {
- SweetAlert.swal({
- title: "删除失败!",
- text: "请先删除选中的分类的子级",
- type: "error"
- })
- } else {
- api_bpm_data.rmvData('incidentcategory', rmvList).then(function(response) {
- if (response.data) {
- SweetAlert.swal({
- title: "删除成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- }, function() {
- $scope.try_async_load();
- $scope.$apply($scope.my_data);
- });
- } else {
- SweetAlert.swal({
- title: "操作异常!",
- text: "系统异常,请稍后重试,或者联系管理员!",
- type: "error"
- });
- }
- })
- }
- }
- })
- }
- $scope.remove1 = function(element) {
- var modalInstance = $modal.open({
- templateUrl: 'assets/views/delete.html',
- controller: function($scope, scope, $modalInstance, api_bpm_data) {
- $scope.title = "巡检范围删除?";
- $scope.connect = "确定要删除此巡检范围?";
- $scope.ok = function() {
- $modalInstance.close(element);
- };
- $scope.cancel = function() {
- $modalInstance.dismiss('cancel');
- };
- },
- size: 'sm',
- resolve: {
- scope: function() {
- return $scope;
- }
- }
- });
- modalInstance.result.then(function(selectedItem) {
- if (selectedItem) {
- var rmvList = [];
- rmvList.push(selectedItem.id);
- if (selectedItem.children.length > 0) {
- SweetAlert.swal({
- title: "删除失败!",
- text: "请先删除选中的范围的子级",
- type: "error"
- })
- } else {
- api_bpm_data.rmvData('inspectionType', rmvList).then(function(response) {
- if (response.data) {
- SweetAlert.swal({
- title: "删除成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- }, function() {
- $scope.try_async_1load();
- $scope.$apply($scope.my_1data);
- });
- } else {
- SweetAlert.swal({
- title: "操作异常!",
- text: "系统异常,请稍后重试,或者联系管理员!",
- type: "error"
- });
- }
- })
- }
- }
- })
- }
- /* -----end remove incidet category----- */
- function convertchildToTree(datum,type) {
- if(type === '故障现象'){
- $scope.subdata = {};
- if(datum.branchUserGroups){
- for (var i = 0; i < datum.branchUserGroups.length; i++) {
- if(datum.branchUserGroups[i].userId){
- datum.branchUserGroups[i].user = {id:datum.branchUserGroups[i].userId,name:datum.branchUserGroups[i].userName};
- delete datum.branchUserGroups[i].userId;
- delete datum.branchUserGroups[i].userName;
- }
- if(datum.branchUserGroups[i].groupId){
- datum.branchUserGroups[i].group = {id:datum.branchUserGroups[i].groupId,groupName:datum.branchUserGroups[i].groupName};
- delete datum.branchUserGroups[i].groupId;
- delete datum.branchUserGroups[i].groupName;
- }
- }
- }
- if (datum.parent) {
- $scope.subdata = { 'id': datum.id, 'category': datum.label, 'group': datum.group||{}, 'hasPlace': datum.hasPlace, 'hasSimple': datum.hasSimple, 'priority': datum.priority, 'complexity': datum.complexity, 'parent': datum.parent, branchType:datum.branchType,branchUserGroups:datum.branchUserGroups||[] }
- } else {
- $scope.subdata = { 'id': datum.id, 'category': datum.label, 'group': datum.group||{}, 'hasSimple': datum.hasSimple, 'hasPlace': datum.hasPlace, 'priority': datum.priority, 'complexity': datum.complexity, branchType:datum.branchType,branchUserGroups:datum.branchUserGroups||[] }
- }
- }else if(type === '巡检范围'){
- $scope.sub1data = {};
- if (datum.parent) {
- $scope.sub1data = { 'id': datum.id, 'type': datum.label, 'parent': datum.parent }
- } else {
- $scope.sub1data = { 'id': datum.id, 'type': datum.label }
- }
- }
- }
- 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
- //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?
- // console.log("datum="+JSON.stringify(datum))
- if (typeof datum.parent === "undefined") {
- //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.onFilterCallback = function(item){
- // $scope.addcategory.parent=item.label;
- $scope.selectedChangeCategory=item;
- console.log(item)
- }
- // $scope.parentdata = {};
- $scope.try_async_load = function() {
- $scope.my_data = [];
- $scope.doing_async = true;
- api_bpm_data.fetchDataList('branch', { "idx": 0, "sum": 1000 }).then(function(result) {
- result = result.list || [];
- $scope.adddata = {branchType:0,branchUserGroups:result.map(v=>({branchName:v.hosName,branchId:v.id}))}
- api_bpm_data.fetchDataList('incidentcategory', { "idx": 0, "sum": 1000 }).then(function(response) {
- var data = response.list;
- var objects = [];
- // $scope.parentdata = data;
- for (var i = 0; i < data.length; i++) {
- var object = {};
- object.id = data[i].id;
- if (angular.isDefined(data[i].parent)) {
- object.parent = data[i].parent;
- }
- if (angular.isDefined(data[i].hasPlace)) {
- object.hasPlace = data[i].hasPlace;
- }
- if (angular.isDefined(data[i].hasSimple)) {
- object.hasSimple = data[i].hasSimple;
- }
- if (angular.isDefined(data[i].group)) {
- object.group = data[i].group||{};
- }
- if (angular.isDefined(data[i].priority)) {
- object.priority = data[i].priority;
- }
- if (angular.isDefined(data[i].complexity)) {
- object.complexity = data[i].complexity;
- }
- if (angular.isDefined(data[i].handleUser)) {
- object.handleUser = data[i].handleUser||{};
- }
- if(angular.isDefined(data[i].userOrGroupType)){
- object.userOrGroupType=data[i].userOrGroupType;
- }
- if(angular.isDefined(data[i].managerUser)){
- object.managerUser=data[i].managerUser||{};
- }
- if(angular.isDefined(data[i].branchType)){
- object.branchType=data[i].branchType||0;
- }
- if(angular.isDefined(data[i].branchUserGroups)){
- data[i].branchUserGroups = data[i].branchUserGroups|| [];
- if(data[i].branchUserGroups.length){
- var arr_b = result.map(v=>({branchName:v.hosName,branchId:v.id,categoryId:data[i].id}));
- for (var j = 0; j < arr_b.length; j++) {
- for (var p = 0; p < data[i].branchUserGroups.length; p++) {
- if(arr_b[j].branchId == data[i].branchUserGroups[p].branchId){
- arr_b[j] = data[i].branchUserGroups[p];
- }
- }
- }
- object.branchUserGroups=arr_b;
- }else{
- object.branchUserGroups = result.map(v=>({branchName:v.hosName,branchId:v.id,categoryId:data[i].id}))
- }
- }else{
- object.branchUserGroups = result.map(v=>({branchName:v.hosName,branchId:v.id,categoryId:data[i].id}))
- }
- object.label = data[i].category;
- object.state = {
- "opened": true
- };
- object.typeName = "type";
- $scope.showAddSolutionType = true;
- $scope.showReviewKnowledgeType = true;
- objects.push(object);
- }
- $scope.my_data = convertParentToChildList(objects);
- $scope.tree_data = angular.copy($scope.my_data);
- $scope.doing_async = false;
- });
- });
- };
- $scope.try_async_1load = function() {
- $scope.my_1data = [];
- $scope.doing_async = true;
- var data = { "idx": 0, "sum": 1000,inspectionType:{deleteFlag:0} };
- api_bpm_data.fetchDataList('inspectionType', data).then(function(response) {
- var data = response.list;
- var objects = [];
- for (var i = 0; i < data.length; i++) {
- var object = {};
- object.id = data[i].id;
- if (angular.isDefined(data[i].user)) {
- object.user = data[i].user||{};
- }
- if (angular.isDefined(data[i].group)) {
- object.group = data[i].group||{};
- }
- if (angular.isDefined(data[i].parent)) {
- object.parent = data[i].parent;
- }
- object.label = data[i].type;
- objects.push(object);
- }
- $scope.my_1data = convertParentToChildList(objects);
- $scope.tree_1data = angular.copy($scope.my_1data);
- $scope.doing_async = false;
- });
- };
- $scope.closethis = function(formdata) {
- formdata.category = "";
- formdata.parent.category = "";
- };
- /* -----start submit incidet category----- */
- $scope.userGroupChecked={};//选中人/组数据
- $scope.submitchange = function(formdata1) {
- var formdata = angular.copy(formdata1);
- // if (formdata.hasArea) {
- // formdata.hasArea = 1;
- // formdata.hasPlace = 1;
- // } else {
- // formdata.hasArea = 0;
- // formdata.hasPlace = 0;
- // }
- if (formdata.hasPlace==true) {
- formdata.hasPlace = 1;
- } else {
- formdata.hasPlace = 0;
- }
- // }
- if (formdata.hasSimple == true) {
- formdata.hasSimple = 1;
- } else {
- formdata.hasSimple = 0;
- }
- // if ($scope.selectedTreeNode.parent) {
- // formdata.parent = { "id": $scope.selectedTreeNode.parent.id };
- // }
- // console.log($scope.thisParent)
- if($scope.selectedChangeCategory){
- formdata['parentCategory'] ={'id':$scope.selectedChangeCategory.id};
- delete formdata.parent
- }else if($scope.thisParent){
- formdata['parentCategory'] ={'id':$scope.thisParent.id};
- delete formdata.parent
- }
- // console.log(formdata)
- // if($scope.userOrGroupType.type){
- // formdata.userOrGroupType=$scope.userOrGroupType.type
- // }
- // if($scope.userGroupChecked&&$scope.userGroupChecked.groupCheck){
- // formdata.group={id:$scope.userGroupChecked.groupCheck.id};
- // // delete formdata.handleUser;
- // }
- // if($scope.userGroupChecked&&$scope.userGroupChecked.userCheck){
- // formdata.handleUser={id:$scope.userGroupChecked.userCheck.id};
- // // delete formdata.group;
- // }
- // ------------------------ start----------------------------
- if($scope.subdata.branchType == 1){
- delete formdata.handleUser;
- delete formdata.group;
- delete formdata.userOrGroupType;
- for (var i = 0; i < formdata.branchUserGroups.length; i++) {
- if(formdata.branchUserGroups[i].branchUserOrGroupType){
- formdata.branchUserGroups[i].branchUserOrGroupType = Number(formdata.branchUserGroups[i].branchUserOrGroupType);
- }
- if(formdata.branchUserGroups[i].user && formdata.branchUserGroups[i].branchUserOrGroupType == 1){
- formdata.branchUserGroups[i].userId=formdata.branchUserGroups[i].user.id;
- delete formdata.branchUserGroups[i].user;
- delete formdata.branchUserGroups[i].groupId;
- }
- if(formdata.branchUserGroups[i].group && formdata.branchUserGroups[i].branchUserOrGroupType == 2){
- formdata.branchUserGroups[i].groupId=formdata.branchUserGroups[i].group.id;
- delete formdata.branchUserGroups[i].group;
- delete formdata.branchUserGroups[i].userId;
- }
- }
- }else if($scope.subdata.branchType == 0){
- formdata.branchUserGroups = [];
- if($scope.userOrGroupType.type){
- formdata.userOrGroupType=$scope.userOrGroupType.type
- }
- if($scope.userGroupChecked&&$scope.userGroupChecked.groupCheck){
- formdata.group={id:$scope.userGroupChecked.groupCheck.id};
- delete formdata.handleUser;
- }
- if($scope.userGroupChecked&&$scope.userGroupChecked.userCheck){
- formdata.handleUser={id:$scope.userGroupChecked.userCheck.id};
- delete formdata.group;
- }
- }
- // ------------------------ end----------------------------
- if($scope.subdata.complexity){
- formdata.complexity=$scope.subdata.complexity
- }
- if($scope.subdata.priority){
- formdata.priority=$scope.subdata.priority
- }
- if($scope.subdata.managerUser){
- formdata.managerUser=$scope.subdata.managerUser
- }
- var filedata = { "incidentcategory": formdata }
- filedata.incidentcategory.branchType = Number(filedata.incidentcategory.branchType);
- console.log(filedata,$scope.userGroupChecked);
- // return;
- api_bpm_data.updData('incidentcategory', filedata).then(function(response) {
- if (response) {
- if (response.status == 200) {
- $scope.try_async_load()
- SweetAlert.swal({
- title: "修改成功!",
- type: "success"
- }, function() {
- $scope.$apply($scope.my_data);
- })
- } else {
- SweetAlert.swal({
- title: "修改失败!",
- type: "error"
- })
- }
- }
- });
- };
- $scope.submit1change = function(formdata) {
- console.log($scope.output)
- if($scope.selectedChangeCategory){
- formdata['parent'] ={'id':$scope.selectedChangeCategory.id};
- }else if($scope.thisParent){
- formdata['parent'] ={'id':$scope.thisParent.id};
- }
- if($scope.group_user.offlineGroup&&$scope.group_user.offlineGroup.id){
- formdata.group={id:$scope.group_user.offlineGroup.id};
- }
- if($scope.group_user.onlineUser&&$scope.group_user.onlineUser.id){
- formdata.user={id:$scope.group_user.onlineUser.id};
- }
- // if($scope.userGroupChecked&&$scope.userGroupChecked.groupCheck){
- // formdata.group={id:$scope.userGroupChecked.groupCheck.id};
- // }
- // if($scope.userGroupChecked&&$scope.userGroupChecked.userCheck){
- // formdata.handleUser={id:$scope.userGroupChecked.userCheck.id};
- // }
- // if($scope.subdata.complexity){
- // formdata.complexity=$scope.subdata.complexity
- // }
- // if($scope.subdata.priority){
- // formdata.priority=$scope.subdata.priority
- // }
- // if($scope.subdata.managerUser){
- // formdata.managerUser=$scope.subdata.managerUser
- // }
- var filedata = { "inspectionType": formdata }
- console.log(filedata,$scope.group_user);
- // return;
- api_bpm_data.updData('inspectionType', filedata).then(function(response) {
- if (response) {
- if (response.status == 200) {
- $scope.try_async_1load()
- SweetAlert.swal({
- title: "修改成功!",
- type: "success"
- }, function() {
- $scope.$apply($scope.my_1data);
- })
- } else {
- SweetAlert.swal({
- title: "修改失败!",
- type: "error"
- })
- }
- }
- });
- };
- $scope.adddata = {};
- $scope.add1data = {};
- $scope.addparent = false;
- // 新增保存提交
- $scope.userGroupCheckedAdd={};//选中人/组数据
- $scope.group_user_Add={};//选中人/组数据
- $scope.userOrGroupTypeAdd={type:0};//运维组/运维人员
- $scope.submitadd = function(formdata1) {
- var formdata = angular.copy(formdata1);
- console.log(formdata)
- // var paret = {};
- // var filedata = {};
- // filedata = angular.copy(formdata);
- // delete filedata.addp
- // if (angular.isDefined(formdata.parent) && addparent) {
- // angular.forEach($scope.parentdata, function(data) {
- // if (formdata.parent.category.id == data.id) {
- // filedata = { "incidentcategory": { "category": formdata.category, "parent": { "id": data.id } } }
- // }
- // })
- // } else {
- // filedata = { "incidentcategory": { "category": formdata.category } }
- // }
- // filedata = { "incidentcategory": { "category": formdata.category, "parent": { "id": formdata.parentNode.id } } }
- // if (formdata.hasArea && formdata.hasArea == true) {
- // if (formdata.hasArea) {
- // formdata.hasArea = 1;
- // formdata.hasPlace = 1;
- // } else {
- // formdata.hasArea = 0;
- // formdata.hasPlace = 0;
- // }
- if (formdata.hasPlace == true) {
- formdata.hasPlace = 1;
- } else {
- formdata.hasPlace = 0;
- }
- if (formdata.hasSimple == true) {
- formdata.hasSimple = 1;
- } else {
- formdata.hasSimple = 0;
- }
- if (formdata.parent) {
- formdata['parentCategory'] = { "id": formdata.parent.id };
- delete formdata.parent
- }
- if($scope.adddata.branchType == 1){
- delete formdata.handleUser;
- delete formdata.group;
- delete formdata.userOrGroupType;
- for (var i = 0; i < formdata.branchUserGroups.length; i++) {
- if(formdata.branchUserGroups[i].branchUserOrGroupType){
- formdata.branchUserGroups[i].branchUserOrGroupType = Number(formdata.branchUserGroups[i].branchUserOrGroupType);
- }
- if(formdata.branchUserGroups[i].user && formdata.branchUserGroups[i].branchUserOrGroupType == 1){
- formdata.branchUserGroups[i].userId=formdata.branchUserGroups[i].user.id;
- delete formdata.branchUserGroups[i].user;
- delete formdata.branchUserGroups[i].groupId;
- }
- if(formdata.branchUserGroups[i].group && formdata.branchUserGroups[i].branchUserOrGroupType == 2){
- formdata.branchUserGroups[i].groupId=formdata.branchUserGroups[i].group.id;
- delete formdata.branchUserGroups[i].group;
- delete formdata.branchUserGroups[i].userId;
- }
- }
- }else if($scope.adddata.branchType == 0){
- formdata.branchUserGroups = [];
- if($scope.userOrGroupTypeAdd.type){
- formdata.userOrGroupType=$scope.userOrGroupTypeAdd.type
- }
- if($scope.userGroupCheckedAdd&&$scope.userGroupCheckedAdd.groupCheck){
- formdata.group={id:$scope.userGroupCheckedAdd.groupCheck.id};
- delete formdata.handleUser;
- }
- if($scope.userGroupCheckedAdd&&$scope.userGroupCheckedAdd.userCheck){
- formdata.handleUser={id:$scope.userGroupCheckedAdd.userCheck.id};
- delete formdata.group;
- }
- }
- var filedata = { "incidentcategory": formdata }
- console.log(filedata);
- // return;
- api_bpm_data.addData('incidentcategory', filedata).then(function(response) {
- if (response) {
- if (response.status == 200) {
- $scope.userdata = [];
- $scope.outdata = [];
- $scope.try_async_load();
- SweetAlert.swal({
- title: "增加成功!",
- type: "success"
- })
- } else if (response.status == 408) {
- SweetAlert.swal({
- title: "增加失败!",
- text: response.error,
- type: "error"
- })
- } else {
- SweetAlert.swal({
- title: "增加失败!",
- type: "error"
- })
- }
- }
- });
- };
- $scope.submit1add = function(formdata) {//lmm
- console.log(formdata)
- if($scope.group_user_Add&&$scope.group_user_Add.group&&$scope.group_user_Add.group.id){
- formdata.group={id:$scope.group_user_Add.group.id};
- }
- if($scope.group_user_Add&&$scope.group_user_Add.user&&$scope.group_user_Add.user.id){
- formdata.user={id:$scope.group_user_Add.user.id};
- }
- formdata.deleteFlag = 0;
- formdata.formUiName = 'inspection_LinHu_detail';
- formdata.formUiEdit = 'inspection_LinHu_confirm';
- formdata.processKey = 'bpm_inspection';
- var filedata = { "inspectionType": formdata }
- console.log(filedata);
- // return;
- api_bpm_data.addData('inspectionType', filedata).then(function(response) {
- if (response) {
- if (response.status == 200) {
- $scope.userdata = [];
- $scope.outdata = [];
- $scope.try_async_1load();
- SweetAlert.swal({
- title: "增加成功!",
- type: "success"
- })
- } else if (response.status == 408) {
- SweetAlert.swal({
- title: "增加失败!",
- text: response.error,
- type: "error"
- })
- } else {
- SweetAlert.swal({
- title: "增加失败!",
- type: "error"
- })
- }
- }
- });
- };
- /* -----end submit incidet category----- */
- // $scope.try_async_load();
- $scope.try_async_1load();
- // $scope.ldloading={};
- var filterData = {
- key: 'null',
- status: 0,
- pageIndex: 0,
- pageSum: 10,
- //treeIds:'[]',
- userId: loginUser.id
- }
- // 故障现象结束
- // 事件紧急度开始
- $scope.incident_emergencyData=[];
- $scope.getIncident_emergency=function(){
- var data={
- "key":"incident_emergency",
- "type":"list"
- }
- api_wechatfile.getDictionary(data).then(function(res){
- $scope.incident_emergencyData=res;
- })
- }
- $scope.getIncident_emergency();
- $scope.incident_emergencySave=function(){
- for(var i=0;i<$scope.incident_emergencyData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_emergencyData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "保存成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_emergency();
- },2000)
- }
- $scope.incident_emergencyReturn=function(){
- $scope.incident_emergencyData[0].name="紧急";
- $scope.incident_emergencyData[1].name="高";
- $scope.incident_emergencyData[2].name="中";
- $scope.incident_emergencyData[3].name="低";
- for(var i=0;i<$scope.incident_emergencyData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_emergencyData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "恢复成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_emergency();
- },2000)
- }
- // 事件紧急度结束
- // 事件影响度开始
- $scope.incident_influenceData=[];
- $scope.getIncident_influence=function(){
- var data={
- "key":"incident_influence",
- "type":"list"
- }
- api_wechatfile.getDictionary(data).then(function(res){
- $scope.incident_influenceData=res;
- })
- }
- $scope.getIncident_influence();
- $scope.incident_influenceSave=function(){
- for(var i=0;i<$scope.incident_influenceData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_influenceData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "保存成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_influence();
- },2000)
- }
- $scope.incident_influenceReturn=function(){
- $scope.incident_influenceData[0].name="高";
- $scope.incident_influenceData[1].name="中";
- $scope.incident_influenceData[2].name="低";
- for(var i=0;i<$scope.incident_influenceData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_influenceData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "恢复成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_influence();
- },2000)
- }
- // 事件影响度结束
- // 事件状态开始
- $scope.incident_classificationData=[];
- $scope.getIncident_classification=function(){
- var data={
- "key":"incident_status",
- "type":"list"
- }
- api_wechatfile.getDictionary(data).then(function(res){
- $scope.incident_classificationData=res;
- })
- }
- $scope.getIncident_classification();
- $scope.incident_classificationSave=function(){
- for(var i=0;i<$scope.incident_classificationData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_classificationData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "保存成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_classification();
- },2000)
- }
- $scope.incident_classificationReturn=function(){
- $scope.incident_classificationData[0].name="待接单";
- $scope.incident_classificationData[1].name="处理中";
- $scope.incident_classificationData[2].name="已解决";
- $scope.incident_classificationData[3].name="已关闭";
- $scope.incident_classificationData[4].name="暂存";
- $scope.incident_classificationData[5].name="重新指派";
- for(var i=0;i<$scope.incident_classificationData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_classificationData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "恢复成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_classification();
- },2000)
- }
- // 事件状态结束
- // 满意度评价开始
- $scope.incident_evaluateData=[];
- $scope.getIncident_evaluate=function(){
- var data={
- "key":"incident_degree",
- "type":"list"
- }
- api_wechatfile.getDictionary(data).then(function(res){
- $scope.incident_evaluateData=res;
- })
- }
- $scope.getIncident_evaluate();
- $scope.incident_evaluateSave=function(){
- for(var i=0;i<$scope.incident_evaluateData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_evaluateData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "保存成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_evaluate();
- },2000)
- }
- $scope.incident_evaluateReturn=function(){
- $scope.incident_evaluateData[0].name="非常满意";
- $scope.incident_evaluateData[1].name="较满意";
- $scope.incident_evaluateData[2].name="满意";
- $scope.incident_evaluateData[3].name="一般";
- $scope.incident_evaluateData[4].name="不满意";
- for(var i=0;i<$scope.incident_evaluateData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_evaluateData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "恢复成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_evaluate();
- },2000)
- }
- // 满意度评价结束
- // 结果类型开始
- $scope.incident_resultData=[];
- $scope.getIncident_result=function(){
- var data={
- "key":"incident_handleresult",
- "type":"list"
- }
- api_wechatfile.getDictionary(data).then(function(res){
- $scope.incident_resultData=res;
- })
- }
- $scope.getIncident_result();
- $scope.incident_resultSave=function(){
- for(var i=0;i<$scope.incident_resultData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_resultData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "保存成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_result();
- },2000)
- }
- $scope.incident_resultReturn=function(){
- $scope.incident_resultData[0].name="全部解决";
- $scope.incident_resultData[1].name="部分解决";
- $scope.incident_resultData[2].name="未解决";
- $scope.incident_resultData[3].name="其它";
- for(var i=0;i<$scope.incident_resultData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_resultData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "恢复成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_result();
- },2000)
- }
- // 结果类型结束
- // 事件优先级开始
- $scope.incident_priorityData=[];
- $scope.getIncident_priority=function(){
- var data={
- "key":"incident_priority",
- "type":"list"
- }
- api_wechatfile.getDictionary(data).then(function(res){
- $scope.incident_priorityData=res;
- })
- }
- $scope.getIncident_priority();
- $scope.incident_prioritySave=function(){
- for(var i=0;i<$scope.incident_priorityData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_priorityData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "保存成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_priority();
- },2000)
- }
- $scope.incident_priorityReturn=function(){
- $scope.incident_priorityData[0].name="重大";
- $scope.incident_priorityData[1].name="高";
- $scope.incident_priorityData[2].name="较高";
- $scope.incident_priorityData[3].name="普通";
- for(var i=0;i<$scope.incident_priorityData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_priorityData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "恢复成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_priority();
- },2000)
- }
- // 事件优先级结束
- // 事件工时开始
- $scope.incident_complexityData=[];
- $scope.getIncident_complexity=function(){
- var data={
- "key":"incident_complexity",
- "type":"list"
- }
- api_wechatfile.getDictionary(data).then(function(res){
- $scope.incident_complexityData=res;
- })
- }
- $scope.getIncident_complexity();
- $scope.incident_complexitySave=function(){
- for(var i=0;i<$scope.incident_complexityData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_complexityData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "保存成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_complexity();
- },2000)
- }
- // 没有恢复默认
- // $scope.incident_complexityReturn=function(){
- // $scope.incident_complexityData[0].name="重大";
- // $scope.incident_complexityData[1].name="高";
- // $scope.incident_complexityData[2].name="较高";
- // $scope.incident_complexityData[3].name="普通";
- // for(var i=0;i<$scope.incident_complexityData.length;i++){
- // api_sysinfo.addData('dictionary', $scope.incident_complexityData[i]).then(function(res) {
- // })
- // }
- // SweetAlert.swal({
- // title: "恢复成功!",
- // type: "success",
- // confirmButtonColor: "#007AFF"
- // });
- // $timeout(function(){
- // $scope.getIncident_complexity();
- // },2000)
- // }
- // 事件工时结束
- // 服务级别协议开始
- $scope.incident_SLA_Data=[];
- $scope.getIncident_SLA=function(){
- var data={
- "idx":0,
- "sum":10
- };
- jry_api_bpm.jry_getFetchDataList(data,"servicelevelagreement").then(function(res){
- $scope.incident_SLA_Data=res.list
- })
- };
- $scope.getIncident_SLA();
- $scope.incident_SLASave=function(){
- for(var i=0;i<$scope.incident_SLA_Data.length;i++){
- $scope.incident_SLA_Data[i].availabilityDate=$scope.incident_SLA_Data[i].availabilityDate+" 08:00:00";
- $scope.incident_SLA_Data[i].terminationDate=$scope.incident_SLA_Data[i].terminationDate+" 08:00:00";
- var data={
- "servicelevelagreement":$scope.incident_SLA_Data[i]
- }
- jry_api_bpm.jry_editFn(data,"servicelevelagreement").then(function(){
- })
- SweetAlert.swal({
- title: "保存成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_SLA();
- },2000)
- }
- }
- $scope.incident_SLAReturn=function(){
- $scope.incident_SLA_Data[0].resolveTime=450;
- $scope.incident_SLA_Data[1].resolveTime=480;
- $scope.incident_SLA_Data[2].resolveTime=480;
- $scope.incident_SLA_Data[3].resolveTime=960;
- $scope.incident_SLA_Data[0].responseTime=30;
- $scope.incident_SLA_Data[1].responseTime=45;
- $scope.incident_SLA_Data[2].responseTime=60;
- $scope.incident_SLA_Data[3].responseTime=240;
- for(var i=0;i<$scope.incident_SLA_Data.length;i++){
- $scope.incident_SLA_Data[i].availabilityDate=$scope.incident_SLA_Data[i].availabilityDate+" 08:00:00";
- $scope.incident_SLA_Data[i].terminationDate=$scope.incident_SLA_Data[i].terminationDate+" 08:00:00";
- var data={
- "servicelevelagreement":$scope.incident_SLA_Data[i]
- }
- jry_api_bpm.jry_editFn(data,"servicelevelagreement").then(function(){
- })
- SweetAlert.swal({
- title: "保存成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_SLA();
- },2000)
- }
- }
- // 服务级别协议结束
- // 事件来源开始
- $scope.incident_sourceData=[];
- $scope.getIncident_source=function(){
- var data={
- "key":"incident_source",
- "type":"list"
- }
- api_wechatfile.getDictionary(data).then(function(res){
- $scope.incident_sourceData=res;
- })
- }
- $scope.getIncident_source();
- $scope.incident_sourceSave=function(){
- for(var i=0;i<$scope.incident_sourceData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_sourceData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "保存成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_source();
- },2000)
- }
- $scope.incident_sourceReturn=function(){
- $scope.incident_sourceData[0].name="电话";
- $scope.incident_sourceData[1].name="留言";
- $scope.incident_sourceData[2].name="微信/web";
- $scope.incident_sourceData[3].name="主动发现";
- $scope.incident_sourceData[4].name="领导指派";
- $scope.incident_sourceData[5].name="其他";
- $scope.incident_sourceData[0].value="phone";
- $scope.incident_sourceData[1].value="record";
- $scope.incident_sourceData[2].value="im";
- $scope.incident_sourceData[3].value="discover";
- $scope.incident_sourceData[4].value="leader";
- $scope.incident_sourceData[5].value="other";
- for(var i=0;i<$scope.incident_sourceData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_sourceData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "恢复成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_source();
- },2000)
- }
- // 事件来源结束
- // 关闭代码开始
- $scope.incident_closecodeData=[];
- $scope.getIncident_closecode=function(){
- var data={
- "key":"incident_closecode",
- "type":"list"
- }
- api_wechatfile.getDictionary(data).then(function(res){
- $scope.incident_closecodeData=res;
- })
- }
- $scope.getIncident_closecode();
- $scope.incident_closecodeSave=function(){
- for(var i=0;i<$scope.incident_closecodeData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_closecodeData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "保存成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_closecode();
- },2000)
- }
- $scope.incident_closecodeReturn=function(){
- $scope.incident_closecodeData[0].value="060";
- $scope.incident_closecodeData[1].value="061";
- $scope.incident_closecodeData[2].value="062";
- $scope.incident_closecodeData[3].value="063";
- $scope.incident_closecodeData[4].value="064";
- $scope.incident_closecodeData[5].value="065";
- $scope.incident_closecodeData[0].desc="事件已经完全解决";
- $scope.incident_closecodeData[1].desc="事件未能完全解决";
- $scope.incident_closecodeData[2].desc="由服务提供商对事件进行处理";
- $scope.incident_closecodeData[3].desc="事件自行消失";
- $scope.incident_closecodeData[4].desc="事件请求不在服务范围内";
- $scope.incident_closecodeData[5].desc="通过问题或变更流程处理";
- $scope.incident_closecodeData[0].desc="完全解决";
- $scope.incident_closecodeData[1].desc="临时解决";
- $scope.incident_closecodeData[2].desc="供应商解决";
- $scope.incident_closecodeData[3].desc="事件消失";
- $scope.incident_closecodeData[4].desc="拒绝";
- $scope.incident_closecodeData[5].desc="进入其他流程处理";
- for(var i=0;i<$scope.incident_closecodeData.length;i++){
- api_sysinfo.addData('dictionary', $scope.incident_closecodeData[i]).then(function(res) {
- })
- }
- SweetAlert.swal({
- title: "恢复成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- $timeout(function(){
- $scope.getIncident_closecode();
- },2000)
- }
- // 关闭代码结束
- // 优先级规则开始
- $scope.incident_prioritymatrixAdd=function(){
- var modalInstance = $modal.open({
- templateUrl: 'assets/views/system/tpl/systemprioritymatrix.html',
- controller: function($scope, $modalInstance, api_bpm_data) {
- $scope.prioritymatrixdata={};
- var prioritymatrixInfluenceData={
- "key":"incident_influence",
- "type":"list"
- }
- $scope.prioritymatrixInfluenceData=[];
- api_wechatfile.getDictionary(prioritymatrixInfluenceData).then(function(res){
- $scope.prioritymatrixInfluenceData=res;
- })
- var prioritymatrixEmergencyData={
- "key":"incident_emergency",
- "type":"list"
- }
- $scope.prioritymatrixEmergencyData=[];
- api_wechatfile.getDictionary(prioritymatrixEmergencyData).then(function(res){
- $scope.prioritymatrixEmergencyData=res;
- })
- var prioritymatrixPriorityData={
- "key":"incident_priority",
- "type":"list"
- }
- $scope.prioritymatrixPriorityData=[];
- api_wechatfile.getDictionary(prioritymatrixPriorityData).then(function(res){
- $scope.prioritymatrixPriorityData=res;
- })
- $scope.cancel = function() {
- $modalInstance.dismiss('cancel');
- };
- $scope.savercode = function(prioritymatrixdata) {
- $modalInstance.close(prioritymatrixdata);
- };
- }
- });
- modalInstance.result.then(function(selectedItem) {
- // console.log('selectedItem='+JSON.stringify(selectedItem));
- if (selectedItem) {
- console.log(selectedItem);
- var fildata = { "prioritymatrix": { "priority": { "id": selectedItem.priority.id }, "emergency": { "id": selectedItem.emergency.id }, "influence": { "id": selectedItem.influence.id } } }
- api_bpm_data.addData('prioritymatrix', fildata).then(function(response) {
- if (response) {
- if (response.status == 200) {
- SweetAlert.swal({
- title: "新增成功!",
- type: "success"
- }, function() {
- $scope.getPrioritymatrix()
- })
- } else {
- SweetAlert.swal({
- title: "新增失败!",
- text: "已有此类优先级规则!",
- type: "error"
- })
- }
- }
- })
- }
- });
- }
- $scope.prioritymatrixData=[];
- $scope.getPrioritymatrix=function(){
- var data={
- "idx":0,
- "sum":999
- }
- api_statistic.tableData(data,"prioritymatrix").then(function(res){
- $scope.prioritymatrixData=res.list
- })
- }
- $scope.incident_prioritymatrixSave=function(){
- SweetAlert.swal({
- title: "修改成功!",
- type: "success"
- })
- for(var i=0;i<$scope.prioritymatrixData.length;i++){
- api_bpm.updData("prioritymatrix",{"prioritymatrix":$scope.prioritymatrixData[i]}).then(function(res){
- if(res.status!=200){
- SweetAlert.swal({
- title: "修改失败!",
- text: "已有此类优先级规则,或者规则不合理!",
- type: "error"
- })
- }
- })
- }
- $timeout(function(){
- $scope.getPrioritymatrix()
- },2000)
- }
- $scope.removePrioritymatrix=function(data){
- SweetAlert.swal({
- title: "确认删除?",
- text: "删除的数据不可恢复,请确认继续操作!",
- type: "warning",
- showCancelButton: true,
- confirmButtonColor: "#DD6B55",
- confirmButtonText: "继续删除",
- cancelButtonText: "取消操作",
- closeOnConfirm: false,
- closeOnCancel: false
- }, function (isConfirm) {
- if (isConfirm) {
- api_bpm_data.rmvData("prioritymatrix",[data.id]).then(function(res){
- console.log(res);
- if(res.status==200){
- SweetAlert.swal({
- title: "删除成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- }, function() {
- $scope.getPrioritymatrix()
- });
- }else{
- SweetAlert.swal({
- title: "删除失败",
- text: "系统错误,请稍后重试!",
- type: "error",
- confirmButtonColor: "#DD6B55"
- });
- }
- })
- } else {
- SweetAlert.swal("操作取消", "数据安全", "error");
- }
- });
- }
- $scope.getPrioritymatrix()
- // 优先级规则结束
- // 维修记录开始
- $scope.incident_prioritymatrixAdd=function(){
- var modalInstance = $modal.open({
- templateUrl: 'assets/views/system/tpl/systemprocessingLog.html',
- controller: function($scope, $modalInstance, api_bpm_data) {
- $scope.processingLogdata={description:''};
- $scope.cancel = function() {
- $modalInstance.dismiss('cancel');
- };
- $scope.savercode = function(processingLogdata) {
- $modalInstance.close(processingLogdata);
- };
- }
- });
- modalInstance.result.then(function(selectedItem) {
- console.log(selectedItem);
- if (selectedItem.description.trim()) {
- console.log(selectedItem);
- var fildata = { "dictionary": { key:'processingLog',name:1,value:selectedItem.description.trim(),deleted:false,system:0 } }
- api_bpm_data.addData('dictionary', fildata).then(function(response) {
- $scope.getProcessingLogList()
- if (response) {
- if (response.status == 200 && response.data.value) {
- SweetAlert.swal({
- title: "新增成功!",
- type: "success"
- })
- } else {
- SweetAlert.swal({
- title: "新增失败!",
- text: "内容重复!",
- type: "error"
- })
- }
- }
- })
- }else{
- SweetAlert.swal({
- title: "新增失败!",
- text: "请填写内容!",
- type: "error"
- })
- }
- });
- }
- $scope.processingLogList=[];
- $scope.getProcessingLogList=function(){
- var data={
- "idx":0,
- "sum":999,
- dictionary:{key:'processingLog'}
- }
- api_statistic.tableData(data,"dictionary").then(function(res){
- $scope.processingLogList=res.list
- })
- }
- $scope.incident_processingLogListSave=function(){
- var n = 0;
- for(var i=0;i<$scope.processingLogList.length;i++){
- n++;
- api_bpm.updData("dictionary",{"dictionary":$scope.processingLogList[i]}).then(function(res){
- if(res.status==200 && res.data.value){
- if(--n == 0){
- SweetAlert.swal({
- title: "修改成功!",
- type: "success"
- })
- $scope.getProcessingLogList()
- }
- }else{
- SweetAlert.swal({
- title: "修改失败!",
- text: "内容重复!",
- type: "error"
- })
- }
- })
- }
- // $timeout(function(){
- // $scope.getProcessingLogList()
- // },2000)
- }
- $scope.removePrioritymatrix=function(data){
- SweetAlert.swal({
- title: "确认删除?",
- text: "删除的数据不可恢复,请确认继续操作!",
- type: "warning",
- showCancelButton: true,
- confirmButtonColor: "#DD6B55",
- confirmButtonText: "继续删除",
- cancelButtonText: "取消操作",
- closeOnConfirm: false,
- closeOnCancel: false
- }, function (isConfirm) {
- if (isConfirm) {
- api_bpm_data.rmvData("dictionary",[data.id]).then(function(res){
- console.log(res);
- $scope.getProcessingLogList();
- if(res.status==200){
- SweetAlert.swal({
- title: "删除成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- }else{
- SweetAlert.swal({
- title: "删除失败",
- text: "系统错误,请稍后重试!",
- type: "error",
- confirmButtonColor: "#DD6B55"
- });
- }
- })
- } else {
- SweetAlert.swal("操作取消", "数据安全", "error");
- }
- });
- }
- $scope.getProcessingLogList()
- // 维修记录结束
- // 维修方式开始
- $scope.incident_maintenanceModeAdd=function(){
- var modalInstance = $modal.open({
- templateUrl: 'assets/views/system/tpl/systemmaintenanceMode.html',
- controller: function($scope, $modalInstance, api_bpm_data) {
- $scope.processingLogdata={description:''};
- $scope.cancel = function() {
- $modalInstance.dismiss('cancel');
- };
- $scope.savercode = function(processingLogdata) {
- $modalInstance.close(processingLogdata);
- };
- }
- });
- modalInstance.result.then(function(selectedItem) {
- console.log(selectedItem);
- if (selectedItem.description.trim()) {
- console.log(selectedItem);
- var fildata = { "dictionary": { key:'repair_type',name:selectedItem.description.trim(),value:new Date().getTime().toString(36),deleted:false,system:0 } }
- api_bpm_data.addData('dictionary', fildata).then(function(response) {
- $scope.getMaintenanceModList()
- if (response) {
- if (response.status == 200 && response.data.value) {
- SweetAlert.swal({
- title: "新增成功!",
- type: "success"
- })
- } else {
- SweetAlert.swal({
- title: "新增失败!",
- text: "内容重复!",
- type: "error"
- })
- }
- }
- })
- }else{
- SweetAlert.swal({
- title: "新增失败!",
- text: "请填写内容!",
- type: "error"
- })
- }
- });
- }
- $scope.maintenanceModList=[];
- $scope.getMaintenanceModList=function(){
- var data={
- "idx":0,
- "sum":999,
- dictionary:{key:'repair_type'}
- }
- api_statistic.tableData(data,"dictionary").then(function(res){
- $scope.maintenanceModList=res.list
- })
- }
- $scope.incident_maintenanceModeListSave=function(){
- var n = 0;
- for(var i=0;i<$scope.maintenanceModList.length;i++){
- n++;
- api_bpm.updData("dictionary",{"dictionary":$scope.maintenanceModList[i]}).then(function(res){
- if(res.status==200 && res.data.value){
- if(--n == 0){
- SweetAlert.swal({
- title: "修改成功!",
- type: "success"
- })
- $scope.getMaintenanceModList()
- }
- }else{
- SweetAlert.swal({
- title: "修改失败!",
- text: "内容重复!",
- type: "error"
- })
- }
- })
- }
- }
- $scope.removeMaintenanceMode=function(data){
- SweetAlert.swal({
- title: "确认删除?",
- text: "删除的数据不可恢复,请确认继续操作!",
- type: "warning",
- showCancelButton: true,
- confirmButtonColor: "#DD6B55",
- confirmButtonText: "继续删除",
- cancelButtonText: "取消操作",
- closeOnConfirm: false,
- closeOnCancel: false
- }, function (isConfirm) {
- if (isConfirm) {
- api_bpm_data.rmvData("dictionary",[data.id]).then(function(res){
- console.log(res);
- $scope.getMaintenanceModList();
- if(res.status==200){
- SweetAlert.swal({
- title: "删除成功!",
- type: "success",
- confirmButtonColor: "#007AFF"
- });
- }else{
- SweetAlert.swal({
- title: "删除失败",
- text: "系统错误,请稍后重试!",
- type: "error",
- confirmButtonColor: "#DD6B55"
- });
- }
- })
- } else {
- SweetAlert.swal("操作取消", "数据安全", "error");
- }
- });
- }
- $scope.getMaintenanceModList()
- // 维修方式结束
- // 获取组数据
- $scope.getGroupList=function(){
- var postData={
- idx: 0,
- sum: 1000,
- group: {selectType: "nouser"}
- }
- api_user_data.fetchDataList('group',postData).then(res=>{
- $scope.groupList=res.list;
- })
- }
- $scope.getGroupList()
- // 获取人数据
- $scope.getUserList=function(){
- var postData={
- idx: 0,
- sum: 1000,
- user: {
- roledata: {rolecode: "first-line support"},
- name:'',
- selectType: "pinyin_qs",
- engineer: 1,
- }
- }
- api_user_data.fetchDataList('user',postData).then(res=>{
- $scope.userList=res.list;
- })
- }
- $scope.getUserList()
- // 获取故障现象人员
- $scope.getUserList1=function(){
- var postData={
- idx: 0,
- sum: 1000,
- user: {
- name:'',
- selectType: "pinyin_qs",
- roledata:{
- rolecode:'incident-category-manager'
- },
- engineer: 1,
- }
- }
- api_user_data.fetchDataList('user',postData).then(res=>{
- $scope.userList1=res.list;
- })
- }
- $scope.getUserList1()
- }]);
|