From b3e081f9f87543dc39d9afde7e2da577c82b1018 Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Thu, 4 Jul 2024 11:53:23 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=B5=8C=E5=85=A5=E5=BC=8F):=20div?= =?UTF-8?q?=E5=B5=8C=E5=85=A5=E6=96=B9=E5=BC=8F=E4=B8=8B=EF=BC=8C=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=BA=90=E6=A0=91=E5=92=8C=E6=95=B0=E6=8D=AE=E9=9B=86?= =?UTF-8?q?=E6=A0=91=E4=B8=AD=E6=97=A0=E6=B3=95=E6=96=B0=E5=BB=BA=E8=B5=84?= =?UTF-8?q?=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core-frontend/src/pages/panel/App.vue | 6 ++- .../src/store/modules/embedded.ts | 32 ++++++++++++- .../visualized/data/dataset/form/index.vue | 12 +++-- .../views/visualized/data/dataset/index.vue | 21 +++++++++ .../visualized/data/datasource/index.vue | 46 ++++++++----------- 5 files changed, 84 insertions(+), 33 deletions(-) diff --git a/core/core-frontend/src/pages/panel/App.vue b/core/core-frontend/src/pages/panel/App.vue index 7c4e1299f4..d2a994ba9c 100644 --- a/core/core-frontend/src/pages/panel/App.vue +++ b/core/core-frontend/src/pages/panel/App.vue @@ -12,6 +12,9 @@ const Dashboard = defineAsyncComponent(() => import('./DashboardPreview.vue')) const ViewWrapper = defineAsyncComponent(() => import('./ViewWrapper.vue')) const Iframe = defineAsyncComponent(() => import('./Iframe.vue')) const Dataset = defineAsyncComponent(() => import('@/views/visualized/data/dataset/index.vue')) +const DatasetEditor = defineAsyncComponent( + () => import('@/views/visualized/data/dataset/form/index.vue') +) const Datasource = defineAsyncComponent( () => import('@/views/visualized/data/datasource/index.vue') ) @@ -37,7 +40,8 @@ const componentMap = { Iframe, Datasource, ScreenPanel, - DashboardPanel + DashboardPanel, + DatasetEditor } const changeCurrentComponent = val => { diff --git a/core/core-frontend/src/store/modules/embedded.ts b/core/core-frontend/src/store/modules/embedded.ts index e6c29b7870..90acccdb70 100644 --- a/core/core-frontend/src/store/modules/embedded.ts +++ b/core/core-frontend/src/store/modules/embedded.ts @@ -15,6 +15,11 @@ interface AppState { templateParams: string jumpInfoParam: string outerUrl: string + datasourceId: string + tableName: string + datasetId: string + datasetCopyId: string + datasetPid: string } export const userStore = defineStore('embedded', { @@ -33,7 +38,12 @@ export const userStore = defineStore('embedded', { createType: '', templateParams: '', outerUrl: '', - jumpInfoParam: '' + jumpInfoParam: '', + datasourceId: '', + tableName: '', + datasetId: '', + datasetCopyId: '', + datasetPid: '' } }, getters: { @@ -96,6 +106,21 @@ export const userStore = defineStore('embedded', { setType(type: string) { this.type = type }, + setdatasetPid(datasetPid: string) { + this.datasetPid = datasetPid + }, + setDatasourceId(datasourceId: string) { + this.datasourceId = datasourceId + }, + setTableName(tableName: string) { + this.tableName = tableName + }, + setDatasetId(datasetId: string) { + this.datasetId = datasetId + }, + setDatasetCopyId(datasetCopyId: string) { + this.datasetCopyId = datasetCopyId + }, setOuterUrl(outerUrl: string) { this.outerUrl = outerUrl }, @@ -154,6 +179,11 @@ export const userStore = defineStore('embedded', { this.setDvId('') this.setJumpInfoParam('') this.setOuterUrl('') + this.setDatasourceId('') + this.setTableName('') + this.setDatasetId('') + this.setDatasetCopyId('') + this.setdatasetPid('') } } }) diff --git a/core/core-frontend/src/views/visualized/data/dataset/form/index.vue b/core/core-frontend/src/views/visualized/data/dataset/form/index.vue index 7b14d9cf1e..603a2455bf 100644 --- a/core/core-frontend/src/views/visualized/data/dataset/form/index.vue +++ b/core/core-frontend/src/views/visualized/data/dataset/form/index.vue @@ -581,8 +581,14 @@ const getTableName = async (datasourceId, tableName) => { } const initEdite = async () => { - const { id, datasourceId, tableName } = route.query - const { id: copyId } = route.params + let { id, datasourceId, tableName } = route.query + let { id: copyId } = route.params + if (appStore.getIsDataEaseBi) { + id = embeddedStore.datasetId + datasourceId = embeddedStore.datasourceId + tableName = embeddedStore.tableName + copyId = embeddedStore.datasetCopyId || copyId + } if (copyId || id) { const barRes = await barInfoApi(copyId || id) if (!barRes || !barRes['id']) { @@ -954,7 +960,7 @@ const datasetSave = () => { } let union = [] dfsNodeList(union, datasetDrag.value.getNodeList()) - const pid = route.query.pid || nodeInfo.pid + const pid = appStore.getIsDataEaseBi ? embeddedStore.datasetPid : route.query.pid || nodeInfo.pid if (!union.length) { ElMessage.error('数据集不能为空') return diff --git a/core/core-frontend/src/views/visualized/data/dataset/index.vue b/core/core-frontend/src/views/visualized/data/dataset/index.vue index dfaa73a0ac..4afcc7134d 100644 --- a/core/core-frontend/src/views/visualized/data/dataset/index.vue +++ b/core/core-frontend/src/views/visualized/data/dataset/index.vue @@ -2,6 +2,8 @@ import { useI18n } from '@/hooks/web/useI18n' import { ref, reactive, shallowRef, computed, watch, onBeforeMount, nextTick, unref } from 'vue' import ArrowSide from '@/views/common/DeResourceArrow.vue' +import { useEmbedded } from '@/store/modules/embedded' +import { useEmitt } from '@/hooks/web/useEmitt' import { ElIcon, ElMessageBox, @@ -284,8 +286,15 @@ const handleNodeClick = (data: BusiTreeNode) => { const editorDataset = () => { handleEdit(nodeInfo.id) } +const embedded = useEmbedded() const handleEdit = id => { + if (isDataEaseBi.value) { + embedded.clearState() + embedded.setDatasetId(id as string) + useEmitt().emitter.emit('changeCurrentComponent', 'DatasetEditor') + return + } router.push({ path: '/dataset-form', query: { @@ -295,6 +304,12 @@ const handleEdit = id => { } const createDataset = (data?: BusiTreeNode) => { + if (isDataEaseBi.value) { + embedded.clearState() + embedded.setdatasetPid(data?.id as string) + useEmitt().emitter.emit('changeCurrentComponent', 'DatasetEditor') + return + } router.push({ path: '/dataset-form', query: { @@ -340,6 +355,12 @@ const handleClick = (tabName: TabPaneName) => { const operation = (cmd: string, data: BusiTreeNode, nodeType: string) => { if (cmd === 'copy') { + if (isDataEaseBi.value) { + embedded.clearState() + embedded.setDatasetCopyId(data.id as string) + useEmitt().emitter.emit('changeCurrentComponent', 'DatasetEditor') + return + } router.push({ name: 'dataset-form', params: { diff --git a/core/core-frontend/src/views/visualized/data/datasource/index.vue b/core/core-frontend/src/views/visualized/data/datasource/index.vue index 402d7f2481..00304df6c2 100644 --- a/core/core-frontend/src/views/visualized/data/datasource/index.vue +++ b/core/core-frontend/src/views/visualized/data/datasource/index.vue @@ -8,6 +8,7 @@ import ArrowSide from '@/views/common/DeResourceArrow.vue' import { HandleMore } from '@/components/handle-more' import { Icon } from '@/components/icon-custom' import { fieldType } from '@/utils/attr' +import { useEmitt } from '@/hooks/web/useEmitt' import { getHidePwById, listSyncRecord, uploadFile } from '@/api/datasource' import CreatDsGroup from './form/CreatDsGroup.vue' import type { Tree } from '../dataset/form/CreatDsGroup.vue' @@ -43,6 +44,7 @@ import { cloneDeep } from 'lodash-es' import { interactiveStoreWithOut } from '@/store/modules/interactive' import treeSort from '@/utils/treeSortUtils' import { useCache } from '@/hooks/web/useCache' +import { useEmbedded } from '@/store/modules/embedded' const route = useRoute() const interactiveStore = interactiveStoreWithOut() interface Field { @@ -77,8 +79,15 @@ const recordState = reactive({ }) const isDataEaseBi = computed(() => appStore.getIsDataEaseBi) const isIframe = computed(() => appStore.getIsIframe) - +const embedded = useEmbedded() const createDataset = (tableName?: string) => { + if (isDataEaseBi.value) { + embedded.clearState() + embedded.setDatasourceId(nodeInfo.id as string) + embedded.setTableName(tableName) + useEmitt().emitter.emit('changeCurrentComponent', 'DatasetEditor') + return + } router.push({ path: '/dataset-form', query: { @@ -127,7 +136,7 @@ const typeMap = dsTypes.reduce((pre, next) => { }, {}) const datasetTypeList = computed(() => { - const list = [ + return [ { label: '新建数据源', svgName: 'icon_dataset', @@ -140,11 +149,6 @@ const datasetTypeList = computed(() => { command: 'folder' } ] - if (isDataEaseBi.value) { - list.shift() - list[0].divided = false - } - return list }) const dsTableDataLoading = ref(false) @@ -825,7 +829,7 @@ const mouseleave = () => { } const getMenuList = (val: boolean) => { - return !val || isDataEaseBi.value + return !val ? menuList : [ { @@ -865,18 +869,13 @@ const getMenuList = (val: boolean) => { - + @@ -966,7 +965,7 @@ const getMenuList = (val: boolean) => { @@ -993,11 +992,7 @@ const getMenuList = (val: boolean) => { >