fix(测试计划): 修复测试计划配置自定义报告相关bug

This commit is contained in:
xinxin.wu 2024-07-16 11:14:42 +08:00 committed by 刘瑞斌
parent 59c2aae047
commit a445c6e83e
6 changed files with 50 additions and 32 deletions

View File

@ -106,8 +106,8 @@ const subPlanList: PlanReportDetail = {
endTime: 0,
summary: '',
caseTotal: 1,
passThreshold: 100.0,
passRate: 0.0,
passThreshold: 100,
passRate: 100,
executeRate: 0,
bugCount: 0,
planCount: 0,

View File

@ -95,7 +95,7 @@
dataIndex: 'priority',
slotName: 'priority',
filterConfig: {
options: casePriorityOptions,
options: props.isPreview ? casePriorityOptions : [],
filterSlotName: FilterSlotNameEnum.CASE_MANAGEMENT_CASE_LEVEL,
},
width: 150,
@ -106,7 +106,7 @@
dataIndex: 'executeResult',
slotName: 'lastExecResult',
filterConfig: {
options: lastReportStatusListOptions.value,
options: props.isPreview ? lastReportStatusListOptions.value : [],
filterSlotName: FilterSlotNameEnum.API_TEST_CASE_API_LAST_EXECUTE_STATUS,
},
width: 150,
@ -153,7 +153,10 @@
});
async function loadCaseList() {
currentCaseTable.value.setLoadListParams({ reportId: props.reportId, shareId: props.shareId ?? undefined });
currentCaseTable.value.setLoadListParams({
reportId: props.reportId,
shareId: props.shareId ?? undefined,
});
currentCaseTable.value.loadList();
}
@ -183,9 +186,8 @@
}
}
watchEffect(() => {
if (props.reportId && props.activeType && props.isPreview) {
currentCaseTable.value.resetFilterParams();
onMounted(() => {
if (props.reportId && props.isPreview) {
currentCaseTable.value.resetPagination();
loadCaseList();
} else {

View File

@ -3,6 +3,9 @@
</template>
<script setup lang="ts">
import { TableSortable } from '@arco-design/web-vue';
import { cloneDeep } from 'lodash-es';
import MsBaseTable from '@/components/pure/ms-table/base-table.vue';
import type { MsTableColumn } from '@/components/pure/ms-table/type';
import useTable from '@/components/pure/ms-table/useTable';
@ -22,16 +25,22 @@
isPreview?: boolean;
}>();
const sortableConfig = computed<TableSortable | undefined>(() => {
return props.isPreview
? {
sortDirections: ['ascend', 'descend'],
sorter: true,
}
: undefined;
});
const columns: MsTableColumn = [
{
title: 'ID',
dataIndex: 'num',
slotName: 'num',
sortIndex: 1,
sortable: {
sortDirections: ['ascend', 'descend'],
sorter: true,
},
sortable: cloneDeep(sortableConfig.value),
fixed: 'left',
width: 100,
showTooltip: true,
@ -41,10 +50,7 @@
dataIndex: 'title',
width: 150,
showTooltip: true,
sortable: {
sortDirections: ['ascend', 'descend'],
sorter: true,
},
sortable: cloneDeep(sortableConfig.value),
},
{
title: 'bugManagement.status',
@ -78,7 +84,7 @@
loadList();
}
watchEffect(() => {
onMounted(() => {
if (props.reportId && props.isPreview) {
loadCaseList();
} else {

View File

@ -28,7 +28,8 @@
</template>
<script setup lang="ts">
import { onBeforeMount } from 'vue';
import { TableSortable } from '@arco-design/web-vue';
import { cloneDeep } from 'lodash-es';
import MsButton from '@/components/pure/ms-button/index.vue';
import MsDrawer from '@/components/pure/ms-drawer/index.vue';
@ -62,16 +63,22 @@
}>();
const { t } = useI18n();
const sortableConfig = computed<TableSortable | undefined>(() => {
return props.isPreview
? {
sortDirections: ['ascend', 'descend'],
sorter: true,
}
: undefined;
});
const staticColumns: MsTableColumn = [
{
title: 'ID',
dataIndex: 'num',
slotName: 'num',
sortIndex: 1,
sortable: {
sortDirections: ['ascend', 'descend'],
sorter: true,
},
sortable: cloneDeep(sortableConfig.value),
fixed: 'left',
width: 100,
ellipsis: true,
@ -81,10 +88,7 @@
title: 'case.caseName',
dataIndex: 'name',
showTooltip: true,
sortable: {
sortDirections: ['ascend', 'descend'],
sorter: true,
},
sortable: cloneDeep(sortableConfig.value),
width: 180,
},
{
@ -94,7 +98,7 @@
filterConfig: {
valueKey: 'key',
labelKey: 'statusText',
options: Object.values(executionResultMap),
options: props.isPreview ? Object.values(executionResultMap) : [],
filterSlotName: FilterSlotNameEnum.CASE_MANAGEMENT_EXECUTE_RESULT,
},
width: 150,
@ -127,7 +131,7 @@
width: 100,
},
];
// TODO
const testPlanNameColumns: MsTableColumn = [
{
title: 'report.plan.name',
@ -159,7 +163,7 @@
loadList();
}
watchEffect(() => {
onMounted(() => {
if (props.reportId && props.isPreview) {
loadCaseList();
} else {
@ -182,6 +186,7 @@
});
executeList.value = [res];
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
} finally {
executeLoading.value = false;

View File

@ -14,6 +14,11 @@
<template #resultStatus="{ record }">
<ExecutionStatus v-if="record.resultStatus !== '-'" :status="record.resultStatus" />
</template>
<template #passThreshold="{ record }">
<div>
{{ `${record.passThreshold || '0.00'}%` }}
</div>
</template>
<template #passRate="{ record }">
<div>
{{ `${record.passRate || '0.00'}%` }}
@ -97,7 +102,7 @@
dataIndex: 'resultStatus',
slotName: 'resultStatus',
filterConfig: {
options: statusResultOptions.value,
options: props.isPreview ? statusResultOptions.value : [],
filterSlotName: FilterSlotNameEnum.TEST_PLAN_STATUS_FILTER,
},
width: 200,
@ -138,7 +143,7 @@
loadList();
}
watchEffect(() => {
onMounted(() => {
if (props.reportId && props.isPreview) {
loadReportDetailList();
} else {

View File

@ -24,7 +24,7 @@
passThreshold: 100, //
passRate: 100, //
executeRate: 100, //
bugCount: 0,
bugCount: 10,
caseTotal: 0,
executeCount: {
success: 0,