From 38fc6ce00e1dc962e942521cdf6885ce2d84ab81 Mon Sep 17 00:00:00 2001 From: jmal Date: Sun, 16 Jun 2024 11:43:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=94=A8=E6=88=B7=E8=87=AA=E5=B7=B1?= =?UTF-8?q?=E7=9A=84=E6=96=87=E4=BB=B6=E5=8F=AF=E4=B8=8E=E6=8C=82=E8=BD=BD?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E4=B9=8B=E9=97=B4=E7=9B=B8=E4=BA=92=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E6=88=96=E5=A4=8D=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ShowFile/ShowFile.vue | 46 ++++++++++------------------ 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index 02b7798..8472341 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -3318,10 +3318,11 @@ export default { }) } if (row.isFolder && row.mountFileId) { - const indicesToDelete = [7, 6, 5, 4, 1] - for (let i of indicesToDelete) { - this.menus.splice(i, 1) - } + const reservations = ['open', 'tag', 'favorite', 'remove'] + // 删除this.menus中不要的菜单, 仅保留reservations中的菜单 + this.menus = this.menus.filter(item => + reservations.includes(item.operation) + ) } if (!row.isFolder) { this.menus.splice(-2, 0, { @@ -3375,28 +3376,18 @@ export default { ) if (file.operationPermissionList && file.operationPermissionList.length > 0) { if (file.operationPermissionList.indexOf('PUT') > -1) { - this.menus.splice(this.menus.length - 1, 0, { - iconClass: 'menu-rename', - label: '重命名', - operation: 'rename', - }) + this.menus.splice(this.menus.length - 1, 0, { iconClass: 'menu-rename', label: '重命名', operation: 'rename'}) } - if ( - file.operationPermissionList.indexOf('UPLOAD') > -1 && - !file.isFolder - ) { - this.menus.splice(this.menus.length - 1, 0, { - iconClass: 'duplicate', - label: '创建副本', - operation: 'duplicate', - }) + if (file.operationPermissionList.indexOf('UPLOAD') > -1) { + if (file.operationPermissionList.indexOf('DELETE') > -1) { + this.menus.splice(this.menus.length - 1, 0, { iconClass: 'menu-copy',label: '移动或复制', operation: 'copy'}) + } + if (!file.isFolder) { + this.menus.splice(this.menus.length - 1, 0, { iconClass: 'duplicate', label: '创建副本', operation: 'duplicate'}) + } } if (file.operationPermissionList.indexOf('DELETE') > -1) { - this.menus.splice(this.menus.length, 0, { - iconClass: 'menu-remove', - label: '删除', - operation: 'remove', - }) + this.menus.splice(this.menus.length, 0, { iconClass: 'menu-remove', label: '删除', operation: 'remove'}) } } this.setMenusCopyDownLoadLinks(file) @@ -3666,16 +3657,13 @@ export default { return resolve([{ id: '0', name: '全部文件' }]) } 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, username: this.$store.state.user.name, fileId: fileId, - }) - .then(res => { + }).then(res => { const nextNodes = res.data return resolve(nextNodes) })