@@ -42,12 +48,12 @@
v-model:model-value="activePlan"
:options="testPlanGroups"
class="w-[240px]"
- @change="searchList"
+ @change="handlePlanChange"
>
import { SelectOptionData } from '@arco-design/web-vue';
+ import dayjs from 'dayjs';
import MsButton from '@/components/pure/ms-button/index.vue';
import MsDrawer from '@/components/pure/ms-drawer/index.vue';
@@ -159,8 +166,32 @@
const detail = ref({});
const testPlanGroups = ref([]);
const activePlan = ref('');
+ const activePlanCaseTotal = ref(0);
+ const activePlanScenarioTotal = ref(0);
const reportAnalysisList = computed(() => {
+ if (props.isGroup) {
+ return [
+ {
+ name: t('report.detail.testPlanTotal'),
+ value: detail.value.planCount,
+ unit: t('report.detail.number'),
+ icon: 'plan_total',
+ },
+ {
+ name: t('report.detail.testPlanCaseTotal'),
+ value: detail.value.caseTotal,
+ unit: t('report.detail.number'),
+ icon: 'case_total',
+ },
+ {
+ name: t('report.passRate'),
+ value: detail.value.passRate,
+ unit: '%',
+ icon: 'passRate',
+ },
+ ];
+ }
return [
{
name: t('report.passRate'),
@@ -231,6 +262,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, {
@@ -280,6 +319,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') {
@@ -300,6 +353,8 @@
loading.value = true;
const res = await getTestPlanResult(props.id);
detail.value = res;
+ activePlanCaseTotal.value = res.caseTotal;
+ activePlanScenarioTotal.value = res.scenarioTotal;
if (res.children?.length) {
testPlanGroups.value = res.children.map((item: any) => ({
value: item.id,
@@ -308,8 +363,14 @@
activePlan.value = res.children[0]?.id;
} else {
testPlanGroups.value = [];
+ activePlanCaseTotal.value = res.children[0]?.caseTotal;
+ activePlanScenarioTotal.value = res.children[0]?.scenarioTotal;
+ activeTable.value = activePlanCaseTotal.value > 0 ? 'case' : 'scenario';
}
- searchList();
+ activeTable.value = activePlanCaseTotal.value > 0 ? 'case' : 'scenario';
+ nextTick(() => {
+ searchList();
+ });
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);