From 3e0139dea14480b3fe386fc4d808163250ee7a09 Mon Sep 17 00:00:00 2001 From: zyh Date: Thu, 25 May 2023 10:06:17 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E5=8F=98=E9=87=8F=E6=9B=BF=E6=8D=A2=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/chart/chart/chartTable.vue | 12 ++++++------ nezha-fronted/src/components/chart/panelChart.vue | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/nezha-fronted/src/components/chart/chart/chartTable.vue b/nezha-fronted/src/components/chart/chart/chartTable.vue index adae168b8..74a6d55f4 100644 --- a/nezha-fronted/src/components/chart/chart/chartTable.vue +++ b/nezha-fronted/src/components/chart/chart/chartTable.vue @@ -205,9 +205,9 @@ export default { display: '', oldValue: '' } - if (/\{\{.+\}\}/.test(column.display)) { - column.display = this.globalVariablesReplace(column.display) - const labelValue = column.display.replace(/(\{\{.+?\}\})/g, function (i) { + const display = this.globalVariablesReplace(column.display) + if (/\{\{.+\}\}/.test(display)) { + const labelValue = display.replace(/(\{\{.+?\}\})/g, function (i) { const label = i.substr(i.indexOf('{{') + 2, i.indexOf('}}') - i.indexOf('{{') - 2) let value = null if (lodash.get(params, label)) { @@ -237,7 +237,7 @@ export default { } return value || '' }) - const oldLabelValue = column.display.replace(/(\{\{.+?\}\})/g, function (i) { + const oldLabelValue = display.replace(/(\{\{.+?\}\})/g, function (i) { const label = i.substr(i.indexOf('{{') + 2, i.indexOf('}}') - i.indexOf('{{') - 2) let value = null if (lodash.get(params, label)) { @@ -270,8 +270,8 @@ export default { } } else { obj[column.title + 'display'] = { - display: column.display, - oldValue: column.display + display: display, + oldValue: display } } }) diff --git a/nezha-fronted/src/components/chart/panelChart.vue b/nezha-fronted/src/components/chart/panelChart.vue index 11ffee26f..e525d88b7 100644 --- a/nezha-fronted/src/components/chart/panelChart.vue +++ b/nezha-fronted/src/components/chart/panelChart.vue @@ -147,13 +147,13 @@ export default { methods: { isGroup, variablesHandle (searchTime) { + this.setGlobalVariablesValue(searchTime) this.myVariables = [] // eslint-disable-next-line vue/no-mutating-props this.chartInfo.elements = this.$loadsh.cloneDeep(this.chartInfo.oldElements.filter(item => item.state)) // 处理不显示的表达式 // eslint-disable-next-line vue/no-mutating-props this.chartInfo.elements = this.chartInfo.elements.map((item, index) => { // 处理表达式的变量 // 全局变量替换 - this.setGlobalVariablesValue(searchTime) item.expression = this.globalVariablesReplace(item.expression, searchTime) // group图表设置repeat的表达式替换 if (this.chartInfo.repeatVariable) {