From 6c9a4fd6d7c9dad77491de4351a0b80685324909 Mon Sep 17 00:00:00 2001 From: baiqi Date: Wed, 11 Dec 2024 16:09:09 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=B7=A5=E4=BD=9C=E5=8F=B0):=20=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E8=AE=A1=E5=88=92=E8=A1=A8=E6=A0=BC&=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E5=8E=86=E5=8F=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pure/ms-table/comp/defaultFilter.vue | 4 +-- frontend/src/models/testPlan/testPlan.ts | 5 ++- .../testPlan/detail/executeResultDrawer.vue | 36 +++++++++++++++++-- .../workbench/components/testPlanTable.vue | 7 +--- 4 files changed, 41 insertions(+), 11 deletions(-) diff --git a/frontend/src/components/pure/ms-table/comp/defaultFilter.vue b/frontend/src/components/pure/ms-table/comp/defaultFilter.vue index c0151c8c4b..506dbadaa1 100644 --- a/frontend/src/components/pure/ms-table/comp/defaultFilter.vue +++ b/frontend/src/components/pure/ms-table/comp/defaultFilter.vue @@ -27,7 +27,7 @@ >
-
{{ item[props.labelKey || 'label'] }}
+ {{ item[props.valueKey || 'value'] }}
@@ -74,7 +74,7 @@ :disabled="!item[props.labelKey || 'label']" >
-
{{ item.label }}
+ {{ item.label }}
diff --git a/frontend/src/models/testPlan/testPlan.ts b/frontend/src/models/testPlan/testPlan.ts index 30463b271a..0df3699671 100644 --- a/frontend/src/models/testPlan/testPlan.ts +++ b/frontend/src/models/testPlan/testPlan.ts @@ -475,7 +475,10 @@ export interface PlanExecuteResultExecuteCaseCount { export interface PlanExecuteResult extends TaskReportDetail { taskName: string; reportId: string; - childPlans: { id: string; name: string }[]; // 子计划 + childPlans: { id: string; name: string; apiCaseTotal: number; apiScenarioTotal: number }[]; // 子计划 createUser: string; + executeRate: string; executeCaseCount: PlanExecuteResultExecuteCaseCount; + apiCaseTotal: number; + apiScenarioTotal: number; } diff --git a/frontend/src/views/test-plan/testPlan/detail/executeResultDrawer.vue b/frontend/src/views/test-plan/testPlan/detail/executeResultDrawer.vue index 23cf87e3fb..3181fb319b 100644 --- a/frontend/src/views/test-plan/testPlan/detail/executeResultDrawer.vue +++ b/frontend/src/views/test-plan/testPlan/detail/executeResultDrawer.vue @@ -25,7 +25,7 @@ v-model:model-value="activePlan" :options="testPlanGroups" size="small" - @change="searchList" + @change="handlePlanChange" > ([]); const executeRateVisible = ref(false); const activePlan = ref(''); + const activePlanCaseTotal = ref(0); + const activePlanScenarioTotal = ref(0); const columns: MsTableColumn = [ { @@ -216,6 +218,14 @@ { value: 'case', label: t('report.detail.apiCaseDetails') }, { value: 'scenario', label: t('report.detail.scenarioCaseDetails') }, ]; + const showContentTabList = computed(() => + contentTabList.filter((item) => { + if (item.value === 'case') { + return activePlanCaseTotal.value > 0; + } + return activePlanScenarioTotal.value > 0; + }) + ); const keyword = ref(''); const useApiTable = useTable(getApiPage, { @@ -265,6 +275,20 @@ currentCaseTable.value.loadList(); } + function handlePlanChange( + value: string | number | boolean | Record | (string | number | boolean | Record)[] + ) { + const plan = testPlanGroups.value.find((item) => item.value === value); + if (plan) { + activePlanCaseTotal.value = plan.caseTotal; + activePlanScenarioTotal.value = plan.scenarioTotal; + activeTable.value = activePlanCaseTotal.value > 0 ? 'case' : 'scenario'; + nextTick(() => { + searchList(); + }); + } + } + // 去用例详情页面 function toDetail(record: ApiOrScenarioCaseItem) { if (activeTable.value === 'scenario') { @@ -315,6 +339,8 @@ ] as Description[], ...res, }; + activePlanCaseTotal.value = res.apiCaseTotal; + activePlanScenarioTotal.value = res.apiScenarioTotal; if (res.childPlans.length) { detail.value.description.push({ label: t('testPlan.testPlanIndex.testPlan'), @@ -326,7 +352,13 @@ label: item.name, })); activePlan.value = res.childPlans[0]?.id; + } else { + testPlanGroups.value = []; + activePlanCaseTotal.value = res.childPlans[0]?.apiCaseTotal; + activePlanScenarioTotal.value = res.childPlans[0]?.apiScenarioTotal; + activeTable.value = activePlanCaseTotal.value > 0 ? 'case' : 'scenario'; } + activeTable.value = activePlanCaseTotal.value > 0 ? 'case' : 'scenario'; searchList(); } catch (error) { // eslint-disable-next-line no-console diff --git a/frontend/src/views/workbench/components/testPlanTable.vue b/frontend/src/views/workbench/components/testPlanTable.vue index 07be0c6664..3dda935a9c 100644 --- a/frontend/src/views/workbench/components/testPlanTable.vue +++ b/frontend/src/views/workbench/components/testPlanTable.vue @@ -171,12 +171,7 @@ dataIndex: 'status', slotName: 'status', filterConfig: { - options: planStatusOptions.filter((e) => { - if (props.type === 'my_todo') { - return e.value !== 'COMPLETED'; - } - return true; - }), + options: planStatusOptions, filterSlotName: FilterSlotNameEnum.TEST_PLAN_STATUS_FILTER, }, showInTable: true,