Commit c5fbc619 authored by wangqinghua's avatar wangqinghua

update

parent 7ba2c671
<div nz-row class="breadcrumbs" >
<div nz-row class="breadcrumbs">
<div nz-col nzSpan="16">
<nz-breadcrumb class="padding-8-0">
<nz-breadcrumb-item>
......@@ -17,54 +17,5 @@
<smart-full-screen></smart-full-screen>
</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>
</div>
<div nz-col nzSpan="3">
<nz-select style="width: 100%;" nzShowSearch nzPlaceHolder="选择分组" [(ngModel)]="obj.groupid">
<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.id"></nz-option>
</ng-container>
</nz-select>
</div>
<div nz-col nzSpan="7">
<nz-radio-group style="width: 100%;" [(ngModel)]="timeType" (ngModelChange)="changeType($event)">
<label nz-radio-button nzValue="1">今天</label>
<label nz-radio-button nzValue="2">昨天</label>
<label nz-radio-button nzValue="3">三天</label>
<label nz-radio-button nzValue="4">一周</label>
<label nz-radio-button nzValue="99">自定义</label>
</nz-radio-group>
</div>
<div nz-col nzSpan="8" *ngIf="timeType == '99'">
<nz-date-picker
[nzFormat]="timeFormat"
[(ngModel)]="dateBegin"
nzPlaceHolder="开始时间"></nz-date-picker>
<nz-date-picker
[nzFormat]="timeFormat"
[(ngModel)]="dateEnd"
nzPlaceHolder="结束时间"></nz-date-picker>
</div>
</div>
<div nz-row class="search-form" style="border-top: none;padding: 0 0 15px 0;">
<div nz-col nzSpan="16">
<input style="width: 15%;" [(ngModel)]="obj.name" nz-input placeholder="告警信息">
<button (click)="searchValue()" nz-button nzType="default"><i class="anticon anticon-search"></i>搜索</button>
</div>
<div nz-col nzSpan="8" class="text-right">
</div>
</div>
<smart-warn-list #warnList></smart-warn-list>
......@@ -43,12 +43,7 @@ export class AlarmListComponent implements OnInit {
//条件
timeType = '1';
obj = {
priorityName: null,
groupid: null,
equipmentType: null,
startTime: '',
endTime: '',
name: ''
isRecord:"isRecord"
};
dateBegin = null;
......@@ -93,16 +88,13 @@ export class AlarmListComponent implements OnInit {
changeType(e) {
if (e == '99') return false;
const obj = this.commonSer.getTimeByType(e);
this.obj.startTime = obj.startTime;
this.obj.endTime = obj.endTime;
}
//查询
searchValue() {
if (this.timeType == '99') {
this.obj.startTime = this.datePipe.transform(this.dateBegin, 'yyyy-MM-dd HH:mm:ss');
this.obj.endTime = this.datePipe.transform(this.dateEnd, 'yyyy-MM-dd HH:mm:ss');
}
console.log(this.obj);
this.warnList.getList(this.obj);
}
......
......@@ -7,30 +7,31 @@
<th>级别</th>
<th>名称</th>
<th nzWidth="15%">告警信息</th>
<th>资源分组</th>
<th>持续时间</th>
<th>状态</th>
<th style="text-align: center">发送记录</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of warnList">
<td class="table-timeline">
<nz-timeline-item>{{data.newClock | date:"yyyy-MM-dd HH:mm:ss"}}</nz-timeline-item>
<nz-timeline-item>{{data.createTime | date:"yyyy-MM-dd HH:mm:ss"}}</nz-timeline-item>
</td>
<td class="round-tag tag-form">
<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 *ngIf="data.level == 0 " [nzColor]="'#58ca13'"></nz-tag>
<nz-tag *ngIf="data.level == 2 " [nzColor]="'#fc0d1b'"></nz-tag>
<nz-tag *ngIf="data.level == 1 " [nzColor]="'#fd9827'"></nz-tag>
</td>
<td>{{data.hostname}}</td>
<td>{{data.name}}</td>
<td>{{data.description}}</td>
<td>{{data.groupname}}</td>
<td>{{data.continuedTime}}</td>
<td>
<ng-container *ngIf="data.r_clock"><span class="color-green"><i class="anticon anticon-check-square-o"></i></span> </ng-container>
<ng-container *ngIf="!data.r_clock"><span class="color-red"> <i class="anticon anticon-warning"></i></span></ng-container>
<ng-container *ngIf="data.continuedTime">{{data.continuedTime}}</ng-container>
</td>
<td>
<ng-container *ngIf="data.r_clock"><span class="color-green"><i class="anticon anticon-check-square-o"></i></span>
</ng-container>
<ng-container *ngIf="!data.r_clock"><span class="color-red"> <i class="anticon anticon-warning"></i></span>
</ng-container>
</td>
<td class="list-icon cursor" (click)="showLog(data)"><i class="anticon anticon-profile"></i></td>
</tr>
</tbody>
</nz-table>
......
......@@ -3,6 +3,7 @@ import {AlarmService} from '../../alarm/alarm.service';
import {pageSize} from '../../app.constants';
import {NzMessageService} from 'ng-zorro-antd';
import {SendLogComponent} from '../../alarm/modal/send-log/send-log.component';
import {CommonService} from '../../shared/common/common.service';
@Component({
selector: 'smart-warn-list',
......@@ -27,7 +28,8 @@ export class WarnListComponent implements OnInit {
totalNum;
loading = false;
constructor(public alarmSer: AlarmService, public message: NzMessageService) {
constructor(public alarmSer: AlarmService, public message: NzMessageService,
private commonSer: CommonService) {
}
ngOnInit() {
......@@ -45,12 +47,18 @@ export class WarnListComponent implements OnInit {
const data = {
pageNum: this.pageNum,
pageCount: this.pageCount,
// obj: obj
obj: obj
};
this.alarmSer.eventFind(data).subscribe(
(res) => {
if (res.errCode == 10000) {
if (res.data) {
res.data.data.forEach(e => {
if (e.endTime && e.createTime) {
const continuedTime = (new Date(e.endTime).getTime() - new Date(e.createTime).getTime());
e.continuedTime = this.commonSer.unitTime(continuedTime);
}
});
this.warnList = res.data.data;
this.totalNum = res.data.totalNum;
this.total.emit(this.totalNum);
......
......@@ -256,6 +256,35 @@ export class CommonService implements OnInit {
return res;
}
//时分秒换算
unitTime(value: any) {
let secondTime = (value.toFixed(0)) / 1000;// 秒
let minuteTime = 0;// 分
let hourTime = 0;// 小时
if (secondTime > 60) {//如果秒数大于60,将秒数转换成整数
//获取分钟,除以60取整数,得到整数分钟
minuteTime =(secondTime / 60);
//获取秒数,秒数取佘,得到整数秒数
secondTime = (secondTime % 60);
//如果分钟大于60,将分钟转换成小时
if (minuteTime > 60) {
//获取小时,获取分钟除以60,得到整数小时
hourTime = (minuteTime / 60);
//获取小时后取佘的分,获取分钟除以60取佘的分
minuteTime = (minuteTime % 60);
}
}
let result = '' + secondTime + 's';
if (minuteTime > 0) {
result = '' + minuteTime.toFixed(0) + 'min' + result;
}
if (hourTime > 0) {
result = '' + hourTime.toFixed(0) + 'h' + result;
}
return result;
}
/**
* 文件预览
*/
......
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