feat(测试计划): 脑图执行用例-操作权限
This commit is contained in:
parent
308a2da1ee
commit
c56ca2975d
|
@ -12,7 +12,7 @@
|
||||||
:can-show-more-menu="canShowMoreMenu"
|
:can-show-more-menu="canShowMoreMenu"
|
||||||
:can-show-enter-node="canShowEnterNode"
|
:can-show-enter-node="canShowEnterNode"
|
||||||
:can-show-more-menu-node-operation="false"
|
:can-show-more-menu-node-operation="false"
|
||||||
:more-menu-other-operation-list="canShowFloatMenu ? moreMenuOtherOperationList : []"
|
:more-menu-other-operation-list="canShowFloatMenu && hasOperationPermission ? moreMenuOtherOperationList : []"
|
||||||
disabled
|
disabled
|
||||||
@node-select="handleNodeSelect"
|
@node-select="handleNodeSelect"
|
||||||
@node-unselect="handleNodeUnselect"
|
@node-unselect="handleNodeUnselect"
|
||||||
|
@ -21,7 +21,11 @@
|
||||||
<!-- 缺陷 -->
|
<!-- 缺陷 -->
|
||||||
<a-dropdown position="bl">
|
<a-dropdown position="bl">
|
||||||
<a-tooltip
|
<a-tooltip
|
||||||
v-if="showAssociateBugMenu && hasAnyPermission(['PROJECT_BUG:READ', 'PROJECT_BUG:READ+ADD'])"
|
v-if="
|
||||||
|
props.canEdit &&
|
||||||
|
showAssociateBugMenu &&
|
||||||
|
hasAllPermission(['PROJECT_BUG:READ', 'PROJECT_TEST_PLAN:READ+EXECUTE'])
|
||||||
|
"
|
||||||
:content="t('common.add')"
|
:content="t('common.add')"
|
||||||
>
|
>
|
||||||
<MsButton type="icon" class="ms-minder-node-float-menu-icon-button">
|
<MsButton type="icon" class="ms-minder-node-float-menu-icon-button">
|
||||||
|
@ -38,7 +42,10 @@
|
||||||
</template>
|
</template>
|
||||||
</a-dropdown>
|
</a-dropdown>
|
||||||
<!-- 执行 -->
|
<!-- 执行 -->
|
||||||
<a-tooltip :content="t('common.execute')">
|
<a-tooltip
|
||||||
|
v-if="props.canEdit && hasAnyPermission(['PROJECT_TEST_PLAN:READ+EXECUTE'])"
|
||||||
|
:content="t('common.execute')"
|
||||||
|
>
|
||||||
<MsButton type="icon" class="ms-minder-node-float-menu-icon-button">
|
<MsButton type="icon" class="ms-minder-node-float-menu-icon-button">
|
||||||
<MsIcon type="icon-icon_play-round_filled" class="text-[var(--color-text-4)]" />
|
<MsIcon type="icon-icon_play-round_filled" class="text-[var(--color-text-4)]" />
|
||||||
</MsButton>
|
</MsButton>
|
||||||
|
@ -77,7 +84,7 @@
|
||||||
v-else-if="activeExtraKey === 'bug'"
|
v-else-if="activeExtraKey === 'bug'"
|
||||||
:active-case="activeCaseInfo"
|
:active-case="activeCaseInfo"
|
||||||
is-test-plan-case
|
is-test-plan-case
|
||||||
show-disassociate-button
|
:show-disassociate-button="props.canEdit && hasAnyPermission(['PROJECT_TEST_PLAN:READ+EXECUTE'])"
|
||||||
/>
|
/>
|
||||||
<ReviewCommentList
|
<ReviewCommentList
|
||||||
v-else
|
v-else
|
||||||
|
@ -115,7 +122,7 @@
|
||||||
import useMinderStore from '@/store/modules/components/minder-editor/index';
|
import useMinderStore from '@/store/modules/components/minder-editor/index';
|
||||||
import useTestPlanFeatureCaseStore from '@/store/modules/testPlan/testPlanFeatureCase';
|
import useTestPlanFeatureCaseStore from '@/store/modules/testPlan/testPlanFeatureCase';
|
||||||
import { findNodeByKey, mapTree, replaceNodeInTree } from '@/utils';
|
import { findNodeByKey, mapTree, replaceNodeInTree } from '@/utils';
|
||||||
import { hasAnyPermission } from '@/utils/permission';
|
import { hasAllPermission, hasAnyPermission } from '@/utils/permission';
|
||||||
|
|
||||||
import { ModuleTreeNode } from '@/models/common';
|
import { ModuleTreeNode } from '@/models/common';
|
||||||
import type { ExecuteHistoryItem } from '@/models/testPlan/testPlan';
|
import type { ExecuteHistoryItem } from '@/models/testPlan/testPlan';
|
||||||
|
@ -131,6 +138,7 @@
|
||||||
activeModule: string;
|
activeModule: string;
|
||||||
moduleTree: ModuleTreeNode[];
|
moduleTree: ModuleTreeNode[];
|
||||||
planId: string;
|
planId: string;
|
||||||
|
canEdit: boolean; // 已归档的测试计划不能操作
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
|
@ -423,10 +431,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasOperationPermission = hasAnyPermission([
|
const hasOperationPermission = computed(
|
||||||
'PROJECT_TEST_PLAN:READ+UPDATE',
|
() => hasAnyPermission(['PROJECT_TEST_PLAN:READ+UPDATE', 'PROJECT_TEST_PLAN:READ+ASSOCIATION']) && props.canEdit
|
||||||
'PROJECT_TEST_PLAN:READ+ASSOCIATION',
|
);
|
||||||
]);
|
|
||||||
const canShowFloatMenu = ref(false); // 是否展示浮动菜单
|
const canShowFloatMenu = ref(false); // 是否展示浮动菜单
|
||||||
const canShowMoreMenu = ref(false); // 更多
|
const canShowMoreMenu = ref(false); // 更多
|
||||||
const canShowEnterNode = ref(false);
|
const canShowEnterNode = ref(false);
|
||||||
|
@ -472,7 +479,7 @@
|
||||||
node.data?.resource?.includes(caseTag) ||
|
node.data?.resource?.includes(caseTag) ||
|
||||||
(node.data?.resource?.includes(moduleTag) &&
|
(node.data?.resource?.includes(moduleTag) &&
|
||||||
(node.children || []).length > 0 &&
|
(node.children || []).length > 0 &&
|
||||||
!(!hasOperationPermission && node.type === 'root'))
|
!(!hasOperationPermission.value && node.type === 'root'))
|
||||||
) {
|
) {
|
||||||
canShowFloatMenu.value = true;
|
canShowFloatMenu.value = true;
|
||||||
setMoreMenuOtherOperationList(node);
|
setMoreMenuOtherOperationList(node);
|
||||||
|
@ -481,7 +488,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// 不展示更多:没操作权限的用例
|
// 不展示更多:没操作权限的用例
|
||||||
if (node.data?.resource?.includes(caseTag) && !hasOperationPermission) {
|
if (node.data?.resource?.includes(caseTag) && !hasOperationPermission.value) {
|
||||||
canShowMoreMenu.value = false;
|
canShowMoreMenu.value = false;
|
||||||
} else {
|
} else {
|
||||||
canShowMoreMenu.value = true;
|
canShowMoreMenu.value = true;
|
||||||
|
|
|
@ -115,6 +115,7 @@
|
||||||
:active-module="props.activeModule"
|
:active-module="props.activeModule"
|
||||||
:module-tree="moduleTree"
|
:module-tree="moduleTree"
|
||||||
:plan-id="props.planId"
|
:plan-id="props.planId"
|
||||||
|
:can-edit="props.canEdit"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!-- 批量执行 -->
|
<!-- 批量执行 -->
|
||||||
|
|
|
@ -130,7 +130,12 @@
|
||||||
<span class="ml-1 text-[rgb(var(--danger-6))]">{{ caseDetail.bugListCount }}</span>
|
<span class="ml-1 text-[rgb(var(--danger-6))]">{{ caseDetail.bugListCount }}</span>
|
||||||
</MsTag>
|
</MsTag>
|
||||||
<a-dropdown @select="handleSelect">
|
<a-dropdown @select="handleSelect">
|
||||||
<a-button v-if="hasAnyPermission(['PROJECT_BUG:READ'])" type="outline" size="small" class="ml-1">
|
<a-button
|
||||||
|
v-if="hasAllPermission(['PROJECT_BUG:READ', 'PROJECT_TEST_PLAN:READ+EXECUTE'])"
|
||||||
|
type="outline"
|
||||||
|
size="small"
|
||||||
|
class="ml-1"
|
||||||
|
>
|
||||||
<template #icon> <icon-plus class="text-[12px]" /> </template>
|
<template #icon> <icon-plus class="text-[12px]" /> </template>
|
||||||
</a-button>
|
</a-button>
|
||||||
<template #content>
|
<template #content>
|
||||||
|
@ -186,7 +191,7 @@
|
||||||
ref="bugRef"
|
ref="bugRef"
|
||||||
:case-id="activeCaseId"
|
:case-id="activeCaseId"
|
||||||
:test-plan-case-id="activeId"
|
:test-plan-case-id="activeId"
|
||||||
:can-edit="canEdit"
|
:can-edit="canEdit && hasAnyPermission(['PROJECT_TEST_PLAN:READ+EXECUTE'])"
|
||||||
@link="linkDefect"
|
@link="linkDefect"
|
||||||
@new="addBug"
|
@new="addBug"
|
||||||
@update-count="loadCaseDetail()"
|
@update-count="loadCaseDetail()"
|
||||||
|
@ -256,7 +261,7 @@
|
||||||
import { useI18n } from '@/hooks/useI18n';
|
import { useI18n } from '@/hooks/useI18n';
|
||||||
import useOpenNewPage from '@/hooks/useOpenNewPage';
|
import useOpenNewPage from '@/hooks/useOpenNewPage';
|
||||||
import useAppStore from '@/store/modules/app';
|
import useAppStore from '@/store/modules/app';
|
||||||
import { hasAnyPermission } from '@/utils/permission';
|
import { hasAllPermission, hasAnyPermission } from '@/utils/permission';
|
||||||
|
|
||||||
import type { TableQueryParams } from '@/models/common';
|
import type { TableQueryParams } from '@/models/common';
|
||||||
import type { ExecuteHistoryItem, PlanDetailFeatureCaseItem, TestPlanDetail } from '@/models/testPlan/testPlan';
|
import type { ExecuteHistoryItem, PlanDetailFeatureCaseItem, TestPlanDetail } from '@/models/testPlan/testPlan';
|
||||||
|
|
Loading…
Reference in New Issue