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() })