fix(测试跟踪): 修复测试计划报告导出html时的部分错误

--bug=1032272 --user=宋天阳
【测试跟踪】报告列表-操作-查看报告详情-导出报告为html-性能用例统计分析-错误请求tab页展示数据不全
https://www.tapd.cn/55049933/s/1429548
This commit is contained in:
song-tianyang 2023-10-23 15:53:13 +08:00 committed by 刘瑞斌
parent 5b88c1d475
commit 45d00882bd
2 changed files with 13 additions and 4 deletions

View File

@ -39,7 +39,7 @@
label="Response Code"
min-width="180">
<template v-slot:default="scope">
<span v-if="scope.row.code === '200' " style="color: #44b349">{{ scope.row.code }}</span>
<span v-if="isSuccessRspCode(scope.row.code)" style="color: #44b349">{{ scope.row.code }}</span>
<span v-else style="color: #E6113C">{{ scope.row.code }}</span>
</template>
</el-table-column>
@ -79,6 +79,9 @@ export default {
this.initTableData();
},
methods: {
isSuccessRspCode(code) {
return !(Number.isNaN(Number(code)) || 300 <= Number(code) || Number(code) < 200);
},
initTableData() {
if (this.errorSamples && this.errorSamples.sampleCount) {
let allSampleCount = 0;
@ -136,7 +139,10 @@ export default {
done();
},
openRecord(row) {
let drawerSamples = this.errorSamples.samples[row.name][row.code];
let drawerSamples = [];
if (this.errorSamples.samples[row.name]) {
drawerSamples = this.errorSamples.samples[row.name][row.code];
}
this.$refs.sampleDrawer.openRecord(drawerSamples);
},
},

View File

@ -46,13 +46,16 @@ export default {
for (let sampleName in this.samples.sampleCount) {
let sampleCountObj = this.samples.sampleCount[sampleName];
for (let code in sampleCountObj) {
if (code !== '200') {
if (Number.isNaN(Number(code)) || 300 <= Number(code) || Number(code) < 200) {
if (!this.errorSamples.sampleCount[sampleName]) {
this.errorSamples.sampleCount[sampleName] = {};
this.errorSamples.samples[sampleName] = {};
}
this.errorSamples.sampleCount[sampleName][code] = this.samples.sampleCount[sampleName][code] || {};
this.errorSamples.samples[sampleName][code] = this.samples.samples[sampleName][code] || [];
if (this.samples.samples[sampleName]) {
this.errorSamples.samples[sampleName][code] = this.samples.samples[sampleName][code] || [];
}
}
}
}