refactor(接口测试): 优化批量操作按钮权限

This commit is contained in:
wxg0103 2024-04-12 13:00:10 +08:00 committed by Craftsman
parent 087bfb417f
commit bd5821acf2
4 changed files with 7 additions and 6 deletions

View File

@ -4,7 +4,7 @@
<template v-for="(element, idx) in baseAction" :key="element.label"> <template v-for="(element, idx) in baseAction" :key="element.label">
<a-divider v-if="element.isDivider" class="divider mx-0 my-[6px]" /> <a-divider v-if="element.isDivider" class="divider mx-0 my-[6px]" />
<a-button <a-button
v-if="!element.isDivider && !element.children && hasAllPermission(element.permission as string[])" v-if="!element.isDivider && !element.children && hasAllPermission(element.permission as string[]) && hasAnyPermission(element.anyPermission as string[])"
class="ml-[12px]" class="ml-[12px]"
:class="{ :class="{
'arco-btn-outline--danger': element.danger, 'arco-btn-outline--danger': element.danger,
@ -16,7 +16,7 @@
> >
<!-- baseAction多菜单选择 --> <!-- baseAction多菜单选择 -->
<a-dropdown <a-dropdown
v-if="!element.isDivider && element.children && hasAllPermission(element.permission as string[])" v-if="!element.isDivider && element.children && hasAllPermission(element.permission as string[]) && hasAnyPermission(element.anyPermission as string[])"
position="tr" position="tr"
@select="handleSelect" @select="handleSelect"
> >
@ -67,7 +67,7 @@
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import { getNodeWidth } from '@/utils/dom'; import { getNodeWidth } from '@/utils/dom';
import { hasAllPermission } from '@/utils/permission'; import { hasAllPermission, hasAnyPermission } from '@/utils/permission';
import { BatchActionConfig, BatchActionParams } from './type'; import { BatchActionConfig, BatchActionParams } from './type';
import ResizeObserver from 'resize-observer-polyfill'; import ResizeObserver from 'resize-observer-polyfill';

View File

@ -131,6 +131,7 @@ export interface BatchActionParams {
danger?: boolean; danger?: boolean;
children?: BatchActionParams[]; children?: BatchActionParams[];
permission?: string[]; permission?: string[];
anyPermission?: string[];
} }
export interface BatchActionConfig { export interface BatchActionConfig {
baseAction: BatchActionParams[]; baseAction: BatchActionParams[];

View File

@ -419,7 +419,7 @@
{ {
label: 'project.taskCenter.batchStop', label: 'project.taskCenter.batchStop',
eventTag: 'batchStop', eventTag: 'batchStop',
permission: permissionsMap[props.group][props.moduleType].stop, anyPermission: permissionsMap[props.group][props.moduleType].stop,
}, },
// { // {
// label: 'project.taskCenter.batchExecution', // label: 'project.taskCenter.batchExecution',

View File

@ -340,12 +340,12 @@
{ {
label: 'project.taskCenter.batchEnable', label: 'project.taskCenter.batchEnable',
eventTag: 'batchEnable', eventTag: 'batchEnable',
// permission: permissionsMap[props.group][props.moduleType].edit, anyPermission: permissionsMap[props.group][props.moduleType].edit,
}, },
{ {
label: 'project.taskCenter.batchDisable', label: 'project.taskCenter.batchDisable',
eventTag: 'batchDisable', eventTag: 'batchDisable',
// permission: permissionsMap[props.group][props.moduleType].edit, anyPermission: permissionsMap[props.group][props.moduleType].edit,
}, },
], ],
}; };