fix(数据大屏): 修复数据大屏中Tab内组件反复预览可能出现的错位问题

This commit is contained in:
wangjiahao 2024-10-25 12:43:01 +08:00
parent bc7fb8318a
commit 8d6de683d2
4 changed files with 18 additions and 8 deletions

View File

@ -432,12 +432,6 @@ const borderActiveColor = computed(() => {
}
})
const onResetLayout = () => {
if (!isDashboard()) {
groupSizeStyleAdaptor(element.value)
}
}
const titleValid = computed(() => {
return !!state.textarea && !!state.textarea.trim()
})

View File

@ -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)

View File

@ -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)

View File

@ -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({
</template>
<style lang="less" scoped>
.db-canvas-dashboard {
padding: 0 !important;
}
.content {
width: 100%;
height: 100%;