fix:多次无用加载修复

This commit is contained in:
wangwenrui
2020-05-28 18:29:15 +08:00
parent 950eba43ee
commit 764eb82bd7

View File

@@ -576,6 +576,7 @@ export default {
} }
let axiosArr=[]; let axiosArr=[];
let paramStr = JSON.stringify(this.promQueryParamConvert(this.currentMsg)); let paramStr = JSON.stringify(this.promQueryParamConvert(this.currentMsg));
if(paramStr&&paramStr.trim()!='""'){
axiosArr.push(axios.get("/prom/api/v1/query_range?query="+paramStr.substring(1, paramStr.length-1).replace(/\+/g, "%2B").replace(/ /g, "%20").replace(/\\/g, "")+"&start="+this.$stringTimeParseToUnix(start)+"&end="+this.$stringTimeParseToUnix(end)+"&step="+step)); axiosArr.push(axios.get("/prom/api/v1/query_range?query="+paramStr.substring(1, paramStr.length-1).replace(/\+/g, "%2B").replace(/ /g, "%20").replace(/\\/g, "")+"&start="+this.$stringTimeParseToUnix(start)+"&end="+this.$stringTimeParseToUnix(end)+"&step="+step));
this.legend = []; this.legend = [];
this.chartDatas = []; this.chartDatas = [];
@@ -630,6 +631,7 @@ export default {
this.$refs.messageChart.endLoading(); this.$refs.messageChart.endLoading();
} }
}) })
}
}, },
getAlertList: function (filterType) { getAlertList: function (filterType) {
let queryParam={ let queryParam={
@@ -669,7 +671,7 @@ export default {
this.storedTableData.forEach((item) => { this.storedTableData.forEach((item) => {
item.labels = JSON.parse(item.labels); item.labels = JSON.parse(item.labels);
let paramStr = JSON.stringify(this.promQueryParamConvert(item)); let paramStr = JSON.stringify(this.promQueryParamConvert(item));
if(paramStr&& paramStr !=''){ if(paramStr&& paramStr !='""'){
this.$get('/prom/api/v1/query?query=' + paramStr.substring(1, paramStr.length-1).replace(/\+/g, "%2B").replace(/ /g, "%20").replace(/\\/g, "")).then(response2 => { this.$get('/prom/api/v1/query?query=' + paramStr.substring(1, paramStr.length-1).replace(/\+/g, "%2B").replace(/ /g, "%20").replace(/\\/g, "")).then(response2 => {
let current = []; let current = [];
if (response2.data && response2.data.result && response2.data.result.length > 0) { if (response2.data && response2.data.result && response2.data.result.length > 0) {