Commit 71b0c734 authored by wangqinghua's avatar wangqinghua

update

parent f1f6d9b7
...@@ -35,6 +35,7 @@ export class BasiCheckComponent implements OnInit { ...@@ -35,6 +35,7 @@ export class BasiCheckComponent implements OnInit {
title; title;
isCheck = false; isCheck = false;
hostId; //主机ID hostId; //主机ID
hostName; //主机name
itemId; //监控项id itemId; //监控项id
interfaceList: any[]; interfaceList: any[];
validateForm:FormGroup; validateForm:FormGroup;
...@@ -66,13 +67,13 @@ export class BasiCheckComponent implements OnInit { ...@@ -66,13 +67,13 @@ export class BasiCheckComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.tabNum = 0;
this.initForm(); this.initForm();
} }
initForm(){ initForm(){
this.tabNum = 0;
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
hostid:[null], hostid:[this.hostId],
name:[null,[Validators.required]], name:[null,[Validators.required]],
interfaceid:[null,[Validators.required]], interfaceid:[null,[Validators.required]],
key_:[null,[Validators.required]], key_:[null,[Validators.required]],
...@@ -93,10 +94,11 @@ export class BasiCheckComponent implements OnInit { ...@@ -93,10 +94,11 @@ export class BasiCheckComponent implements OnInit {
} }
//新增 //新增
showAddModal(hostId){ showAddModal(hostId,hostName){
this.title = '添加监测点'; this.title = '添加监测点';
this.isCheck = true; this.isCheck = true;
this.hostId = hostId; this.hostId = hostId;
this.hostName = hostName;
//主机接口 //主机接口
this.overAllSer.findDetailed(this.hostId).subscribe( this.overAllSer.findDetailed(this.hostId).subscribe(
(res) => { (res) => {
...@@ -157,6 +159,7 @@ export class BasiCheckComponent implements OnInit { ...@@ -157,6 +159,7 @@ export class BasiCheckComponent implements OnInit {
return false; return false;
} }
this.validateForm.value.applicationids = [this.validateForm.value.applicationids]; this.validateForm.value.applicationids = [this.validateForm.value.applicationids];
this.validateForm.value.hostid = this.hostId;
if(this.title == "添加监测点"){ if(this.title == "添加监测点"){
this.create(); this.create();
} }
...@@ -225,10 +228,10 @@ export class BasiCheckComponent implements OnInit { ...@@ -225,10 +228,10 @@ export class BasiCheckComponent implements OnInit {
this.overAllSer.createItemType(obj).subscribe( this.overAllSer.createItemType(obj).subscribe(
(res) => { (res) => {
if (res.errCode == 10000) { if (res.errCode == 10000) {
this.message.info('添加成功'); this.message.success('添加成功');
this.getItemType(); this.getItemType();
} else { } else {
this.message.info(res.errMsg); this.message.error(res.errMsg);
} }
} }
); );
...@@ -271,17 +274,17 @@ export class BasiCheckComponent implements OnInit { ...@@ -271,17 +274,17 @@ export class BasiCheckComponent implements OnInit {
} }
//阈值--start //阈值--start
save(){ saveTrigger(){
const data = { const data = {
condition:'', condition:'',
faultCondition:'' faultCondition:''
}; };
if (this.conditionType == 'commonly') { //常规 if (this.conditionType == 'commonly') { //常规
this.conditionList.forEach(res => { this.conditionList.forEach(res => {
data.condition += '{' + this.validateForm.value.name + ':' + this.validateForm.value.key_ + '.last()}' + res.equal + '' + res.value ; data.condition += '{' + this.hostName + ':' + this.validateForm.value.key_ + '.last()}' + res.equal + '' + res.value ;
}); });
this.faultConditionList.forEach(res => { this.faultConditionList.forEach(res => {
data.faultCondition += '{' + this.validateForm.value.name + ':' + this.validateForm.value.key_ + '.last()}' + res.equal + '' + res.value; data.faultCondition += '{' + this.hostName + ':' + this.validateForm.value.key_ + '.last()}' + res.equal + '' + res.value;
}); });
} else { //高级 } else { //高级
data.condition = this.validateForm.value.condition_high; data.condition = this.validateForm.value.condition_high;
...@@ -301,9 +304,15 @@ export class BasiCheckComponent implements OnInit { ...@@ -301,9 +304,15 @@ export class BasiCheckComponent implements OnInit {
faultCondition:data.faultCondition, faultCondition:data.faultCondition,
condition:data.condition condition:data.condition
}; };
this.overAllSer.createTrigger(res).subscribe(res=>{ this.overAllSer.createTrigger(res).subscribe(
(response)=>{
}) if(response.errCode == 10000){
this.message.success("创建阈值成功");
}else{
this.message.error(response.errMsg);
}
}
)
} }
//2.修改阈值 //2.修改阈值
......
...@@ -164,7 +164,7 @@ ...@@ -164,7 +164,7 @@
<span (click)="showBasicEditModal(item)">添加资源</span> <span (click)="showBasicEditModal(item)">添加资源</span>
</ng-container> </ng-container>
<ng-container *ngIf="item.level"> <ng-container *ngIf="item.level">
<span (click)="showBasicCheckModal(item.hostid)">添加监测点</span> <span (click)="showBasicCheckModal(item.hostid,item.host)">添加监测点</span>
<span (click)="editBasicModal(item)">编辑</span> <span (click)="editBasicModal(item)">编辑</span>
<span (click)="showDeleteConfirm(item)">删除</span> <span (click)="showDeleteConfirm(item)">删除</span>
<nz-dropdown [nzTrigger]="'click'" class="table-dropdown"> <nz-dropdown [nzTrigger]="'click'" class="table-dropdown">
...@@ -265,7 +265,7 @@ ...@@ -265,7 +265,7 @@
<span (click)="showDeleteGroupConfirm(item)">删除</span> <span (click)="showDeleteGroupConfirm(item)">删除</span>
</ng-container> </ng-container>
<ng-container *ngIf="item.level"> <ng-container *ngIf="item.level">
<span (click)="showBasicCheckModal(item.hostid)">添加监测点</span> <span (click)="showBasicCheckModal(item.hostid,item.host)">添加监测点</span>
<span (click)="editBasicModal(item)">编辑</span> <span (click)="editBasicModal(item)">编辑</span>
<span (click)="showDeleteConfirm(item)">删除</span> <span (click)="showDeleteConfirm(item)">删除</span>
<nz-dropdown [nzTrigger]="'click'" class="table-dropdown"> <nz-dropdown [nzTrigger]="'click'" class="table-dropdown">
...@@ -353,7 +353,7 @@ ...@@ -353,7 +353,7 @@
</ng-container> </ng-container>
</td> </td>
<td class="handle"> <td class="handle">
<span (click)="showBasicCheckModal(item.hostid)">添加监测点</span> <span (click)="showBasicCheckModal(item.hostid,item.host)">添加监测点</span>
<span (click)="editBasicModal(item)">编辑</span> <span (click)="editBasicModal(item)">编辑</span>
<span (click)="showDeleteConfirm(item)">删除</span> <span (click)="showDeleteConfirm(item)">删除</span>
<nz-dropdown [nzTrigger]="'click'" class="table-dropdown"> <nz-dropdown [nzTrigger]="'click'" class="table-dropdown">
......
...@@ -207,8 +207,8 @@ export class BasicComponent implements OnInit { ...@@ -207,8 +207,8 @@ export class BasicComponent implements OnInit {
} }
//添加监测点 //添加监测点
showBasicCheckModal(hostid) { showBasicCheckModal(hostid,host) {
this.smartCheck.showAddModal(hostid); this.smartCheck.showAddModal(hostid,host);
} }
//列表 //列表
......
...@@ -300,12 +300,12 @@ export class OverAllService { ...@@ -300,12 +300,12 @@ export class OverAllService {
} }
//创建触发器 //创建触发器
createTrigger(data){ createTrigger(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/item/createItemTrigger',data); return this.http.post(SERVER_API_URL + '/item/createItemTrigger',data);
} }
//修改触发器 //修改触发器
updateTrigger(data){ updateTrigger(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/item/updateItemTrigger',data); return this.http.post(SERVER_API_URL + '/item/updateItemTrigger',data);
} }
......
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