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