From 6b9812bd6a37b97d492c1ae5c93b8dddce9331bb Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 30 May 2024 11:24:22 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8DCas=E9=87=8D=E6=96=B0=E7=99=BB=E5=BD=95=E5=90=8E?= =?UTF-8?q?=E7=9C=8B=E4=B8=8D=E5=88=B0=E6=95=B0=E6=8D=AE=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/panel/list/PanelList.vue | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/core/frontend/src/views/panel/list/PanelList.vue b/core/frontend/src/views/panel/list/PanelList.vue index 9ba4421a26..87c7bdc788 100644 --- a/core/frontend/src/views/panel/list/PanelList.vue +++ b/core/frontend/src/views/panel/list/PanelList.vue @@ -989,9 +989,17 @@ export default { }, tree(cache = false) { const modelInfo = localStorage.getItem('panel-main-tree') - const userCache = modelInfo && cache + let preParse + if (modelInfo) { + try { + preParse = JSON.parse(modelInfo) + } catch (e) { + console.warn('panel-main-tree cache error') + } + } + const userCache = preParse && cache if (userCache) { - this.originResourceTree = JSON.parse(modelInfo) + this.originResourceTree = preParse this.sortTypeChange(this.localSortParams) } groupTree(this.groupForm, !userCache).then((res) => { @@ -1017,10 +1025,18 @@ export default { panelType: 'system' } const modelInfo = localStorage.getItem('panel-default-tree') - const userCache = modelInfo && cache + let preParse + if (modelInfo) { + try { + preParse = JSON.parse(modelInfo) + } catch (e) { + console.warn('panel-default-tree cache error') + } + } + const userCache = preParse && cache if (userCache) { - this.defaultData = JSON.parse(modelInfo) + this.defaultData = preParse if (showFirst && this.defaultData && this.defaultData.length > 0) { this.activeDefaultNodeAndClickOnly(this.defaultData[0].id) }