feat: overview trend日期筛选
This commit is contained in:
@@ -191,6 +191,8 @@
|
|||||||
alertRuleStatData: {},
|
alertRuleStatData: {},
|
||||||
dataCenterMapSeries: [],
|
dataCenterMapSeries: [],
|
||||||
|
|
||||||
|
trendSearchTime: {start: '', end: ''},
|
||||||
|
|
||||||
alertMessageShow: 'asset', //asset/module
|
alertMessageShow: 'asset', //asset/module
|
||||||
bottom3DropdownShow: false, //最底部行第三列的下拉选择框
|
bottom3DropdownShow: false, //最底部行第三列的下拉选择框
|
||||||
|
|
||||||
@@ -416,16 +418,27 @@
|
|||||||
},
|
},
|
||||||
queryAlertTrendData() {
|
queryAlertTrendData() {
|
||||||
this.$refs.chartbox.startLoading();
|
this.$refs.chartbox.startLoading();
|
||||||
let cur=this.dateFormat('yyyy-mm-dd HH:MM:SS',new Date());
|
let before;
|
||||||
let beforeDate=new Date();
|
let end;
|
||||||
beforeDate.setHours(new Date().getHours()-1);
|
if (this.trendSearchTime.start) {
|
||||||
let before=this.dateFormat('yyyy-mm-dd HH:MM:SS',beforeDate);
|
before = this.trendSearchTime.start;
|
||||||
|
} else {
|
||||||
|
before = new Date();
|
||||||
|
before.setMinutes(new Date().getMinutes()-5);
|
||||||
|
before = this.dateFormat('yyyy-mm-dd HH:MM:SS', before);
|
||||||
|
}
|
||||||
|
if (this.trendSearchTime.end) {
|
||||||
|
end = this.trendSearchTime.end;
|
||||||
|
} else {
|
||||||
|
end = new Date();
|
||||||
|
end = this.dateFormat('yyyy-mm-dd HH:MM:SS', end);
|
||||||
|
}
|
||||||
let params = {
|
let params = {
|
||||||
query: 'sum(nz_alert_nums)',
|
query: 'sum(nz_alert_nums)',
|
||||||
start: before,
|
start: before,
|
||||||
end:cur,
|
end: end,
|
||||||
step: '15s'
|
step: '15s'
|
||||||
}
|
};
|
||||||
this.$get('/prom/api/v1/query_range',params).then(response=>{
|
this.$get('/prom/api/v1/query_range',params).then(response=>{
|
||||||
if(response.status == 'success'){
|
if(response.status == 'success'){
|
||||||
if(response.data.result){
|
if(response.data.result){
|
||||||
@@ -435,11 +448,10 @@
|
|||||||
smooth:true, //曲线变平滑
|
smooth:true, //曲线变平滑
|
||||||
data: [],
|
data: [],
|
||||||
type:'line',
|
type:'line',
|
||||||
// areaStyle:{}
|
};
|
||||||
}
|
|
||||||
series.data=response.data.result[0].values.map((item)=>{
|
series.data=response.data.result[0].values.map((item)=>{
|
||||||
return [item[0]*1000,item[1]];
|
return [item[0]*1000,item[1]];
|
||||||
})
|
});
|
||||||
this.chartSeries = [series];
|
this.chartSeries = [series];
|
||||||
this.$refs.chartbox.setSeries(this.chartSeries);
|
this.$refs.chartbox.setSeries(this.chartSeries);
|
||||||
this.$refs.chartbox.endLoading();
|
this.$refs.chartbox.endLoading();
|
||||||
@@ -608,11 +620,9 @@
|
|||||||
},
|
},
|
||||||
/*初始化数据 end*/
|
/*初始化数据 end*/
|
||||||
dateChange(val) {
|
dateChange(val) {
|
||||||
/*this.searchTime = [...val];
|
this.trendSearchTime.start = val[0];
|
||||||
this.filter.start_time = bus.timeFormate(this.searchTime[0], 'yyyy-MM-dd hh:mm:ss');
|
this.trendSearchTime.end = val[1];
|
||||||
this.filter.end_time = bus.timeFormate(this.searchTime[1], 'yyyy-MM-dd hh:mm:ss');
|
this.queryAlertTrendData();
|
||||||
this.filter.panelId = this.showPanel.id;
|
|
||||||
this.getData(this.filter);*/
|
|
||||||
},
|
},
|
||||||
topNChange(type, top) {
|
topNChange(type, top) {
|
||||||
this.topFilter[type] = top;
|
this.topFilter[type] = top;
|
||||||
|
|||||||
Reference in New Issue
Block a user