forked from github/dataease
perf(数据集): iframe嵌入式编辑数据集路由切换
This commit is contained in:
parent
478892f762
commit
202244a879
@ -10,7 +10,7 @@ import { useCache } from '@/hooks/web/useCache'
|
||||
import { isMobile } from '@/utils/utils'
|
||||
import { interactiveStoreWithOut } from '@/store/modules/interactive'
|
||||
import { useAppearanceStoreWithOut } from '@/store/modules/appearance'
|
||||
|
||||
import { useEmbedded } from '@/store/modules/embedded'
|
||||
const appearanceStore = useAppearanceStoreWithOut()
|
||||
const { wsCache } = useCache()
|
||||
const permissionStore = usePermissionStoreWithOut()
|
||||
@ -23,7 +23,13 @@ const { start, done } = useNProgress()
|
||||
const { loadStart, loadDone } = usePageLoading()
|
||||
|
||||
const whiteList = ['/login', '/de-link', '/chart-view'] // 不重定向白名单
|
||||
const embeddedWhiteList = ['/dvCanvas', '/dashboard']
|
||||
const embeddedWhiteList = [
|
||||
'/dvCanvas',
|
||||
'/dashboard',
|
||||
'/dataset-embedded',
|
||||
'/dataset-form',
|
||||
'/dataset-embedded-form'
|
||||
]
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
start()
|
||||
loadStart()
|
||||
@ -99,11 +105,15 @@ router.beforeEach(async (to, from, next) => {
|
||||
next(nextData)
|
||||
}
|
||||
} else {
|
||||
if (
|
||||
embeddedWhiteList.includes(to.path) ||
|
||||
whiteList.indexOf(to.path) !== -1 ||
|
||||
to.path.startsWith('/de-link/')
|
||||
) {
|
||||
const embeddedStore = useEmbedded()
|
||||
if (embeddedStore.getToken && appStore.getIsIframe && embeddedWhiteList.includes(to.path)) {
|
||||
if (to.path.includes('/dataset-form')) {
|
||||
next({ path: '/dataset-embedded-form', query: to.query })
|
||||
return
|
||||
}
|
||||
permissionStore.setCurrentPath(to.path)
|
||||
next()
|
||||
} else if (whiteList.indexOf(to.path) !== -1 || to.path.startsWith('/de-link/')) {
|
||||
permissionStore.setCurrentPath(to.path)
|
||||
next()
|
||||
} else {
|
||||
|
@ -70,8 +70,15 @@ export const routes: AppRouteRecordRaw[] = [
|
||||
component: () => import('@/views/common/DeResourceTree.vue')
|
||||
},
|
||||
{
|
||||
path: '/dataset',
|
||||
name: 'dataset',
|
||||
path: '/dataset-embedded',
|
||||
name: 'dataset-embedded',
|
||||
hidden: true,
|
||||
meta: {},
|
||||
component: () => import('@/views/visualized/data/dataset/index.vue')
|
||||
},
|
||||
{
|
||||
path: '/dataset-embedded-form',
|
||||
name: 'dataset-embedded-form',
|
||||
hidden: true,
|
||||
meta: {},
|
||||
component: () => import('@/views/visualized/data/dataset/form/index.vue')
|
||||
|
@ -27,6 +27,8 @@ import CreatDsGroup from './CreatDsGroup.vue'
|
||||
import { guid, getFieldName, timeTypes, type DataSource } from './util'
|
||||
import { fieldType } from '@/utils/attr'
|
||||
import { cancelMap } from '@/config/axios/service'
|
||||
import { useEmbedded } from '@/store/modules/embedded'
|
||||
import { useAppStoreWithOut } from '@/store/modules/app'
|
||||
import {
|
||||
getDatasourceList,
|
||||
getTables,
|
||||
@ -49,7 +51,8 @@ interface Field {
|
||||
originName: string
|
||||
deType: number
|
||||
}
|
||||
|
||||
const appStore = useAppStoreWithOut()
|
||||
const embeddedStore = useEmbedded()
|
||||
const { t } = useI18n()
|
||||
const route = useRoute()
|
||||
const { push } = useRouter()
|
||||
@ -217,8 +220,9 @@ const getDsName = (id: string) => {
|
||||
}
|
||||
|
||||
const pushDataset = () => {
|
||||
const routeName = embeddedStore.getToken && appStore.getIsIframe ? 'dataset-embedded' : 'dataset'
|
||||
push({
|
||||
name: 'dataset',
|
||||
name: routeName,
|
||||
params: {
|
||||
id: nodeInfo.id
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user