diff --git a/nezha-fronted/src/components/chart/chartList.vue b/nezha-fronted/src/components/chart/chartList.vue index 71ba64809..8d2c44b99 100644 --- a/nezha-fronted/src/components/chart/chartList.vue +++ b/nezha-fronted/src/components/chart/chartList.vue @@ -794,6 +794,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 a0ee60cfc..a02ce25db 100644 --- a/nezha-fronted/src/components/chart/panelChart.vue +++ b/nezha-fronted/src/components/chart/panelChart.vue @@ -762,6 +762,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)