|
@@ -358,10 +358,24 @@ app.controller('incidentSetUp', ["$rootScope", "$scope", "$state", "$timeout", "
|
358
|
358
|
function convertchildToTree(datum,type) {
|
359
|
359
|
if(type === '事件分类'){
|
360
|
360
|
$scope.subdata = {};
|
|
361
|
+ if(datum.branchUserGroups){
|
|
362
|
+ for (var i = 0; i < datum.branchUserGroups.length; i++) {
|
|
363
|
+ if(datum.branchUserGroups[i].userId){
|
|
364
|
+ datum.branchUserGroups[i].user = {id:datum.branchUserGroups[i].userId,name:datum.branchUserGroups[i].userName};
|
|
365
|
+ delete datum.branchUserGroups[i].userId;
|
|
366
|
+ delete datum.branchUserGroups[i].userName;
|
|
367
|
+ }
|
|
368
|
+ if(datum.branchUserGroups[i].groupId){
|
|
369
|
+ datum.branchUserGroups[i].group = {id:datum.branchUserGroups[i].groupId,groupName:datum.branchUserGroups[i].groupName};
|
|
370
|
+ delete datum.branchUserGroups[i].groupId;
|
|
371
|
+ delete datum.branchUserGroups[i].groupName;
|
|
372
|
+ }
|
|
373
|
+ }
|
|
374
|
+ }
|
361
|
375
|
if (datum.parent) {
|
362
|
|
- $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 }
|
|
376
|
+ $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||[] }
|
363
|
377
|
} else {
|
364
|
|
- $scope.subdata = { 'id': datum.id, 'category': datum.label, 'group': datum.group||{}, 'hasSimple': datum.hasSimple, 'hasPlace': datum.hasPlace, 'priority': datum.priority, 'complexity': datum.complexity }
|
|
378
|
+ $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||[] }
|
365
|
379
|
}
|
366
|
380
|
}else if(type === '巡检范围'){
|
367
|
381
|
$scope.sub1data = {};
|
|
@@ -436,55 +450,71 @@ app.controller('incidentSetUp', ["$rootScope", "$scope", "$state", "$timeout", "
|
436
|
450
|
$scope.my_data = [];
|
437
|
451
|
|
438
|
452
|
$scope.doing_async = true;
|
439
|
|
- var data = { "idx": 0, "sum": 1000 };
|
440
|
|
- api_bpm_data.fetchDataList('incidentcategory', data).then(function(response) {
|
441
|
|
- var data = response.list;
|
442
|
|
- var objects = [];
|
443
|
|
- // $scope.parentdata = data;
|
444
|
|
- for (var i = 0; i < data.length; i++) {
|
445
|
|
- var object = {};
|
446
|
|
- object.id = data[i].id;
|
447
|
|
- if (angular.isDefined(data[i].parent)) {
|
448
|
|
- object.parent = data[i].parent;
|
449
|
|
- }
|
450
|
|
- if (angular.isDefined(data[i].hasPlace)) {
|
451
|
|
- object.hasPlace = data[i].hasPlace;
|
452
|
|
- }
|
453
|
|
- if (angular.isDefined(data[i].hasSimple)) {
|
454
|
|
- object.hasSimple = data[i].hasSimple;
|
455
|
|
- }
|
456
|
|
- if (angular.isDefined(data[i].group)) {
|
457
|
|
- object.group = data[i].group||{};
|
458
|
|
- }
|
459
|
|
- if (angular.isDefined(data[i].priority)) {
|
460
|
|
- object.priority = data[i].priority;
|
461
|
|
- }
|
462
|
|
- if (angular.isDefined(data[i].complexity)) {
|
463
|
|
- object.complexity = data[i].complexity;
|
464
|
|
- }
|
465
|
|
- if (angular.isDefined(data[i].handleUser)) {
|
466
|
|
- object.handleUser = data[i].handleUser||{};
|
467
|
|
- }
|
468
|
|
- if(angular.isDefined(data[i].userOrGroupType)){
|
469
|
|
- object.userOrGroupType=data[i].userOrGroupType;
|
|
453
|
+ api_bpm_data.fetchDataList('branch', { "idx": 0, "sum": 1000 }).then(function(result) {
|
|
454
|
+ result = result.list || [];
|
|
455
|
+ $scope.adddata = {branchType:0,branchUserGroups:result.map(v=>({branchName:v.hosName,branchId:v.id}))}
|
|
456
|
+ api_bpm_data.fetchDataList('incidentcategory', { "idx": 0, "sum": 1000 }).then(function(response) {
|
|
457
|
+ var data = response.list;
|
|
458
|
+ var objects = [];
|
|
459
|
+ // $scope.parentdata = data;
|
|
460
|
+ for (var i = 0; i < data.length; i++) {
|
|
461
|
+ var object = {};
|
|
462
|
+ object.id = data[i].id;
|
|
463
|
+ if (angular.isDefined(data[i].parent)) {
|
|
464
|
+ object.parent = data[i].parent;
|
|
465
|
+ }
|
|
466
|
+ if (angular.isDefined(data[i].hasPlace)) {
|
|
467
|
+ object.hasPlace = data[i].hasPlace;
|
|
468
|
+ }
|
|
469
|
+ if (angular.isDefined(data[i].hasSimple)) {
|
|
470
|
+ object.hasSimple = data[i].hasSimple;
|
|
471
|
+ }
|
|
472
|
+ if (angular.isDefined(data[i].group)) {
|
|
473
|
+ object.group = data[i].group||{};
|
|
474
|
+ }
|
|
475
|
+ if (angular.isDefined(data[i].priority)) {
|
|
476
|
+ object.priority = data[i].priority;
|
|
477
|
+ }
|
|
478
|
+ if (angular.isDefined(data[i].complexity)) {
|
|
479
|
+ object.complexity = data[i].complexity;
|
|
480
|
+ }
|
|
481
|
+ if (angular.isDefined(data[i].handleUser)) {
|
|
482
|
+ object.handleUser = data[i].handleUser||{};
|
|
483
|
+ }
|
|
484
|
+ if(angular.isDefined(data[i].userOrGroupType)){
|
|
485
|
+ object.userOrGroupType=data[i].userOrGroupType;
|
|
486
|
+ }
|
|
487
|
+ if(angular.isDefined(data[i].managerUser)){
|
|
488
|
+ object.managerUser=data[i].managerUser||{};
|
|
489
|
+ }
|
|
490
|
+ if(angular.isDefined(data[i].branchType)){
|
|
491
|
+ object.branchType=data[i].branchType||0;
|
|
492
|
+ }
|
|
493
|
+ if(angular.isDefined(data[i].branchUserGroups)){
|
|
494
|
+ data[i].branchUserGroups = data[i].branchUserGroups|| [];
|
|
495
|
+ if(data[i].branchUserGroups.length){
|
|
496
|
+ object.branchUserGroups=data[i].branchUserGroups
|
|
497
|
+ }else{
|
|
498
|
+ object.branchUserGroups = result.map(v=>({branchName:v.hosName,branchId:v.id,categoryId:data[i].id}))
|
|
499
|
+ }
|
|
500
|
+ }else{
|
|
501
|
+ object.branchUserGroups = result.map(v=>({branchName:v.hosName,branchId:v.id,categoryId:data[i].id}))
|
|
502
|
+ }
|
|
503
|
+ object.label = data[i].category;
|
|
504
|
+ object.state = {
|
|
505
|
+ "opened": true
|
|
506
|
+ };
|
|
507
|
+ object.typeName = "type";
|
|
508
|
+ $scope.showAddSolutionType = true;
|
|
509
|
+ $scope.showReviewKnowledgeType = true;
|
|
510
|
+ objects.push(object);
|
470
|
511
|
}
|
471
|
|
- if(angular.isDefined(data[i].managerUser)){
|
472
|
|
- object.managerUser=data[i].managerUser||{};
|
|
512
|
+ $scope.my_data = convertParentToChildList(objects);
|
|
513
|
+ $scope.tree_data = angular.copy($scope.my_data);
|
|
514
|
+ if ($scope.my_data.length > 0) {
|
|
515
|
+ $scope.doing_async = false;
|
473
|
516
|
}
|
474
|
|
- object.label = data[i].category;
|
475
|
|
- object.state = {
|
476
|
|
- "opened": true
|
477
|
|
- };
|
478
|
|
- object.typeName = "type";
|
479
|
|
- $scope.showAddSolutionType = true;
|
480
|
|
- $scope.showReviewKnowledgeType = true;
|
481
|
|
- objects.push(object);
|
482
|
|
- }
|
483
|
|
- $scope.my_data = convertParentToChildList(objects);
|
484
|
|
- $scope.tree_data = angular.copy($scope.my_data);
|
485
|
|
- if ($scope.my_data.length > 0) {
|
486
|
|
- $scope.doing_async = false;
|
487
|
|
- }
|
|
517
|
+ });
|
488
|
518
|
});
|
489
|
519
|
};
|
490
|
520
|
$scope.try_async_1load = function() {
|
|
@@ -524,7 +554,8 @@ app.controller('incidentSetUp', ["$rootScope", "$scope", "$state", "$timeout", "
|
524
|
554
|
|
525
|
555
|
/* -----start submit incidet category----- */
|
526
|
556
|
$scope.userGroupChecked={};//选中人/组数据
|
527
|
|
- $scope.submitchange = function(formdata) {
|
|
557
|
+ $scope.submitchange = function(formdata1) {
|
|
558
|
+ var formdata = angular.copy(formdata1);
|
528
|
559
|
// if (formdata.hasArea) {
|
529
|
560
|
// formdata.hasArea = 1;
|
530
|
561
|
// formdata.hasPlace = 1;
|
|
@@ -557,17 +588,52 @@ app.controller('incidentSetUp', ["$rootScope", "$scope", "$state", "$timeout", "
|
557
|
588
|
delete formdata.parent
|
558
|
589
|
}
|
559
|
590
|
// console.log(formdata)
|
560
|
|
- if($scope.userOrGroupType.type){
|
561
|
|
- formdata.userOrGroupType=$scope.userOrGroupType.type
|
562
|
|
- }
|
563
|
|
- if($scope.userGroupChecked&&$scope.userGroupChecked.groupCheck){
|
564
|
|
- formdata.group={id:$scope.userGroupChecked.groupCheck.id};
|
565
|
|
- // delete formdata.handleUser;
|
566
|
|
- }
|
567
|
|
- if($scope.userGroupChecked&&$scope.userGroupChecked.userCheck){
|
568
|
|
- formdata.handleUser={id:$scope.userGroupChecked.userCheck.id};
|
569
|
|
- // delete formdata.group;
|
|
591
|
+ // if($scope.userOrGroupType.type){
|
|
592
|
+ // formdata.userOrGroupType=$scope.userOrGroupType.type
|
|
593
|
+ // }
|
|
594
|
+ // if($scope.userGroupChecked&&$scope.userGroupChecked.groupCheck){
|
|
595
|
+ // formdata.group={id:$scope.userGroupChecked.groupCheck.id};
|
|
596
|
+ // // delete formdata.handleUser;
|
|
597
|
+ // }
|
|
598
|
+ // if($scope.userGroupChecked&&$scope.userGroupChecked.userCheck){
|
|
599
|
+ // formdata.handleUser={id:$scope.userGroupChecked.userCheck.id};
|
|
600
|
+ // // delete formdata.group;
|
|
601
|
+ // }
|
|
602
|
+ // ------------------------ start----------------------------
|
|
603
|
+ if($scope.subdata.branchType == 1){
|
|
604
|
+ delete formdata.handleUser;
|
|
605
|
+ delete formdata.group;
|
|
606
|
+ delete formdata.userOrGroupType;
|
|
607
|
+ for (var i = 0; i < formdata.branchUserGroups.length; i++) {
|
|
608
|
+ if(formdata.branchUserGroups[i].branchUserOrGroupType){
|
|
609
|
+ formdata.branchUserGroups[i].branchUserOrGroupType = Number(formdata.branchUserGroups[i].branchUserOrGroupType);
|
|
610
|
+ }
|
|
611
|
+ if(formdata.branchUserGroups[i].user && formdata.branchUserGroups[i].branchUserOrGroupType == 1){
|
|
612
|
+ formdata.branchUserGroups[i].userId=formdata.branchUserGroups[i].user.id;
|
|
613
|
+ delete formdata.branchUserGroups[i].user;
|
|
614
|
+ delete formdata.branchUserGroups[i].groupId;
|
|
615
|
+ }
|
|
616
|
+ if(formdata.branchUserGroups[i].group && formdata.branchUserGroups[i].branchUserOrGroupType == 2){
|
|
617
|
+ formdata.branchUserGroups[i].groupId=formdata.branchUserGroups[i].group.id;
|
|
618
|
+ delete formdata.branchUserGroups[i].group;
|
|
619
|
+ delete formdata.branchUserGroups[i].userId;
|
|
620
|
+ }
|
|
621
|
+ }
|
|
622
|
+ }else if($scope.subdata.branchType == 0){
|
|
623
|
+ formdata.branchUserGroups = [];
|
|
624
|
+ if($scope.userOrGroupType.type){
|
|
625
|
+ formdata.userOrGroupType=$scope.userOrGroupType.type
|
|
626
|
+ }
|
|
627
|
+ if($scope.userGroupChecked&&$scope.userGroupChecked.groupCheck){
|
|
628
|
+ formdata.group={id:$scope.userGroupChecked.groupCheck.id};
|
|
629
|
+ delete formdata.handleUser;
|
|
630
|
+ }
|
|
631
|
+ if($scope.userGroupChecked&&$scope.userGroupChecked.userCheck){
|
|
632
|
+ formdata.handleUser={id:$scope.userGroupChecked.userCheck.id};
|
|
633
|
+ delete formdata.group;
|
|
634
|
+ }
|
570
|
635
|
}
|
|
636
|
+ // ------------------------ end----------------------------
|
571
|
637
|
if($scope.subdata.complexity){
|
572
|
638
|
formdata.complexity=$scope.subdata.complexity
|
573
|
639
|
}
|
|
@@ -658,7 +724,8 @@ app.controller('incidentSetUp', ["$rootScope", "$scope", "$state", "$timeout", "
|
658
|
724
|
$scope.userGroupCheckedAdd={};//选中人/组数据
|
659
|
725
|
$scope.group_user_Add={};//选中人/组数据
|
660
|
726
|
$scope.userOrGroupTypeAdd={type:0};//运维组/运维人员
|
661
|
|
- $scope.submitadd = function(formdata) {
|
|
727
|
+ $scope.submitadd = function(formdata1) {
|
|
728
|
+ var formdata = angular.copy(formdata1);
|
662
|
729
|
console.log(formdata)
|
663
|
730
|
// var paret = {};
|
664
|
731
|
// var filedata = {};
|
|
@@ -696,18 +763,41 @@ app.controller('incidentSetUp', ["$rootScope", "$scope", "$state", "$timeout", "
|
696
|
763
|
formdata['parentCategory'] = { "id": formdata.parent.id };
|
697
|
764
|
delete formdata.parent
|
698
|
765
|
}
|
699
|
|
- if($scope.userOrGroupTypeAdd.type){
|
700
|
|
- formdata.userOrGroupType=$scope.userOrGroupTypeAdd.type
|
701
|
|
- }
|
702
|
|
- if($scope.userGroupCheckedAdd&&$scope.userGroupCheckedAdd.groupCheck){
|
703
|
|
- formdata.group={id:$scope.userGroupCheckedAdd.groupCheck.id};
|
704
|
|
- // delete formdata.handleUser;
|
705
|
|
- }
|
706
|
|
- if($scope.userGroupCheckedAdd&&$scope.userGroupCheckedAdd.userCheck){
|
707
|
|
- formdata.handleUser={id:$scope.userGroupCheckedAdd.userCheck.id};
|
708
|
|
- // delete formdata.group;
|
|
766
|
+ if($scope.adddata.branchType == 1){
|
|
767
|
+ delete formdata.handleUser;
|
|
768
|
+ delete formdata.group;
|
|
769
|
+ delete formdata.userOrGroupType;
|
|
770
|
+ for (var i = 0; i < formdata.branchUserGroups.length; i++) {
|
|
771
|
+ if(formdata.branchUserGroups[i].branchUserOrGroupType){
|
|
772
|
+ formdata.branchUserGroups[i].branchUserOrGroupType = Number(formdata.branchUserGroups[i].branchUserOrGroupType);
|
|
773
|
+ }
|
|
774
|
+ if(formdata.branchUserGroups[i].user && formdata.branchUserGroups[i].branchUserOrGroupType == 1){
|
|
775
|
+ formdata.branchUserGroups[i].userId=formdata.branchUserGroups[i].user.id;
|
|
776
|
+ delete formdata.branchUserGroups[i].user;
|
|
777
|
+ delete formdata.branchUserGroups[i].groupId;
|
|
778
|
+ }
|
|
779
|
+ if(formdata.branchUserGroups[i].group && formdata.branchUserGroups[i].branchUserOrGroupType == 2){
|
|
780
|
+ formdata.branchUserGroups[i].groupId=formdata.branchUserGroups[i].group.id;
|
|
781
|
+ delete formdata.branchUserGroups[i].group;
|
|
782
|
+ delete formdata.branchUserGroups[i].userId;
|
|
783
|
+ }
|
|
784
|
+ }
|
|
785
|
+ }else if($scope.adddata.branchType == 0){
|
|
786
|
+ formdata.branchUserGroups = [];
|
|
787
|
+ if($scope.userOrGroupTypeAdd.type){
|
|
788
|
+ formdata.userOrGroupType=$scope.userOrGroupTypeAdd.type
|
|
789
|
+ }
|
|
790
|
+ if($scope.userGroupCheckedAdd&&$scope.userGroupCheckedAdd.groupCheck){
|
|
791
|
+ formdata.group={id:$scope.userGroupCheckedAdd.groupCheck.id};
|
|
792
|
+ delete formdata.handleUser;
|
|
793
|
+ }
|
|
794
|
+ if($scope.userGroupCheckedAdd&&$scope.userGroupCheckedAdd.userCheck){
|
|
795
|
+ formdata.handleUser={id:$scope.userGroupCheckedAdd.userCheck.id};
|
|
796
|
+ delete formdata.group;
|
|
797
|
+ }
|
709
|
798
|
}
|
710
|
799
|
|
|
800
|
+
|
711
|
801
|
var filedata = { "incidentcategory": formdata }
|
712
|
802
|
console.log(filedata);
|
713
|
803
|
// return;
|