From 7f49e93dcb4c8f17b8b189b7ed498072f089f9d2 Mon Sep 17 00:00:00 2001 From: zyh Date: Thu, 25 Apr 2024 15:27:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/components/chart/panelChart.vue | 4 ++-- .../src/components/common/mixin/globalVariables.js | 10 ++++++++++ nezha-fronted/src/components/common/mixin/table.js | 2 -- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/nezha-fronted/src/components/chart/panelChart.vue b/nezha-fronted/src/components/chart/panelChart.vue index 9ff5538ca..a0e5f6ed5 100644 --- a/nezha-fronted/src/components/chart/panelChart.vue +++ b/nezha-fronted/src/components/chart/panelChart.vue @@ -176,7 +176,7 @@ export default { // eslint-disable-next-line vue/no-mutating-props this.chartInfo.elements = this.chartInfo.elements.map((item, index) => { // 处理表达式的变量 // 全局变量替换 - item.expression = this.globalVariablesReplace(item.expression, searchTime) + item.expression = this.globalVariablesReplace(item.expression) // group图表设置repeat的表达式替换 if (this.chartInfo.repeatVariable) { item.expression = this.variablesReplaceRepeat(item.expression) @@ -253,7 +253,7 @@ export default { if (!this.chartInfo.oldElements) { // 创建一个备份 用于判断变量替换 能拿到原本变量的位置 this.chartInfo.oldElements = this.chartInfo.elements ? JSON.parse(JSON.stringify(this.chartInfo.elements)) : [] } - this.variablesHandle() + this.variablesHandle([startTime * 1000, endTime * 1000]) const elements = this.chartInfo.elements || [] if (this.isExportHtml) { this.chartInfo.loaded && this.queryData(elements, startTime, endTime, step, params, isRefresh) diff --git a/nezha-fronted/src/components/common/mixin/globalVariables.js b/nezha-fronted/src/components/common/mixin/globalVariables.js index 7271ca690..c87c91f7d 100644 --- a/nezha-fronted/src/components/common/mixin/globalVariables.js +++ b/nezha-fronted/src/components/common/mixin/globalVariables.js @@ -29,6 +29,12 @@ export default { if (!timeRange) { return } + if (!isNaN(timeRange[0])) { + timeRange[0] = bus.computeTimezone(timeRange[0]) + } + if (!isNaN(timeRange[1])) { + timeRange[1] = bus.computeTimezone(timeRange[1]) + } this.globalVariables.forEach(item => { switch (item.name) { case '$G.dashboard.name': { @@ -83,6 +89,8 @@ export default { value = parseInt(step) * 1000 } else if (unit === 'm') { value = parseInt(step) * 1000 * 60 + } else if (unit === 'h') { + value = parseInt(step) * 1000 * 60 * 60 } item.value = value break @@ -95,6 +103,8 @@ export default { value = parseInt(step) } else if (unit === 'm') { value = parseInt(step) * 60 + } else if (unit === 'h') { + value = parseInt(step) * 60 * 60 } item.value = value break diff --git a/nezha-fronted/src/components/common/mixin/table.js b/nezha-fronted/src/components/common/mixin/table.js index 50b70c4d8..133837375 100644 --- a/nezha-fronted/src/components/common/mixin/table.js +++ b/nezha-fronted/src/components/common/mixin/table.js @@ -126,8 +126,6 @@ export default { const findItem = this.customTableTitle.find(item => item.prop == column.property) findItem && (findItem.width = newWidth) this.$parent.$parent.setPreference() - console.log(this.customTableTitle) - console.log(column) this.$nextTick(() => { this.$refs.dataTable.doLayout() })