Commit c37fbafe authored by wangqinghua's avatar wangqinghua

log

parent dbf69768
<div nz-row class="breadcrumbs" >
<div nz-row class="breadcrumbs">
<div nz-col nzSpan="16">
<nz-breadcrumb class="padding-8-0">
<nz-breadcrumb-item>
......@@ -13,34 +13,32 @@
</nz-breadcrumb>
</div>
<div nz-col nzSpan="8" class="text-right">
<button nz-button nzType="primary"><i class="anticon anticon-search"></i></button>
<button (click)="search()" nz-button nzType="primary"><i class="anticon anticon-search"></i></button>
<button nz-button nzType="primary"><i class="anticon anticon-sync"></i></button>
<button nz-button nzType="primary"><i class="anticon anticon-arrows-alt"></i></button>
</div>
</div>
<div nz-row [nzGutter]="4" class="search-form">
<div nz-col nzSpan="3">
<nz-select style="width: 100%;" nzShowSearch nzAllowClear nzPlaceHolder="选择发送方式" [(ngModel)]="obj.priorityName">
<nz-option nzLabel="告警" nzValue="告警"></nz-option>
<nz-option nzLabel="严重" nzValue="严重"></nz-option>
<nz-select style="width: 100%;" nzShowSearch nzAllowClear nzPlaceHolder="选择发送方式" [(ngModel)]="obj.mediatypeids">
<ng-container *ngFor="let item of sendList">
<nz-option nzLabel="{{item.description}}" nzValue="{{item.mediatypeid}}"></nz-option>
</ng-container>
</nz-select>
</div>
<div nz-col nzSpan="3">
<nz-select style="width: 100%;" nzShowSearch nzAllowClear nzPlaceHolder="选择告警组" [(ngModel)]="obj.groupid">
<nz-select style="width: 100%;" nzShowSearch nzAllowClear nzPlaceHolder="选择告警组" [(ngModel)]="obj.alertGroupId">
<ng-container *ngFor="let item of groupList;">
<nz-option nzLabel="{{item.name}}" nzValue="{{item.groupid}}"></nz-option>
</ng-container>
</nz-select>
</div>
<div nz-col nzSpan="3">
<nz-select style="width: 100%;" nzShowSearch nzAllowClear nzPlaceHolder="选择告警目标" [(ngModel)]="obj.equipmentType" >
<ng-container *ngFor="let item of warnCountList;">
<nz-option nzLabel="{{item.name}}" nzValue="{{item.name}}"></nz-option>
</ng-container>
</nz-select>
<button nz-button (click)="showTargetModal()" nzType="primary">选择告警目标</button>
</div>
<div nz-col nzSpan="7">
<nz-radio-group style="width: 100%;" [(ngModel)]="timeType" (ngModelChange)="changeType()" [nzButtonStyle]="'solid'">
<nz-radio-group style="width: 100%;" [(ngModel)]="timeType" (ngModelChange)="changeType()"
[nzButtonStyle]="'solid'">
<label nz-radio-button nzValue="1">今天</label>
<label nz-radio-button nzValue="2">昨天</label>
<label nz-radio-button nzValue="3">三天</label>
......@@ -51,54 +49,72 @@
<div nz-col nzSpan="8" *ngIf="timeType == '5'">
<nz-date-picker
nzShowTime
[(ngModel)]="obj.startTime"
[(ngModel)]="obj.time_from"
nzPlaceHolder="开始时间"
></nz-date-picker>
<nz-date-picker
nzShowTime
nzFormat="yyyy-MM-dd HH:mm:ss"
[(ngModel)]="obj.endTime"
[(ngModel)]="obj.time_till"
nzPlaceHolder="结束时间"
></nz-date-picker>
</div>
</div>
<div nz-row class="search-form" style="border-top: none;padding: 0 0 15px 0;">
<input [(ngModel)]="obj.name" nz-input placeholder="搜索">
<button (click)="searchValue()" nz-button nzType="default"><i class="anticon anticon-search"></i>搜索</button>
</div>
<nz-table #nzTable [nzData]="logList" [nzFrontPagination]="false" [nzTotal]="totalNum" [nzPageIndex]="pageNum" [nzPageSize]="pageCount" (nzPageIndexChange)="change($event)" [nzLoading]="loading">
<nz-table #nzTable [nzData]="logList" [nzFrontPagination]="false" [nzTotal]="totalNum" [nzPageIndex]="pageNum"
[nzPageSize]="pageCount" (nzPageIndexChange)="change($event)">
<thead>
<tr>
<th nzShowSort>告警名称</th>
<th nzWidth="15%">告警名称</th>
<th>告警时间</th>
<th>告警目标</th>
<th nzWidth="15%">告警内容</th>
<th>告警内容</th>
<th>状态</th>
<th>发送方式</th>
<th>发送对象</th>
<!--<th>产生事件</th>-->
<th style="text-align: center">操作</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of logList">
<td class="round-tag">
<nz-tag *ngIf="data.priority == 4 || data.priority == 5" [nzColor]="'#fc0d1b'"></nz-tag>
<nz-tag *ngIf="data.priority == 2 || data.priority == 3" [nzColor]="'#fd9827'"></nz-tag>
<nz-tag [nzColor]="'#fc0d1b'"></nz-tag>
{{data.subject}}
</td>
<td>{{data.clock | date:"yyyy-MM-dd HH:mm:ss"}}</td>
<td>
<ng-container *ngIf="data.hosts">
{{data.hosts[0].name}}
</ng-container>
</td>
<td class="handle">
<span (click)="showDeleteModal(data)">查看</span>
</td>
<td>
<span *ngIf="data.status == 0">消息未发送</span>
<span *ngIf="data.status == 1">消息已发送</span>
<span *ngIf="data.status == 2">经多次重试后失败</span>
</td>
<td>名称</td>
<td>查看</td>
<td>查看</td>
<td>{{data.groupname}}</td>
<td>{{data.continuedTime}}</td>
<!--<td>{{data.eventid}}</td>-->
<td>
<ng-container *ngIf="data.r_clock">已恢复</ng-container>
<ng-container *ngIf="!data.r_clock">告警中</ng-container>
{{data.sendto}}
</td>
<td class="handle">
<span (click)="deleteLog(data)">删除</span>
</td>
<td class="list-icon" (click)="showLog(data)"><i class="anticon anticon-profile"></i></td>
</tr>
</tbody>
</nz-table>
<smart-send-log #sendLog></smart-send-log>
\ No newline at end of file
<!--告警内容-->
<nz-modal [(nzVisible)]="isVisible" [nzFooter]="null" nzTitle="查看告警内容" (nzOnCancel)="handleCancel()"
(nzOnOk)="handleOk()" [nzOkLoading]="isOkLoading">
<div style="padding: 10px;">
<p>主题:</p>
<p>{{title}}</p>
<p>消息:</p>
<p>{{content}}</p>
</div>
</nz-modal>
<!--告警目标-->
<smart-alarm-target #smartAlarmTarget></smart-alarm-target>
......@@ -4,7 +4,8 @@ import {OverAllService} from '../../overAll/overAll.service';
import {DatePipe} from '@angular/common';
import {AlarmService} from '../alarm.service';
import {pageSize} from '../../app.constants';
import {NzMessageService} from 'ng-zorro-antd';
import {NzMessageService, NzModalService} from 'ng-zorro-antd';
import {AlarmTargetComponent} from '../modal/alarm-target/alarm-target.component';
@Component({
selector: 'smart-alarm-log',
......@@ -29,6 +30,7 @@ import {NzMessageService} from 'ng-zorro-antd';
export class AlarmLogComponent implements OnInit {
@ViewChild('warnList') warnList: WarnListComponent;
@ViewChild('smartAlarmTarget') smartAlarmTarget:AlarmTargetComponent;
logList = [];
warnCountList = [];
groupList = [];
......@@ -37,36 +39,46 @@ export class AlarmLogComponent implements OnInit {
pageCount = pageSize;
totalNum;
//发送方式
sendList;
//条件
timeType;
obj = {
priorityName:null,
groupid:null,
equipmentType:null,
startTime:'',
endTime:'',
name:''
time_from:'',
time_till:'',
alertGroupId:'',
mediatypeids:'',
hostids:'',
};
//modal
isVisible = false;
title;
content;
constructor(public alarmSer: AlarmService,public overAllSer:OverAllService,public message:NzMessageService,
public datePipe:DatePipe) {
public datePipe:DatePipe,public modalSer:NzModalService) {
}
ngOnInit() {
const obj = {};
this.getType();
this.getWarnGroup();
this.getList();
this.getList(this.obj);
}
//
getList(){
const obj = {
//获取list
getList(obj){
const data = {
"eventPage":this.pageNum,
"pageRecords":this.pageCount
}
this.alarmSer.alertFind(obj).subscribe(
"pageRecords":this.pageCount,
"alertGroupId":obj.alertGroupId,
"time_from":obj.time_from,
"time_till":obj.time_till,
"mediatypeids":[obj.mediatypeids],
"hostids":null
};
this.alarmSer.alertFind(data).subscribe(
(res)=>{
if(res.errCode == 10000){
this.logList = res.data.data;
......@@ -89,60 +101,113 @@ export class AlarmLogComponent implements OnInit {
)
}
//获取资源类型
//获取告警组
getType(){
this.overAllSer.findHostWarningCount().subscribe(
this.alarmSer.mediaTypeFind({}).subscribe(
(res)=>{
if(res.errCode == 10000){
this.warnCountList = res.data;
}else{
this.message.info(res.errMsg);
this.sendList = res.data;
}
}
)
}
//获取告警目标弹窗
getTarget(){
}
//时间改变
changeType(){
const nowDate = new Date().getTime();
let day1,day2;
switch (this.timeType){
case'1':{
this.obj.startTime = this.datePipe.transform(nowDate,'yyyy-MM-dd') +' 00:00:00';
this.obj.endTime = this.datePipe.transform(nowDate,'yyyy-MM-dd') +' 23:59:59';
this.obj.time_from = this.datePipe.transform(nowDate,'yyyy-MM-dd') +' 00:00:00';
this.obj.time_till = this.datePipe.transform(nowDate,'yyyy-MM-dd') +' 23:59:59';
break;
};
}
case'2':{
day1 = nowDate - 1*24*60*60*1000;
this.obj.startTime = this.datePipe.transform(day1,'yyyy-MM-dd') + ' 00:00:00';
this.obj.endTime = this.datePipe.transform(day1,'yyyy-MM-dd') + ' 23:59:59';
this.obj.time_from = this.datePipe.transform(day1,'yyyy-MM-dd') + ' 00:00:00';
this.obj.time_till = this.datePipe.transform(day1,'yyyy-MM-dd') + ' 23:59:59';
break;
};
}
case'3':{
day1 = nowDate - 3*24*60*60*1000;
day2 = nowDate - 1*24*60*60*1000;
this.obj.startTime = this.datePipe.transform(day1,'yyyy-MM-dd') + ' 00:00:00';
this.obj.endTime = this.datePipe.transform(day2,'yyyy-MM-dd') + ' 23:59:59';
this.obj.time_from = this.datePipe.transform(day1,'yyyy-MM-dd') + ' 00:00:00';
this.obj.time_till = this.datePipe.transform(day2,'yyyy-MM-dd') + ' 23:59:59';
break;
};
}
case'4':{
day1 = nowDate - 7*24*60*60*1000;
day2 = nowDate - 1*24*60*60*1000;
this.obj.startTime = this.datePipe.transform(day1,'yyyy-MM-dd') + ' 00:00:00';
this.obj.endTime = this.datePipe.transform(day2,'yyyy-MM-dd') + ' 23:59:59';
this.obj.time_from = this.datePipe.transform(day1,'yyyy-MM-dd') + ' 00:00:00';
this.obj.time_till = this.datePipe.transform(day2,'yyyy-MM-dd') + ' 23:59:59';
break;
};
}
case'5':{
break;
};
}
}
}
//查询
searchValue(){
this.obj.startTime = this.datePipe.transform(this.obj.startTime,'yyyy-MM-dd HH:mm:ss');
this.obj.endTime = this.datePipe.transform(this.obj.endTime,'yyyy-MM-dd HH:mm:ss');
this.warnList.getList(this.obj);
search(){
this.obj.time_from = this.datePipe.transform(this.obj.time_from,'ms') +'';
this.obj.time_till = this.datePipe.transform(this.obj.time_till,'ms') +'';
console.log(this.obj);
this.getList(this.obj);
}
change(e){
this.pageNum = e;
// this.getList(null);
}
//查看消息内容
showDeleteModal(data){
this.isVisible = true;
this.title = data.subject;
this.content = data.message;
}
//modal取消
handleCancel(){
this.isVisible = false;
}
//删除告警日志
deleteLog(data){
this.modalSer.confirm({
nzTitle: '删除',
nzContent: '<b style="color: red;">确认删除该告警组吗?</b>',
nzOkText: '确定',
nzOkType: 'danger',
nzOnOk: () => {
const arr = {
ids:[]
};
arr.ids.push(data.alertid);
this.alarmSer.alertDelete(arr).subscribe(
(res) => {
if (res.errCode == 10000) {
this.message.info('删除成功');
} else {
this.message.info(res.errMsg);
}
}
);
},
nzCancelText: '取消',
nzOnCancel: () => console.log('Cancel'),
})
}
//选择告警目标--主机
showTargetModal(){
this.smartAlarmTarget.showModal();
}
}
......@@ -22,7 +22,7 @@
<div nz-row class="search-form">
<div nz-col nzSpan="12">
<nz-select style="width: 200px;" nzShowSearch nzAllowClear nzPlaceHolder="选择告警组" [(ngModel)]="alertGroupId" (ngModelChange)="getList()">
<ng-container *ngFor="let item of groupList">
<ng-container *ngFor="let item of groupList;let i = index;">
<nz-option nzLabel="{{item.name}}" nzValue="{{item.id}}"></nz-option>
</ng-container>
</nz-select>
......@@ -30,17 +30,17 @@
<div nz-col nzSpan="12" class="text-right">
<button nz-button nzType="default" (click)="showGroupModal()"><i class="anticon anticon-plus"></i>添加
</button>
<button nz-button nzType="default"><i class="anticon anticon-pause-circle-o"></i>编辑</button>
<button nz-button nzType="default"><i class="anticon anticon-play-circle-o"></i>删除</button>
<button nz-button nzType="default" (click)="editGroup()"><i class="anticon anticon-pause-circle-o"></i>编辑</button>
<button nz-button nzType="default" (click)="deleteGroup()"><i class="anticon anticon-play-circle-o"></i>删除</button>
<button nz-button nzType="default"><i class="anticon anticon-close-circle"></i>暂停</button>
</div>
</div>
<div nz-row class="search-form">
<div nz-col nzSpan="16">
<button (click)="selectJ()" nz-button nzType="default"><i class="anticon anticon-search"></i>新增告警推送</button>
<button nz-button nzType="default"><i class="anticon anticon-search"></i>新增告警推送</button>
</div>
</div>
<nz-table #nzTable [nzData]="setList" [nzFrontPagination]="false" [nzTotal]="totalNum" [nzPageIndex]="pageNum" [nzPageSize]="pageCount" (nzPageIndexChange)="change($event)" [nzLoading]="loading">
<nz-table #nzTable [nzData]="setList" [nzFrontPagination]="false" [nzTotal]="totalNum" [nzPageIndex]="pageNum" [nzPageSize]="pageCount" (nzPageIndexChange)="change($event)">
<thead>
<tr>
<th nzShowSort>名称</th>
......
......@@ -2,6 +2,7 @@ import {Component, OnInit, ViewChild} from '@angular/core';
import {AlarmService} from '../alarm.service';
import {pageSize} from '../../app.constants';
import {AlarmGroupComponent} from '../modal/alarm-group/alarm-group.component';
import {NzMessageService, NzModalService} from 'ng-zorro-antd';
@Component({
selector: 'smart-alarm-set',
......@@ -18,7 +19,8 @@ export class AlarmSetComponent implements OnInit {
pageCount = pageSize;
totalNum;
constructor(private alarmSer: AlarmService) {
constructor(private alarmSer: AlarmService,private modalSer:NzModalService,
private message:NzMessageService) {
}
ngOnInit() {
......@@ -58,4 +60,49 @@ export class AlarmSetComponent implements OnInit {
showGroupModal() {
this.smartAlarmGroup.addModal();
}
//删除告警组
deleteGroup(){
this.modalSer.confirm({
nzTitle: '删除',
nzContent: '<b style="color: red;">确认删除该告警组吗?</b>',
nzOkText: '确定',
nzOkType: 'danger',
nzOnOk: () => {
const arr = {
ids:[]
};
arr.ids.push(this.alertGroupId);
this.alarmSer.alertGroupDelete(arr).subscribe(
(res) => {
if (res.errCode == 10000) {
this.message.info('删除成功');
} else {
this.message.info(res.errMsg);
}
}
);
},
nzCancelText: '取消',
nzOnCancel: () => console.log('Cancel'),
})
}
//修改告警组
editGroup(){
if(!this.alertGroupId){
this.message.info('请选择需要编辑的分组');
return false;
}
let arr = [];
this.groupList.forEach(res=>{
if(res.id == this.alertGroupId){
arr = res;
}
});
console.log(arr);
this.smartAlarmGroup.editModal(arr);
}
change(e){}
}
......@@ -19,6 +19,11 @@ export class AlarmService {
return this.http.post(SERVER_API_URL + '/alert/find',data);
}
//删除告警推送日志
alertDelete(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/alert/delete',data);
}
//查询告警推送设置
actionFind(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/action/find',data);
......@@ -59,6 +64,16 @@ export class AlarmService {
return this.http.post(SERVER_API_URL + '/alertGroup/create',data);
}
//修改告警组
alertGroupUpdate(data): Observable<any>{
return this.http.put(SERVER_API_URL + '/alertGroup/update',data);
}
//删除告警组
alertGroupDelete(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/alertGroup/delete',data);
}
//发送方式列表
mediaTypeFind(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/mediaType/find',data);
......
......@@ -19,6 +19,7 @@ export class AlarmGroupComponent implements OnInit {
title;
isVisible = false;
groupId;
validateForm: FormGroup;
name;
......@@ -32,6 +33,14 @@ export class AlarmGroupComponent implements OnInit {
this.initForm();
}
//初始化
initForm(){
this.validateForm = this.fb.group({
name:[null,[Validators.required]],
description:[null]
})
}
//新增告警组
addModal() {
this.title = '新增告警组';
......@@ -39,19 +48,21 @@ export class AlarmGroupComponent implements OnInit {
}
//编辑告警组
editModal() {
editModal(arr) {
this.title = '编辑告警组';
this.groupId = arr.id;
this.isVisible = true;
this.validateForm.patchValue(arr);
}
//取消
handleCancel() {
this.isVisible = false;
this.initForm();
}
//确定
handleOk() {
// console.log(this.validateForm.valid);
for(const i in this.validateForm.controls) {
this.validateForm.controls[ i ].markAsDirty();
this.validateForm.controls[ i ].updateValueAndValidity();
......@@ -60,23 +71,42 @@ export class AlarmGroupComponent implements OnInit {
return false;
}
if(this.title == '编辑告警组'){
this.update();
}else{
this.create();
}
}
create(){
this.alarmSer.alertGroupCreate(this.validateForm.value).subscribe(
(res)=>{
if(res.errCode == 10000){
this.isVisible = false;
this.add.emit();
this.initForm();
}
this.message.info(res.errMsg);
}
)
}
//初始化
initForm(){
this.validateForm = this.fb.group({
name:[null,[Validators.required]],
description:[null]
})
update(){
const data = {
id:this.groupId,
name:this.validateForm.value.name,
description:this.validateForm.value.description
};
this.alarmSer.alertGroupUpdate(data).subscribe(
(res)=>{
if(res.errCode == 10000){
this.isVisible = false;
this.add.emit();
this.initForm();
}
this.message.info(res.errMsg);
}
)
}
}
<nz-modal [(nzVisible)]="isVisible" [nzFooter]="null" nzTitle="选择告警目标" (nzOnCancel)="handleCancel()"
(nzOnOk)="handleOk()">
<div style="padding: 10px;">
<nz-tree
[(ngModel)]="nodes"
[nzCheckable]="true"
[nzMultiple]="true"
[nzAsyncData] = "true""
(nzClick)="mouseAction('expand',$event)"
(nzExpandChange)="mouseAction('expand',$event)"
>
</nz-tree>
</div>
</nz-modal>
\ No newline at end of file
import {Component, OnInit} from '@angular/core';
import {OverAllService} from '../../../overAll/overAll.service';
import {NzMessageService, NzTreeNode, NzFormatEmitEvent} from 'ng-zorro-antd';
import {ToTree} from '../../../shared/common/toTree';
@Component({
selector: 'smart-alarm-target',
templateUrl: './alarm-target.component.html',
styles: []
})
export class AlarmTargetComponent implements OnInit {
isVisible = false;
dataSet;
nodes;
constructor(private overAllSer:OverAllService,private message:NzMessageService,
private toTree:ToTree) {
}
ngOnInit() {
this.getGroup();
}
getGroup(){
this.overAllSer.findGroup().subscribe(
(res) => {
if (res.errCode == 10000) {
const dataSet = res.data;
dataSet.forEach(res=>{
res.title = res.name;
res.key = res.groupid;
});
this.toNode(dataSet);
} else {
this.message.info(res.errMsg);
}
}
);
}
toNode(data){
console.log(data);
// const arr = this.toTree.listToTree(1,2,data)
this.nodes = data.map(res=>{
return new NzTreeNode(res);
})
}
//下级
mouseAction(name: string, event: NzFormatEmitEvent): void {
console.log(name);
console.log(event);
// if (name === 'expand') {
setTimeout(_ => {
// if (e.node.getChildren().length === 0 && e.node.isExpanded) {
// e.node.addChildren([
// {
// title: 'childAdd-1',
// key : '10031-' + (new Date()).getTime()
// },
// {
// title : 'childAdd-2',
// key : '10032-' + (new Date()).getTime(),
// isLeaf: true
// } ]);
// }
}, 1000);
// }
}
showModal() {
this.isVisible = true;
}
handleOk() {
this.isVisible = false;
}
handleCancel() {
this.isVisible = false;
}
}
......@@ -19,10 +19,10 @@
</div>
</div>
<div nz-row class="search-form" style="border-top: none;padding: 0 0 15px 0;">
<button (click)="searchValue()" nz-button nzType="default"><i class="anticon anticon-search"></i>新增发送方式</button>
<button nz-button nzType="default"><i class="anticon anticon-search"></i>新增发送方式</button>
</div>
<nz-table #nzTable [nzData]="sendList" [nzFrontPagination]="false" [nzTotal]="totalNum" [nzPageIndex]="pageNum" [nzPageSize]="pageCount" (nzPageIndexChange)="change($event)" [nzLoading]="loading">
<nz-table #nzTable [nzData]="sendList" [nzFrontPagination]="false">
<thead>
<tr>
<th nzShowSort>名称</th>
......
......@@ -43,6 +43,7 @@ import {SmartService} from './smart/smart.service';
import {WorkService} from './work/work.service';
import {AlarmGroupComponent} from './alarm/modal/alarm-group/alarm-group.component';
import {MediaTypeComponent} from './alarm/modal/media-type/media-type.component';
import {AlarmTargetComponent} from './alarm/modal/alarm-target/alarm-target.component';
@NgModule({
imports: [
......@@ -86,7 +87,8 @@ import {MediaTypeComponent} from './alarm/modal/media-type/media-type.component'
NeTopologyComponent,
FlowTrendComponent,
AlarmGroupComponent,
MediaTypeComponent
MediaTypeComponent,
AlarmTargetComponent
],
providers:[
OverAllService,
......@@ -97,8 +99,7 @@ import {MediaTypeComponent} from './alarm/modal/media-type/media-type.component'
OperationService,
SmartService,
WorkService,
{ provide: NZ_I18N,
useValue: zh_CN }
{ provide: NZ_I18N, useValue: zh_CN },
],
exports:[
BasiCheckComponent,
......
......@@ -44,13 +44,19 @@ export class BasicEditComponent implements OnInit {
macroTYpe = 'macro'; //宏tabs
mainHost = 'hostType1'; //主机tabs
constructor(private fb: FormBuilder, private overAllSer: OverAllService,
private message: NzMessageService) {
public message: NzMessageService) {
}
ngOnInit() {
this.tabNum = 0;
this.initForm();
this.getTemplate();
this.getGroup();
}
//获取分组
getGroup(){
this.groupList = [];
this.overAllSer.getgroups({}).subscribe(
(res) => {
for (let i = 0; i < res.data.length; i++) {
......@@ -121,7 +127,26 @@ export class BasicEditComponent implements OnInit {
);
}
handEditleOk(): void {
//确定
handEditleOk(){
if(!this.validateForm.hostExtend.equipmentType) {
this.message.info('请选择选择设备类型');
return false;
}
if(!this.validateForm.hostExtend.secondLevelType){
this.message.info('请选择选择二级类型');
return false;
}
if(!this.validateForm.name){
this.message.info('请输入显示名');
return false;
}
if(!this.validateForm.host){
this.message.info('请输入IP地址');
return false;
}
//获取分组id
const groupArr = [];
for (let i = 0; i < this.groupList.length; i++) {
......@@ -130,6 +155,14 @@ export class BasicEditComponent implements OnInit {
groupArr.push(groupid);
}
}
this.interfaceslist.forEach(res=>{
if(res.bulk){
res.bulk = '1';
}else{
res.bulk = '0';
}
});
this.validateForm.groups = groupArr;
if (this.modalTitle == '编辑资源') {
this.update();
......@@ -147,10 +180,11 @@ export class BasicEditComponent implements OnInit {
(res) => {
if (res.errCode == 10000) {
this.isBasicEdit = false;
}
this.initForm();
this.getGroup();
this.done.emit();
}
this.message.info(res.errMsg);
this.initForm();
},
(err) => {
this.message.info('系统错误');
......@@ -172,6 +206,7 @@ export class BasicEditComponent implements OnInit {
this.isBasicEdit = false;
this.done.emit();
this.initForm();
this.getGroup();
}
this.message.info(res.errMsg);
},
......@@ -185,6 +220,7 @@ export class BasicEditComponent implements OnInit {
handleEditCancel(): void {
this.isBasicEdit = false;
this.initForm();
this.getGroup();
}
//tabs切换
......@@ -210,7 +246,7 @@ export class BasicEditComponent implements OnInit {
type: '1',
port: '10050',
useip: 1,
bulk: 0,
bulk: false,
};
this.interfaceslist.push(demo);
}
......@@ -229,7 +265,7 @@ export class BasicEditComponent implements OnInit {
}
case '2': {
this.interfaceslist[index].port = '161';
this.interfaceslist[index].bulk = 1;
this.interfaceslist[index].bulk = false;
break;
}
case '3': {
......@@ -302,7 +338,7 @@ export class BasicEditComponent implements OnInit {
type: '1',
port: '10050',
useip: 1,
bulk: 0,
bulk: false,
}
];
this.tabNum = 0;
......
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