From 9828dfb1234f6811177ff6a0aa57ee227a9aeeb7 Mon Sep 17 00:00:00 2001 From: "xinxin.wu" Date: Mon, 16 Dec 2024 18:05:18 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=B7=A5=E4=BD=9C=E5=8F=B0):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=B7=A5=E4=BD=9C=E5=8F=B0=E6=8E=A5=E5=8F=A3=E6=9C=AA?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E4=B8=8D=E5=8C=85=E5=90=AB=E8=AF=AF=E6=8A=A5?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=85=A5=E5=8F=82&=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E5=8D=A1=E7=89=87bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/config/workbench.ts | 4 ++-- .../homePage/components/testPlanCount.vue | 23 ++++++++++--------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/frontend/src/config/workbench.ts b/frontend/src/config/workbench.ts index be4d491d95..4fe5fc9663 100644 --- a/frontend/src/config/workbench.ts +++ b/frontend/src/config/workbench.ts @@ -342,7 +342,7 @@ export const NAV_NAVIGATION: Record = { lastReportStatus: [ExecuteResultEnum.SUCCESS], // 接口用例-执行结果-已通过 }, [WorkNavValueEnum.API_COUNT_EXECUTE_ERROR]: { - lastReportStatus: [ExecuteResultEnum.ERROR, ExecuteResultEnum.FAKE_ERROR], // 接口用例-执行结果-未通过 + lastReportStatus: [ExecuteResultEnum.ERROR], // 接口用例-执行结果-未通过 }, [WorkNavValueEnum.API_COUNT_EXECUTED_RESULT]: { lastReportStatus: [ExecuteResultEnum.SUCCESS, ExecuteResultEnum.ERROR, ExecuteResultEnum.FAKE_ERROR], // 接口用例-有执行结果 @@ -357,7 +357,7 @@ export const NAV_NAVIGATION: Record = { lastReportStatus: [ExecuteResultEnum.SUCCESS], // 场景用例-执行结果-已通过 }, [WorkNavValueEnum.SCENARIO_COUNT_EXECUTE_ERROR]: { - lastReportStatus: [ExecuteResultEnum.ERROR, ExecuteResultEnum.FAKE_ERROR], // 场景用例-执行结果-未通过 + lastReportStatus: [ExecuteResultEnum.ERROR], // 场景用例-执行结果-未通过 }, [WorkNavValueEnum.SCENARIO_COUNT_EXECUTED_RESULT]: { lastReportStatus: [ExecuteResultEnum.SUCCESS, ExecuteResultEnum.ERROR, ExecuteResultEnum.FAKE_ERROR], // 场景用例-有执行结果 diff --git a/frontend/src/views/workbench/homePage/components/testPlanCount.vue b/frontend/src/views/workbench/homePage/components/testPlanCount.vue index 9d58b506c2..e05ff2ffbf 100644 --- a/frontend/src/views/workbench/homePage/components/testPlanCount.vue +++ b/frontend/src/views/workbench/homePage/components/testPlanCount.vue @@ -162,27 +162,28 @@ ]; const statusPercentList = [ - { status: t('common.notStarted'), count: prepared, percentValue: '0%' }, - { status: t('common.inProgress'), count: running, percentValue: '0%' }, - { status: t('common.completed'), count: finished, percentValue: '0%' }, - { status: t('common.archived'), count: archived, percentValue: '0%' }, + { status: t('common.notStarted'), count: prepared, percentValue: '0.00%' }, + { status: t('common.inProgress'), count: running, percentValue: '0.00%' }, + { status: t('common.completed'), count: finished, percentValue: '0.00%' }, + { status: t('common.archived'), count: archived, percentValue: '0.00%' }, ]; + const total = statusPercentList.reduce((sum, item) => sum + item.count, 0); + + const listStatusPercentList = statusPercentList.map((item) => ({ + ...item, + percentValue: total > 0 ? `${((item.count / total) * 100).toFixed(2)}%` : '0.00%', + })); + statusPercentValue.value = (statusPercentList || []).map((item, index) => { return { ...item, selected: true, color: `${colorMapConfig[props.item.key][index]}`, + percentValue: total > 0 ? `${((item.count / total) * 100).toFixed(2)}%` : '0.00%', }; }); - const total = statusPercentList.reduce((sum, item) => sum + item.count, 0); - - const listStatusPercentList = statusPercentList.map((item) => ({ - ...item, - percentValue: total > 0 ? `${((item.count / total) * 100).toFixed(2)}%` : '0%', - })); - const completeRate = total > 0 ? parseFloat((((finished + archived) / total) * 100).toFixed(2)) : 0; const completeData = [