feat(用例管理): 用例详情关联缺陷放开测试计划页

This commit is contained in:
guoyuqi 2024-05-09 19:27:12 +08:00 committed by 刘瑞斌
parent b1279b4ebc
commit 0626f5c048
4 changed files with 52 additions and 14 deletions

View File

@ -21,9 +21,11 @@ import java.util.Map;
public class AssociateBugPageRequest extends BaseProviderCondition { public class AssociateBugPageRequest extends BaseProviderCondition {
@Schema(description = "用例id", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "用例id", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{functional_case.id.not_blank}")
private String caseId; private String caseId;
@Schema(description = "关联测试计划用例ID", requiredMode = Schema.RequiredMode.REQUIRED)
private String testPlanCaseId;
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{functional_case.project_id.not_blank}") @NotBlank(message = "{functional_case.project_id.not_blank}")
private String projectId; private String projectId;

View File

@ -136,6 +136,9 @@
<if test="request.caseId != null and request.caseId != ''"> <if test="request.caseId != null and request.caseId != ''">
and brc.case_id = #{request.caseId} and brc.case_id = #{request.caseId}
</if> </if>
<if test="request.testPlanCaseId != null and request.testPlanCaseId != ''">
and brc.test_plan_case_id = #{request.testPlanCaseId}
</if>
<if test="request.keyword != null and request.keyword != ''"> <if test="request.keyword != null and request.keyword != ''">
and b.title like concat('%', #{request.keyword},'%') and b.title like concat('%', #{request.keyword},'%')
</if> </if>

View File

@ -17,6 +17,7 @@ export interface BugListItem {
createTime: string; // 创建时间 createTime: string; // 创建时间
updateTime: string; // 更新时间 updateTime: string; // 更新时间
deleted: boolean; // 删除标志 deleted: boolean; // 删除标志
testPlanId: string; // 测试计划ID
} }
export interface BugOptionItem { export interface BugOptionItem {

View File

@ -36,14 +36,14 @@
t('caseManagement.featureCase.testPlanLinkList') t('caseManagement.featureCase.testPlanLinkList')
}}</div> }}</div>
<div class="mb-4"> <div class="mb-4">
<!-- <a-radio-group v-model:model-value="showType" type="button" class="file-show-type ml-[4px]"> <a-radio-group v-model:model-value="showType" type="button" class="file-show-type ml-[4px]">
<a-radio value="link" class="show-type-icon p-[2px]">{{ <a-radio value="link" class="show-type-icon p-[2px]">{{
t('caseManagement.featureCase.directLink') t('caseManagement.featureCase.directLink')
}}</a-radio> }}</a-radio>
<a-radio value="testPlan" class="show-type-icon p-[2px]">{{ <a-radio value="testPlan" class="show-type-icon p-[2px]">{{
t('caseManagement.featureCase.testPlan') t('caseManagement.featureCase.testPlan')
}}</a-radio> }}</a-radio>
</a-radio-group>--> </a-radio-group>
<a-input-search <a-input-search
v-model:model-value="keyword" v-model:model-value="keyword"
:placeholder="t('caseManagement.featureCase.searchByName')" :placeholder="t('caseManagement.featureCase.searchByName')"
@ -149,6 +149,9 @@
</template> </template>
</a-popover> </a-popover>
</template> </template>
<template #testPlanName="{ record }">
<a-button type="text" class="px-0" @click="goToPlan(record)">{{ record.testPlanName }}</a-button>
</template>
<template #handleUserFilter="{ columnConfig }"> <template #handleUserFilter="{ columnConfig }">
<TableFilter <TableFilter
v-model:visible="handleUserFilterVisible" v-model:visible="handleUserFilterVisible"
@ -197,10 +200,7 @@
</template> </template>
<template v-if="(keyword || '').trim() === ''" #empty> <template v-if="(keyword || '').trim() === ''" #empty>
<div class="flex w-full items-center justify-center text-[var(--color-text-4)]"> <div class="flex w-full items-center justify-center text-[var(--color-text-4)]">
{{ t('caseManagement.caseReview.tableNoData') }} {{ t('caseManagement.caseReview.tableNoDataNoPermission') }}
<MsButton class="ml-[8px]" @click="createDefect">
{{ t('caseManagement.featureCase.createDefect') }}
</MsButton>
</div> </div>
</template> </template>
</ms-base-table> </ms-base-table>
@ -219,6 +219,7 @@
* @description 用例管理-详情抽屉-tab-缺陷 * @description 用例管理-详情抽屉-tab-缺陷
*/ */
import { ref } from 'vue'; import { ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { Message } from '@arco-design/web-vue'; import { Message } from '@arco-design/web-vue';
import MsButton from '@/components/pure/ms-button/index.vue'; import MsButton from '@/components/pure/ms-button/index.vue';
@ -240,8 +241,9 @@
import useFeatureCaseStore from '@/store/modules/case/featureCase'; import useFeatureCaseStore from '@/store/modules/case/featureCase';
import { hasAnyPermission } from '@/utils/permission'; import { hasAnyPermission } from '@/utils/permission';
import { BugOptionItem } from '@/models/bug-management'; import { BugListItem, BugOptionItem } from '@/models/bug-management';
import type { TableQueryParams } from '@/models/common'; import type { TableQueryParams } from '@/models/common';
import { TestPlanRouteEnum } from '@/enums/routeEnum';
const featureCaseStore = useFeatureCaseStore(); const featureCaseStore = useFeatureCaseStore();
@ -266,6 +268,9 @@
const severityFilterValue = ref<string[]>([]); const severityFilterValue = ref<string[]>([]);
const severityColumnId = ref(''); const severityColumnId = ref('');
const router = useRouter();
const route = useRoute();
const columns: MsTableColumn = [ const columns: MsTableColumn = [
{ {
title: 'caseManagement.featureCase.tableColumnID', title: 'caseManagement.featureCase.tableColumnID',
@ -341,7 +346,7 @@
const testPlanColumns: MsTableColumn = [ const testPlanColumns: MsTableColumn = [
{ {
title: 'caseManagement.featureCase.tableColumnID', title: 'caseManagement.featureCase.tableColumnID',
dataIndex: 'id', dataIndex: 'num',
width: 200, width: 200,
showInTable: true, showInTable: true,
showTooltip: true, showTooltip: true,
@ -360,8 +365,8 @@
}, },
{ {
title: 'caseManagement.featureCase.planName', title: 'caseManagement.featureCase.planName',
slotName: 'testPlan', slotName: 'testPlanName',
dataIndex: 'testPlan', dataIndex: 'testPlanName',
showInTable: true, showInTable: true,
showTooltip: true, showTooltip: true,
width: 300, width: 300,
@ -378,6 +383,16 @@
ellipsis: true, ellipsis: true,
showDrag: false, showDrag: false,
}, },
{
title: 'caseManagement.featureCase.updateUser',
slotName: 'handleUserName',
dataIndex: 'handleUserName',
titleSlotName: 'handleUserFilter',
showInTable: true,
showTooltip: true,
width: 300,
ellipsis: true,
},
]; ];
const { const {
@ -438,7 +453,11 @@
const { msPagination } = linkPropsRes.value; const { msPagination } = linkPropsRes.value;
featureCaseStore.setListCount(featureCaseStore.activeTab, msPagination?.total || 0); featureCaseStore.setListCount(featureCaseStore.activeTab, msPagination?.total || 0);
} else { } else {
setTestPlanListParams({ keyword: keyword.value, projectId: appStore.currentProjectId, caseId: props.caseId }); setTestPlanListParams({
keyword: keyword.value,
projectId: appStore.currentProjectId,
testPlanCaseId: props.caseId,
});
await testPlanLinkList(); await testPlanLinkList();
featureCaseStore.getCaseCounts(props.caseId); featureCaseStore.getCaseCounts(props.caseId);
} }
@ -534,12 +553,25 @@
} }
function changeHandler() { function changeHandler() {
console.log(keyword.value);
if (keyword.value.trim().length === 0) { if (keyword.value.trim().length === 0) {
getFetch(); getFetch();
} }
} }
//
function goToPlan(record: BugListItem) {
router.push({
name: TestPlanRouteEnum.TEST_PLAN_INDEX,
query: {
...route.query,
id: record.testPlanId,
},
state: {
params: JSON.stringify(setTestPlanListParams()),
},
});
}
watch( watch(
() => props.caseId, () => props.caseId,
(val) => { (val) => {