feat(测试计划): 加权限

This commit is contained in:
teukkk 2024-05-17 15:16:31 +08:00 committed by 刘瑞斌
parent 5f6299b8d5
commit 601d659708
4 changed files with 31 additions and 24 deletions

View File

@ -36,9 +36,8 @@
<ExecuteResult :execute-result="filterContent.key" /> <ExecuteResult :execute-result="filterContent.key" />
</template> </template>
<template #lastExecResult="{ record }"> <template #lastExecResult="{ record }">
<!-- TODO: 修改permission -->
<a-select <a-select
v-if="hasAnyPermission(['PROJECT_API_DEFINITION_CASE:READ+UPDATE'])" v-if="hasAnyPermission(['PROJECT_TEST_PLAN:READ+EXECUTE'])"
v-model:model-value="record.lastExecResult" v-model:model-value="record.lastExecResult"
:placeholder="t('common.pleaseSelect')" :placeholder="t('common.pleaseSelect')"
class="param-input w-full" class="param-input w-full"
@ -55,7 +54,7 @@
</template> </template>
<template #operation="{ record }"> <template #operation="{ record }">
<MsButton <MsButton
v-permission="['PROJECT_API_DEFINITION_CASE:READ+EXECUTE']" v-permission="['PROJECT_TEST_PLAN:READ+EXECUTE']"
type="text" type="text"
class="!mr-0" class="!mr-0"
@click="toCaseDetail(record)" @click="toCaseDetail(record)"
@ -75,16 +74,15 @@
{{ t('common.cancelLink') }} {{ t('common.cancelLink') }}
</MsButton> </MsButton>
</MsPopconfirm> </MsPopconfirm>
<!-- TODO: 修改permission -->
<a-divider <a-divider
v-if="props.repeatCase" v-if="props.repeatCase"
v-permission="['PROJECT_API_DEFINITION_CASE:READ+EXECUTE']" v-permission="['PROJECT_TEST_PLAN:READ+ASSOCIATION']"
direction="vertical" direction="vertical"
:margin="8" :margin="8"
></a-divider> ></a-divider>
<MsButton <MsButton
v-if="props.repeatCase" v-if="props.repeatCase"
v-permission="['PROJECT_API_DEFINITION_CASE:READ+ADD']" v-permission="['PROJECT_TEST_PLAN:READ+ASSOCIATION']"
type="text" type="text"
class="!mr-0" class="!mr-0"
@click="handleCopyCase(record)" @click="handleCopyCase(record)"
@ -240,7 +238,6 @@
projectId: appStore.currentProjectId, projectId: appStore.currentProjectId,
}); });
// TODO: Permission
const hasOperationPermission = computed(() => const hasOperationPermission = computed(() =>
hasAnyPermission(['PROJECT_TEST_PLAN:READ+EXECUTE', 'PROJECT_TEST_PLAN:READ+ASSOCIATION']) hasAnyPermission(['PROJECT_TEST_PLAN:READ+EXECUTE', 'PROJECT_TEST_PLAN:READ+ASSOCIATION'])
); );
@ -360,7 +357,6 @@
}; };
} }
); );
// TODO: permission
const batchActions = { const batchActions = {
baseAction: [ baseAction: [
{ {
@ -371,6 +367,7 @@
{ {
label: 'testPlan.featureCase.changeExecutor', label: 'testPlan.featureCase.changeExecutor',
eventTag: 'changeExecutor', eventTag: 'changeExecutor',
permission: ['PROJECT_TEST_PLAN:READ+UPDATE'],
}, },
], ],
moreAction: [ moreAction: [

View File

@ -99,7 +99,10 @@
<div v-else-if="activeTab === 'detail'" class="align-content-start flex h-full flex-col"> <div v-else-if="activeTab === 'detail'" class="align-content-start flex h-full flex-col">
<CaseTabDetail ref="caseTabDetailRef" is-test-plan :form="caseDetail" /> <CaseTabDetail ref="caseTabDetailRef" is-test-plan :form="caseDetail" />
<!-- 开始执行 --> <!-- 开始执行 -->
<div class="px-[16px] py-[8px] shadow-[0_-1px_4px_rgba(2,2,2,0.1)]"> <div
v-permission="['PROJECT_TEST_PLAN:READ+EXECUTE']"
class="px-[16px] py-[8px] shadow-[0_-1px_4px_rgba(2,2,2,0.1)]"
>
<div class="mb-[12px] flex items-center justify-between"> <div class="mb-[12px] flex items-center justify-between">
<div class="font-medium text-[var(--color-text-1)]"> <div class="font-medium text-[var(--color-text-1)]">
{{ t('testPlan.featureCase.startExecution') }} {{ t('testPlan.featureCase.startExecution') }}

View File

@ -82,9 +82,13 @@
<StatusProgress :status-detail="countDetail" height="8px" radius="var(--border-radius-mini)" /> <StatusProgress :status-detail="countDetail" height="8px" radius="var(--border-radius-mini)" />
</div> </div>
</template> </template>
<a-tabs v-model:active-key="activeTab" class="no-content"> <MsTab
<a-tab-pane v-for="item of tabList" :key="item.key" :title="item.title" /> v-model:active-key="activeTab"
</a-tabs> :get-text-func="getTabBadge"
:content-tab-list="tabList"
no-content
class="relative mx-[16px] border-b"
/>
</MsCard> </MsCard>
<!-- special-height的174: 上面卡片高度158 + mt的16 --> <!-- special-height的174: 上面卡片高度158 + mt的16 -->
<MsCard class="mt-[16px]" :special-height="174" simple has-breadcrumb no-content-padding> <MsCard class="mt-[16px]" :special-height="174" simple has-breadcrumb no-content-padding>
@ -112,6 +116,7 @@
import MsButton from '@/components/pure/ms-button/index.vue'; import MsButton from '@/components/pure/ms-button/index.vue';
import MsCard from '@/components/pure/ms-card/index.vue'; import MsCard from '@/components/pure/ms-card/index.vue';
import MsIcon from '@/components/pure/ms-icon-font/index.vue'; import MsIcon from '@/components/pure/ms-icon-font/index.vue';
import MsTab from '@/components/pure/ms-tab/index.vue';
import MsTableMoreAction from '@/components/pure/ms-table-more-action/index.vue'; import MsTableMoreAction from '@/components/pure/ms-table-more-action/index.vue';
import { ActionsItem } from '@/components/pure/ms-table-more-action/types'; import { ActionsItem } from '@/components/pure/ms-table-more-action/types';
import MsStatusTag from '@/components/business/ms-status-tag/index.vue'; import MsStatusTag from '@/components/business/ms-status-tag/index.vue';
@ -209,6 +214,16 @@
return fullActions.filter((e) => e.eventTag !== 'archive'); return fullActions.filter((e) => e.eventTag !== 'archive');
}); });
function getTabBadge(tabKey: string) {
switch (tabKey) {
case 'featureCase':
const count = detail.value.functionalCaseCount ?? 0;
return `${count > 0 ? count : ''}`;
default:
return '';
}
}
function archiveHandler() { function archiveHandler() {
openModal({ openModal({
type: 'warning', type: 'warning',
@ -264,8 +279,8 @@
const activeTab = ref('featureCase'); const activeTab = ref('featureCase');
const tabList = ref([ const tabList = ref([
{ {
key: 'featureCase', value: 'featureCase',
title: t('menu.caseManagement.featureCase'), label: t('menu.caseManagement.featureCase'),
}, },
// TODO // TODO
// { // {

View File

@ -9,22 +9,14 @@
:placeholder="t('caseManagement.featureCase.searchTip')" :placeholder="t('caseManagement.featureCase.searchTip')"
allow-clear allow-clear
/> />
<a-dropdown-button <a-button
v-permission="['PROJECT_TEST_PLAN:READ+ADD']" v-permission="['PROJECT_TEST_PLAN:READ+ADD']"
class="ml-2" class="ml-2"
type="primary" type="primary"
@click="handleSelect('createPlan')" @click="handleSelect('createPlan')"
> >
{{ t('common.newCreate') }} {{ t('common.newCreate') }}
<template #icon> </a-button>
<icon-down />
</template>
<template #content>
<a-doption value="Excel">
{{ t('testPlan.testPlanIndex.newCreatePlanGroup') }}
</a-doption>
</template>
</a-dropdown-button>
</div> </div>
<div class="test-plan h-[100%]"> <div class="test-plan h-[100%]">