refactor: 优化系统当前界面打开模式部分事件监听

This commit is contained in:
wangjiahao
2024-11-29 16:24:37 +08:00
parent d16be832f9
commit 19b1651323
3 changed files with 31 additions and 21 deletions

View File

@@ -13,7 +13,7 @@ import icon_undo_outlined from '@/assets/svg/icon_undo_outlined.svg'
import icon_redo_outlined from '@/assets/svg/icon_redo_outlined.svg'
import { ElMessage, ElMessageBox } from 'element-plus-secondary'
import eventBus from '@/utils/eventBus'
import { ref, nextTick, computed, toRefs } from 'vue'
import { ref, nextTick, computed, toRefs, onBeforeUnmount, onMounted } from 'vue'
import { useEmbedded } from '@/store/modules/embedded'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot'
@@ -145,7 +145,10 @@ const saveCanvasWithCheck = () => {
},
appData: appData.value
}
resourceAppOpt.value.init(params)
nextTick(() => {
console.log('===test444')
resourceAppOpt.value.init(params)
})
} else {
const params = { name: dvInfo.value.name, leaf: true, id: dvInfo.value.pid }
resourceGroupOpt.value.optInit('leaf', params, 'newLeaf', true)
@@ -265,9 +268,17 @@ const appStore = useAppStoreWithOut()
const isDataEaseBi = computed(() => appStore.getIsDataEaseBi)
const multiplexingRef = ref(null)
eventBus.on('preview', preview)
eventBus.on('save', saveCanvasWithCheck)
eventBus.on('clearCanvas', clearCanvas)
onMounted(() => {
eventBus.on('preview', preview)
eventBus.on('save', saveCanvasWithCheck)
eventBus.on('clearCanvas', clearCanvas)
})
onBeforeUnmount(() => {
eventBus.off('preview', preview)
eventBus.off('save', saveCanvasWithCheck)
eventBus.off('clearCanvas', clearCanvas)
})
const openOuterParamsSet = () => {
if (componentData.value.length === 0) {