From 924f5a935fc0617d167ade248bc53c0bd4e8e963 Mon Sep 17 00:00:00 2001 From: pfl <14579250+shadowman1@user.noreply.gitee.com> Date: Thu, 26 Jun 2025 16:19:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E5=85=B3?= =?UTF-8?q?=E8=81=94=E6=B5=8B=E8=AF=95=E6=8A=A5=E5=91=8A=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/TestReportServiceImpl.java | 10 +++++++-- .../test/testplan/caseReport/caseReport.vue | 2 +- .../testplan/caseReport/platformReport.vue | 21 +++++++++++++------ 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/test-test/src/main/java/com/test/test/service/impl/TestReportServiceImpl.java b/test-test/src/main/java/com/test/test/service/impl/TestReportServiceImpl.java index 7d81e1c..3aedf5a 100644 --- a/test-test/src/main/java/com/test/test/service/impl/TestReportServiceImpl.java +++ b/test-test/src/main/java/com/test/test/service/impl/TestReportServiceImpl.java @@ -68,16 +68,22 @@ public class TestReportServiceImpl implements ITestReportService { List testCaseResults = testCaseResultMapper.selectTestCaseResultList(testCaseResult); int count = testCaseResults.size(); int passNum = (int)testCaseResults.stream().filter(result -> "成功".equals(result.getStatus())).count(); + if (count == passNum) { + testReportAddQO.setResult("1"); + } TestCaseReportVO testCaseReportVO = new TestCaseReportVO(); testCaseReportVO.setName(testReportAddQO.getName()); - testCaseReportVO.setResult("success"); + testCaseReportVO.setResult("0"); testCaseReportVO.setCaseNum(count); testCaseReportVO.setPassNum(passNum); String reportJson = JSONObject.toJSONString(testCaseReportVO); TestReport testReport = new TestReport(); + if (count == passNum) { + testReport.setResult("1"); + } BeanUtils.copyProperties(testReportAddQO,testReport); testReport.setSerialNumber(generateSerialNumber()); - testReport.setResult("1"); + testReport.setResult("0"); testReport.setStatus("0"); testReport.setReport(reportJson); testReport.setCreateTime(DateUtils.getNowDate()); diff --git a/test-ui/src/views/test/testplan/caseReport/caseReport.vue b/test-ui/src/views/test/testplan/caseReport/caseReport.vue index 7784d7d..5246870 100644 --- a/test-ui/src/views/test/testplan/caseReport/caseReport.vue +++ b/test-ui/src/views/test/testplan/caseReport/caseReport.vue @@ -114,7 +114,7 @@ export default { this.$tab.openPage('平台报告', '/testplan/casereport/platformReport', {id: row.id, name: row.name, - type: row.result, + type: row.type, planId: row.planId, report: row.report } diff --git a/test-ui/src/views/test/testplan/caseReport/platformReport.vue b/test-ui/src/views/test/testplan/caseReport/platformReport.vue index f84e247..c235957 100644 --- a/test-ui/src/views/test/testplan/caseReport/platformReport.vue +++ b/test-ui/src/views/test/testplan/caseReport/platformReport.vue @@ -5,7 +5,7 @@
测试结果 - + -
+
{{ reportTitle }} @@ -90,9 +90,8 @@ export default { reportData: {}, selectedResult: '', // 选择的测试结果 resultOptions: [ // 测试结果选项 - { value: 'all', label: '全部' }, - { value: 'passed', label: '通过' }, - { value: 'failed', label: '失败' } + { value: '1', label: '通过' }, + { value: '0', label: '不通过' } ], // 执行结果分布数据 @@ -118,6 +117,7 @@ export default { this.reportTitle = this.$route.query.name; this.reportType = this.$route.query.type; this.reportData = JSON.parse(this.$route.query.report); + this.selectedResult = this.reportData.result; // 更新饼图数据 this.resultDistributionData.series[0].value = this.reportData.passNum || 0; @@ -141,6 +141,9 @@ export default { passRate() { if (this.reportData.caseNum === 0) return 0; return (this.reportData.passNum / this.reportData.caseNum) * 100; + }, + testStatusClass() { + return this.selectedResult === '0' ? 'status-not-passed' : 'status-passed'; } }, mounted() { @@ -156,6 +159,7 @@ export default { myChart.setOption({ series: [{ type: 'pie', + radius: ['40%', '70%'], data: this.resultDistributionData.series }] }, true); // true 表示合并选项 @@ -259,7 +263,12 @@ export default { .report-container { height: 300px; margin-bottom: 20px; - background: linear-gradient(90deg, #6fcdac, #9ed2bb); + &.status-not-passed { + background: linear-gradient(180deg, #e7998b, #e8b1b0); + } + &.status-passed { + background: linear-gradient(180deg, #6fcdac, #9ed2bb); + } .report-header { color: white;