Commit 768e4153 authored by wangqinghua's avatar wangqinghua

告警模块

parent 3dc04b43
...@@ -64,6 +64,8 @@ export class BasicEditComponent implements OnInit { ...@@ -64,6 +64,8 @@ export class BasicEditComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.tabNum = 0; this.tabNum = 0;
// this.isBasicEdit = true; // this.isBasicEdit = true;
this.getTemplate();
this.validateForm = { this.validateForm = {
groups: [], groups: [],
hostExtend: { hostExtend: {
...@@ -104,30 +106,11 @@ export class BasicEditComponent implements OnInit { ...@@ -104,30 +106,11 @@ export class BasicEditComponent implements OnInit {
//新增 //新增
showModal(hostId, name, gId): void { showModal(hostId, name, gId): void {
this.groupList = [];
if (gId) {
const gObj = {
label: name, value: gId, checked: true
};
this.groupList.push(gObj);
} else {
this.overAllSer.getgroups({}).subscribe(
(res) => {
for (let i = 0; i < res.data.length; i++) {
const gObj = {
label: res.data[i].name, value: res.data[i].groupid, checked: false
};
this.groupList.push(gObj);
}
}
);
}
this.modalTitle = '添加资源'; this.modalTitle = '添加资源';
this.hostId = hostId; this.hostId = hostId;
this.tabNum = 0; this.tabNum = 0;
this.isBasicEdit = true; this.isBasicEdit = true;
this.getTemplate();
this.validateForm = { this.validateForm = {
groups: [], groups: [],
hostExtend: { hostExtend: {
...@@ -159,42 +142,31 @@ export class BasicEditComponent implements OnInit { ...@@ -159,42 +142,31 @@ export class BasicEditComponent implements OnInit {
//编辑 //编辑
editModal(hostId, name, gId): void { editModal(hostId, name, gId): void {
console.log(this.validateForm); console.log(this.validateForm);
this.groupList = [];
if (gId) {
const gObj = {
label: name, value: gId, checked: true
};
this.groupList.push(gObj);
} else {
this.overAllSer.getgroups({}).subscribe(
(res) => {
for (let i = 0; i < res.data.length; i++) {
const gObj = {
label: res.data[i].name, value: res.data[i].groupid, checked: false
};
this.groupList.push(gObj);
}
}
);
}
this.hostId = hostId; this.hostId = hostId;
this.modalTitle = '编辑资源'; this.modalTitle = '编辑资源';
this.tabNum = 0; this.tabNum = 0;
this.isBasicEdit = true; this.isBasicEdit = true;
this.getTemplate();
this.overAllSer.findDetailed(this.hostId).subscribe( this.overAllSer.findDetailed(this.hostId).subscribe(
(res) => { (res) => {
this.validateForm = res.data[0]; this.validateForm = res.data[0];
this.validateForm.ipmi_authtype = res.data[0].ipmi_authtype + ''; this.validateForm.ipmi_authtype = res.data[0].ipmi_authtype + '';
this.validateForm.ipmi_privilege = res.data[0].ipmi_privilege + ''; this.validateForm.ipmi_privilege = res.data[0].ipmi_privilege + '';
this.validateForm.groups = [{groupid:1},{groupid:2}]; this.validateForm.groups = res.data[0].groups;
this.interfaceslist = res.data[0].interfaces; this.interfaceslist = res.data[0].interfaces;
this.interfaceslist.forEach(res=>{ this.interfaceslist.forEach(res=>{
res.main = res.main +''; res.main = res.main +'';
res.type = res.type +''; res.type = res.type +'';
}); });
for(let i = 0;i<this.validateForm.groups.length;i++){
for(let j = 0;j<this.groupList.length;j++){
if(this.validateForm.groups[i].groupid == this.groupList[j].value){
console.log(this.groupList[j].value);
this.groupList[j].checked = true;
}
}
}
console.log(this.validateForm); console.log(this.validateForm);
// this.message.info(res.errMsg); // this.message.info(res.errMsg);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment