Newer
Older
import {Component, OnInit, EventEmitter, Output} 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 {
constructor(private systemSer: SystemService, private message: NzMessageService,
) {
(res) => {
if (res.errCode == 10000) {
this.first = res.data[0];
this.first.check = this.first.scValue == 1 ? true : false;
this.second.check = this.second.scValue == 1 ? true : false;
this.third.check = this.third.scValue == 1 ? true : false;
}
}
);
}
showModal(title) {
this.title = title;
this.isVisible = true;
this.separationPowerStatus();
}
handleCancel() {
this.isVisible = false;
}
this.systemSer.separationConfigOpen().subscribe(
(res) => {
if (res.data == 1) {
this.systemSer.separationConfigClose().subscribe(
(res) => {
if (res.data == 1) {
this.systemSer.openSystem().subscribe(
(res) => {
if (res.data == 1) {
this.systemSer.closeSystem().subscribe(
(res) => {
if (res.data == 1) {
this.systemSer.openAuth().subscribe(
(res) => {
if (res.data == 1) {
this.systemSer.closeAuth().subscribe(
(res) => {
if (res.data == 1) {
//保存
handleOk() {
let arr = [];
arr.push(this.first);
arr = arr.concat(this.list);
let arr1 = arr.map(res => {
const data = {
id: res.id,
scValue: null,
};
if (res.check) {
data.scValue = 0;
} else {
data.scValue = 1;
}
return data;
});
this.systemSer.updateValue(arr1).subscribe(
(res) => {
if (res.errCode == 10000) {
if (this.first.check) {
this.message.success('已开启三员分立功能');
} else {
this.message.success('已关闭三员分立功能');
}
this.isVisible = false;
}
}
);