fix(工作台): 测试计划表格&执行历史

This commit is contained in:
baiqi 2024-12-11 16:09:09 +08:00 committed by 刘瑞斌
parent ee155ac24f
commit 6c9a4fd6d7
4 changed files with 41 additions and 11 deletions

View File

@ -27,7 +27,7 @@
> >
<div class="one-line-text max-w-[120px]"> <div class="one-line-text max-w-[120px]">
<slot name="item" :filter-item="item" :index="index"> <slot name="item" :filter-item="item" :index="index">
<div class="one-line-text max-w-[120px]">{{ item[props.labelKey || 'label'] }}</div> {{ item[props.valueKey || 'value'] }}
</slot> </slot>
</div> </div>
</a-tooltip> </a-tooltip>
@ -74,7 +74,7 @@
:disabled="!item[props.labelKey || 'label']" :disabled="!item[props.labelKey || 'label']"
> >
<div class="one-line-text max-w-[120px]" @click.stop="checkItem(item.value)"> <div class="one-line-text max-w-[120px]" @click.stop="checkItem(item.value)">
<div class="one-line-text max-w-[120px]">{{ item.label }}</div> {{ item.label }}
</div> </div>
</a-tooltip> </a-tooltip>
</a-checkbox> </a-checkbox>

View File

@ -475,7 +475,10 @@ export interface PlanExecuteResultExecuteCaseCount {
export interface PlanExecuteResult extends TaskReportDetail { export interface PlanExecuteResult extends TaskReportDetail {
taskName: string; taskName: string;
reportId: string; reportId: string;
childPlans: { id: string; name: string }[]; // 子计划 childPlans: { id: string; name: string; apiCaseTotal: number; apiScenarioTotal: number }[]; // 子计划
createUser: string; createUser: string;
executeRate: string;
executeCaseCount: PlanExecuteResultExecuteCaseCount; executeCaseCount: PlanExecuteResultExecuteCaseCount;
apiCaseTotal: number;
apiScenarioTotal: number;
} }

View File

@ -25,7 +25,7 @@
v-model:model-value="activePlan" v-model:model-value="activePlan"
:options="testPlanGroups" :options="testPlanGroups"
size="small" size="small"
@change="searchList" @change="handlePlanChange"
></a-select> ></a-select>
<executeRatePopper <executeRatePopper
v-else-if="item.key === 'rate'" v-else-if="item.key === 'rate'"
@ -49,7 +49,7 @@
<div class="flex items-center justify-between"> <div class="flex items-center justify-between">
<MsTab <MsTab
v-model:active-key="activeTable" v-model:active-key="activeTable"
:content-tab-list="contentTabList" :content-tab-list="showContentTabList"
:show-badge="false" :show-badge="false"
class="testPlan-execute-tab no-content" class="testPlan-execute-tab no-content"
@change="searchList" @change="searchList"
@ -161,6 +161,8 @@
const testPlanGroups = ref<SelectOptionData[]>([]); const testPlanGroups = ref<SelectOptionData[]>([]);
const executeRateVisible = ref(false); const executeRateVisible = ref(false);
const activePlan = ref(''); const activePlan = ref('');
const activePlanCaseTotal = ref(0);
const activePlanScenarioTotal = ref(0);
const columns: MsTableColumn = [ const columns: MsTableColumn = [
{ {
@ -216,6 +218,14 @@
{ value: 'case', label: t('report.detail.apiCaseDetails') }, { value: 'case', label: t('report.detail.apiCaseDetails') },
{ value: 'scenario', label: t('report.detail.scenarioCaseDetails') }, { 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 keyword = ref('');
const useApiTable = useTable(getApiPage, { const useApiTable = useTable(getApiPage, {
@ -265,6 +275,20 @@
currentCaseTable.value.loadList(); currentCaseTable.value.loadList();
} }
function handlePlanChange(
value: string | number | boolean | Record<string, any> | (string | number | boolean | Record<string, any>)[]
) {
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) { function toDetail(record: ApiOrScenarioCaseItem) {
if (activeTable.value === 'scenario') { if (activeTable.value === 'scenario') {
@ -315,6 +339,8 @@
] as Description[], ] as Description[],
...res, ...res,
}; };
activePlanCaseTotal.value = res.apiCaseTotal;
activePlanScenarioTotal.value = res.apiScenarioTotal;
if (res.childPlans.length) { if (res.childPlans.length) {
detail.value.description.push({ detail.value.description.push({
label: t('testPlan.testPlanIndex.testPlan'), label: t('testPlan.testPlanIndex.testPlan'),
@ -326,7 +352,13 @@
label: item.name, label: item.name,
})); }));
activePlan.value = res.childPlans[0]?.id; 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(); searchList();
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console

View File

@ -171,12 +171,7 @@
dataIndex: 'status', dataIndex: 'status',
slotName: 'status', slotName: 'status',
filterConfig: { filterConfig: {
options: planStatusOptions.filter((e) => { options: planStatusOptions,
if (props.type === 'my_todo') {
return e.value !== 'COMPLETED';
}
return true;
}),
filterSlotName: FilterSlotNameEnum.TEST_PLAN_STATUS_FILTER, filterSlotName: FilterSlotNameEnum.TEST_PLAN_STATUS_FILTER,
}, },
showInTable: true, showInTable: true,