fix: 支持数据集的复制
This commit is contained in:
parent
94ec27862c
commit
60966fb6e3
@ -71,7 +71,6 @@ const editUnion = ref(false)
|
||||
const datasetDrag = ref()
|
||||
const datasetName = ref('未命名数据集')
|
||||
const tabActive = ref('preview')
|
||||
const originName = ref('')
|
||||
const activeName = ref('')
|
||||
const dataSource = ref('')
|
||||
const searchTable = ref('')
|
||||
@ -567,23 +566,26 @@ const getTableName = async (datasourceId, tableName) => {
|
||||
|
||||
const initEdite = () => {
|
||||
const { id, datasourceId, tableName } = route.query
|
||||
const { id: copyId } = route.params
|
||||
if (datasourceId) {
|
||||
dataSource.value = datasourceId as string
|
||||
getTableName(datasourceId as string, tableName)
|
||||
}
|
||||
if (!id) return
|
||||
if (!id && !copyId) return
|
||||
loading.value = true
|
||||
getDatasetDetails(id)
|
||||
getDatasetDetails(copyId || id)
|
||||
.then(res => {
|
||||
let arr = []
|
||||
const { id, pid, name } = res || {}
|
||||
nodeInfo = {
|
||||
id,
|
||||
pid,
|
||||
name
|
||||
name: copyId ? '复制数据集' : name
|
||||
}
|
||||
datasetName.value = name
|
||||
originName.value = name
|
||||
if (copyId) {
|
||||
nodeInfo.id = ''
|
||||
}
|
||||
datasetName.value = nodeInfo.name
|
||||
allfields.value = res.allFields || []
|
||||
dfsUnion(arr, res.union || [])
|
||||
const [fir] = res.union as { currentDs: { datasourceId: string } }[]
|
||||
@ -868,7 +870,7 @@ const datasetSave = () => {
|
||||
}
|
||||
const union = []
|
||||
dfsNodeList(union, datasetDrag.value.nodeList)
|
||||
const { pid } = route.query
|
||||
const pid = route.query.pid || nodeInfo.pid
|
||||
if (!union.length) {
|
||||
ElMessage.error('数据集不能为空')
|
||||
return
|
||||
|
||||
@ -320,6 +320,15 @@ const handleClick = (tabName: TabPaneName) => {
|
||||
}
|
||||
|
||||
const operation = (cmd: string, data: BusiTreeNode, nodeType: string) => {
|
||||
if (cmd === 'copy') {
|
||||
router.push({
|
||||
name: 'dataset-form',
|
||||
params: {
|
||||
id: data.id
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
if (cmd === 'delete') {
|
||||
let options = {
|
||||
confirmButtonType: 'danger',
|
||||
@ -417,6 +426,18 @@ const filterNode = (value: string, data: BusiTreeNode) => {
|
||||
if (!value) return true
|
||||
return data.name?.toLocaleLowerCase().includes(value.toLocaleLowerCase())
|
||||
}
|
||||
|
||||
const getMenuList = (val: boolean) => {
|
||||
return !val
|
||||
? menuList
|
||||
: [
|
||||
{
|
||||
label: t('common.copy'),
|
||||
svgName: 'icon_copy_filled',
|
||||
command: 'copy'
|
||||
}
|
||||
].concat(menuList)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -498,7 +519,7 @@ const filterNode = (value: string, data: BusiTreeNode) => {
|
||||
</el-icon>
|
||||
<handle-more
|
||||
@handle-command="cmd => operation(cmd, data, data.leaf ? 'dataset' : 'folder')"
|
||||
:menu-list="menuList"
|
||||
:menu-list="getMenuList(data.leaf)"
|
||||
></handle-more>
|
||||
</div>
|
||||
</span>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user