diff --git a/core/core-frontend/src/views/data-visualization/PreviewHead.vue b/core/core-frontend/src/views/data-visualization/PreviewHead.vue index 544b79ff99..fa6c174e1f 100644 --- a/core/core-frontend/src/views/data-visualization/PreviewHead.vue +++ b/core/core-frontend/src/views/data-visualization/PreviewHead.vue @@ -4,25 +4,39 @@ import { storeToRefs } from 'pinia' import { useI18n } from '@/hooks/web/useI18n' import { useAppStoreWithOut } from '@/store/modules/app' import DvDetailInfo from '@/views/common/DvDetailInfo.vue' +import { useEmbedded } from '@/store/modules/embedded' import { storeApi, storeStatusApi } from '@/api/visualization/dataVisualization' import { ref, watch, computed } from 'vue' import ShareVisualHead from '@/views/share/share/ShareVisualHead.vue' import { XpackComponent } from '@/components/plugin' +import { useEmitt } from '@/hooks/web/useEmitt' import DeFullscreen from '@/components/visualization/common/DeFullscreen.vue' const dvMainStore = dvMainStoreWithOut() const appStore = useAppStoreWithOut() const { dvInfo } = storeToRefs(dvMainStore) const emit = defineEmits(['reload', 'download', 'downloadAsAppTemplate']) const { t } = useI18n() +const embeddedStore = useEmbedded() const favorited = ref(false) const fullScreeRef = ref(null) const preview = () => { + if (isDataEaseBi.value) { + embeddedStore.clearState() + if (dvInfo.value.type === 'dataV') { + embeddedStore.setDvId(dvInfo.value.id) + } else { + embeddedStore.setResourceId(dvInfo.value.id) + } + useEmitt().emitter.emit('changeCurrentComponent', 'Preview') + return + } const url = '#/preview?dvId=' + dvInfo.value.id const newWindow = window.open(url, '_blank') initOpenHandler(newWindow) } const isDataEaseBi = computed(() => appStore.getIsDataEaseBi) +const isIframe = computed(() => appStore.getIsIframe) const reload = () => { emit('reload', dvInfo.value.id) @@ -36,6 +50,19 @@ const downloadAsAppTemplate = downloadType => { } const dvEdit = () => { + if (isDataEaseBi.value) { + embeddedStore.clearState() + if (dvInfo.value.type === 'dataV') { + embeddedStore.setDvId(dvInfo.value.id) + } else { + embeddedStore.setResourceId(dvInfo.value.id) + } + useEmitt().emitter.emit( + 'changeCurrentComponent', + dvInfo.value.type === 'dataV' ? 'VisualizationEditor' : 'DashboardEditor' + ) + return + } const baseUrl = dvInfo.value.type === 'dataV' ? '#/dvCanvas?dvId=' : '#/dashboard?resourceId=' const newWindow = window.open(baseUrl + dvInfo.value.id, '_blank') initOpenHandler(newWindow) @@ -105,13 +132,13 @@ const initOpenHandler = newWindow => {
- + 全屏 - + @@ -122,12 +149,7 @@ const initOpenHandler = newWindow => { :weight="dvInfo.weight" :resource-type="dvInfo.type" /> - +