From 294053b118dce7d0362e23460269d5bc6f45ed1a Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 15 Nov 2024 16:24:26 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=9B=BE=E8=A1=A8):=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4tab=E5=A4=A7=E5=B0=8F=E5=8F=98=E5=8C=96=E6=97=B6?= =?UTF-8?q?=E5=86=85=E9=83=A8=E7=BB=84=E4=BB=B6=E8=B0=83=E6=95=B4=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=EF=BC=8C=E9=98=B2=E6=AD=A2=E5=87=BA=E7=8E=B0=E5=81=8F?= =?UTF-8?q?=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/data-visualization/canvas/Shape.vue | 2 +- .../src/custom-component/de-tabs/Component.vue | 2 +- core/core-frontend/src/utils/style.ts | 14 ++++++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/core/core-frontend/src/components/data-visualization/canvas/Shape.vue b/core/core-frontend/src/components/data-visualization/canvas/Shape.vue index e2353ecfbb..36ada2785b 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/Shape.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/Shape.vue @@ -131,7 +131,7 @@ import Icon from '@/components/icon-custom/src/Icon.vue' import ComponentEditBar from '@/components/visualization/ComponentEditBar.vue' import { useEmitt } from '@/hooks/web/useEmitt' import ComposeShow from '@/components/data-visualization/canvas/ComposeShow.vue' -import { groupSizeStyleAdaptor, groupStyleRevert } from '@/utils/style' +import { groupSizeStyleAdaptor, groupStyleRevert, groupStyleRevertBatch } from '@/utils/style' import { isDashboard, isGroupCanvas, isMainCanvas, isTabCanvas } from '@/utils/canvasUtils' import Board from '@/components/de-board/Board.vue' import { activeWatermarkCheckUser, removeActiveWatermark } from '@/components/watermark/watermark' 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 2d2d49a701..7d78e97910 100644 --- a/core/core-frontend/src/custom-component/de-tabs/Component.vue +++ b/core/core-frontend/src/custom-component/de-tabs/Component.vue @@ -364,7 +364,7 @@ const componentMoveIn = component => { dvMainStore.deleteComponent(curIndex) dvMainStore.setCurComponent({ component: null, index: null }) component.canvasId = element.value.id + '--' + tabItem.name - dataVTabComponentAdd(component, element.value.style) + dataVTabComponentAdd(component, element.value) tabItem.componentData.push(component) } } diff --git a/core/core-frontend/src/utils/style.ts b/core/core-frontend/src/utils/style.ts index b9c11912aa..3ab87550b5 100644 --- a/core/core-frontend/src/utils/style.ts +++ b/core/core-frontend/src/utils/style.ts @@ -278,6 +278,16 @@ function groupItemStyleAdaptor(component, parentStyle) { component.style.height = parentStyle.height * styleScale.height } +export function groupStyleRevertBatch(groupComponent, parentStyle) { + if (groupComponent.component === 'DeTabs') { + groupComponent.propValue.forEach(tabItem => { + tabItem.componentData.forEach(tabComponent => { + groupStyleRevert(tabComponent, parentStyle) + }) + }) + } +} + export function groupStyleRevert(innerComponent, parentStyle) { const innerStyle = { ...innerComponent.style } innerComponent.groupStyle.left = innerStyle.left / parentStyle.width @@ -297,11 +307,11 @@ export function groupSizeStyleAdaptor(groupComponent) { } } -export function dataVTabComponentAdd(innerComponent, parentStyle) { +export function dataVTabComponentAdd(innerComponent, parentComponent) { //do dataVTabComponentAdd innerComponent.style.top = 0 innerComponent.style.left = 0 - const parentStyleAdaptor = { ...parentStyle } + const parentStyleAdaptor = { ...parentComponent.style } // 去掉tab头部高度 parentStyleAdaptor.height = parentStyleAdaptor.height - 48 groupStyleRevert(innerComponent, parentStyleAdaptor)