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)