fix(接口管理): 修复接口用例回收站报告值传值不对问题

This commit is contained in:
guoyuqi 2024-03-28 19:02:03 +08:00 committed by Craftsman
parent 9f67d9fb6b
commit 5769ba327f
1 changed files with 25 additions and 9 deletions

View File

@ -94,7 +94,7 @@
<div class="flex items-center justify-center px-[6px] py-[2px]"> <div class="flex items-center justify-center px-[6px] py-[2px]">
<a-checkbox-group v-model:model-value="lastReportStatusFilters" direction="vertical" size="small"> <a-checkbox-group v-model:model-value="lastReportStatusFilters" direction="vertical" size="small">
<a-checkbox v-for="val of lastReportStatusList" :key="val" :value="val"> <a-checkbox v-for="val of lastReportStatusList" :key="val" :value="val">
<span>{{ val }}</span> <ExecutionStatus :module-type="ReportEnum.API_REPORT" :status="val" />
</a-checkbox> </a-checkbox>
</a-checkbox-group> </a-checkbox-group>
</div> </div>
@ -102,6 +102,13 @@
</template> </template>
</a-trigger> </a-trigger>
</template> </template>
<template #lastReportStatus="{ record }">
<ExecutionStatus
:module-type="ReportEnum.API_REPORT"
:status="record.lastReportStatus"
:class="[!record.lastReportId ? '' : 'cursor-pointer']"
/>
</template>
<template #passRateColumn> <template #passRateColumn>
<div class="flex items-center text-[var(--color-text-3)]"> <div class="flex items-center text-[var(--color-text-3)]">
{{ t('case.passRate') }} {{ t('case.passRate') }}
@ -150,6 +157,7 @@
import useTable from '@/components/pure/ms-table/useTable'; import useTable from '@/components/pure/ms-table/useTable';
import caseLevel from '@/components/business/ms-case-associate/caseLevel.vue'; import caseLevel from '@/components/business/ms-case-associate/caseLevel.vue';
import apiStatus from '@/views/api-test/components/apiStatus.vue'; import apiStatus from '@/views/api-test/components/apiStatus.vue';
import ExecutionStatus from '@/views/api-test/report/component/reportStatus.vue';
import { import {
batchDeleteRecycleCase, batchDeleteRecycleCase,
@ -166,6 +174,7 @@
import { ApiCaseBatchParams, ApiCaseDetail } from '@/models/apiTest/management'; import { ApiCaseBatchParams, ApiCaseDetail } from '@/models/apiTest/management';
import { RequestDefinitionStatus } from '@/enums/apiEnum'; import { RequestDefinitionStatus } from '@/enums/apiEnum';
import { ReportEnum, ReportStatus } from '@/enums/reportEnum';
import { TableKeyEnum } from '@/enums/tableEnum'; import { TableKeyEnum } from '@/enums/tableEnum';
const props = defineProps<{ const props = defineProps<{
@ -180,7 +189,6 @@
const { openModal } = useModal(); const { openModal } = useModal();
const keyword = ref(''); const keyword = ref('');
const refreshModuleTree: (() => Promise<any>) | undefined = inject('refreshModuleTree');
const columns: MsTableColumn = [ const columns: MsTableColumn = [
{ {
@ -247,9 +255,9 @@
{ {
title: 'case.lastReportStatus', title: 'case.lastReportStatus',
dataIndex: 'lastReportStatus', dataIndex: 'lastReportStatus',
slotName: 'lastReportStatus',
titleSlotName: 'lastReportStatusFilter', titleSlotName: 'lastReportStatusFilter',
showInTable: false, showInTable: false,
showTooltip: true,
width: 150, width: 150,
showDrag: true, showDrag: true,
}, },
@ -366,20 +374,26 @@
}; };
const statusFilterVisible = ref(false); const statusFilterVisible = ref(false);
const statusFilters = ref<string[]>([]); const statusFilters = ref(Object.keys(RequestDefinitionStatus));
const defaultStatusFiltersLength = ref(Object.keys(RequestDefinitionStatus)).value.length;
const caseLevelFields = ref<Record<string, any>>({}); const caseLevelFields = ref<Record<string, any>>({});
const caseFilterVisible = ref(false); const caseFilterVisible = ref(false);
const caseFilters = ref<string[]>([]); const caseFilters = ref<string[]>([]);
const defaultCaseFilters = ref<string[]>([]);
const caseLevelList = computed(() => { const caseLevelList = computed(() => {
return caseLevelFields.value?.options || []; return caseLevelFields.value?.options || [];
}); });
const lastReportStatusFilterVisible = ref(false); const lastReportStatusFilterVisible = ref(false);
const lastReportStatusList = ['error', 'FakeError', 'success']; const lastReportStatusList = computed(() => {
const lastReportStatusFilters = ref<string[]>([]); return Object.keys(ReportStatus[ReportEnum.API_REPORT]);
});
const defaultLastReportStatusLength = ref(Object.keys(ReportStatus[ReportEnum.API_REPORT])).value.length;
const lastReportStatusFilters = ref<string[]>(Object.keys(ReportStatus[ReportEnum.API_REPORT]));
const moduleIds = computed(() => { const moduleIds = computed(() => {
return props.activeModule === 'all' ? [] : [props.activeModule]; return props.activeModule === 'all' ? [] : [props.activeModule];
}); });
function loadCaseList() { function loadCaseList() {
const params = { const params = {
keyword: keyword.value, keyword: keyword.value,
@ -387,9 +401,10 @@
moduleIds: moduleIds.value, moduleIds: moduleIds.value,
protocol: props.protocol, protocol: props.protocol,
filter: { filter: {
status: statusFilters.value, status: statusFilters.value.length === defaultStatusFiltersLength ? [] : statusFilters.value,
priority: caseFilters.value, priority: caseFilters.value.length === defaultCaseFilters.value.length ? [] : caseFilters.value,
lastReportStatus: lastReportStatusFilters.value, lastReportStatus:
lastReportStatusFilters.value.length === defaultLastReportStatusLength ? [] : lastReportStatusFilters.value,
}, },
}; };
setLoadListParams(params); setLoadListParams(params);
@ -405,6 +420,7 @@
const result = await getCaseDefaultFields(appStore.currentProjectId); const result = await getCaseDefaultFields(appStore.currentProjectId);
caseLevelFields.value = result.customFields.find((item: any) => item.internal && item.fieldName === '用例等级'); caseLevelFields.value = result.customFields.find((item: any) => item.internal && item.fieldName === '用例等级');
caseFilters.value = caseLevelFields.value?.options.map((item: any) => item.text); caseFilters.value = caseLevelFields.value?.options.map((item: any) => item.text);
defaultCaseFilters.value = caseLevelFields.value?.options.map((item: any) => item.text);
} }
onBeforeMount(() => { onBeforeMount(() => {