Merge pull request #9057 from dataease/pr@dev-v2_bug_fix

fix(移动端): 修复移动端布局后仪表板无法继续向tab组件添加图表的问题
This commit is contained in:
dataeaseShu 2024-04-11 14:22:57 +08:00 committed by GitHub
commit 6f7ac6ee7e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 27 deletions

View File

@ -50,7 +50,7 @@
</el-dropdown> </el-dropdown>
</template> </template>
<de-canvas <de-canvas
v-if="isEdit" v-if="isEdit && !mobileInPc"
:ref="'tabCanvas_' + index" :ref="'tabCanvas_' + index"
:component-data="tabItem.componentData" :component-data="tabItem.componentData"
:canvas-style-data="canvasStyleData" :canvas-style-data="canvasStyleData"

View File

@ -41,9 +41,6 @@ const mobileStatusChange = (type, value) => {
} }
const handleLoad = () => { const handleLoad = () => {
componentData.value.forEach(ele => {
ele.inMobile = canvasDataPreview.includes(ele.id)
})
mobileStatusChange( mobileStatusChange(
'panelInit', 'panelInit',
JSON.parse( JSON.parse(
@ -111,26 +108,9 @@ const saveCanvasWithCheckFromMobile = () => {
ElMessage.success('保存成功') ElMessage.success('保存成功')
}) })
} }
let canvasDataPreview = []
const loadCanvasData = () => { const loadCanvasData = () => {
if (!dvInfo.value?.id) { handleLoad()
handleLoad() mobileLoading.value = false
mobileLoading.value = false
return
}
findById(dvInfo.value.id, 'dashboard')
.then(res => {
const canvasInfo = res.data
const canvasDataResult = JSON.parse(canvasInfo.componentData) as unknown as Array<{
inMobile: boolean
id: string
}>
canvasDataPreview = (canvasDataResult || []).filter(ele => !!ele.inMobile).map(ele => ele.id)
handleLoad()
})
.finally(() => {
mobileLoading.value = false
})
} }
const setMobileStyle = debounce(() => { const setMobileStyle = debounce(() => {

View File

@ -30,10 +30,12 @@ const hanedleMessage = event => {
ele.propValue.forEach(tabItem => { ele.propValue.forEach(tabItem => {
tabItem.componentData.forEach(tabComponent => { tabItem.componentData.forEach(tabComponent => {
const { mx: tx, my: ty, mSizeX: tSizeX, mSizeY: tSizeY } = tabComponent const { mx: tx, my: ty, mSizeX: tSizeX, mSizeY: tSizeY } = tabComponent
tabComponent.x = tx if (tSizeX && tSizeY) {
tabComponent.y = ty tabComponent.x = tx
tabComponent.sizeX = tSizeX tabComponent.y = ty
tabComponent.sizeY = tSizeY tabComponent.sizeX = tSizeX
tabComponent.sizeY = tSizeY
}
}) })
}) })
} }