From bf41d482557220bb1a90ecd71b70d2e6a0a25009 Mon Sep 17 00:00:00 2001 From: wangwenrui Date: Thu, 15 Oct 2020 10:03:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=86=85=E7=BD=AE=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E8=A7=84=E5=88=99=E4=BA=A7=E7=94=9F=E7=9A=84=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E4=B8=8D=E6=9F=A5=E8=AF=A2=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/alert/alertMessageTable.vue | 7 ++- .../common/bottomBox/tabs/alertMessageTab.vue | 57 ++++++++++--------- .../src/components/page/alert/list.vue | 44 +++++++------- 3 files changed, 59 insertions(+), 49 deletions(-) diff --git a/nezha-fronted/src/components/common/alert/alertMessageTable.vue b/nezha-fronted/src/components/common/alert/alertMessageTable.vue index 188b5ac95..41b1d37b3 100644 --- a/nezha-fronted/src/components/common/alert/alertMessageTable.vue +++ b/nezha-fronted/src/components/common/alert/alertMessageTable.vue @@ -133,7 +133,7 @@ {{scope.row['state'] == 2 ? "Expired" : ""}}
- - + -
@@ -614,12 +614,15 @@ this.deleteBox.show = false; }, exportCur:function(){ - this.exportExcel(this.searchLabel); + let searchLabel=Object.assign({},this.searchLabel) + this.$set(searchLabel,'language',localStorage.getItem("nz-language") ? localStorage.getItem("nz-language") : 'en') + this.exportExcel(searchLabel); this.closeDialog(); }, exportAll:function(){ let temp = JSON.parse(JSON.stringify(this.searchLabel)); temp.pageSize = -1; + this.$set(temp,'language',localStorage.getItem("nz-language") ? localStorage.getItem("nz-language") : 'en') this.exportExcel(temp); this.closeDialog(); }, diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTab.vue index 05cd0b7ac..bdce79fc7 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTab.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTab.vue @@ -307,7 +307,16 @@ }) }, exportCur:function(){ - this.exportExcel(this.searchLabel); + let searchLabel=Object.assign({},this.searchLabel) + this.$set(searchLabel,'language',localStorage.getItem("nz-language") ? localStorage.getItem("nz-language") : 'en') + this.exportExcel(searchLabel); + this.importBox.show = false; + }, + exportAll:function(){ + let temp = JSON.parse(JSON.stringify(this.searchLabel)); + temp.pageSize = -1; + this.$set(temp,'language',localStorage.getItem("nz-language") ? localStorage.getItem("nz-language") : 'en') + this.exportExcel(temp); this.importBox.show = false; }, getTimeString:function(){ @@ -324,12 +333,6 @@ formatNum:function(num){ return num>9?num:'0'+num; }, - exportAll:function(){ - let temp = JSON.parse(JSON.stringify(this.searchLabel)); - temp.pageSize = -1; - this.exportExcel(temp); - this.importBox.show = false; - }, exportExcel:function(params){ let temp=this; if(!params){ @@ -485,25 +488,27 @@ this.tableData = response.data.list; this.tableData.forEach((item) => { item.labels = JSON.parse(item.labels); - let paramStr = JSON.stringify(this.promQueryParamConvert(item)); - 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) { - current = response2.data.result[0].value.map((item, i) => { - if (i == 0) { - return bus.computeTimezone(item); - } else { - return parseFloat(item).toFixed(2); - } - }); - } - this.requestIndex+=1; - item.current=current; - if(this.requestIndex===this.tableData.length){ - this.$set(item, "current", current); - this.requestIndex=0; - } - }); + if(item.alertRule.buildIn != 1) { + let paramStr = JSON.stringify(this.promQueryParamConvert(item)); + 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) { + current = response2.data.result[0].value.map((item, i) => { + if (i == 0) { + return bus.computeTimezone(item); + } else { + return parseFloat(item).toFixed(2); + } + }); + } + this.requestIndex += 1; + item.current = current; + if (this.requestIndex === this.tableData.length) { + this.$set(item, "current", current); + this.requestIndex = 0; + } + }); + } }); this.pageObj.total = response.data.total; this.loading = false; diff --git a/nezha-fronted/src/components/page/alert/list.vue b/nezha-fronted/src/components/page/alert/list.vue index 2db97d482..dfb3bd113 100644 --- a/nezha-fronted/src/components/page/alert/list.vue +++ b/nezha-fronted/src/components/page/alert/list.vue @@ -348,27 +348,29 @@ this.$nextTick(() => { this.tableData.forEach((item) => { item.labels = JSON.parse(item.labels); - let paramStr = JSON.stringify(this.promQueryParamConvert(item)); - 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) { - current = response2.data.result[0].value.map((item, i) => { - if (i == 0) { - return bus.computeTimezone(item); - } else { - return parseFloat(item).toFixed(2); - } - }); - }else{ - current=[null,null] - } - this.requestIndex+=1; - item.current=current; - if(this.requestIndex===this.tableData.length){ - this.$set(item, "current", current); - this.requestIndex=0; - } - }); + if(item.alertRule.buildIn != 1){ + let paramStr = JSON.stringify(this.promQueryParamConvert(item)); + 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) { + current = response2.data.result[0].value.map((item, i) => { + if (i == 0) { + return bus.computeTimezone(item); + } else { + return parseFloat(item).toFixed(2); + } + }); + }else{ + current=[null,null] + } + this.requestIndex+=1; + item.current=current; + if(this.requestIndex===this.tableData.length){ + this.$set(item, "current", current); + this.requestIndex=0; + } + }); + } }); }); this.deleteBox.ids='';