From e0f895022197ce45d99b06a1c162087556ab6857 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Mon, 24 Jul 2023 15:45:54 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9Agroup=20chart=20=E5=B1=95=E5=BC=80?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E8=AE=B0=E5=BD=95=E5=88=B0=20localstorage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/components/chart/chartList.vue | 6 ++++++ nezha-fronted/src/components/chart/panelChart.vue | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/nezha-fronted/src/components/chart/chartList.vue b/nezha-fronted/src/components/chart/chartList.vue index b176f9c1b..f0336b0ca 100644 --- a/nezha-fronted/src/components/chart/chartList.vue +++ b/nezha-fronted/src/components/chart/chartList.vue @@ -788,6 +788,12 @@ export default { item.span = 12 item.height = 2 } + if (item.type === 'group') { + const chartGroupExpand = localStorage.getItem('nz-chart-group-expand') ? JSON.parse(localStorage.getItem('nz-chart-group-expand')) : {} + if (typeof chartGroupExpand[item.id] !== 'undefined') { + item.param.collapse = chartGroupExpand[item.id] + } + } if (item.param) { param = JSON.parse(JSON.stringify(item.param)) // try { diff --git a/nezha-fronted/src/components/chart/panelChart.vue b/nezha-fronted/src/components/chart/panelChart.vue index fe2df651d..2953be214 100644 --- a/nezha-fronted/src/components/chart/panelChart.vue +++ b/nezha-fronted/src/components/chart/panelChart.vue @@ -748,6 +748,11 @@ export default { this.chartInfo.param = {} } this.chartInfo.param.collapse = flag + const chartGroupExpand = localStorage.getItem('nz-chart-group-expand') ? JSON.parse(localStorage.getItem('nz-chart-group-expand')) : {} + if (this.chartInfo.id && this.chartInfo.id > 0) { + chartGroupExpand[this.chartInfo.id] = this.chartInfo.param.collapse + localStorage.setItem('nz-chart-group-expand', JSON.stringify(chartGroupExpand)) + } this.groupInit() bus.$emit('groupMove', '', '', true) this.$emit('groupShow', this.chartInfo)