From b91df985653034b05a54df5fe54710c8730c7368 Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Thu, 21 Nov 2024 19:02:54 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):=20?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E5=8E=86=E5=8F=B2=E7=BB=93=E6=9E=9C=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plan/mapper/ExtTestPlanReportMapper.xml | 2 +- .../plan/service/TestPlanReportService.java | 5 ++- .../taskCenter/component/caseTaskTable.vue | 2 +- .../component/testPlanExecuteResultDrawer.vue | 45 ++----------------- .../views/test-plan/report/locale/en-US.ts | 1 + .../views/test-plan/report/locale/zh-CN.ts | 1 + 6 files changed, 10 insertions(+), 46 deletions(-) diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportMapper.xml b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportMapper.xml index 2074c3a5b8..d1f39c3429 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportMapper.xml +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportMapper.xml @@ -555,7 +555,7 @@ diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanReportService.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanReportService.java index 72f22eb42d..08ce616e5a 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanReportService.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanReportService.java @@ -1441,10 +1441,10 @@ public class TestPlanReportService { * @return 用例执行情况 */ private TestPlanReportDetailResponse calcTaskExecFinish(String reportId, String detailName, TestPlanReportDetailResponse detail) { - detail.setId(reportId); - detail.setName(detailName); TestPlanReport report = checkReport(reportId); BeanUtils.copyBean(detail, report); + detail.setId(reportId); + detail.setName(detailName); TestPlanReportSummary summary = getReportSummary(reportId); // 任务执行结果只需统计 接口 + 场景 (数据来源: 报告汇总) detail.setApiCaseCount(summary.getApiExecuteResult() == null ? CaseCount.builder().build() : JSON.parseObject(new String(summary.getApiExecuteResult()), CaseCount.class)); @@ -1452,6 +1452,7 @@ public class TestPlanReportService { detail.setApiCaseTotal(detail.getApiCaseCount().sum()); detail.setApiScenarioTotal(detail.getApiScenarioCount().sum()); detail.setExecuteCount(CountUtils.summarizeProperties(List.of(detail.getApiCaseCount(), detail.getApiScenarioCount()))); + detail.setCaseTotal(detail.getExecuteCount().sum()); CaseCount executeCount = detail.getExecuteCount(); detail.setExecuteRate(RateCalculateUtils.divWithPrecision((executeCount.sum() - executeCount.getPending()), executeCount.sum(), 2)); detail.setPassRate(RateCalculateUtils.divWithPrecision(executeCount.getSuccess(), executeCount.sum(), 2)); diff --git a/frontend/src/views/taskCenter/component/caseTaskTable.vue b/frontend/src/views/taskCenter/component/caseTaskTable.vue index 2db1ccdb56..2473491c48 100644 --- a/frontend/src/views/taskCenter/component/caseTaskTable.vue +++ b/frontend/src/views/taskCenter/component/caseTaskTable.vue @@ -724,7 +724,7 @@ showReportDetail(record); } else if ([ExecuteTaskType.TEST_PLAN_GROUP, ExecuteTaskType.TEST_PLAN].includes(record.taskType)) { showTestPlanDetailDrawer.value = true; - activeDetailId.value = record.reportId; + activeDetailId.value = record.id; isTestPlanGroup.value = record.taskType === ExecuteTaskType.TEST_PLAN_GROUP; } } diff --git a/frontend/src/views/taskCenter/component/testPlanExecuteResultDrawer.vue b/frontend/src/views/taskCenter/component/testPlanExecuteResultDrawer.vue index 9cf01017a3..204050576b 100644 --- a/frontend/src/views/taskCenter/component/testPlanExecuteResultDrawer.vue +++ b/frontend/src/views/taskCenter/component/testPlanExecuteResultDrawer.vue @@ -132,7 +132,6 @@ } from '@/api/modules/test-plan/report'; import { useI18n } from '@/hooks/useI18n'; import useOpenNewPage from '@/hooks/useOpenNewPage'; - import { addCommasToNumber } from '@/utils'; import { ApiOrScenarioCaseItem } from '@/models/testPlan/report'; import { ReportMetricsItemModel } from '@/models/testPlan/testPlanReport'; @@ -162,41 +161,7 @@ const activePlan = ref(''); 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', - }, - { - name: t('report.detail.totalDefects'), - value: addCommasToNumber(detail.value.bugCount), - unit: t('report.detail.number'), - icon: 'bugTotal', - }, - ]; - } return [ - { - name: t('report.detail.threshold'), - value: detail.value.passThreshold, - unit: '%', - icon: 'threshold', - }, { name: t('report.passRate'), value: detail.value.passRate, @@ -204,17 +169,11 @@ icon: 'passRate', }, { - name: t('report.detail.performCompletion'), + name: t('report.detail.rate_completion'), value: detail.value.executeRate, unit: '%', icon: 'passRate', }, - { - name: t('report.detail.totalDefects'), - value: addCommasToNumber(detail.value.bugCount), - unit: t('report.detail.number'), - icon: 'bugTotal', - }, ]; }); @@ -347,6 +306,8 @@ label: item.name, })); activePlan.value = res.children[0]?.id; + } else { + testPlanGroups.value = []; } searchList(); } catch (error) { diff --git a/frontend/src/views/test-plan/report/locale/en-US.ts b/frontend/src/views/test-plan/report/locale/en-US.ts index bd83847a62..2c33ad85bb 100644 --- a/frontend/src/views/test-plan/report/locale/en-US.ts +++ b/frontend/src/views/test-plan/report/locale/en-US.ts @@ -31,6 +31,7 @@ export default { 'report.detail.executionAnalysis': 'Execution Analysis', 'report.detail.threshold': 'Pass threshold', 'report.detail.performCompletion': 'Perform completion', + 'report.detail.rate_completion': 'Rate of completion', 'report.detail.totalDefects': 'Total defects', 'report.detail.useCaseAnalysis': 'Function of use case analysis', 'report.detail.apiUseCaseAnalysis': 'Api use case analysis', diff --git a/frontend/src/views/test-plan/report/locale/zh-CN.ts b/frontend/src/views/test-plan/report/locale/zh-CN.ts index 1357289c2d..0398dcfffd 100644 --- a/frontend/src/views/test-plan/report/locale/zh-CN.ts +++ b/frontend/src/views/test-plan/report/locale/zh-CN.ts @@ -31,6 +31,7 @@ export default { 'report.detail.executionAnalysis': '执行分析', 'report.detail.threshold': '通过阈值', 'report.detail.performCompletion': '执行完成率', + 'report.detail.rate_completion': '完成率', 'report.detail.totalDefects': '缺陷总数', 'report.detail.useCaseAnalysis': '功能用例分析', 'report.detail.apiUseCaseAnalysis': '接口用例分析',