fix(用例管理): 修复用例管理模块树按钮依据权限显示问题

--bug=1039850 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001039850
This commit is contained in:
guoyuqi 2024-04-22 17:12:41 +08:00 committed by 刘瑞斌
parent db79a9bfb6
commit 27c1f177dc
3 changed files with 5 additions and 6 deletions

View File

@ -35,7 +35,6 @@ import io.metersphere.system.mapper.UserRoleRelationMapper;
import io.metersphere.system.notice.constants.NoticeConstants; import io.metersphere.system.notice.constants.NoticeConstants;
import io.metersphere.system.service.BaseCustomFieldOptionService; import io.metersphere.system.service.BaseCustomFieldOptionService;
import io.metersphere.system.service.BaseCustomFieldService; import io.metersphere.system.service.BaseCustomFieldService;
import io.metersphere.system.service.UserLoginService;
import io.metersphere.system.uid.IDGenerator; import io.metersphere.system.uid.IDGenerator;
import io.metersphere.system.utils.ServiceUtils; import io.metersphere.system.utils.ServiceUtils;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
@ -111,8 +110,6 @@ public class CaseReviewFunctionalCaseService {
private BaseCustomFieldService baseCustomFieldService; private BaseCustomFieldService baseCustomFieldService;
@Resource @Resource
private BaseCustomFieldOptionService baseCustomFieldOptionService; private BaseCustomFieldOptionService baseCustomFieldOptionService;
@Resource
private UserLoginService userLoginService;
private static final String CASE_MODULE_COUNT_ALL = "all"; private static final String CASE_MODULE_COUNT_ALL = "all";

View File

@ -41,6 +41,7 @@
</template> </template>
<template v-if="!props.isModal" #extra="nodeData"> <template v-if="!props.isModal" #extra="nodeData">
<MsPopConfirm <MsPopConfirm
v-if="hasAnyPermission(['FUNCTIONAL_CASE:READ+ADD'])"
:visible="addSubVisible" :visible="addSubVisible"
:is-delete="false" :is-delete="false"
:all-names="[]" :all-names="[]"
@ -58,6 +59,7 @@
</MsButton> </MsButton>
</MsPopConfirm> </MsPopConfirm>
<MsPopConfirm <MsPopConfirm
v-if="hasAnyPermission(['FUNCTIONAL_CASE:READ+UPDATE'])"
:title="t('caseManagement.featureCase.rename')" :title="t('caseManagement.featureCase.rename')"
:all-names="[]" :all-names="[]"
:is-delete="false" :is-delete="false"
@ -93,12 +95,12 @@
moveCaseModuleTree, moveCaseModuleTree,
updateCaseModuleTree, updateCaseModuleTree,
} from '@/api/modules/case-management/featureCase'; } from '@/api/modules/case-management/featureCase';
import { ProjectMemberOptions } from '@/api/requrls/project-management/projectMember';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useModal from '@/hooks/useModal'; import useModal from '@/hooks/useModal';
import useAppStore from '@/store/modules/app'; import useAppStore from '@/store/modules/app';
import useFeatureCaseStore from '@/store/modules/case/featureCase'; import useFeatureCaseStore from '@/store/modules/case/featureCase';
import { mapTree } from '@/utils'; import { mapTree } from '@/utils';
import { hasAnyPermission } from '@/utils/permission';
import type { CreateOrUpdateModule, UpdateModule } from '@/models/caseManagement/featureCase'; import type { CreateOrUpdateModule, UpdateModule } from '@/models/caseManagement/featureCase';
import { ModuleTreeNode } from '@/models/common'; import { ModuleTreeNode } from '@/models/common';

View File

@ -19,7 +19,7 @@
<MsIcon :type="isExpandAll ? 'icon-icon_folder_collapse1' : 'icon-icon_folder_expansion1'" /> <MsIcon :type="isExpandAll ? 'icon-icon_folder_collapse1' : 'icon-icon_folder_expansion1'" />
</MsButton> </MsButton>
</a-tooltip> </a-tooltip>
<popConfirm mode="add" :all-names="rootModulesName" parent-id="NONE" @add-finish="() => initModules()"> <popConfirm v-if="hasAnyPermission(['CASE_REVIEW:READ+UPDATE'])" mode="add" :all-names="rootModulesName" parent-id="NONE" @add-finish="() => initModules()">
<MsButton type="icon" class="!mr-0 p-[2px]"> <MsButton type="icon" class="!mr-0 p-[2px]">
<MsIcon <MsIcon
type="icon-icon_create_planarity" type="icon-icon_create_planarity"
@ -67,7 +67,7 @@
<template v-if="!props.isModal" #extra="nodeData"> <template v-if="!props.isModal" #extra="nodeData">
<!-- 默认模块的 id 是root默认模块不可编辑不可添加子模块 --> <!-- 默认模块的 id 是root默认模块不可编辑不可添加子模块 -->
<popConfirm <popConfirm
v-if="nodeData.id !== 'root' && hasAnyPermission(['CASE_REVIEW:READ+DELETE'])" v-if="nodeData.id !== 'root' && hasAnyPermission(['CASE_REVIEW:READ+ADD'])"
mode="add" mode="add"
:all-names="(nodeData.children || []).map((e: ModuleTreeNode) => e.name || '')" :all-names="(nodeData.children || []).map((e: ModuleTreeNode) => e.name || '')"
:parent-id="nodeData.id" :parent-id="nodeData.id"