From 4ba083f48fa2784aea2d622665e303fff10d66d1 Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Tue, 12 Dec 2023 11:54:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BC=80=E5=90=AF=E9=A6=96=E9=A1=B9?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E5=88=B7=E6=96=B0=E9=A1=B5=E9=9D=A2=EF=BC=8C?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E9=A6=96=E9=A1=B9=E9=80=89=E9=A1=B9=E7=9A=84?= =?UTF-8?q?=E8=A7=86=E5=9B=BE=E6=98=BE=E7=A4=BA=E6=88=90=E7=A9=BA=E7=99=BD?= =?UTF-8?q?=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../canvas/components/editor/DeEditor.vue | 17 ++++++++++++++ .../canvas/components/editor/Preview.vue | 23 +++++++++++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/core/frontend/src/components/canvas/components/editor/DeEditor.vue b/core/frontend/src/components/canvas/components/editor/DeEditor.vue index 7340198ee3..99c7ed36c4 100644 --- a/core/frontend/src/components/canvas/components/editor/DeEditor.vue +++ b/core/frontend/src/components/canvas/components/editor/DeEditor.vue @@ -886,6 +886,7 @@ export default { originWidth: 80, // 原始尺寸 originHeight: 20 }, + filterMapCache: {}, showDrag: true, vLine: [], hLine: [], @@ -1026,6 +1027,18 @@ export default { }, filterMap() { const result = buildFilterMap(this.componentData) + Object.keys(result).forEach(ele => { + if (this.filterMapCache[ele]?.length) { + result[ele].forEach(itx => { + const condition = this.filterMapCache[ele].find(item => item.componentId === itx.componentId && itx.cacheObj) + if (condition) { + itx.cacheObj = condition.cacheObj + } + }) + } else { + this.filterMapCache[ele] = result[ele] + } + }) if (this.searchButtonInfo && this.searchButtonInfo.buttonExist && !this.searchButtonInfo.autoTrigger && this.searchButtonInfo.relationFilterIds) { for (const key in result) { if (Object.hasOwnProperty.call(result, key)) { @@ -1140,12 +1153,16 @@ export default { bus.$off('trigger-search-button', this.triggerSearchButton) bus.$off('refresh-button-info', this.refreshButtonInfo) bus.$off('trigger-reset-button', this.triggerResetButton) + bus.$off('filter-loaded-viewIds') }, created() { + bus.$on('filter-loaded-viewIds', this.filterLoaded) }, methods: { filterLoaded(p) { + console.log('filter-loaded-viewIds') buildAfterFilterLoaded(this.filterMap, p) + this.filterMapCache = {} }, getWrapperChildRefs() { return this.$refs['wrapperChild'] diff --git a/core/frontend/src/components/canvas/components/editor/Preview.vue b/core/frontend/src/components/canvas/components/editor/Preview.vue index 82c49439d7..2507d59bea 100644 --- a/core/frontend/src/components/canvas/components/editor/Preview.vue +++ b/core/frontend/src/components/canvas/components/editor/Preview.vue @@ -276,6 +276,7 @@ export default { mainWidth: '100%', mainHeight: '100%', searchCount: 0, + filterMapCache: {}, // 布局展示 1.pc pc端布局 2.mobile 移动端布局 terminal: 'pc', buttonFilterMap: null, @@ -383,6 +384,21 @@ export default { }, filterMap() { const result = buildFilterMap(this.componentData) + Object.keys(result).forEach(ele => { + if (this.filterMapCache[ele]?.length) { + result[ele].forEach(itx => { + const condition = this.filterMapCache[ele].find(item => item.componentId === itx.componentId && itx.cacheObj) + if (condition) { + itx.cacheObj = condition.cacheObj + } + }) + if (!result[ele].length) { + result[ele] = this.filterMapCache[ele] + } + } else { + this.filterMapCache[ele] = result[ele] + } + }) if (this.searchButtonInfo && this.searchButtonInfo.buttonExist && !this.searchButtonInfo.autoTrigger && this.searchButtonInfo.relationFilterIds) { for (const key in result) { if (Object.hasOwnProperty.call(result, key)) { @@ -446,6 +462,7 @@ export default { bus.$on('trigger-search-button', this.triggerSearchButton) bus.$on('trigger-reset-button', this.triggerResetButton) this.initPdfTemplate() + bus.$on('filter-loaded-preview', this.filterLoaded) }, beforeDestroy() { if (this.$refs[this.previewTempRefId]) { @@ -454,16 +471,18 @@ export default { if (this.$refs[this.previewRefId]) { erd.uninstall(this.$refs[this.previewRefId]) } - erd.uninstall(this.canvasMain) - erd.uninstall(this.tempCanvas) + this.canvasMain && erd.uninstall(this.canvasMain) + this.tempCanvas && erd.uninstall(this.tempCanvas) clearInterval(this.timer) this.canvasId === 'canvas-main' && bus.$off('pcChartDetailsDialog', this.openChartDetailsDialog) bus.$off('trigger-search-button', this.triggerSearchButton) bus.$off('trigger-reset-button', this.triggerResetButton) + bus.$off('filter-loaded-preview') }, methods: { filterLoaded(p) { buildAfterFilterLoaded(this.filterMap, p) + this.filterMapCache = {} this.getWrapperChildRefs().forEach(item => item.triggerFilterLoaded(p)) }, getWrapperChildRefs() {