Newer
Older
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';
import {WarnListComponent} from '../../modal/warn-list/warn-list.component';
import {CommonService} from '../../shared/common/common.service';
import {WorkService} from '../../work/work.service';
selector: 'smart-now-alarm',
templateUrl: './now-alarm.component.html',
styles: [
`
.tag-warn{
padding: 5px;
}
.tag-warn span{
border: 1px solid #ccc;
margin-right: 10px;
display: inline-block;
margin-bottom: 10px;
padding: 2px 4px;
border-radius: 4px;
}
.tag-warn span.select-border {
border: 1px solid #1626e2;
border-radius: 5px;
padding: 2px;
margin-right: 5px;
}
loading = false;
pageCount = pageSize;
pageNum = 1;
totalNum;
constructor(public alarmSer: AlarmService, public message: NzMessageService,private workSer:WorkService,
public overAllSer:OverAllService,private commonSer:CommonService) {
this.time_ = setInterval(()=>{
this.search(null);
},2*60*1000);
}
ngOnDestroy(){
clearInterval(this.time_);
getType(){
this.overAllSer.findHostWarningCount().subscribe(
(res)=>{
if(res.errCode == 10000){
this.warnCountList = res.data;
}else{
this.message.info(res.errMsg);
}
}
)
}
change(e){
this.pageNum = e;
}
//打开modal
showModal(data){
this.sendLog.showModal(data);
}
//导出文件
downLoadExcel(){
this.isDownload = true;
const data = {
isWaring:'yes',
hostid:this.selectHostId,
};
this.alarmSer.getExportUrlEvent(data).subscribe(
(res)=>{
if(res.errCode == 10000){
this.workSer.downloadTemplate('alarm',res.data).subscribe(
(data)=>{
this.isDownload = false;
this.commonSer.downloadFile('当前告警.xlsx',data);
}
)
}else{
this.message.error(res.errMsg);
}
this.isDownload = false;
}
)
}