Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import {Component, OnInit} from '@angular/core';
import {SystemService} from '../../system.service';
import {NzMessageService} from 'ng-zorro-antd';
@Component({
selector: 'smart-separation',
templateUrl: './separation.component.html',
styles: []
})
export class SeparationComponent implements OnInit {
isVisible = false;
title;
list = [];
value = 0;
first = {
id:"",
value:null,
check:null
};
constructor(private systemSer: SystemService,private message:NzMessageService) {
}
ngOnInit() {}
//查询三员分立
separationPowerStatus() {
this.systemSer.separationPowers().subscribe(
(res) => {
if (res.errCode == 10000) {
this.first = res.data[0];
if(this.first.value == 0){
this.first.check = true;
}else{
this.first.check = false;
}
res.data.splice(0, 1);
this.list = res.data;
this.list.forEach(e=>{
if(e.value == 0){
e.check = true;
}else{
e.check = false;
}
})
}
}
);
}
showModal(title) {
this.title = title;
this.isVisible = true;
this.separationPowerStatus();
}
handleCancel() {
this.isVisible = false;
}
//保存
handleOk() {
let arr = [];
arr.push(this.first);
arr = arr.concat(this.list);
let arr1 = arr.map(res=>{
const data = {
id:res.id,
value:null
}
if(res.check){
data.value = 0;
}else{
data.value = 1;
}
return data;
});
this.systemSer.updateSeparationPowerStatus(arr1).subscribe(
(res)=>{
if(res.errCode == 10000){
if(this.first.check){
this.message.success("已开启三员分立功能");
}else{
this.message.success("已关闭三员分立功能");
}
this.isVisible = false;
}else{
this.message.error(res.errMsg);
}
}
)
}
}