forked from github/dataease
Merge pull request #9443 from dataease/pr@dev-v2_st
fix(嵌入式): 修复大屏树-div 嵌入-新建数据大屏界面图层、画布、大屏配置错位的问题
This commit is contained in:
commit
117f5bb797
@ -2,22 +2,7 @@ import { createRouter, createWebHashHistory } from 'vue-router'
|
||||
import type { RouteRecordRaw } from 'vue-router'
|
||||
import type { App } from 'vue'
|
||||
|
||||
export const routes: AppRouteRecordRaw[] = [
|
||||
{
|
||||
path: '/dvCanvas',
|
||||
name: 'dvCanvas',
|
||||
hidden: true,
|
||||
meta: {},
|
||||
component: () => import('@/views/data-visualization/index.vue')
|
||||
},
|
||||
{
|
||||
path: '/dashboard',
|
||||
name: 'dashboard',
|
||||
hidden: true,
|
||||
meta: {},
|
||||
component: () => import('@/views/dashboard/index.vue')
|
||||
}
|
||||
]
|
||||
export const routes: AppRouteRecordRaw[] = []
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHashHistory(),
|
||||
|
@ -100,10 +100,14 @@ const onMobileConfig = () => {
|
||||
}
|
||||
|
||||
const loadFinish = ref(false)
|
||||
const newWindowFromDiv = ref(false)
|
||||
let p = null
|
||||
const XpackLoaded = () => p(true)
|
||||
// 全局监听按键事件
|
||||
onMounted(async () => {
|
||||
if (window.location.hash.includes('#/dashboard')) {
|
||||
newWindowFromDiv.value = true
|
||||
}
|
||||
await new Promise(r => (p = r))
|
||||
loadFinish.value = true
|
||||
useEmitt({
|
||||
@ -185,7 +189,7 @@ onUnmounted(() => {
|
||||
<template>
|
||||
<div
|
||||
class="dv-common-layout dv-teleport-query"
|
||||
:class="isDataEaseBi && 'dataease-w-h'"
|
||||
:class="isDataEaseBi && !newWindowFromDiv && 'dataease-w-h'"
|
||||
v-if="loadFinish && !mobileConfig"
|
||||
>
|
||||
<DbToolbar />
|
||||
|
@ -208,10 +208,13 @@ const checkPer = async resourceId => {
|
||||
}
|
||||
|
||||
const loadFinish = ref(false)
|
||||
|
||||
const newWindowFromDiv = ref(false)
|
||||
let p = null
|
||||
const XpackLoaded = () => p(true)
|
||||
onMounted(async () => {
|
||||
if (window.location.hash.includes('#/dvCanvas')) {
|
||||
newWindowFromDiv.value = true
|
||||
}
|
||||
await new Promise(r => (p = r))
|
||||
loadFinish.value = true
|
||||
window.addEventListener('blur', releaseAttachKey)
|
||||
@ -311,7 +314,11 @@ eventBus.on('handleNew', handleNew)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div ref="dvLayout" class="dv-common-layout" :class="isDataEaseBi && 'dataease-w-h'">
|
||||
<div
|
||||
ref="dvLayout"
|
||||
class="dv-common-layout"
|
||||
:class="isDataEaseBi && !newWindowFromDiv && 'dataease-w-h'"
|
||||
>
|
||||
<DvToolbar />
|
||||
<div class="custom-dv-divider" />
|
||||
<el-container
|
||||
|
@ -162,6 +162,8 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { searchMarket } from '@/api/templateMarket'
|
||||
import { useEmbedded } from '@/store/modules/embedded'
|
||||
import { useAppStoreWithOut } from '@/store/modules/app'
|
||||
import elementResizeDetectorMaker from 'element-resize-detector'
|
||||
import { nextTick, reactive, watch, onMounted, ref, computed } from 'vue'
|
||||
import { useI18n } from '@/hooks/web/useI18n'
|
||||
@ -175,7 +177,8 @@ import { XpackComponent } from '@/components/plugin'
|
||||
import { Base64 } from 'js-base64'
|
||||
const { t } = useI18n()
|
||||
const { wsCache } = useCache()
|
||||
|
||||
const embeddedStore = useEmbedded()
|
||||
const appStore = useAppStoreWithOut()
|
||||
const interactiveStore = interactiveStoreWithOut()
|
||||
|
||||
// full 正常展示 marketPreview 模板中心预览 createPreview 创建界面预览
|
||||
@ -187,7 +190,7 @@ const close = () => {
|
||||
}
|
||||
|
||||
const title = computed(() => (state.curPosition === 'branch' ? '模板中心' : '使用模板新建'))
|
||||
|
||||
const isDataEaseBi = computed(() => appStore.getIsDataEaseBi)
|
||||
const state = reactive({
|
||||
initReady: true,
|
||||
curPosition: 'branch',
|
||||
@ -430,10 +433,14 @@ const apply = template => {
|
||||
'&templateParams=' +
|
||||
Base64.encode(JSON.stringify(templateTemplate))
|
||||
let newWindow = null
|
||||
let embeddedBaseUrl = ''
|
||||
if (isDataEaseBi.value) {
|
||||
embeddedBaseUrl = embeddedStore.baseUrl
|
||||
}
|
||||
if (state.pid) {
|
||||
newWindow = window.open(baseUrl + `&pid=${state.pid}`, '_blank')
|
||||
newWindow = window.open(embeddedBaseUrl + baseUrl + `&pid=${state.pid}`, '_blank')
|
||||
} else {
|
||||
newWindow = window.open(baseUrl, '_blank')
|
||||
newWindow = window.open(embeddedBaseUrl + baseUrl, '_blank')
|
||||
}
|
||||
initOpenHandler(newWindow)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user