Commit a03d9f45 authored by wangqinghua's avatar wangqinghua

update

parent 73ef8491
......@@ -164,7 +164,7 @@
<nz-form-label [nzSpan]="3" > <span *ngIf="i == 0">危险阈值</span> </nz-form-label>
<nz-form-control [nzSpan]="18" class="form-select">
<div nz-row [nzGutter]="12">
<nz-form-control nz-col [nzSpan]="4">
<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>
......@@ -173,7 +173,7 @@
<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]="3">
<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>
......@@ -195,7 +195,7 @@
<nz-form-label [nzSpan]="3"><span *ngIf="i == 0;">故障阈值</span></nz-form-label>
<nz-form-control [nzSpan]="18" class="form-select">
<div nz-row [nzGutter]="12">
<nz-form-control nz-col [nzSpan]="4">
<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>
......@@ -204,7 +204,7 @@
<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]="3">
<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>
......
......@@ -21,8 +21,9 @@ import {NewTypeComponent} from '../new-type/new-type.component';
background-color: #fff;
border-color: #d9d9d9;
}
:host ::ng-deep .ant-tabs-nav .ant-tabs-tab-disabled{
color: rgba(0,0,0,.65);
:host ::ng-deep .ant-tabs-nav .ant-tabs-tab-disabled {
color: rgba(0, 0, 0, .65);
}
`
]
......@@ -39,7 +40,7 @@ export class BasiCheckComponent implements OnInit {
itemId; //监控项id
interfaceList: any[];
valueMapList = [];
validateForm:FormGroup;
validateForm: FormGroup;
checkList; //监测点分类
interval; //间隔时长
conditionType = 'commonly';
......@@ -57,13 +58,14 @@ export class BasiCheckComponent implements OnInit {
value: '',
}
]; //故障list
tabNum:number;
tabNum: number;
triggerObj = {
condition:'',
faultCondition:'',
itemName:''
condition: '',
faultCondition: '',
itemName: ''
};
triggerId = [];
triggerConditionId;
triggerFaultConditionId;
constructor(private overAllSer: OverAllService, private fb: FormBuilder,
private message: NzMessageService) {
......@@ -74,34 +76,34 @@ export class BasiCheckComponent implements OnInit {
this.getValuemap();
}
initForm(){
initForm() {
this.tabNum = 0;
this.validateForm = this.fb.group({
hostid:[this.hostId],
name:[null,[Validators.required]],
interfaceid:[null,[Validators.required]],
key_:[null,[Validators.required]],
value_type:[null,[Validators.required]],
type:[null,[Validators.required]],
units:[null],
formula:[null,[Validators.required]],
history:['3600'],
trends:[null],
valuemapid:['0'],
delay:[null,[Validators.required]],
snmp_oid:[null],
snmp_community:['public'],
applicationids:[null],
hostid: [this.hostId],
name: [null, [Validators.required]],
interfaceid: [null, [Validators.required]],
key_: [null, [Validators.required]],
value_type: [null, [Validators.required]],
type: [null, [Validators.required]],
units: [null],
formula: [null, [Validators.required]],
history: ['3600'],
trends: [null],
valuemapid: ['0'],
delay: [null, [Validators.required]],
snmp_oid: [null],
snmp_community: ['public'],
applicationids: [null],
});
this.triggerObj = {
condition:'',
faultCondition:'',
itemName:''
condition: '',
faultCondition: '',
itemName: ''
};
}
//新增
showAddModal(hostId,hostName){
showAddModal(hostId, hostName) {
this.title = '添加监测点';
this.isCheck = true;
this.hostId = hostId;
......@@ -116,21 +118,21 @@ export class BasiCheckComponent implements OnInit {
}
//映射值
getValuemap(){
getValuemap() {
this.overAllSer.findValuemap().subscribe(
(res)=>{
if(res.errCode == 10000){
(res) => {
if (res.errCode == 10000) {
this.valueMapList = res.data;
}else{
} else {
this.message.error(res.errMsg);
}
}
)
);
}
//编辑
showEditModal(hostId,id,hostName){
this.title = "编辑监测点";
showEditModal(hostId, id, hostName) {
this.title = '编辑监测点';
this.hostId = hostId;
this.isCheck = true;
this.itemId = id;
......@@ -139,55 +141,56 @@ export class BasiCheckComponent implements OnInit {
(res) => {
const data = res.data[0];
data.type += '';
data.interfaceid += "";
data.value_type += "";
data.interfaceid += '';
data.value_type += '';
this.validateForm.patchValue(data);
data.triggers.forEach( (value)=> {
this.triggerId.push(value.triggerid);
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'){
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 + " ";
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 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){
if (index > 0) {
data = {
and: " "+equal[index-1]+" ",
and: ' ' + equal[index - 1] + ' ',
equal: d[0],
value: d.substring(1,c.length),
}
}else{
value: d.substring(1, c.length),
};
} else {
data = {
equal: d[0],
value: d.substring(1,c.length),
}
value: d.substring(1, c.length),
};
}
arr.push(data);
});
if(value.priority == 2 || value.priority == 3){ //危险
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){ //故障
if (value.priority == 4 || value.priority == 5) { //故障
this.conditionList = arr;
this.triggerObj.faultCondition = con;
this.triggerFaultConditionId = value.triggerid;
}
});
......@@ -218,32 +221,32 @@ export class BasiCheckComponent implements OnInit {
//添加
handleCheckOk() {
for(let i in this.validateForm.controls) {
this.validateForm.controls[ i ].markAsDirty();
this.validateForm.controls[ i ].updateValueAndValidity();
for (let i in this.validateForm.controls) {
this.validateForm.controls[i].markAsDirty();
this.validateForm.controls[i].updateValueAndValidity();
}
if(this.validateForm.invalid){
this.message.error("请输入必填信息");
if (this.validateForm.invalid) {
this.message.error('请输入必填信息');
return false;
}
this.validateForm.value.applicationids = [this.validateForm.value.applicationids];
this.validateForm.value.hostid = this.hostId;
if(this.title == "添加监测点"){
if (this.title == '添加监测点') {
this.create();
}
if(this.title == "编辑监测点"){
if (this.title == '编辑监测点') {
this.update();
}
}
create(){
create() {
this.overAllSer.create(this.validateForm.value).subscribe(
(res) => {
if (res.errCode == 10000) {
this.message.success("创建监测点成功");
this.message.success('创建监测点成功');
this.done.emit();
this.tabNum = 1;
}else{
} else {
this.message.error(res.errMsg);
}
},
......@@ -254,15 +257,15 @@ export class BasiCheckComponent implements OnInit {
}
//修改监控项
update(){
this.validateForm.addControl('itemid',new FormControl(this.itemId));
update() {
this.validateForm.addControl('itemid', new FormControl(this.itemId));
this.overAllSer.itemUpdata(this.validateForm.value).subscribe(
(res) => {
if (res.errCode == 10000) {
this.message.success("修改监测点成功");
this.message.success('修改监测点成功');
this.done.emit();
this.tabNum = 1;
}else{
} else {
this.message.error(res.errMsg);
}
},
......@@ -337,75 +340,88 @@ export class BasiCheckComponent implements OnInit {
getKey(keyValue): void {
const d = {
key_:keyValue
}
key_: keyValue
};
this.validateForm.patchValue(d);
}
//阈值--start
saveTrigger(){
saveTrigger() {
const data = {
condition:'',
faultCondition:''
condition: '',
faultCondition: ''
};
if (this.conditionType == 'commonly') { //常规
this.conditionList.forEach(res => {
data.condition += '{' + this.hostName + ':' + this.validateForm.value.key_ + '.last()}' + res.equal + '' + res.value + res.and;
if(!res.and){
res.and = "";
}
console.log(res);
data.condition += res.and + '{' + this.hostName + ':' + this.validateForm.value.key_ + '.last()}' + res.equal + '' + res.value ;
});
this.faultConditionList.forEach(res => {
data.faultCondition += '{' + this.hostName + ':' + this.validateForm.value.key_ + '.last()}' + res.equal + '' + res.value + res.and;
if(!res.and){
res.and = "";
}
data.faultCondition += res.and + '{' + this.hostName + ':' + this.validateForm.value.key_ + '.last()}' + res.equal + '' + res.value ;
});
data.condition = data.condition.substring(0,data.condition.length -4);
data.faultCondition = data.faultCondition.substring(0,data.faultCondition.length -4);
} else { //高级
data.condition = this.triggerObj.condition;
data.faultCondition = this.triggerObj.faultCondition;
}
if(this.title == "添加监测点"){
if (this.title == '添加监测点') {
this.createTrigger(data);
}
if(this.title == "编辑监测点"){
if (this.title == '编辑监测点') {
this.updateTrigger(data);
}
}
//1.创建阈值
createTrigger(data){
createTrigger(data) {
const res = {
itemName:this.validateForm.value.name,
faultCondition:data.faultCondition,
condition:data.condition
itemName: this.validateForm.value.name,
faultCondition: data.faultCondition,
condition: data.condition
};
this.overAllSer.createTrigger(res).subscribe(
(response)=>{
if(response.errCode == 10000){
this.message.success("创建阈值成功");
(response) => {
if (response.errCode == 10000) {
this.message.success('创建阈值成功');
this.initForm();
this.isCheck = false;
}else{
} else {
this.message.error(response.errMsg);
}
}
)
);
}
//2.修改阈值
updateTrigger(data){
updateTrigger(data) {
const res = {
triggerid:this.triggerId,
itemName:this.validateForm.value.name,
faultCondition:data.faultCondition,
condition:data.condition
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.overAllSer.updateTrigger(res).subscribe(res => {
if (res.errCode == 10000) {
this.message.success('修改阈值成功');
this.initForm();
this.isCheck = false;
}else{
} else {
this.message.error(res.errMsg);
}
})
});
}
//阈值--end
}
......@@ -409,7 +409,7 @@
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired nzFor="equipmentTypeid">资产名称
</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="资产名称" name="serialnoA">
<input nz-input placeholder="资产名称" name="name" [(ngModel)]="validateForm.name">
</nz-form-control>
</nz-form-item>
</div>
......@@ -439,7 +439,7 @@
<nz-form-item nzFlex>
<nz-form-label [nzSpan]="6" nzFor="serialnoA">品牌</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="品牌">
<input nz-input placeholder="品牌" name="invertoryname" [(ngModel)]="validateForm.inventoryExtend.invertoryname">
</nz-form-control>
</nz-form-item>
</div>
......@@ -459,7 +459,7 @@
<nz-form-item nzFlex>
<nz-form-label [nzSpan]="6" >型号</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="型号">
<input nz-input placeholder="型号" name="serialnoA" [(ngModel)]="validateForm.inventoryExtend.serialnoA">
</nz-form-control>
</nz-form-item>
</div>
......@@ -479,7 +479,7 @@
<nz-form-item nzFlex>
<nz-form-label [nzSpan]="6" >MAC地址</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="MAC地址">
<input nz-input placeholder="MAC地址" name="mac" [(ngModel)]="validateForm.inventoryExtend.mac">
</nz-form-control>
</nz-form-item>
</div>
......@@ -498,7 +498,7 @@
<nz-form-item nzFlex>
<nz-form-label [nzSpan]="6">维保到期</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="维保到期" >
<input nz-input placeholder="维保到期" name="maintenanceExpiration" [(ngModel)]="validateForm.inventoryExtend.maintenanceExpiration" >
</nz-form-control>
</nz-form-item>
</div>
......@@ -518,7 +518,7 @@
<nz-form-item nzFlex>
<nz-form-label [nzSpan]="6">存放地点</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input placeholder="存放地点">
<input nz-input placeholder="存放地点" [(ngModel)]="validateForm.inventoryExtend.storageLocation">
</nz-form-control>
</nz-form-item>
</div>
......
......@@ -399,7 +399,8 @@ export class BasicEditComponent implements OnInit {
invertoryname: null,
mac: null,
storageLocation: null,
maintenanceExpiration: null
maintenanceExpiration: null,
name:null
},
templates: null,
name: null,
......
......@@ -113,7 +113,7 @@
</nz-collapse>
</div>
<div nz-row>
<nz-table #basicTable [nzData]="dataSet">
<nz-table #basicTable [nzData]="dataSet" [nzFrontPagination]="false" [nzTotal]="totalNumInOut" [nzPageIndex]="pageNum" [nzPageSize]="pageCount" (nzPageIndexChange)="changeInoutInfo($event)" [nzLoading]="inOutLoading">
<thead>
<tr>
<th>状态</th>
......@@ -153,7 +153,6 @@
<th nzWidth="250px">最新数据时间</th>
<th>监测点分类</th>
<th>更新时间间隔</th>
<!--<th>来源</th>-->
<th>图表</th>
<th>操作</th>
</tr>
......
......@@ -94,7 +94,9 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
//进出口流量-分页
pageNum = 1;
pageCount = 5;
totalNumInOut;
inOutLoading;
//分页--告警
warn_totalNum;
......@@ -573,17 +575,20 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
//进出口流量-SNMP
inOutInfo() {
this.inOutLoading = true;
const data = {
obj:{
hostid:Number(this.hostId)
},
pageNum:this.pageNum,
pageCount:this.pageSize
pageCount:this.pageCount
}
this.overAllSer.inOutInfoSnmp(data).subscribe(
(res) => {
if (res.errCode == 10000) {
this.dataSet = res.data;
this.dataSet = res.data.data;
this.inOutLoading = false;
this.totalNumInOut = res.data.totalNum;
}else{
this.message.info(res.errMsg);
}
......@@ -591,6 +596,12 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
);
}
//进出口流量 翻页
changeInoutInfo(e){
this.pageNum = e;
this.inOutInfo();
}
//添加监测点
showCheckModal() {
this.smartCheck.showAddModal(this.hostId,this.realName);
......
......@@ -110,7 +110,9 @@
<nz-tag *ngIf="item.maxLevel == 2 || item.maxLevel == 3" [nzColor]="col.yellow"></nz-tag>
<nz-tag *ngIf="item.maxLevel < 2" [nzColor]="col.green"></nz-tag>
</td>
<td>关联资产</td>
<td>
<span (click)="goTOInventory(item?.inventory?.id)">{{item?.inventory?.name}}</span>
</td>
<td>
<span *ngIf="item.status == 0">已监控</span>
<span *ngIf="item.status == 1">未监控</span>
......@@ -211,7 +213,7 @@
<nz-tag *ngIf="item.maxLevel == 2 || item.maxLevel == 3" [nzColor]="color.yellow"></nz-tag>
<nz-tag *ngIf="item.maxLevel < 2" [nzColor]="color.green"></nz-tag>
</td>
<td>关联资产</td>
<td>{{item?.inventory?.name}}</td>
<td>
<span *ngIf="item.status == 0">已监控</span>
<span *ngIf="item.status == 1">未监控</span>
......@@ -303,7 +305,7 @@
<nz-tag *ngIf="item.maxLevel == 2 || item.maxLevel == 3" [nzColor]="color.yellow"></nz-tag>
<nz-tag *ngIf="item.maxLevel < 2" [nzColor]="color.green"></nz-tag>
</td>
<td>关联资产</td>
<td>{{item?.inventory?.name}}</td>
<td>
<span *ngIf="item.status == 0">已监控</span>
<span *ngIf="item.status == 1">未监控</span>
......
......@@ -231,6 +231,7 @@ export class BasicComponent implements OnInit {
this.loading = true;
this.searchStatus = false;
this.frontPagination = true;
this.findOpStatus();
if (this.selectedValue == 'group') {
this.overAllSer.getgroups({}).subscribe(
(res) => {
......@@ -540,4 +541,9 @@ export class BasicComponent implements OnInit {
nzOnCancel: () => console.log('Cancel')
});
}
//资产页面
goTOInventory(id){
}
}
......@@ -84,5 +84,5 @@
</tbody>
</nz-table>
<smart-plan-modal #smartPlanMoadl ></smart-plan-modal>
<smart-plan-modal #smartPlanMoadl (done)="getList()"></smart-plan-modal>
<smart-look-plan #smartLookPlan></smart-look-plan>
\ No newline at end of file
import {Component, OnInit, ViewChild} from '@angular/core';
import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {WorkService} from '../../work.service';
import {NzMessageService, UploadFile} from 'ng-zorro-antd';
......@@ -11,6 +11,7 @@ import {SelectPersonComponent} from '../../../modal/select-person/select-person.
})
export class PlanModalComponent implements OnInit {
@ViewChild('smartSelectPerson') smartSelectPerson: SelectPersonComponent;
@Output() done = new EventEmitter<any>();
planList;
planId;
......@@ -127,6 +128,7 @@ export class PlanModalComponent implements OnInit {
if (res.errCode == 10000) {
this.message.success('修改计划成功');
this.initForm();
this.done.emit();
this.isVisiable = false;
} else {
this.message.error(res.errMsg);
......
......@@ -18,7 +18,7 @@
"label-position": true,
"max-line-length": [
true,
180
280
],
"member-access": false,
"member-ordering": [
......
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