测试计划关联测试报告界面调整
This commit is contained in:
@@ -68,16 +68,22 @@ public class TestReportServiceImpl implements ITestReportService {
|
||||
List<TestCaseResult> 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());
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<el-page-header :title="reportTitle" @back="goBack" ></el-page-header>
|
||||
<div class="header-buttons">
|
||||
<span>测试结果</span>
|
||||
<el-select v-model="selectedResult" placeholder="请选择" clearable>
|
||||
<el-select v-model="selectedResult" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in resultOptions"
|
||||
:key="item.value"
|
||||
@@ -18,7 +18,7 @@
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="report-container">
|
||||
<div class="report-container" :class="testStatusClass">
|
||||
<div class="report-header">
|
||||
<div class="report-title">
|
||||
<span>{{ reportTitle }}</span>
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user