fix(项目管理): 修复文件管理存储库删除按钮不显示补充权限

This commit is contained in:
xinxin.wu 2024-08-14 16:05:14 +08:00 committed by 刘瑞斌
parent 7d78a171fd
commit 632be61186
1 changed files with 32 additions and 27 deletions

View File

@ -493,23 +493,23 @@
label: 'project.fileManagement.delete', label: 'project.fileManagement.delete',
eventTag: 'delete', eventTag: 'delete',
danger: true, danger: true,
permission: ['PROJECT_FILE_MANAGEMENT:READ+DELETE'],
}, },
]; ];
} }
const moveActions = [ const normalActions = [
{ {
label: 'project.fileManagement.move', label: 'project.fileManagement.move',
eventTag: 'move', eventTag: 'move',
permission: ['PROJECT_FILE_MANAGEMENT:READ+UPDATE'],
}, },
{ {
isDivider: true, isDivider: true,
}, },
];
const normalActions = [
{ {
label: 'project.fileManagement.delete', label: 'project.fileManagement.delete',
eventTag: 'delete', eventTag: 'delete',
permission: ['PROJECT_FILE_MANAGEMENT:READ+DELETE'],
danger: true, danger: true,
}, },
]; ];
@ -518,8 +518,8 @@
{ {
label: 'project.fileManagement.download', label: 'project.fileManagement.download',
eventTag: 'download', eventTag: 'download',
permission: ['PROJECT_FILE_MANAGEMENT:READ+DOWNLOAD'],
}, },
...moveActions,
...normalActions, ...normalActions,
]; ];
} }
@ -527,58 +527,63 @@
}); });
function getJarFileActions(record: FileItem) { function getJarFileActions(record: FileItem) {
let enableActions: ActionsItem[] = [ const moveFileActions: ActionsItem[] = [
{
label: 'project.fileManagement.move',
eventTag: 'move',
permission: ['PROJECT_FILE_MANAGEMENT:READ+UPDATE'],
},
];
let enableFileActions = [
{ {
label: 'common.enable', label: 'common.enable',
eventTag: 'toggle', eventTag: 'toggle',
permission: ['PROJECT_FILE_MANAGEMENT:READ+UPDATE'],
}, },
{ {
label: 'common.disable', label: 'common.disable',
eventTag: 'toggle', eventTag: 'toggle',
permission: ['PROJECT_FILE_MANAGEMENT:READ+UPDATE'],
}, },
]; ];
if (record.enable) { if (record.enable) {
enableActions = enableActions.filter((e) => e.label !== 'common.enable'); enableFileActions = enableFileActions.filter((e) => e.label !== 'common.enable');
} else if (record.enable === false) { } else if (record.enable === false) {
enableActions = enableActions.filter((e) => e.label !== 'common.disable'); enableFileActions = enableFileActions.filter((e) => e.label !== 'common.disable');
} }
const deleteActions = [ const deleteFileActions: ActionsItem[] = [
{
label: 'project.fileManagement.delete',
eventTag: 'delete',
danger: true,
},
];
const jarFileActions: ActionsItem[] = [
{
label: 'project.fileManagement.move',
eventTag: 'move',
},
{ {
isDivider: true, isDivider: true,
}, },
{
label: 'project.fileManagement.delete',
eventTag: 'delete',
permission: ['PROJECT_FILE_MANAGEMENT:READ+DELETE'],
danger: true,
},
]; ];
if (showType.value === 'card') { if (showType.value === 'card') {
return [ return [
{ {
label: 'project.fileManagement.download', label: 'project.fileManagement.download',
eventTag: 'download', eventTag: 'download',
permission: ['PROJECT_FILE_MANAGEMENT:READ+DOWNLOAD'],
}, },
...jarFileActions, ...moveFileActions,
...enableActions, ...enableFileActions,
...deleteActions, ...deleteFileActions,
]; ];
} }
if (record.storage === 'GIT') { if (record.storage === 'GIT') {
return jarFileActions.filter((e) => e.eventTag !== 'move'); enableFileActions = showType.value === 'list' ? [] : enableFileActions;
return [...enableFileActions, ...deleteFileActions];
} }
return [...jarFileActions, ...deleteActions]; return [...moveFileActions, ...deleteFileActions];
} }
const hasOperationPermission = computed(() => const hasOperationPermission = computed(() =>
hasAnyPermission([ hasAnyPermission([