feat: 用户自己的文件可与挂载目录之间相互移动或复制

This commit is contained in:
jmal 2024-06-16 11:43:07 +08:00
parent 98b182c60d
commit 38fc6ce00e

View File

@ -3318,10 +3318,11 @@ export default {
}) })
} }
if (row.isFolder && row.mountFileId) { if (row.isFolder && row.mountFileId) {
const indicesToDelete = [7, 6, 5, 4, 1] const reservations = ['open', 'tag', 'favorite', 'remove']
for (let i of indicesToDelete) { // 删除this.menus中不要的菜单, 仅保留reservations中的菜单
this.menus.splice(i, 1) this.menus = this.menus.filter(item =>
} reservations.includes(item.operation)
)
} }
if (!row.isFolder) { if (!row.isFolder) {
this.menus.splice(-2, 0, { this.menus.splice(-2, 0, {
@ -3375,28 +3376,18 @@ export default {
) )
if (file.operationPermissionList && file.operationPermissionList.length > 0) { if (file.operationPermissionList && file.operationPermissionList.length > 0) {
if (file.operationPermissionList.indexOf('PUT') > -1) { if (file.operationPermissionList.indexOf('PUT') > -1) {
this.menus.splice(this.menus.length - 1, 0, { this.menus.splice(this.menus.length - 1, 0, { iconClass: 'menu-rename', label: '重命名', operation: 'rename'})
iconClass: 'menu-rename',
label: '重命名',
operation: 'rename',
})
} }
if ( if (file.operationPermissionList.indexOf('UPLOAD') > -1) {
file.operationPermissionList.indexOf('UPLOAD') > -1 && if (file.operationPermissionList.indexOf('DELETE') > -1) {
!file.isFolder this.menus.splice(this.menus.length - 1, 0, { iconClass: 'menu-copy',label: '移动或复制', operation: 'copy'})
) { }
this.menus.splice(this.menus.length - 1, 0, { if (!file.isFolder) {
iconClass: 'duplicate', this.menus.splice(this.menus.length - 1, 0, { iconClass: 'duplicate', label: '创建副本', operation: 'duplicate'})
label: '创建副本', }
operation: 'duplicate',
})
} }
if (file.operationPermissionList.indexOf('DELETE') > -1) { if (file.operationPermissionList.indexOf('DELETE') > -1) {
this.menus.splice(this.menus.length, 0, { this.menus.splice(this.menus.length, 0, { iconClass: 'menu-remove', label: '删除', operation: 'remove'})
iconClass: 'menu-remove',
label: '删除',
operation: 'remove',
})
} }
} }
this.setMenusCopyDownLoadLinks(file) this.setMenusCopyDownLoadLinks(file)
@ -3666,16 +3657,13 @@ export default {
return resolve([{ id: '0', name: '全部文件' }]) return resolve([{ id: '0', name: '全部文件' }])
} }
if (node.level > 1) { if (node.level > 1) {
fileId = node.data.id fileId = node.data.mountFileId || node.data.id
} }
api.queryFileTree({
api
.queryFileTree({
userId: this.$store.state.user.userId, userId: this.$store.state.user.userId,
username: this.$store.state.user.name, username: this.$store.state.user.name,
fileId: fileId, fileId: fileId,
}) }).then(res => {
.then(res => {
const nextNodes = res.data const nextNodes = res.data
return resolve(nextNodes) return resolve(nextNodes)
}) })