Commit 1a274244 authored by wangqinghua's avatar wangqinghua

定时刷新

parent 25c8598b
import {Component, OnInit, ViewChild, ElementRef} from '@angular/core';
import {Component, OnInit, ViewChild, ElementRef, OnDestroy} from '@angular/core';
import {AlarmService} from '../alarm.service';
import {NzMessageService} from 'ng-zorro-antd';
import {SendLogComponent} from '../modal/send-log/send-log.component';
......@@ -28,7 +28,7 @@ import {OverAllService} from '../../overAll/overAll.service';
`
]
})
export class NowAlarmComponent implements OnInit {
export class NowAlarmComponent implements OnInit, OnDestroy {
@ViewChild('sendLog') sendLog:SendLogComponent;
@ViewChild('warnList') warnList:WarnListComponent;
......@@ -39,6 +39,7 @@ export class NowAlarmComponent implements OnInit {
pageCount = pageSize;
pageNum = 1;
totalNum;
time_;
constructor(public alarmSer: AlarmService, public message: NzMessageService,
public overAllSer:OverAllService) {
......@@ -47,6 +48,13 @@ export class NowAlarmComponent implements OnInit {
ngOnInit() {
this.search(null);
this.getType();
this.time_ = setInterval(()=>{
this.search(null);
},2*60*1000);
}
ngOnDestroy(){
clearInterval(this.time_);
}
search(hostid){
......
......@@ -13,7 +13,6 @@
</nz-breadcrumb>
</div>
<div nz-col nzSpan="8" class="text-right">
<button (click)="search()" nz-button nzType="primary"><i class="anticon anticon-search"></i></button>
<button (click)="ngOnInit()" nz-button nzType="primary"><i class="anticon anticon-sync"></i></button>
<smart-full-screen></smart-full-screen>
</div>
......@@ -61,7 +60,7 @@
</div>
</div>
<nz-table #nzTable [nzData]="eventList" [nzFrontPagination]="false" [nzTotal]="totalNum" [nzPageIndex]="pageNum" [nzPageSize]="pageCount" (nzPageIndexChange)="change($event)">
<nz-table #nzTable [nzData]="eventList" [nzLoading]="isLoading" [nzFrontPagination]="false" [nzTotal]="totalNum" [nzPageIndex]="pageNum" [nzPageSize]="pageCount" (nzPageIndexChange)="change($event)">
<thead>
<tr>
<th>事件编号</th>
......
......@@ -25,6 +25,8 @@ export class WorkHandleComponent implements OnInit {
eventTypeList;
startTime;
endTime;
isLoading = false;
pageCount = pageSize;
pageNum = 1;
totalNum;
......@@ -63,6 +65,7 @@ export class WorkHandleComponent implements OnInit {
//获取列表
getList() {
this.isLoading = true;
const obj = {
pageCount: this.pageCount,
pageNum: this.pageNum,
......@@ -78,6 +81,7 @@ export class WorkHandleComponent implements OnInit {
if (res.errCode == 10000) {
this.eventList = res.data.data;
this.totalNum = res.data.totalNum;
this.isLoading = false;
}
}
);
......
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