fix: 禁止把资源移动到【迁移资源】文件夹

This commit is contained in:
fit2cloud-chenyw
2025-01-14 17:10:38 +08:00
committed by dataeaseShu
parent 3f39e5c6bc
commit 8cb6b64219
4 changed files with 21 additions and 19 deletions

View File

@@ -245,7 +245,7 @@ export const isFreeFolder = (node, flag) => {
const freeRootId = (Number(oid) + flag).toString()
let cNode = node
while (cNode) {
const data = node.data
const data = cNode.data
const id = data['id']
if (id === freeRootId) {
return true

View File

@@ -541,14 +541,14 @@ const sortTypeChange = sortType => {
state.curSortType = sortType
}
const proxyHandleDrop = (arg1, arg2, arg3) => {
const flagArray = ['dashboard', 'datav', 'dataset', 'datasource']
const proxyAllowDrop = (arg1, arg2) => {
const flagArray = ['dashboard', 'dataV', 'dataset', 'datasource']
const flag = flagArray.findIndex(item => item === curCanvasType.value)
if (flag < 0 || !isFreeFolder(arg2, flag + 1)) {
handleDrop(arg1, arg2, arg3)
return
return allowDrop(arg1, arg2)
}
ElMessage.warning(t('free.save_error'))
return false
}
watch(filterText, val => {
@@ -697,8 +697,8 @@ defineExpose({
@node-collapse="nodeCollapse"
@node-click="nodeClick"
@node-drag-start="handleDragStart"
:allow-drop="allowDrop"
@node-drop="proxyHandleDrop"
:allow-drop="proxyAllowDrop"
@node-drop="handleDrop"
draggable
>
<template #default="{ node, data }">

View File

@@ -783,14 +783,15 @@ const getMenuList = (val: boolean) => {
}
].concat(menuList)
}
const proxyHandleDrop = (arg1, arg2, arg3) => {
const flagArray = ['dashboard', 'datav', 'dataset', 'datasource']
const proxyAllowDrop = (arg1, arg2) => {
const flagArray = ['dashboard', 'dataV', 'dataset', 'datasource']
const flag = flagArray.findIndex(item => item === 'dataset')
if (flag < 0 || !isFreeFolder(arg2, flag + 1)) {
handleDrop(arg1, arg2, arg3)
return
return allowDrop(arg1, arg2)
}
ElMessage.warning(t('free.save_error'))
return false
}
</script>
@@ -901,8 +902,8 @@ const proxyHandleDrop = (arg1, arg2, arg3) => {
expand-on-click-node
highlight-current
@node-drag-start="handleDragStart"
:allow-drop="allowDrop"
@node-drop="proxyHandleDrop"
:allow-drop="proxyAllowDrop"
@node-drop="handleDrop"
draggable
@node-expand="nodeExpand"
@node-collapse="nodeCollapse"

View File

@@ -1009,14 +1009,15 @@ const loadInit = () => {
state.curSortType = historyTreeSort
}
}
const proxyHandleDrop = (arg1, arg2, arg3) => {
const flagArray = ['dashboard', 'datav', 'dataset', 'datasource']
const proxyAllowDrop = (arg1, arg2) => {
const flagArray = ['dashboard', 'dataV', 'dataset', 'datasource']
const flag = flagArray.findIndex(item => item === 'datasource')
if (flag < 0 || !isFreeFolder(arg2, flag + 1)) {
handleDrop(arg1, arg2, arg3)
return
return allowDrop(arg1, arg2)
}
ElMessage.warning(t('free.save_error'))
return false
}
onMounted(() => {
const dsId = wsCache.get('ds-info-id') || route.params.id
@@ -1160,8 +1161,8 @@ const getMenuList = (val: boolean) => {
:data="state.datasourceTree"
:props="defaultProps"
@node-drag-start="handleDragStart"
:allow-drop="allowDrop"
@node-drop="proxyHandleDrop"
:allow-drop="proxyAllowDrop"
@node-drop="handleDrop"
draggable
@node-click="handleNodeClick"
>