Merge pull request #11539 from dataease/refactor_tab-move

Refactor tab move
This commit is contained in:
王嘉豪 2024-08-14 11:01:39 +08:00 committed by GitHub
commit 0bdc710e1b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 10 deletions

View File

@ -116,7 +116,7 @@ import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import { guid } from '@/views/visualized/data/dataset/form/util' import { guid } from '@/views/visualized/data/dataset/form/util'
import eventBus from '@/utils/eventBus' import eventBus from '@/utils/eventBus'
import { canvasChangeAdaptor, findComponentIndexById } from '@/utils/canvasUtils' import { canvasChangeAdaptor, findComponentIndexById, isDashboard } from '@/utils/canvasUtils'
import DeCustomTab from '@/custom-component/de-tabs/DeCustomTab.vue' import DeCustomTab from '@/custom-component/de-tabs/DeCustomTab.vue'
import DePreview from '@/components/data-visualization/canvas/DePreview.vue' import DePreview from '@/components/data-visualization/canvas/DePreview.vue'
import { useEmitt } from '@/hooks/web/useEmitt' import { useEmitt } from '@/hooks/web/useEmitt'
@ -281,14 +281,16 @@ const componentMoveIn = component => {
if (refInstance) { if (refInstance) {
const matrixBase = refInstance.getBaseMatrixSize() // const matrixBase = refInstance.getBaseMatrixSize() //
canvasChangeAdaptor(component, matrixBase) canvasChangeAdaptor(component, matrixBase)
component.x = 1
component.y = 200
component.style.left = 0
component.style.top = 0
tabItem.componentData.push(component) tabItem.componentData.push(component)
nextTick(() => { if (isDashboard()) {
component.x = 1 nextTick(() => {
component.y = 1 refInstance.addItemBox(component) //
component.style.left = 0 })
component.style.top = 0 }
refInstance.addItemBox(component) //
})
} }
} }
}) })

View File

@ -170,10 +170,10 @@ const initOpenHandler = newWindow => {
>PDF</el-dropdown-item >PDF</el-dropdown-item
> >
<el-dropdown-item style="width: 118px" @click="downloadAsAppTemplate('template')" <el-dropdown-item style="width: 118px" @click="downloadAsAppTemplate('template')"
>模板</el-dropdown-item >样式模板</el-dropdown-item
> >
<el-dropdown-item style="width: 118px" @click="downloadAsAppTemplate('app')" <el-dropdown-item style="width: 118px" @click="downloadAsAppTemplate('app')"
>应用</el-dropdown-item >应用模板</el-dropdown-item
> >
<el-dropdown-item @click="download('img')">{{ <el-dropdown-item @click="download('img')">{{
t('chart.image') t('chart.image')