Commit 071aee01 authored by wangqinghua's avatar wangqinghua

update

parent ce253d58
......@@ -95,6 +95,7 @@ import {SelectGroupComponent} from './modal/select-group/select-group.component'
import {ModifyPasswordComponent} from './modal/modify-password/modify-password.component';
import {FullScreenComponent} from './modal/full-screen/full-screen.component';
import {LookRoleComponent} from './look-role/look-role.component';
import {ThresholdComponent} from './modal/threshold/threshold.component';
@NgModule({
imports: [
......@@ -192,6 +193,7 @@ import {LookRoleComponent} from './look-role/look-role.component';
FullScreenComponent,
LookPlanComponent,
LookRoleComponent,
ThresholdComponent,
],
providers:[
OverAllService,
......
<section>
<nz-modal [nzWidth]="880" [nzFooter]="null" [(nzVisible)]="isCheck" [nzTitle]="title" (nzOnCancel)="handleCheckCancel()"
<nz-modal [nzWidth]="880" [(nzVisible)]="isCheck" [nzTitle]="title" (nzOnCancel)="handleCheckCancel()"
(nzOnOk)="handleCheckOk()">
<nz-tabset [nzSelectedIndex]="tabNum" style="padding-bottom: 25px;min-height: 500px">
<nz-tab nzTitle="基本属性" nzDisabled="true">
<form [formGroup]="validateForm" nz-form>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired nzFor="checkName">监测点名称</nz-form-label>
......@@ -102,15 +98,6 @@
<button nz-button nzType="primary" (click)="showTypeModal()">新建分类</button>
</nz-form-control>
</nz-form-item>
<!--<nz-form-item>-->
<!--<nz-form-label [nzSpan]="6" nzRequired nzFor="formula">使用自定义倍数</nz-form-label>-->
<!--<nz-form-control [nzSpan]="14">-->
<!--<input id="formula" name="formula" type="text" placeholder="输入倍数" nz-input-->
<!--formControlName="formula">-->
<!--<nz-form-explain *ngIf="validateForm.get('formula').dirty && validateForm.get('formula').errors">请输入自定义倍数!</nz-form-explain>-->
<!--</nz-form-control>-->
<!--</nz-form-item>-->
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired nzFor="delay">数据更新间隔</nz-form-label>
<nz-form-control [nzSpan]="14">
......@@ -145,109 +132,7 @@
<!--</nz-form-control>-->
<!--</nz-form-item>-->
</form>
<div class="modal-footer-btn">
<button nz-button (click)="handleCheckOk()" nzType="primary">下一步</button>
</div>
</nz-tab>
<nz-tab nzTitle="阈值设置" nzDisabled="true">
<nz-form-item nzFlex>
<nz-form-control [nzOffset]="4" [nzSpan]="14">
<nz-radio-group [(ngModel)]="conditionType">
<label nz-radio-button nzValue="commonly"><span>常规</span></label>
<label nz-radio-button nzValue="high"><span>高级</span></label>
</nz-radio-group>
</nz-form-control>
</nz-form-item>
<ng-container *ngIf="conditionType == 'commonly'">
<nz-form-item class="form-select">
<nz-form-control class="form-select" >
<div nz-row [nzGutter]="12">
<nz-form-control nz-col [nzPush]="3" [nzSpan]="6">
<button nz-button nzType="primary" nzSize="small" (click)="addFault()">添加条件</button>
<span>危险阈值</span>
</nz-form-control>
</div>
<div nz-row [nzGutter]="12" *ngFor="let fault of faultConditionList;let i = index;" >
<nz-form-control nz-col [nzSpan]="3"></nz-form-control>
<nz-form-control nz-col [nzSpan]="5">
<nz-select name="interfaces_main" nzPlaceHolder="选择接口类型" [(ngModel)]="fault.and" *ngIf="i>0">
<nz-option nzValue=" and " nzLabel="并且"></nz-option>
<nz-option nzValue=" or " nzLabel="或"></nz-option>
</nz-select>
</nz-form-control>
<nz-form-control nz-col [nzSpan]="4">
<button class="tag-button" nz-button nzType="default">返回值</button>
</nz-form-control>
<nz-form-control nz-col [nzSpan]="5">
<nz-select name="interfaces_main" nzPlaceHolder="选择接口类型" [(ngModel)]="fault.equal">
<nz-option nzValue="=" nzLabel="="></nz-option>
<nz-option nzValue=">" nzLabel=">"></nz-option>
<nz-option nzValue="<" nzLabel="<"></nz-option>
</nz-select>
</nz-form-control>
<nz-form-control nz-col [nzSpan]="5">
<input type="text" placeholder="值" nz-input name="value" [(ngModel)]="fault.value">
</nz-form-control>
<nz-form-control nz-col [nzSpan]="2">
<button nz-button nzType="primary" (click)="deleteFault(i)"><i class="anticon anticon-close-circle-o"></i></button>
</nz-form-control>
</div>
</nz-form-control>
</nz-form-item>
<nz-form-item class="form-select" >
<nz-form-control class="form-select" >
<div nz-row [nzGutter]="12">
<nz-form-control nz-col [nzPush]="3" [nzSpan]="6">
<button nz-button nzType="primary" nzSize="small" (click)="addcondition()">添加条件</button>
<span>故障阈值</span>
</nz-form-control>
</div>
<div nz-row [nzGutter]="12" *ngFor="let fault of conditionList;let i = index;">
<nz-form-control nz-col [nzSpan]="3"></nz-form-control>
<nz-form-control nz-col [nzSpan]="5">
<nz-select name="interfaces_main" [(ngModel)]="fault.and" *ngIf="i>0">
<nz-option nzValue=" and " nzLabel="并且"></nz-option>
<nz-option nzValue=" or " nzLabel="或"></nz-option>
</nz-select>
</nz-form-control>
<nz-form-control nz-col [nzSpan]="4">
<button class="tag-button" nz-button nzType="default">返回值</button>
</nz-form-control>
<nz-form-control nz-col [nzSpan]="5">
<nz-select name="interfaces_main" nzPlaceHolder="选择接口类型" [(ngModel)]="fault.equal">
<nz-option nzValue="=" nzLabel="="></nz-option>
<nz-option nzValue=">" nzLabel=">"></nz-option>
<nz-option nzValue="<" nzLabel="<"></nz-option>
</nz-select>
</nz-form-control>
<nz-form-control nz-col [nzSpan]="5">
<input type="text" placeholder="值" nz-input name="value" [(ngModel)]="fault.value">
</nz-form-control>
<nz-form-control nz-col [nzSpan]="2">
<button nz-button nzType="primary" (click)="deleteCondition(i)"><i class="anticon anticon-close-circle-o"></i></button>
</nz-form-control>
</div>
</nz-form-control>
</nz-form-item>
</ng-container>
<ng-container *ngIf="conditionType == 'high'">
<nz-form-item nzFlex>
<nz-form-control [nzOffset]="4" [nzSpan]="14">
<p>危险阈值</p>
<textarea rows="4" nz-input [(ngModel)]="triggerObj.condition"></textarea>
<p>故障阈值</p>
<textarea rows="4" nz-input [(ngModel)]="triggerObj.faultCondition"></textarea>
</nz-form-control>
</nz-form-item>
</ng-container>
<div class="modal-footer-btn">
<button nz-button (click)="saveTrigger()" nzType="primary">完成</button>
</div>
</nz-tab>
</nz-tabset>
</nz-modal>
</section>
</nz-modal>
<!--键值查询-->
<smart-basic-key (keyValue)="getKey($event)" #basicKey></smart-basic-key>
......
......@@ -44,21 +44,13 @@ export class BasiCheckComponent implements OnInit {
validateForm: FormGroup;
checkList; //监测点分类
interval; //间隔时长
conditionType = 'commonly';
faultConditionList = [
]; //危险阀值list
conditionList = [
]; //故障list
tabNum: number;
triggerObj = {
condition: '',
faultCondition: '',
itemName: ''
};
triggerConditionId;
triggerFaultConditionId;
constructor(private overAllSer: OverAllService, private fb: FormBuilder,
private message: NzMessageService) {
......@@ -142,56 +134,6 @@ export class BasiCheckComponent implements OnInit {
});
}
this.validateForm.patchValue(data);
data.triggers.forEach((value) => {
let str = value.expression;
let equal = [];
let arr = [];
let con = '';
let a = str.split(' ');
a.forEach((e) => { // 符号数组
let index1 = e.indexOf('}');
if (e == 'and' || e == 'or') {
equal.push(e);
}
if (index1 > -1) {
let f = e.substring(index1 + 1, e.length);
con += '{' + this.hostName + ':' + this.validateForm.value.key_ + '.last()}' + f + ' ';
} else {
con += e + ' ';
}
});
let c = str.replace(/and/g, '').replace(/or/g, '').split(' ');
c.forEach((val, index) => {
let index1 = val.indexOf('}');
let d = val.substring(index1 + 1, val.length);
let data;
if (index > 0) {
data = {
and: ' ' + equal[index - 1] + ' ',
equal: d[0],
value: d.substring(1, c.length),
};
} else {
data = {
equal: d[0],
value: d.substring(1, c.length),
};
}
arr.push(data);
});
if (value.priority == 2 || value.priority == 3) { //危险
this.faultConditionList = arr;
this.triggerObj.condition = con;
this.triggerConditionId = value.triggerid;
}
if (value.priority == 4 || value.priority == 5) { //故障
this.conditionList = arr;
this.triggerObj.faultCondition = con;
this.triggerFaultConditionId = value.triggerid;
}
});
}
);
......@@ -244,6 +186,7 @@ export class BasiCheckComponent implements OnInit {
this.message.success('创建监测点成功');
this.done.emit();
this.tabNum = 1;
this.isCheck = false;
} else {
this.message.error(res.errMsg);
}
......@@ -263,6 +206,7 @@ export class BasiCheckComponent implements OnInit {
this.message.success('修改监测点成功');
this.done.emit();
this.tabNum = 1;
this.isCheck = false;
} else {
this.message.error(res.errMsg);
}
......@@ -306,148 +250,10 @@ export class BasiCheckComponent implements OnInit {
);
}
//危险add
addFault() {
const demo = {
and: ' and ',
equal: '=',
value: '',
};
this.faultConditionList.push(demo);
}
//故障add
addcondition() {
const demo = {
and: ' and ',
equal: '=',
value: '',
};
this.conditionList.push(demo);
}
//危险delete
deleteFault(index) {
this.faultConditionList.splice(index, 1);
}
//故障delete
deleteCondition(index) {
this.conditionList.splice(index, 1);
}
getKey(keyValue): void {
const d = {
key_: keyValue
};
this.validateForm.patchValue(d);
}
//阈值--start
saveTrigger() {
const data = {
condition: '',
faultCondition: ''
};
if (this.conditionType == 'commonly') { //常规
this.conditionList.forEach(res => {
if(!res.and){
res.and = "";
}
data.condition += res.and + '{' + this.hostName + ':' + this.validateForm.value.key_ + '.last()}' + res.equal + '' + res.value ;
});
this.faultConditionList.forEach(res => {
if(!res.and){
res.and = "";
}
data.faultCondition += res.and + '{' + this.hostName + ':' + this.validateForm.value.key_ + '.last()}' + res.equal + '' + res.value ;
});
} else { //高级
data.condition = this.triggerObj.condition;
data.faultCondition = this.triggerObj.faultCondition;
}
if(!this.checkFun()){
this.message.error("请输入阈值");
return false;
}
if(this.conditionList.length == 0 && this.faultConditionList.length == 0){
this.isCheck = false;
this.initForm();
return false;
}
if (this.title == '添加监测点') {
this.createTrigger(data);
}
if (this.title == '编辑监测点') {
this.updateTrigger(data);
}
}
//校验是否填值
checkFun(){
let error = true;
this.conditionList.map(e=>{
if(e.value.length > 0){
}else{
error = false;
}
});
this.faultConditionList.map(e=>{
if(e.value.length > 0){
console.log(e.value)
}else{
error = false;
}
});
return error;
}
//1.创建阈值
createTrigger(data) {
const res = {
itemName: this.validateForm.value.name,
faultCondition: data.faultCondition.substring(5,data.faultCondition.length),
condition: data.condition.substring(5,data.faultCondition.length)
};
this.overAllSer.createTrigger(res).subscribe(
(response) => {
if (response.errCode == 10000) {
this.message.success('创建阈值成功');
this.initForm();
this.isCheck = false;
} else {
this.message.error(response.errMsg);
}
}
);
}
//2.修改阈值
updateTrigger(data) {
const res = {
faultCondition: {
itemName: this.validateForm.value.name,
faultCondition: data.faultCondition,
triggerid: this.triggerFaultConditionId
},
condition: {
itemName: this.validateForm.value.name,
condition: data.condition,
triggerid: this.triggerConditionId
}
};
this.overAllSer.updateTrigger(res).subscribe(res => {
if (res.errCode == 10000) {
this.message.success('修改阈值成功');
this.initForm();
this.isCheck = false;
} else {
this.message.error(res.errMsg);
}
});
}
//阈值--end
}
<section>
<nz-modal [nzWidth]="880" [(nzVisible)]="isVisiable" [nzTitle]="title"
(nzOnCancel)="handleCheckCancel()"
(nzOnOk)="saveTrigger()">
<nz-form-item nzFlex>
<nz-form-control [nzOffset]="4" [nzSpan]="14">
<nz-radio-group [(ngModel)]="conditionType">
<label nz-radio-button nzValue="commonly"><span>常规</span></label>
<label nz-radio-button nzValue="high"><span>高级</span></label>
</nz-radio-group>
</nz-form-control>
</nz-form-item>
<ng-container *ngIf="conditionType == 'commonly'">
<nz-form-item class="form-select">
<nz-form-control class="form-select">
<div nz-row [nzGutter]="12">
<nz-form-control nz-col [nzPush]="3" [nzSpan]="6">
<button nz-button nzType="primary" nzSize="small" (click)="addcondition()">添加条件</button>
<span>危险阈值</span>
</nz-form-control>
</div>
<div nz-row [nzGutter]="12" *ngFor="let fault of conditionList;let i = index;">
<nz-form-control nz-col [nzSpan]="3"></nz-form-control>
<nz-form-control nz-col [nzSpan]="5">
<nz-select name="interfaces_main" nzPlaceHolder="选择接口类型" [(ngModel)]="fault.and"
*ngIf="i>0">
<nz-option nzValue=" and " nzLabel="并且"></nz-option>
<nz-option nzValue=" or " nzLabel="或"></nz-option>
</nz-select>
</nz-form-control>
<nz-form-control nz-col [nzSpan]="4">
<button class="tag-button" nz-button nzType="default">返回值</button>
</nz-form-control>
<nz-form-control nz-col [nzSpan]="5">
<nz-select name="interfaces_main" nzPlaceHolder="选择接口类型" [(ngModel)]="fault.equal">
<nz-option nzValue="=" nzLabel="="></nz-option>
<nz-option nzValue=">" nzLabel=">"></nz-option>
<nz-option nzValue="<" nzLabel="<"></nz-option>
</nz-select>
</nz-form-control>
<nz-form-control nz-col [nzSpan]="5">
<input type="text" placeholder="值" nz-input name="value" [(ngModel)]="fault.value">
</nz-form-control>
<nz-form-control nz-col [nzSpan]="2">
<button nz-button nzType="primary" (click)="deleteCondition(i)"><i style="color: #fff"
class="anticon anticon-close-circle-o"></i></button>
</nz-form-control>
</div>
</nz-form-control>
</nz-form-item>
<nz-form-item class="form-select">
<nz-form-control class="form-select">
<div nz-row [nzGutter]="12">
<nz-form-control nz-col [nzPush]="3" [nzSpan]="6">
<button nz-button nzType="primary" nzSize="small" (click)="addFault()">添加条件</button>
<span>故障阈值</span>
</nz-form-control>
</div>
<div nz-row [nzGutter]="12" *ngFor="let fault of faultConditionList;let i = index;">
<nz-form-control nz-col [nzSpan]="3"></nz-form-control>
<nz-form-control nz-col [nzSpan]="5">
<nz-select name="interfaces_main" [(ngModel)]="fault.and" *ngIf="i>0">
<nz-option nzValue=" and " nzLabel="并且"></nz-option>
<nz-option nzValue=" or " nzLabel="或"></nz-option>
</nz-select>
</nz-form-control>
<nz-form-control nz-col [nzSpan]="4">
<button class="tag-button" nz-button nzType="default">返回值</button>
</nz-form-control>
<nz-form-control nz-col [nzSpan]="5">
<nz-select name="interfaces_main" nzPlaceHolder="选择接口类型" [(ngModel)]="fault.equal">
<nz-option nzValue="=" nzLabel="="></nz-option>
<nz-option nzValue=">" nzLabel=">"></nz-option>
<nz-option nzValue="<" nzLabel="<"></nz-option>
</nz-select>
</nz-form-control>
<nz-form-control nz-col [nzSpan]="5">
<input type="text" placeholder="值" nz-input name="value" [(ngModel)]="fault.value">
</nz-form-control>
<nz-form-control nz-col [nzSpan]="2">
<button nz-button nzType="primary" (click)="deleteFault(i)"><i style="color: #fff"
class="anticon anticon-close-circle-o"></i></button>
</nz-form-control>
</div>
</nz-form-control>
</nz-form-item>
</ng-container>
<ng-container *ngIf="conditionType == 'high'">
<nz-form-item nzFlex>
<nz-form-control [nzOffset]="4" [nzSpan]="14">
<p>危险阈值</p>
<textarea rows="4" nz-input [(ngModel)]="triggerObj.condition"></textarea>
<p>故障阈值</p>
<textarea rows="4" nz-input [(ngModel)]="triggerObj.faultCondition"></textarea>
</nz-form-control>
</nz-form-item>
</ng-container>
</nz-modal>
</section>
import {Component, EventEmitter, OnInit, Output} from '@angular/core';
import {OverAllService} from '../../overAll/overAll.service';
import {FormBuilder} from '@angular/forms';
import {NzMessageService} from 'ng-zorro-antd';
@Component({
selector: 'smart-threshold',
templateUrl: './threshold.component.html',
styles: []
})
export class ThresholdComponent implements OnInit {
@Output() done = new EventEmitter<any>();
isVisiable = false;
title;
itemId; //监控项ID
hostName; //主机name
itemObj; //监控项对象
conditionType = 'commonly';
faultConditionList = [
]; //故障阈值
conditionList = [
]; //危险阈值
triggerConditionId;
triggerFaultConditionId;
triggerObj = {
condition: '',
faultCondition: '',
itemName: ''
};
constructor(private overAllSer: OverAllService, private fb: FormBuilder,
private message: NzMessageService) {
}
ngOnInit() {
}
initForm(){
this.faultConditionList = [
]; //危险阀值list
this.conditionList = [
]; //故障list
this.triggerObj = {
condition: '',
faultCondition: '',
itemName: ''
};
}
//危险add
addFault() {
const demo = {
and: ' and ',
equal: '=',
value: '',
};
this.faultConditionList.push(demo);
}
//危险add
addcondition() {
const demo = {
and: ' and ',
equal: '=',
value: '',
};
this.conditionList.push(demo);
}
//故障delete
deleteFault(index) {
this.faultConditionList.splice(index, 1);
}
//危险delete
deleteCondition(index) {
this.conditionList.splice(index, 1);
}
//新增
showAddModal(title,itemId,hostName) {
this.title = title;
this.itemId = itemId;
this.isVisiable = true;
this.hostName = hostName;
this.overAllSer.findItemDetail(this.itemId).subscribe(
(res)=>{
this.itemObj = res.data[0];
}
)
}
//编辑
showEditModal(title,itemId,hostId,hostName) {
this.title = title;
this.itemId = itemId;
this.isVisiable = true;
this.hostName = hostName;
this.overAllSer.findItemDetail(this.itemId).subscribe(
(res) => {
this.itemObj = res.data[0];
this.itemObj.triggers.forEach((value) => {
let str = value.expression;
let equal = [];
let arr = [];
let con = '';
let a = str.split(' ');
a.forEach((e) => { // 符号数组
let index1 = e.indexOf('}');
if (e == 'and' || e == 'or') {
equal.push(e);
}
if (index1 > -1) {
let f = e.substring(index1 + 1, e.length);
con += '{' + this.hostName + ':' + this.itemObj.key_ + '.last()}' + f + ' ';
} else {
con += e + ' ';
}
});
let c = str.replace(/and/g, '').replace(/or/g, '').split(' ');
c.forEach((val, index) => {
let index1 = val.indexOf('}');
let d = val.substring(index1 + 1, val.length);
let data;
if (index > 0) {
data = {
and: ' ' + equal[index - 1] + ' ',
equal: d[0],
value: d.substring(1, d.length),
};
} else {
data = {
equal: d[0],
value: d.substring(1, d.length),
};
}
arr.push(data);
});
if (value.priority == 2 || value.priority == 3) { //危险
this.conditionList = arr;
this.triggerObj.condition = con;
this.triggerConditionId = value.triggerid;
}
if (value.priority == 4 || value.priority == 5) { //故障
this.faultConditionList = arr;
this.triggerObj.faultCondition = con;
this.triggerFaultConditionId = value.triggerid;
}
});
console.log(this.faultConditionList);
console.log(this.conditionList);
}
);
}
//阈值--start
saveTrigger() {
const data = {
condition: '',
faultCondition: ''
};
if (this.conditionType == 'commonly') { //常规
this.conditionList.forEach(res => {
if(!res.and){
res.and = "";
}
data.condition += res.and + '{' + this.hostName + ':' + this.itemObj.key_ + '.last()}' + res.equal + '' + res.value ;
});
this.faultConditionList.forEach(res => {
if(!res.and){
res.and = "";
}
data.faultCondition += res.and + '{' + this.hostName + ':' + this.itemObj.key_ + '.last()}' + res.equal + '' + res.value ;
});
} else { //高级
data.condition = this.triggerObj.condition;
data.faultCondition = this.triggerObj.faultCondition;
}
if(!this.checkFun()){
this.message.error("请输入阈值");
return false;
}
if(this.conditionList.length == 0 && this.faultConditionList.length == 0){
this.isVisiable = false;
this.initForm();
return false;
}
if (this.title == '添加阈值') {
this.createTrigger(data);
}
if (this.title == '编辑阈值') {
this.updateTrigger(data);
}
}
//校验是否填值
checkFun(){
let error = true;
this.conditionList.map(e=>{
if(e.value.length > 0){
}else{
error = false;
}
});
this.faultConditionList.map(e=>{
if(e.value.length > 0){
console.log(e.value)
}else{
error = false;
}
});
return error;
}
//1.创建阈值
createTrigger(data) {
const res = {
itemName: this.itemObj.name,
faultCondition: data.faultCondition,
condition: data.condition
};
this.overAllSer.createTrigger(res).subscribe(
(response) => {
if (response.errCode == 10000) {
this.message.success('创建阈值成功');
this.initForm();
this.isVisiable = false;
} else {
this.message.error(response.errMsg);
}
}
);
}
//2.修改阈值
updateTrigger(data) {
const res = {
faultCondition: { //故障阈值
itemName: this.itemObj.name,
condition: data.faultCondition,
triggerid: this.triggerFaultConditionId
},
condition: { //危险阈值
itemName: this.itemObj.name,
condition: data.condition,
triggerid: this.triggerConditionId
}
};
this.overAllSer.updateTrigger(res).subscribe(res => {
if (res.errCode == 10000) {
this.message.success('修改阈值成功');
this.initForm();
this.isVisiable = false;
} else {
this.message.error(res.errMsg);
}
});
}
//取消
handleCheckCancel(){
this.isVisiable = false;
this.initForm();
}
}
......@@ -156,7 +156,7 @@
<tr>
<th nzWidth="250px">监测点名称</th>
<th >最新数据</th>
<th nzWidth="250px">最新数据时间</th>
<th nzWidth="200px">最新数据时间</th>
<th>监测点分类</th>
<th>更新时间间隔</th>
<th>图表</th>
......@@ -176,13 +176,16 @@
<td>{{data.itemType}}</td>
<td>{{data.delay}}</td>
<td class="main-color cursor main-color">
<span (click)="showImageModal(data)">图表</span>
<span *ngIf="data.value_type == 0 || data.value_type == 3" (click)="showImageModal(data)">图表</span>
</td>
<td class="handle cursor">
<td class="handle cursor main-color">
<ng-container *ngIf="!data.flags">
<span (click)="showEditModal(data)">编辑监测点</span>
<span (click)="deleteCheckItem(data)">删除监测点</span>
<span (click)="deleteCheckItem(data)">添加阈值</span>
<span (click)="deleteCheckItem(data)">编辑阈值</span>
<br>
<span *ngIf="data.triggerCount == 0" (click)="showAddThresholdModal(data)">添加阈值</span>
<span *ngIf="data.triggerCount > 0" (click)="showEditThresholdModal(data)">编辑阈值</span>
</ng-container>
<span *ngIf="data.status == 0 && data.state==0" (click)="updateItem(data.itemid,1)" style="color: red">停止</span>
<span *ngIf="data.status == 0 && data.state==1" (click)="updateItem(data.itemid,1)" style="color: red">不支持的</span>
<span *ngIf="data.status == 1 && data.state==0" (click)="updateItem(data.itemid,0)" style="color: green">启用</span>
......@@ -201,9 +204,12 @@
</div>
</nz-spin>
<!--添加监测点-->
<!--监测点-->
<smart-basi-check #smartCheck (done)="getList()"></smart-basi-check>
<!--阈值-->
<smart-threshold #smartThreshold (done)="getList()"></smart-threshold>
<nz-modal [nzFooter]="null" nzWidth="1080" [(nzVisible)]="isGrapha" nzTitle="" (nzOnCancel)="handleImageCancel()">
<div class="releative">
<div class="time-select">
......
......@@ -8,6 +8,7 @@ import {NzModalService} from 'ng-zorro-antd';
import {color, pageSize} from '../../../app.constants';
import {WarnListComponent} from '../../../modal/warn-list/warn-list.component';
import {DatePipe} from '@angular/common';
import {ThresholdComponent} from '../../../modal/threshold/threshold.component';
@Component({
selector: 'jhi-basic-detail',
......@@ -40,6 +41,7 @@ import {DatePipe} from '@angular/common';
})
export class BasicDetailComponent implements OnInit, AfterViewInit {
@ViewChild('smartCheck') smartCheck: BasiCheckComponent;
@ViewChild('smartThreshold') smartThreshold: ThresholdComponent;
@ViewChild('thirdTabs') thirdTabs: ElementRef;
@ViewChild('warnList') warnList: WarnListComponent;
@ViewChild('colorEle') colorEle:ElementRef;
......@@ -111,6 +113,8 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
warn_totalNum;
warn_pageNum = 1;
searchName;
validateForm: FormGroup;
isSpinning; //刷新
......@@ -635,28 +639,20 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
this.smartCheck.showEditModal(this.hostId,item.itemid,this.realName);
}
//添加or编辑监测点 之后
getList(){
this.getCheckList();
this.findItemType();
}
handleCheckCancel() {
this.isCheck = false;
//添加阈值
showAddThresholdModal(item){
this.smartThreshold.showAddModal("添加阈值",item.itemid,this.realName);
}
showKeyModal() {
this.isKey = true;
this.keyTypeChange();
//编辑阈值
showEditThresholdModal(item){
this.smartThreshold.showEditModal("编辑阈值",item.itemid,this.hostId,this.realName);
}
//键值类型变更
keyTypeChange() {
this.overAllSer.zabbixKey(this.keyType).subscribe(
(res) => {
this.keyList = res.data;
}
);
//添加or编辑监测点 之后
getList(){
this.getCheckList();
this.findItemType();
}
handleKeyCancel() {
......@@ -677,7 +673,8 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
obj:{
applicationid: this.applicationId,
hostid: this.hostId,
priorityName:this.changeStates
priorityName:this.changeStates,
name:this.searchName
}
};
this.overAllSer.findCheckByType(data).subscribe(
......
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'smart-threshold',
templateUrl: './threshold.component.html',
styles: []
})
export class ThresholdComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
......@@ -161,7 +161,22 @@ export class ChildAssetsComponent implements OnInit {
let title;
title = this.selectList.length == 0? "确定导出所有的资产?":"确定导出所选择的资产";
this.commonSer.confirmThing("导出",title,()=>{
const data = {
type:this.childId,
ids: this.selectList.map(e=>{
return e.id;
}),
query_name:null
};
this.workSer.getExportUrl(data).subscribe(
(res)=>{
this.workSer.downloadTemplate("inventory",res.data).subscribe(
(data)=>{
this.commonSer.downloadFile("文件",data)
}
)
}
)
});
}
}
......@@ -194,4 +194,10 @@ export class WorkService {
return this.http.get( SERVER_API_URL + "/api/download/file/" + pararmsType +"/"+ paramsId,{responseType: 'blob'});
}
/**
* 批量下载资产文件
*/
getExportUrl(data): Observable<any>{
return this.http.post( SERVER_API_URL + "/inventory/getExportUrl" ,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