测试计划关联测试报告界面调整
This commit is contained in:
@@ -68,16 +68,22 @@ public class TestReportServiceImpl implements ITestReportService {
|
|||||||
List<TestCaseResult> testCaseResults = testCaseResultMapper.selectTestCaseResultList(testCaseResult);
|
List<TestCaseResult> testCaseResults = testCaseResultMapper.selectTestCaseResultList(testCaseResult);
|
||||||
int count = testCaseResults.size();
|
int count = testCaseResults.size();
|
||||||
int passNum = (int)testCaseResults.stream().filter(result -> "成功".equals(result.getStatus())).count();
|
int passNum = (int)testCaseResults.stream().filter(result -> "成功".equals(result.getStatus())).count();
|
||||||
|
if (count == passNum) {
|
||||||
|
testReportAddQO.setResult("1");
|
||||||
|
}
|
||||||
TestCaseReportVO testCaseReportVO = new TestCaseReportVO();
|
TestCaseReportVO testCaseReportVO = new TestCaseReportVO();
|
||||||
testCaseReportVO.setName(testReportAddQO.getName());
|
testCaseReportVO.setName(testReportAddQO.getName());
|
||||||
testCaseReportVO.setResult("success");
|
testCaseReportVO.setResult("0");
|
||||||
testCaseReportVO.setCaseNum(count);
|
testCaseReportVO.setCaseNum(count);
|
||||||
testCaseReportVO.setPassNum(passNum);
|
testCaseReportVO.setPassNum(passNum);
|
||||||
String reportJson = JSONObject.toJSONString(testCaseReportVO);
|
String reportJson = JSONObject.toJSONString(testCaseReportVO);
|
||||||
TestReport testReport = new TestReport();
|
TestReport testReport = new TestReport();
|
||||||
|
if (count == passNum) {
|
||||||
|
testReport.setResult("1");
|
||||||
|
}
|
||||||
BeanUtils.copyProperties(testReportAddQO,testReport);
|
BeanUtils.copyProperties(testReportAddQO,testReport);
|
||||||
testReport.setSerialNumber(generateSerialNumber());
|
testReport.setSerialNumber(generateSerialNumber());
|
||||||
testReport.setResult("1");
|
testReport.setResult("0");
|
||||||
testReport.setStatus("0");
|
testReport.setStatus("0");
|
||||||
testReport.setReport(reportJson);
|
testReport.setReport(reportJson);
|
||||||
testReport.setCreateTime(DateUtils.getNowDate());
|
testReport.setCreateTime(DateUtils.getNowDate());
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ export default {
|
|||||||
this.$tab.openPage('平台报告', '/testplan/casereport/platformReport',
|
this.$tab.openPage('平台报告', '/testplan/casereport/platformReport',
|
||||||
{id: row.id,
|
{id: row.id,
|
||||||
name: row.name,
|
name: row.name,
|
||||||
type: row.result,
|
type: row.type,
|
||||||
planId: row.planId,
|
planId: row.planId,
|
||||||
report: row.report
|
report: row.report
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<el-page-header :title="reportTitle" @back="goBack" ></el-page-header>
|
<el-page-header :title="reportTitle" @back="goBack" ></el-page-header>
|
||||||
<div class="header-buttons">
|
<div class="header-buttons">
|
||||||
<span>测试结果</span>
|
<span>测试结果</span>
|
||||||
<el-select v-model="selectedResult" placeholder="请选择" clearable>
|
<el-select v-model="selectedResult" placeholder="请选择">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in resultOptions"
|
v-for="item in resultOptions"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<div class="report-container">
|
<div class="report-container" :class="testStatusClass">
|
||||||
<div class="report-header">
|
<div class="report-header">
|
||||||
<div class="report-title">
|
<div class="report-title">
|
||||||
<span>{{ reportTitle }}</span>
|
<span>{{ reportTitle }}</span>
|
||||||
@@ -90,9 +90,8 @@ export default {
|
|||||||
reportData: {},
|
reportData: {},
|
||||||
selectedResult: '', // 选择的测试结果
|
selectedResult: '', // 选择的测试结果
|
||||||
resultOptions: [ // 测试结果选项
|
resultOptions: [ // 测试结果选项
|
||||||
{ value: 'all', label: '全部' },
|
{ value: '1', label: '通过' },
|
||||||
{ value: 'passed', label: '通过' },
|
{ value: '0', label: '不通过' }
|
||||||
{ value: 'failed', label: '失败' }
|
|
||||||
],
|
],
|
||||||
|
|
||||||
// 执行结果分布数据
|
// 执行结果分布数据
|
||||||
@@ -118,6 +117,7 @@ export default {
|
|||||||
this.reportTitle = this.$route.query.name;
|
this.reportTitle = this.$route.query.name;
|
||||||
this.reportType = this.$route.query.type;
|
this.reportType = this.$route.query.type;
|
||||||
this.reportData = JSON.parse(this.$route.query.report);
|
this.reportData = JSON.parse(this.$route.query.report);
|
||||||
|
this.selectedResult = this.reportData.result;
|
||||||
|
|
||||||
// 更新饼图数据
|
// 更新饼图数据
|
||||||
this.resultDistributionData.series[0].value = this.reportData.passNum || 0;
|
this.resultDistributionData.series[0].value = this.reportData.passNum || 0;
|
||||||
@@ -141,6 +141,9 @@ export default {
|
|||||||
passRate() {
|
passRate() {
|
||||||
if (this.reportData.caseNum === 0) return 0;
|
if (this.reportData.caseNum === 0) return 0;
|
||||||
return (this.reportData.passNum / this.reportData.caseNum) * 100;
|
return (this.reportData.passNum / this.reportData.caseNum) * 100;
|
||||||
|
},
|
||||||
|
testStatusClass() {
|
||||||
|
return this.selectedResult === '0' ? 'status-not-passed' : 'status-passed';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@@ -156,6 +159,7 @@ export default {
|
|||||||
myChart.setOption({
|
myChart.setOption({
|
||||||
series: [{
|
series: [{
|
||||||
type: 'pie',
|
type: 'pie',
|
||||||
|
radius: ['40%', '70%'],
|
||||||
data: this.resultDistributionData.series
|
data: this.resultDistributionData.series
|
||||||
}]
|
}]
|
||||||
}, true); // true 表示合并选项
|
}, true); // true 表示合并选项
|
||||||
@@ -259,7 +263,12 @@ export default {
|
|||||||
.report-container {
|
.report-container {
|
||||||
height: 300px;
|
height: 300px;
|
||||||
margin-bottom: 20px;
|
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 {
|
.report-header {
|
||||||
|
|
||||||
color: white;
|
color: white;
|
||||||
|
|||||||
Reference in New Issue
Block a user