Commit fa91c547 authored by wangqinghua's avatar wangqinghua

重构 jtopo

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