fix(嵌入式): 跳转问题排查

This commit is contained in:
dataeaseShu 2025-01-02 16:48:42 +08:00 committed by fit2cloud-chenyw
parent 5439cead12
commit f9bfacc272
3 changed files with 15 additions and 16 deletions

View File

@ -53,9 +53,11 @@ const componentMap = {
const isDataFilling = ref(false) const isDataFilling = ref(false)
const dataFillingPath = ref('') const dataFillingPath = ref('')
const showComponent = ref(false)
const changeCurrentComponent = val => { const changeCurrentComponent = val => {
isDataFilling.value = false isDataFilling.value = false
showComponent.value = true
currentComponent.value = undefined currentComponent.value = undefined
if (val && val.includes('DataFilling')) { if (val && val.includes('DataFilling')) {
if (val === 'DataFilling') { if (val === 'DataFilling') {
@ -70,7 +72,10 @@ const changeCurrentComponent = val => {
isDataFilling.value = true isDataFilling.value = true
}) })
} else { } else {
nextTick(() => {
currentComponent.value = componentMap[val] currentComponent.value = componentMap[val]
showComponent.value = false
})
} }
} }
@ -79,13 +84,12 @@ useEmitt({
callback: changeCurrentComponent callback: changeCurrentComponent
}) })
//currentComponent.value = componentMap[props.componentName]
onMounted(() => { onMounted(() => {
changeCurrentComponent(props.componentName) changeCurrentComponent(props.componentName)
}) })
</script> </script>
<template> <template>
<component :is="currentComponent" v-if="!isDataFilling"></component> <component :is="currentComponent" v-if="!isDataFilling && !showComponent"></component>
<template v-else> <template v-else>
<component :is="currentComponent" :jsname="dataFillingPath"></component> <component :is="currentComponent" :jsname="dataFillingPath"></component>
</template> </template>

View File

@ -12,7 +12,7 @@ import { XpackComponent } from '@/components/plugin'
import { useEmitt } from '@/hooks/web/useEmitt' import { useEmitt } from '@/hooks/web/useEmitt'
const currentComponent = shallowRef() const currentComponent = shallowRef()
const Preview = defineAsyncComponent(() => import('@/views/data-visualization/PreviewCanvas.vue'))
const VisualizationEditor = defineAsyncComponent( const VisualizationEditor = defineAsyncComponent(
() => import('@/views/data-visualization/index.vue') () => import('@/views/data-visualization/index.vue')
) )
@ -36,6 +36,7 @@ const componentMap = {
DashboardEditor, DashboardEditor,
VisualizationEditor, VisualizationEditor,
ViewWrapper, ViewWrapper,
Preview,
Dashboard, Dashboard,
Dataset, Dataset,
Datasource, Datasource,
@ -77,8 +78,10 @@ const initIframe = (name: string) => {
showComponent.value = true showComponent.value = true
}) })
} else { } else {
nextTick(() => {
currentComponent.value = componentMap[name || 'ViewWrapper'] currentComponent.value = componentMap[name || 'ViewWrapper']
showComponent.value = true showComponent.value = true
})
} }
} }

View File

@ -36,7 +36,6 @@ import DrillPath from '@/views/chart/components/views/components/DrillPath.vue'
import { ElIcon, ElInput, ElMessage } from 'element-plus-secondary' import { ElIcon, ElInput, ElMessage } from 'element-plus-secondary'
import { useFilter } from '@/hooks/web/useFilter' import { useFilter } from '@/hooks/web/useFilter'
import { useCache } from '@/hooks/web/useCache' import { useCache } from '@/hooks/web/useCache'
import { parseUrl } from '@/utils/ParseUrl'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain' import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { cloneDeep } from 'lodash-es' import { cloneDeep } from 'lodash-es'
@ -533,20 +532,13 @@ const jumpClick = param => {
} }
const currentUrl = window.location.href const currentUrl = window.location.href
localStorage.setItem('beforeJumpUrl', currentUrl) localStorage.setItem('beforeJumpUrl', currentUrl)
if (isIframe.value || isDataEaseBi.value) { console.log('embeddedStore', embeddedStore)
embeddedStore.clearState() if (divSelf || iframeSelf) {
}
if (divSelf) {
embeddedStore.setDvId(jumpInfo.targetDvId) embeddedStore.setDvId(jumpInfo.targetDvId)
embeddedStore.setJumpInfoParam(encodeURIComponent(Base64.encode(JSON.stringify(param)))) embeddedStore.setJumpInfoParam(encodeURIComponent(Base64.encode(JSON.stringify(param))))
divEmbedded('Preview') divEmbedded('Preview')
return return
} }
if (iframeSelf) {
router.push(parseUrl(url))
return
}
windowsJump(url, jumpInfo.jumpType, jumpInfo.windowSize) windowsJump(url, jumpInfo.jumpType, jumpInfo.windowSize)
} }
} else { } else {