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',
eventTag: 'delete',
danger: true,
permission: ['PROJECT_FILE_MANAGEMENT:READ+DELETE'],
},
];
}
const moveActions = [
const normalActions = [
{
label: 'project.fileManagement.move',
eventTag: 'move',
permission: ['PROJECT_FILE_MANAGEMENT:READ+UPDATE'],
},
{
isDivider: true,
},
];
const normalActions = [
{
label: 'project.fileManagement.delete',
eventTag: 'delete',
permission: ['PROJECT_FILE_MANAGEMENT:READ+DELETE'],
danger: true,
},
];
@ -518,8 +518,8 @@
{
label: 'project.fileManagement.download',
eventTag: 'download',
permission: ['PROJECT_FILE_MANAGEMENT:READ+DOWNLOAD'],
},
...moveActions,
...normalActions,
];
}
@ -527,58 +527,63 @@
});
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',
eventTag: 'toggle',
permission: ['PROJECT_FILE_MANAGEMENT:READ+UPDATE'],
},
{
label: 'common.disable',
eventTag: 'toggle',
permission: ['PROJECT_FILE_MANAGEMENT:READ+UPDATE'],
},
];
if (record.enable) {
enableActions = enableActions.filter((e) => e.label !== 'common.enable');
enableFileActions = enableFileActions.filter((e) => e.label !== 'common.enable');
} else if (record.enable === false) {
enableActions = enableActions.filter((e) => e.label !== 'common.disable');
enableFileActions = enableFileActions.filter((e) => e.label !== 'common.disable');
}
const deleteActions = [
{
label: 'project.fileManagement.delete',
eventTag: 'delete',
danger: true,
},
];
const jarFileActions: ActionsItem[] = [
{
label: 'project.fileManagement.move',
eventTag: 'move',
},
const deleteFileActions: ActionsItem[] = [
{
isDivider: true,
},
{
label: 'project.fileManagement.delete',
eventTag: 'delete',
permission: ['PROJECT_FILE_MANAGEMENT:READ+DELETE'],
danger: true,
},
];
if (showType.value === 'card') {
return [
{
label: 'project.fileManagement.download',
eventTag: 'download',
permission: ['PROJECT_FILE_MANAGEMENT:READ+DOWNLOAD'],
},
...jarFileActions,
...enableActions,
...deleteActions,
...moveFileActions,
...enableFileActions,
...deleteFileActions,
];
}
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(() =>
hasAnyPermission([