fix:加载后台报错处理
This commit is contained in:
@@ -15,7 +15,7 @@ export default {
|
||||
/*this.$http.get("config.json").then((result)=>{
|
||||
this.$axios.defaults.baseURL = result.body.baseUrl;
|
||||
});*/
|
||||
this.$axios.defaults.baseURL = 'http://192.168.40.42:8080/nz-admin';
|
||||
this.$axios.defaults.baseURL = 'http://192.168.40.41:8080/nz-admin';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -571,7 +571,9 @@ export default {
|
||||
}else{
|
||||
step='30m';
|
||||
}
|
||||
if(this.$refs.messageChart){
|
||||
this.$refs.messageChart.startLoading();
|
||||
}
|
||||
let axiosArr=[];
|
||||
let paramStr = JSON.stringify(this.promQueryParamConvert(this.currentMsg));
|
||||
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));
|
||||
@@ -667,6 +669,7 @@ export default {
|
||||
this.storedTableData.forEach((item) => {
|
||||
item.labels = JSON.parse(item.labels);
|
||||
let paramStr = JSON.stringify(this.promQueryParamConvert(item));
|
||||
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 => {
|
||||
let current = [];
|
||||
if (response2.data && response2.data.result && response2.data.result.length > 0) {
|
||||
@@ -680,6 +683,7 @@ export default {
|
||||
}
|
||||
this.$set(item, "current", current);
|
||||
});
|
||||
}
|
||||
});
|
||||
this.pageObj.total = response.data.total;
|
||||
this.isError = false;
|
||||
@@ -695,6 +699,7 @@ export default {
|
||||
});
|
||||
},
|
||||
promQueryParamConvert(obj) {
|
||||
if(obj){
|
||||
return "(" + obj.alertRule.expr + ") and (" + function(){
|
||||
let q = "{";
|
||||
for (let k in obj.labels) {
|
||||
@@ -710,6 +715,8 @@ export default {
|
||||
q += "}";
|
||||
return q;
|
||||
}() + ")";
|
||||
}
|
||||
return '';
|
||||
},
|
||||
elementsetShow(s, e) {
|
||||
var eventfixed = {
|
||||
|
||||
Reference in New Issue
Block a user