Commit fa91c547 authored by wangqinghua's avatar wangqinghua

重构 jtopo

parent f24db4a4
......@@ -139,33 +139,43 @@
<!--</nz-form-control>-->
<!--</nz-form-item>-->
<!--<nz-form-item>-->
<!--<nz-form-label [nzSpan]="4" nzFor="serviceid">生成事件</nz-form-label>-->
<!--<nz-form-control [nzSpan]="14">-->
<!--<nz-radio-group>-->
<!--<label nz-radio nzValue="1">是</label>-->
<!--<label nz-radio nzValue="2">否</label>-->
<!--</nz-radio-group>-->
<!--</nz-form-control>-->
<!--</nz-form-item>-->
<nz-form-item>
<nz-form-label [nzSpan]="4" nzFor="serviceid">生成事件</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-radio-group>
<label nz-radio nzValue="1"></label>
<label nz-radio nzValue="2"></label>
</nz-radio-group>
</nz-form-control>
</nz-form-item>
<!--<nz-form-item>-->
<!--<nz-form-label [nzSpan]="4" nzFor="serviceid">事件分类</nz-form-label>-->
<!--<nz-form-control [nzSpan]="14">-->
<!--<nz-select name="serviceid" nzPlaceHolder="事件分类">-->
<!--<nz-option nzValue="" nzLabel="无"></nz-option>-->
<!--</nz-select>-->
<!--</nz-form-control>-->
<!--</nz-form-item>-->
<nz-form-item>
<nz-form-label [nzSpan]="4" nzFor="serviceid">事件分类</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select name="serviceid" nzPlaceHolder="事件分类" [(ngModel)]="validateForm.event.eventTypeId">
<ng-container *ngFor="let item of eventTypeList">
<nz-option [nzLabel]="item.name" [nzValue]="item.id"></nz-option>
</ng-container>
</nz-select>
</nz-form-control>
</nz-form-item>
<!--<nz-form-item>-->
<!--<nz-form-label [nzSpan]="4" nzFor="serviceid">事件负责人</nz-form-label>-->
<!--<nz-form-control [nzSpan]="14">-->
<!--<nz-select name="serviceid" nzPlaceHolder="事件负责人">-->
<!--<nz-option nzValue="" nzLabel="无"></nz-option>-->
<!--</nz-select>-->
<!--</nz-form-control>-->
<!--</nz-form-item>-->
<nz-form-item>
<nz-form-label [nzSpan]="4" nzFor="serviceid">事件负责人</nz-form-label>
<nz-form-control [nzSpan]="14">
<button (click)="selectPerson()" nz-button><span>选择</span></button>
<ng-container *ngFor="let item of operatorList;let i = index;">
<span>{{item.username}}</span><span (click)="delete(i)">X</span>
</ng-container>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired nzFor="serviceid">详细描述</nz-form-label>
<nz-form-control [nzSpan]="14">
<textarea nz-input nzPlaceholder="事件描述" [nzAutosize]="{ minRows: 4, maxRows: 4 }" [(ngModel)]="validateForm.event.description"></textarea>
</nz-form-control>
</nz-form-item>
</div>
<div class="modal-footer-btn">
<button nz-button (click)="handleEditCancel()" nzType="primary">取消</button>
......@@ -241,3 +251,5 @@
</nz-tab>
</nz-tabset>
</nz-modal>
<!--选择负责人-->
<smart-select-person #smartSelectPerson (done)="getUser($event)"></smart-select-person>
......@@ -3,6 +3,8 @@ import {AlarmService} from '../../alarm/alarm.service';
import {FindUserComponent} from '../../alarm/modal/find-user/find-user.component';
import {NzFormatEmitEvent, NzMessageService, NzTreeComponent, NzTreeNode} from 'ng-zorro-antd';
import {OverAllService} from '../../overAll/overAll.service';
import {SelectPersonComponent} from '../select-person/select-person.component';
import {WorkService} from '../../work/work.service';
@Component({
selector: 'smart-alarm-modal',
......@@ -20,6 +22,7 @@ import {OverAllService} from '../../overAll/overAll.service';
})
export class AlarmModalComponent implements OnInit {
@ViewChild('smartFindUser') smartFindUser: FindUserComponent;
@ViewChild('smartSelectPerson') smartSelectPerson: SelectPersonComponent;
@ViewChild('nzTree') nzTree: NzTreeComponent;
@Output() done = new EventEmitter<any>();
......@@ -39,8 +42,11 @@ export class AlarmModalComponent implements OnInit {
selectModal = false;
sendInfoList = []; //发送方式
eventTypeList; //事件分类列表
operatorList = []; //负责人列表
constructor(private alarmSer: AlarmService, private message: NzMessageService,
private overAllSer: OverAllService) {
private overAllSer: OverAllService,private workSer: WorkService,) {
}
ngOnInit() {
......@@ -49,6 +55,7 @@ export class AlarmModalComponent implements OnInit {
this.getACtion();
this.getGroup();
this.getZabbixObj();
this.getEventType();
}
//初始化
......@@ -65,9 +72,26 @@ export class AlarmModalComponent implements OnInit {
r_longdata:null,
r_shortdata:null,
sendInfos:null,
event:{
eventTypeId:null, //事件分类id
operators:null, //事件负责人
description:null, //事件描述
}
};
}
//获取事件分类
getEventType() {
const data = {
type: 0
};
this.workSer.findParamsByType(data).subscribe(
(res) => {
this.eventTypeList = res.data;
}
);
}
//获取告警目标
getACtion() {
this.overAllSer.findGroup().subscribe(
......@@ -213,6 +237,24 @@ export class AlarmModalComponent implements OnInit {
this.tabNum = index;
}
//选择处理人弹窗
selectPerson(){
this.smartSelectPerson.showModal("选择事件负责人",null);
}
//选择事件负责人done
getUser(e){
const arr = [];
e.forEach(res => {
const data = {
username: res.name,
userId: res.id
};
arr.push(data);
});
this.operatorList = arr;
}
//保存
handEditleOk() {
......@@ -239,6 +281,11 @@ export class AlarmModalComponent implements OnInit {
def_longdata:this.validateForm.def_longdata,
r_longdata:this.validateForm.r_longdata,
r_shortdata:this.validateForm.r_shortdata,
event:{
eventTypeId:this.validateForm.event.eventTypeId, //事件分类id
operators:this.operatorList, //事件负责人
description:this.validateForm.event.description, //事件描述
}
};
if(this.title == '添加告警'){
......
......@@ -73,11 +73,11 @@
<nz-form-label [nzSpan]="6" nzRequired nzFor="value_type">信息类型</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select name="value_type" formControlName="value_type" nzPlaceHolder="请选择信息类型">
<nz-option nzValue="1" nzLabel="数字"></nz-option>
<nz-option nzValue="2" nzLabel="浮点数"></nz-option>
<nz-option nzValue="3" nzLabel="字符"></nz-option>
<nz-option nzValue="4" nzLabel="日志"></nz-option>
<nz-option nzValue="5" nzLabel="文本"></nz-option>
<nz-option nzValue="0" nzLabel="浮点数"></nz-option>
<nz-option nzValue="1" nzLabel="字符"></nz-option>
<nz-option nzValue="2" nzLabel="日志"></nz-option>
<nz-option nzValue="3" nzLabel="整数"></nz-option>
<nz-option nzValue="4" nzLabel="文本"></nz-option>
</nz-select>
<nz-form-explain *ngIf="validateForm.get('value_type').dirty && validateForm.get('value_type').errors">请选择信息类型!</nz-form-explain>
</nz-form-control>
......
......@@ -278,7 +278,7 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe
const arr = topologyJson.childs[0].childs;
const list = [];
arr.forEach(e=>{
if(e.elementType == 'link'){
if(e.elementType == 'link' && e.itemId && e.itemId.length > 0){
const data = {
itemIdIn:e.itemId.split(',')[0],
itemIdOut:e.itemId.split(',')[1],
......@@ -287,22 +287,26 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe
list.push(data);
}
});
const data = {
"list" : list
if(list.length > 0){ //有流量监控-->查询流量监控
const data = {
"list" : list
};
this.topologySer.findFlow(data).subscribe(
(res)=>{
const response = res.data;
response.forEach(e1=>{
arr.forEach(e2=>{
if(e1.linkId == e2.id){
e2.text = "进口流量:"+e1.valueIn+e1.units+" 出口流量:"+e1.valueOut+e1.units;
}
})
});
editor.loadTopologyByJson(topologyJson, 'img/backimg.png');
}
)
}else{ //无流量监控
editor.loadTopologyByJson(topologyJson, 'img/backimg.png');
}
this.topologySer.findFlow(data).subscribe(
(res)=>{
const response = res.data;
response.forEach(e1=>{
arr.forEach(e2=>{
if(e1.linkId == e2.id){
e2.text = "进口流量:"+e1.valueIn+e1.units+" 出口流量:"+e1.valueOut+e1.units;
}
})
});
editor.loadTopologyByJson(topologyJson, 'img/backimg.png');
}
)
}
//查询监控点状态
......
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