123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659 |
- app.controller('faultSymptoms', ["$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","api_category", 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,api_category) {
- 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=="guzhangxianxiang_xinzeng"){
- $scope.xinzeng=true
- }
- if(loginUser.menu[i].link=="guzhangxianxiang_shanchu"){
- $scope.shanchu=true
- }
- if(loginUser.menu[i].link=="guzhangxianxiang_bianji"){
- $scope.bianji=true
- }
- }
- $scope.listData=[
- {"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) {
- if(branch.parent){
- $scope.selectedChangeCategory = branch.parent;
- }else{
- $scope.selectedChangeCategory = null;
- }
- 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
- // $scope.setSelected($scope.tree_data, $scope.thisParent.id);
- };
- // 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.setSelected = function(items, id){
- items.forEach(function(v){
- if(v.id == id){
- v.selected = true;
- }else{
- $scope.setSelected(v.children, id);
- }
- })
- }
- $scope.addType = function(element) {
- $scope.tree_data = $scope.dataSave.length?angular.copy($scope.dataSave):$scope.tree_data;
- $scope.addcate = false
- $scope.addcate = true
- $scope.changecate = false
- if(element){
- $scope.addparent = true;
- var output = angular.copy(element);
- output.isExpanded = true;
- output.selected = true;
- $scope.adddata.parent = output;
- $scope.selectedChangeCategory = output;
- console.log($scope.adddata);
- // $scope.setSelected($scope.tree_data, element.id);
- }
- // 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() {
- scope.try_async_load();
- scope.addcate = false;
- scope.changecate = false;
- $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(!angular.isObject(datum.branchUserGroups[i].dutyId) && datum.branchUserGroups[i].dutyId){
- datum.branchUserGroups[i].dutyId = {id:datum.branchUserGroups[i].dutyId,dept:datum.branchUserGroups[i].dutyName,branchName:datum.branchUserGroups[i].branchName}
- }
- 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||[],dutyDepartment:datum.dutyDepartment,alias1:datum.alias1,alias2:datum.alias2,alias3:datum.alias3,alias4:datum.alias4,alias5:datum.alias5 }
- } 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||[],dutyDepartment:datum.dutyDepartment,alias1:datum.alias1,alias2:datum.alias2,alias3:datum.alias3,alias4:datum.alias4,alias5:datum.alias5 }
- }
- $scope.subdata.branchUserGroups.forEach(v=>{
- $scope.getDeptList(v.branchId);
- })
- }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}))}
- $scope.adddata.branchUserGroups.forEach(v=>{
- $scope.getDeptList(v.branchId);
- })
- api_bpm_data.fetchDataList('incidentcategory', { "idx": 0, "sum": 9999 }).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].dutyDepartment)) {
- object.dutyDepartment = data[i].dutyDepartment;
- }
- if (angular.isDefined(data[i].alias)) {
- object.alias1 = data[i].alias[0]?data[i].alias[0].alias:"";
- object.alias2 = data[i].alias[1]?data[i].alias[1].alias:"";
- object.alias3 = data[i].alias[2]?data[i].alias[2].alias:"";
- object.alias4 = data[i].alias[3]?data[i].alias[3].alias:"";
- object.alias5 = data[i].alias[4]?data[i].alias[4].alias:"";
- }
- 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.dutyDepartment;
- delete formdata.handleUser;
- delete formdata.group;
- delete formdata.userOrGroupType;
- for (var i = 0; i < formdata.branchUserGroups.length; i++) {
- if(formdata.branchUserGroups[i].dutyId){
- if(angular.isObject(formdata.branchUserGroups[i].dutyId)){
- formdata.branchUserGroups[i].dutyId = formdata.branchUserGroups[i].dutyId.id;
- }
- }
- 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&&$scope.userOrGroupType.type == 2){
- formdata.group={id:$scope.userGroupChecked.groupCheck.id};
- delete formdata.handleUser;
- }
- if($scope.userGroupChecked&&$scope.userGroupChecked.userCheck&&$scope.userOrGroupType.type == 1){
- 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);
- filedata.incidentcategory.alias = [];
- console.log(filedata,$scope.userGroupChecked);
- for (var j = 1; j <= 5; j++) {
- if(filedata.incidentcategory['alias'+j].trim()){
- filedata.incidentcategory.alias.push({alias:filedata.incidentcategory['alias'+j].trim(),categoryId:filedata.incidentcategory.id});
- delete filedata.incidentcategory['alias'+j];
- }
- }
- 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, addparent) {
- 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 (addparent && $scope.selectedChangeCategory) {
- formdata['parentCategory'] = { "id": $scope.selectedChangeCategory.id };
- delete formdata.parent
- }
- if($scope.adddata.branchType == 1){
- delete formdata.dutyDepartment;
- delete formdata.handleUser;
- delete formdata.group;
- delete formdata.userOrGroupType;
- for (var i = 0; i < formdata.branchUserGroups.length; i++) {
- if(formdata.branchUserGroups[i].dutyId){
- if(angular.isObject(formdata.branchUserGroups[i].dutyId)){
- formdata.branchUserGroups[i].dutyId = formdata.branchUserGroups[i].dutyId.id;
- }
- }
- 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();
- $scope.addcate = false;
- $scope.changecate = false;
- 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.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.deptCollection = {};
- $scope.getDeptList=function(branchId){
- var postData={
- idx: 0,
- sum: 1000,
- dutyDepartment: {
- branch:branchId,
- name:'',
- selectType: "pinyin_qs",
- }
- }
- api_user_data.fetchDataList('dutyDepartment',postData).then(res=>{
- $scope.deptCollection['deptList'+(branchId?branchId:0)]=res.list;
- console.log($scope)
- })
- }
- $scope.getDeptList();
- // 获取故障现象人员
- $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()
- // 向下复制分配方式
- $scope.copyCategoryConfig = function(){
- $rootScope.isMask = true;
- api_category.copyCategoryConfig({categoryId: $scope.output.id}).then(res=>{
- $rootScope.isMask = false;
- if(res.status == 200){
- $scope.try_async_load()
- SweetAlert.swal({
- title: "修改成功!",
- type: "success"
- })
- }else{
- SweetAlert.swal({
- title: "修改失败",
- type: "error",
- confirmButtonColor: "#DD6B55"
- });
- }
- })
- }
- }]);
|