From 8d6de683d26e115380c00592faaac6b92a143596 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 25 Oct 2024 12:43:01 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F=E4=B8=AD?= =?UTF-8?q?Tab=E5=86=85=E7=BB=84=E4=BB=B6=E5=8F=8D=E5=A4=8D=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E5=8F=AF=E8=83=BD=E5=87=BA=E7=8E=B0=E7=9A=84=E9=94=99?= =?UTF-8?q?=E4=BD=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/custom-component/de-tabs/Component.vue | 6 ------ .../src/utils/changeComponentsSizeWithScale.ts | 3 ++- core/core-frontend/src/utils/style.ts | 13 ++++++++++++- core/core-frontend/src/views/canvas/DeCanvas.vue | 4 ++++ 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/core/core-frontend/src/custom-component/de-tabs/Component.vue b/core/core-frontend/src/custom-component/de-tabs/Component.vue index d5d2603979..4b67fa75d8 100644 --- a/core/core-frontend/src/custom-component/de-tabs/Component.vue +++ b/core/core-frontend/src/custom-component/de-tabs/Component.vue @@ -432,12 +432,6 @@ const borderActiveColor = computed(() => { } }) -const onResetLayout = () => { - if (!isDashboard()) { - groupSizeStyleAdaptor(element.value) - } -} - const titleValid = computed(() => { return !!state.textarea && !!state.textarea.trim() }) diff --git a/core/core-frontend/src/utils/changeComponentsSizeWithScale.ts b/core/core-frontend/src/utils/changeComponentsSizeWithScale.ts index efa37f65cb..0da51824da 100644 --- a/core/core-frontend/src/utils/changeComponentsSizeWithScale.ts +++ b/core/core-frontend/src/utils/changeComponentsSizeWithScale.ts @@ -3,6 +3,7 @@ import { divide, multiply } from 'mathjs' import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain' import { storeToRefs } from 'pinia' import { groupSizeStyleAdaptor } from '@/utils/style' +import { nextTick } from 'vue' const dvMainStore = dvMainStoreWithOut() const { componentData, curComponentIndex, canvasStyleData } = storeToRefs(dvMainStore) @@ -49,7 +50,7 @@ export function changeComponentsSizeWithScale(scale) { // 计算逻辑 Group 中样式 * groupComponent.groupStyle[sonKey]. if (['Group', 'DeTabs'].includes(component.component)) { try { - groupSizeStyleAdaptor(component) + nextTick(() => groupSizeStyleAdaptor(component)) } catch (e) { // 旧Group适配 console.error('group adaptor error:' + e) diff --git a/core/core-frontend/src/utils/style.ts b/core/core-frontend/src/utils/style.ts index 27b6c9ea7a..b9c11912aa 100644 --- a/core/core-frontend/src/utils/style.ts +++ b/core/core-frontend/src/utils/style.ts @@ -249,7 +249,18 @@ export function createGroupStyle(groupComponent) { function dataVTabSizeStyleAdaptor(tabComponent) { const parentStyleAdaptor = { ...tabComponent.style } - parentStyleAdaptor.height = parentStyleAdaptor.height - 48 + const domId = + dvMainStore.editMode === 'edit' + ? 'component' + tabComponent.id + : 'enlarge-inner-content' + tabComponent.id + const tabDom = document.getElementById(domId) + if (tabDom) { + parentStyleAdaptor.height = tabDom.clientHeight - 46 + parentStyleAdaptor.width = tabDom.clientWidth + } else { + parentStyleAdaptor.height = parentStyleAdaptor.height - 46 + } + tabComponent.propValue.forEach(tabItem => { tabItem.componentData.forEach(tabComponent => { groupItemStyleAdaptor(tabComponent, parentStyleAdaptor) diff --git a/core/core-frontend/src/views/canvas/DeCanvas.vue b/core/core-frontend/src/views/canvas/DeCanvas.vue index b1fd767888..dc13acdaf0 100644 --- a/core/core-frontend/src/views/canvas/DeCanvas.vue +++ b/core/core-frontend/src/views/canvas/DeCanvas.vue @@ -287,6 +287,7 @@ defineExpose({ :id="domId" ref="canvasInner" class="db-canvas" + :class="{ 'db-canvas-dashboard': !isDashboard() }" :style="editStyle" @drop="handleDrop" @dragover="handleDragOver" @@ -310,6 +311,9 @@ defineExpose({