From 93d4fd8f6686f47e90ddcc3be20299efdcb132ca Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Sun, 28 Apr 2024 17:36:00 +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=8D=E8=A2=AB=E8=81=94=E5=8A=A8=E5=9B=BE=E8=A1=A8=E8=A2=AB?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=90=8E=EF=BC=8C=E8=81=94=E5=8A=A8=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=B2=A1=E6=9C=89=E6=B8=85=E7=90=86=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data-visualization/canvas/CanvasCore.vue | 1 + .../modules/data-visualization/dvMain.ts | 21 +++++++++++++++++++ .../modules/data-visualization/snapshot.ts | 7 +++++-- .../editor/editor-senior/Senior.vue | 2 +- 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue b/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue index 540a8c0aa9..a450434e39 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue @@ -867,6 +867,7 @@ function removeItem(index) { }) } componentData.value.splice(index, 1) + dvMainStore.removeLinkageInfo(item['id']) if (!!checkedFields.length) { Array.from(new Set(checkedFields)).forEach(ele => { emitter.emit(`query-data-${ele}`) diff --git a/core/core-frontend/src/store/modules/data-visualization/dvMain.ts b/core/core-frontend/src/store/modules/data-visualization/dvMain.ts index 868f204e3d..20edffc4b9 100644 --- a/core/core-frontend/src/store/modules/data-visualization/dvMain.ts +++ b/core/core-frontend/src/store/modules/data-visualization/dvMain.ts @@ -793,6 +793,9 @@ export const dvMainStore = defineStore('dataVisualization', { setNowPanelJumpInfo(jumpInfo) { this.nowPanelJumpInfo = jumpInfo.baseJumpInfoMap }, + setNowPanelJumpInfoInner(jumpInfo) { + this.nowPanelJumpInfo = jumpInfo + }, setNowTargetPanelJumpInfo(jumpInfo) { this.nowPanelJumpInfoTargetPanel = jumpInfo.baseJumpInfoVisualizationMap }, @@ -1122,6 +1125,24 @@ export const dvMainStore = defineStore('dataVisualization', { this.componentData = [] this.canvasViewInfo = {} }, + removeLinkageInfo(targetId) { + if (!!targetId && !!this.nowPanelTrackInfo) { + Object.keys(this.nowPanelTrackInfo).forEach(trackId => { + const targetInfo = this.nowPanelTrackInfo[trackId] + for (let i = 0; i < targetInfo.length; i++) { + if (targetInfo[i].indexOf(targetId) > -1) { + targetInfo.splice(i, 1) + i-- + } + } + }) + Object.keys(this.nowPanelTrackInfo).forEach(trackId => { + if (trackId.indexOf(targetId) > -1 || this.nowPanelTrackInfo[trackId].length === 0) { + delete this.nowPanelTrackInfo[trackId] + } + }) + } + }, canvasDataInit() { this.canvasViewInfo = {} this.componentData = [] diff --git a/core/core-frontend/src/store/modules/data-visualization/snapshot.ts b/core/core-frontend/src/store/modules/data-visualization/snapshot.ts index 23222c4ac7..1e1ce22eee 100644 --- a/core/core-frontend/src/store/modules/data-visualization/snapshot.ts +++ b/core/core-frontend/src/store/modules/data-visualization/snapshot.ts @@ -13,7 +13,8 @@ const { canvasStyleData, canvasViewInfo, curOriginThemes, - dataPrepareState + dataPrepareState, + nowPanelTrackInfo } = storeToRefs(dvMainStore) let defaultCanvasInfo = { @@ -81,6 +82,7 @@ export const snapshotStore = defineStore('snapshot', { dvMainStore.setComponentData(snapshotInfo.componentData) dvMainStore.setCanvasStyle(snapshotInfo.canvasStyleData) dvMainStore.setCanvasViewInfo(snapshotInfo.canvasViewInfo) + dvMainStore.setNowPanelJumpInfoInner(snapshotInfo.nowPanelTrackInfo) const curCacheViewIdInfo = deepCopy(this.cacheViewIdInfo) this.cacheViewIdInfo = snapshotInfo.cacheViewIdInfo @@ -139,7 +141,8 @@ export const snapshotStore = defineStore('snapshot', { componentData: deepCopy(componentData.value), canvasStyleData: deepCopy(canvasStyleData.value), canvasViewInfo: deepCopy(canvasViewInfo.value), - cacheViewIdInfo: deepCopy(this.cacheViewIdInfo) + cacheViewIdInfo: deepCopy(this.cacheViewIdInfo), + nowPanelTrackInfo: deepCopy(nowPanelTrackInfo.value) } this.snapshotData[++this.snapshotIndex] = newSnapshot // 在 undo 过程中,添加新的快照时,要将它后面的快照清理掉 diff --git a/core/core-frontend/src/views/chart/components/editor/editor-senior/Senior.vue b/core/core-frontend/src/views/chart/components/editor/editor-senior/Senior.vue index bbe33bf9b8..bc6b3fa1c2 100644 --- a/core/core-frontend/src/views/chart/components/editor/editor-senior/Senior.vue +++ b/core/core-frontend/src/views/chart/components/editor/editor-senior/Senior.vue @@ -21,7 +21,7 @@ import { BASE_VIEW_CONFIG } from '../util/chart' import { cloneDeep, defaultsDeep } from 'lodash-es' const dvMainStore = dvMainStoreWithOut() -const { nowPanelTrackInfo, nowPanelJumpInfo, dvInfo } = storeToRefs(dvMainStore) +const { nowPanelTrackInfo, nowPanelJumpInfo, dvInfo, componentData } = storeToRefs(dvMainStore) const { t } = useI18n() const linkJumpRef = ref(null)