forked from github/dataease
Merge pull request #10794 from dataease/pr@dev-v2_st
fix(嵌入式): div嵌入方式下,数据源树和数据集树中无法新建资源
This commit is contained in:
commit
6cbccd30f2
@ -12,6 +12,9 @@ const Dashboard = defineAsyncComponent(() => import('./DashboardPreview.vue'))
|
|||||||
const ViewWrapper = defineAsyncComponent(() => import('./ViewWrapper.vue'))
|
const ViewWrapper = defineAsyncComponent(() => import('./ViewWrapper.vue'))
|
||||||
const Iframe = defineAsyncComponent(() => import('./Iframe.vue'))
|
const Iframe = defineAsyncComponent(() => import('./Iframe.vue'))
|
||||||
const Dataset = defineAsyncComponent(() => import('@/views/visualized/data/dataset/index.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(
|
const Datasource = defineAsyncComponent(
|
||||||
() => import('@/views/visualized/data/datasource/index.vue')
|
() => import('@/views/visualized/data/datasource/index.vue')
|
||||||
)
|
)
|
||||||
@ -37,7 +40,8 @@ const componentMap = {
|
|||||||
Iframe,
|
Iframe,
|
||||||
Datasource,
|
Datasource,
|
||||||
ScreenPanel,
|
ScreenPanel,
|
||||||
DashboardPanel
|
DashboardPanel,
|
||||||
|
DatasetEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
const changeCurrentComponent = val => {
|
const changeCurrentComponent = val => {
|
||||||
|
@ -15,6 +15,11 @@ interface AppState {
|
|||||||
templateParams: string
|
templateParams: string
|
||||||
jumpInfoParam: string
|
jumpInfoParam: string
|
||||||
outerUrl: string
|
outerUrl: string
|
||||||
|
datasourceId: string
|
||||||
|
tableName: string
|
||||||
|
datasetId: string
|
||||||
|
datasetCopyId: string
|
||||||
|
datasetPid: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export const userStore = defineStore('embedded', {
|
export const userStore = defineStore('embedded', {
|
||||||
@ -33,7 +38,12 @@ export const userStore = defineStore('embedded', {
|
|||||||
createType: '',
|
createType: '',
|
||||||
templateParams: '',
|
templateParams: '',
|
||||||
outerUrl: '',
|
outerUrl: '',
|
||||||
jumpInfoParam: ''
|
jumpInfoParam: '',
|
||||||
|
datasourceId: '',
|
||||||
|
tableName: '',
|
||||||
|
datasetId: '',
|
||||||
|
datasetCopyId: '',
|
||||||
|
datasetPid: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
@ -96,6 +106,21 @@ export const userStore = defineStore('embedded', {
|
|||||||
setType(type: string) {
|
setType(type: string) {
|
||||||
this.type = type
|
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) {
|
setOuterUrl(outerUrl: string) {
|
||||||
this.outerUrl = outerUrl
|
this.outerUrl = outerUrl
|
||||||
},
|
},
|
||||||
@ -154,6 +179,11 @@ export const userStore = defineStore('embedded', {
|
|||||||
this.setDvId('')
|
this.setDvId('')
|
||||||
this.setJumpInfoParam('')
|
this.setJumpInfoParam('')
|
||||||
this.setOuterUrl('')
|
this.setOuterUrl('')
|
||||||
|
this.setDatasourceId('')
|
||||||
|
this.setTableName('')
|
||||||
|
this.setDatasetId('')
|
||||||
|
this.setDatasetCopyId('')
|
||||||
|
this.setdatasetPid('')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -581,8 +581,14 @@ const getTableName = async (datasourceId, tableName) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const initEdite = async () => {
|
const initEdite = async () => {
|
||||||
const { id, datasourceId, tableName } = route.query
|
let { id, datasourceId, tableName } = route.query
|
||||||
const { id: copyId } = route.params
|
let { id: copyId } = route.params
|
||||||
|
if (appStore.getIsDataEaseBi) {
|
||||||
|
id = embeddedStore.datasetId
|
||||||
|
datasourceId = embeddedStore.datasourceId
|
||||||
|
tableName = embeddedStore.tableName
|
||||||
|
copyId = embeddedStore.datasetCopyId || copyId
|
||||||
|
}
|
||||||
if (copyId || id) {
|
if (copyId || id) {
|
||||||
const barRes = await barInfoApi(copyId || id)
|
const barRes = await barInfoApi(copyId || id)
|
||||||
if (!barRes || !barRes['id']) {
|
if (!barRes || !barRes['id']) {
|
||||||
@ -954,7 +960,7 @@ const datasetSave = () => {
|
|||||||
}
|
}
|
||||||
let union = []
|
let union = []
|
||||||
dfsNodeList(union, datasetDrag.value.getNodeList())
|
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) {
|
if (!union.length) {
|
||||||
ElMessage.error('数据集不能为空')
|
ElMessage.error('数据集不能为空')
|
||||||
return
|
return
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import { ref, reactive, shallowRef, computed, watch, onBeforeMount, nextTick, unref } from 'vue'
|
import { ref, reactive, shallowRef, computed, watch, onBeforeMount, nextTick, unref } from 'vue'
|
||||||
import ArrowSide from '@/views/common/DeResourceArrow.vue'
|
import ArrowSide from '@/views/common/DeResourceArrow.vue'
|
||||||
|
import { useEmbedded } from '@/store/modules/embedded'
|
||||||
|
import { useEmitt } from '@/hooks/web/useEmitt'
|
||||||
import {
|
import {
|
||||||
ElIcon,
|
ElIcon,
|
||||||
ElMessageBox,
|
ElMessageBox,
|
||||||
@ -284,8 +286,15 @@ const handleNodeClick = (data: BusiTreeNode) => {
|
|||||||
const editorDataset = () => {
|
const editorDataset = () => {
|
||||||
handleEdit(nodeInfo.id)
|
handleEdit(nodeInfo.id)
|
||||||
}
|
}
|
||||||
|
const embedded = useEmbedded()
|
||||||
|
|
||||||
const handleEdit = id => {
|
const handleEdit = id => {
|
||||||
|
if (isDataEaseBi.value) {
|
||||||
|
embedded.clearState()
|
||||||
|
embedded.setDatasetId(id as string)
|
||||||
|
useEmitt().emitter.emit('changeCurrentComponent', 'DatasetEditor')
|
||||||
|
return
|
||||||
|
}
|
||||||
router.push({
|
router.push({
|
||||||
path: '/dataset-form',
|
path: '/dataset-form',
|
||||||
query: {
|
query: {
|
||||||
@ -295,6 +304,12 @@ const handleEdit = id => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const createDataset = (data?: BusiTreeNode) => {
|
const createDataset = (data?: BusiTreeNode) => {
|
||||||
|
if (isDataEaseBi.value) {
|
||||||
|
embedded.clearState()
|
||||||
|
embedded.setdatasetPid(data?.id as string)
|
||||||
|
useEmitt().emitter.emit('changeCurrentComponent', 'DatasetEditor')
|
||||||
|
return
|
||||||
|
}
|
||||||
router.push({
|
router.push({
|
||||||
path: '/dataset-form',
|
path: '/dataset-form',
|
||||||
query: {
|
query: {
|
||||||
@ -340,6 +355,12 @@ const handleClick = (tabName: TabPaneName) => {
|
|||||||
|
|
||||||
const operation = (cmd: string, data: BusiTreeNode, nodeType: string) => {
|
const operation = (cmd: string, data: BusiTreeNode, nodeType: string) => {
|
||||||
if (cmd === 'copy') {
|
if (cmd === 'copy') {
|
||||||
|
if (isDataEaseBi.value) {
|
||||||
|
embedded.clearState()
|
||||||
|
embedded.setDatasetCopyId(data.id as string)
|
||||||
|
useEmitt().emitter.emit('changeCurrentComponent', 'DatasetEditor')
|
||||||
|
return
|
||||||
|
}
|
||||||
router.push({
|
router.push({
|
||||||
name: 'dataset-form',
|
name: 'dataset-form',
|
||||||
params: {
|
params: {
|
||||||
|
@ -8,6 +8,7 @@ import ArrowSide from '@/views/common/DeResourceArrow.vue'
|
|||||||
import { HandleMore } from '@/components/handle-more'
|
import { HandleMore } from '@/components/handle-more'
|
||||||
import { Icon } from '@/components/icon-custom'
|
import { Icon } from '@/components/icon-custom'
|
||||||
import { fieldType } from '@/utils/attr'
|
import { fieldType } from '@/utils/attr'
|
||||||
|
import { useEmitt } from '@/hooks/web/useEmitt'
|
||||||
import { getHidePwById, listSyncRecord, uploadFile } from '@/api/datasource'
|
import { getHidePwById, listSyncRecord, uploadFile } from '@/api/datasource'
|
||||||
import CreatDsGroup from './form/CreatDsGroup.vue'
|
import CreatDsGroup from './form/CreatDsGroup.vue'
|
||||||
import type { Tree } from '../dataset/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 { interactiveStoreWithOut } from '@/store/modules/interactive'
|
||||||
import treeSort from '@/utils/treeSortUtils'
|
import treeSort from '@/utils/treeSortUtils'
|
||||||
import { useCache } from '@/hooks/web/useCache'
|
import { useCache } from '@/hooks/web/useCache'
|
||||||
|
import { useEmbedded } from '@/store/modules/embedded'
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const interactiveStore = interactiveStoreWithOut()
|
const interactiveStore = interactiveStoreWithOut()
|
||||||
interface Field {
|
interface Field {
|
||||||
@ -77,8 +79,15 @@ const recordState = reactive({
|
|||||||
})
|
})
|
||||||
const isDataEaseBi = computed(() => appStore.getIsDataEaseBi)
|
const isDataEaseBi = computed(() => appStore.getIsDataEaseBi)
|
||||||
const isIframe = computed(() => appStore.getIsIframe)
|
const isIframe = computed(() => appStore.getIsIframe)
|
||||||
|
const embedded = useEmbedded()
|
||||||
const createDataset = (tableName?: string) => {
|
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({
|
router.push({
|
||||||
path: '/dataset-form',
|
path: '/dataset-form',
|
||||||
query: {
|
query: {
|
||||||
@ -127,7 +136,7 @@ const typeMap = dsTypes.reduce((pre, next) => {
|
|||||||
}, {})
|
}, {})
|
||||||
|
|
||||||
const datasetTypeList = computed(() => {
|
const datasetTypeList = computed(() => {
|
||||||
const list = [
|
return [
|
||||||
{
|
{
|
||||||
label: '新建数据源',
|
label: '新建数据源',
|
||||||
svgName: 'icon_dataset',
|
svgName: 'icon_dataset',
|
||||||
@ -140,11 +149,6 @@ const datasetTypeList = computed(() => {
|
|||||||
command: 'folder'
|
command: 'folder'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
if (isDataEaseBi.value) {
|
|
||||||
list.shift()
|
|
||||||
list[0].divided = false
|
|
||||||
}
|
|
||||||
return list
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const dsTableDataLoading = ref(false)
|
const dsTableDataLoading = ref(false)
|
||||||
@ -825,7 +829,7 @@ const mouseleave = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getMenuList = (val: boolean) => {
|
const getMenuList = (val: boolean) => {
|
||||||
return !val || isDataEaseBi.value
|
return !val
|
||||||
? menuList
|
? menuList
|
||||||
: [
|
: [
|
||||||
{
|
{
|
||||||
@ -865,18 +869,13 @@ const getMenuList = (val: boolean) => {
|
|||||||
<el-tooltip effect="dark" content="新建文件夹" placement="top">
|
<el-tooltip effect="dark" content="新建文件夹" placement="top">
|
||||||
<el-icon
|
<el-icon
|
||||||
class="custom-icon btn"
|
class="custom-icon btn"
|
||||||
:style="{ marginRight: isDataEaseBi ? 0 : '20px' }"
|
:style="{ marginRight: '20px' }"
|
||||||
@click="handleDatasourceTree('folder')"
|
@click="handleDatasourceTree('folder')"
|
||||||
>
|
>
|
||||||
<Icon name="dv-new-folder" />
|
<Icon name="dv-new-folder" />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip
|
<el-tooltip effect="dark" :content="t('datasource.create')" placement="top">
|
||||||
v-if="!isDataEaseBi"
|
|
||||||
effect="dark"
|
|
||||||
:content="t('datasource.create')"
|
|
||||||
placement="top"
|
|
||||||
>
|
|
||||||
<el-icon class="custom-icon btn" @click="createDatasource">
|
<el-icon class="custom-icon btn" @click="createDatasource">
|
||||||
<Icon name="icon_file-add_outlined" />
|
<Icon name="icon_file-add_outlined" />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
@ -966,7 +965,7 @@ const getMenuList = (val: boolean) => {
|
|||||||
<el-icon
|
<el-icon
|
||||||
class="hover-icon"
|
class="hover-icon"
|
||||||
@click.stop="handleEdit(data)"
|
@click.stop="handleEdit(data)"
|
||||||
v-else-if="data.type !== 'Excel' && !isDataEaseBi"
|
v-else-if="data.type !== 'Excel'"
|
||||||
>
|
>
|
||||||
<icon name="icon_edit_outlined"></icon>
|
<icon name="icon_edit_outlined"></icon>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
@ -993,11 +992,7 @@ const getMenuList = (val: boolean) => {
|
|||||||
>
|
>
|
||||||
<template v-if="!state.datasourceTree.length && mounted">
|
<template v-if="!state.datasourceTree.length && mounted">
|
||||||
<empty-background description="暂无数据源" img-type="none">
|
<empty-background description="暂无数据源" img-type="none">
|
||||||
<el-button
|
<el-button v-if="rootManage" @click="() => createDatasource()" type="primary">
|
||||||
v-if="rootManage && !isDataEaseBi"
|
|
||||||
@click="() => createDatasource()"
|
|
||||||
type="primary"
|
|
||||||
>
|
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<Icon name="icon_add_outlined"></Icon>
|
<Icon name="icon_add_outlined"></Icon>
|
||||||
</template>
|
</template>
|
||||||
@ -1029,7 +1024,7 @@ const getMenuList = (val: boolean) => {
|
|||||||
:creator="infoList.creator"
|
:creator="infoList.creator"
|
||||||
></dataset-detail>
|
></dataset-detail>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
<div class="right-btn flex-align-center" v-if="!isDataEaseBi">
|
<div class="right-btn flex-align-center">
|
||||||
<el-button secondary @click="createDataset(null)" v-permission="['dataset']">
|
<el-button secondary @click="createDataset(null)" v-permission="['dataset']">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<Icon name="icon_dataset_outlined"></Icon>
|
<Icon name="icon_dataset_outlined"></Icon>
|
||||||
@ -1175,12 +1170,7 @@ const getMenuList = (val: boolean) => {
|
|||||||
width="108"
|
width="108"
|
||||||
>
|
>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tooltip
|
<el-tooltip effect="dark" content="新建数据集" placement="top">
|
||||||
v-if="!isDataEaseBi"
|
|
||||||
effect="dark"
|
|
||||||
content="新建数据集"
|
|
||||||
placement="top"
|
|
||||||
>
|
|
||||||
<el-button
|
<el-button
|
||||||
@click.stop="createDataset(scope.row.tableName)"
|
@click.stop="createDataset(scope.row.tableName)"
|
||||||
text
|
text
|
||||||
|
Loading…
Reference in New Issue
Block a user