From 844772c937915c9fec2e0d7cab613b9b3dd1ce9e Mon Sep 17 00:00:00 2001 From: zhangyu Date: Thu, 8 Jun 2023 14:58:31 +0800 Subject: [PATCH 1/2] =?UTF-8?q?NEZ-2860=20fix=EF=BC=9AChart=20preview=20?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E8=8C=83=E5=9B=B4=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/rightBox/chart/chartRightBox.vue | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue index 04a3e10b7..88347ab63 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue +++ b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue @@ -183,7 +183,10 @@ export default { computed: { chartLastPosition () { return this.$store.getters.getChartLastPosition - } + }, + timeRange () { + return this.$store.getters.getTimeRange + }, }, data () { return { @@ -198,7 +201,7 @@ export default { id: '', name: '' }, - timeRange: [], + // timeRange: [], prevChart: '', filterPanel: '', groupArr: [], @@ -507,9 +510,9 @@ export default { if (show) { this.prevChart = '' setTimeout(() => { - const start = new Date().setHours(new Date().getHours() - 1) - const end = new Date() - this.timeRange = [bus.computeTimezoneTime(start), bus.computeTimezoneTime(end)] + // const start = new Date().setHours(new Date().getHours() - 1) + // const end = new Date() + // this.timeRange = [bus.computeTimezoneTime(start), bus.computeTimezoneTime(end)] this.prevChart = { ...lodash.cloneDeep(this.editChart), loaded: true From feecf7956afc6923f854feb177920de46ef84ec3 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Thu, 8 Jun 2023 15:33:35 +0800 Subject: [PATCH 2/2] =?UTF-8?q?NEZ-2860=20fxi=EF=BC=9A=20Chart=20preview?= =?UTF-8?q?=20=E6=97=B6=E9=97=B4=E8=8C=83=E5=9B=B4=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/chart/ChartScreenHeader.vue | 9 +++++++-- .../src/components/chart/chartHeaderMixin.js | 3 +++ .../src/components/chart/panelChart.vue | 5 +++++ .../common/rightBox/chart/chartRightBox.vue | 18 ++++++++++-------- 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/nezha-fronted/src/components/chart/ChartScreenHeader.vue b/nezha-fronted/src/components/chart/ChartScreenHeader.vue index 7b6d46d22..52d1ebd7d 100644 --- a/nezha-fronted/src/components/chart/ChartScreenHeader.vue +++ b/nezha-fronted/src/components/chart/ChartScreenHeader.vue @@ -197,8 +197,13 @@ export default { this.searchTime[1] = bus.timeFormate(this.timeRange[1]) this.nowType.start_time = this.searchTime[0] this.nowType.end_time = this.searchTime[1] - this.$refs.pickTime.$refs.timePicker.setCustomTime(this.nowType) - this.setSearchTime(this.nowType.type, this.nowType.value, this.nowType) + if (!this.nowTimeType) { + this.$refs.pickTime.$refs.timePicker.setCustomTime(this.nowType) + this.setSearchTime(this.nowType.type, this.nowType.value, this.nowType) + } else { + this.$refs.pickTime.$refs.timePicker.setCustomTime(this.nowTimeType) + this.setSearchTime(this.nowType.type, this.nowType.value, this.nowTimeType) + } } } } diff --git a/nezha-fronted/src/components/chart/chartHeaderMixin.js b/nezha-fronted/src/components/chart/chartHeaderMixin.js index 214b4d6af..c89b0a600 100644 --- a/nezha-fronted/src/components/chart/chartHeaderMixin.js +++ b/nezha-fronted/src/components/chart/chartHeaderMixin.js @@ -27,6 +27,9 @@ export default { type: Boolean, default: false }, + nowTimeType: { + type: Number + }, hiddenText: { // 隐藏图表的悬浮文字 type: String } diff --git a/nezha-fronted/src/components/chart/panelChart.vue b/nezha-fronted/src/components/chart/panelChart.vue index cc1d737ae..f185c5010 100644 --- a/nezha-fronted/src/components/chart/panelChart.vue +++ b/nezha-fronted/src/components/chart/panelChart.vue @@ -7,6 +7,7 @@ :is-group="isGroup(chartInfo.type)" :isExportHtml="isExportHtml" :isError="isError" + :nowTimeType="nowTimeType" :chartData="chartData" :chart-info="chartInfo" :showAllData.sync="showAllData" @@ -26,6 +27,7 @@ :is-group="isGroup(chartInfo.type)" :isError="isError" :from="from" + :nowTimeType="nowTimeType" :chartData="chartData" :chart-info="chartInfo" :showAllData.sync="showAllData" @@ -92,6 +94,9 @@ export default { type: Boolean, default: true }, + nowTimeType: { + type: Object + }, isExportHtml: { // 是否是导出的html type: Boolean, default: false diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue index 88347ab63..bb443b4df 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue +++ b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue @@ -121,6 +121,11 @@ > { - // const start = new Date().setHours(new Date().getHours() - 1) - // const end = new Date() - // this.timeRange = [bus.computeTimezoneTime(start), bus.computeTimezoneTime(end)] + const start = new Date().setHours(new Date().getHours() - 1) + const end = new Date() + this.timeRange = [bus.computeTimezoneTime(start), bus.computeTimezoneTime(end)] this.prevChart = { ...lodash.cloneDeep(this.editChart), loaded: true