fix(性能测试): 性能测试导出报告时支持新版错误记录页面

This commit is contained in:
song-tianyang 2023-10-18 13:11:13 +08:00 committed by 刘瑞斌
parent c9bf47b03d
commit 58758ffd90
3 changed files with 22 additions and 5 deletions

View File

@ -26,6 +26,13 @@
</template> </template>
<ms-report-request-statistics :report="report" ref="requestStatistics"/> <ms-report-request-statistics :report="report" ref="requestStatistics"/>
</el-card> </el-card>
<el-card v-if="haveErrorSamples" id="errorSamples" title="'errorSamples'">
<template v-slot:header>
<span class="title">{{ $t('report.test_error_log') }}</span>
</template>
<samples-tabs ref="errorSamples" :samples="errorSamples"/>
</el-card>
<el-card id="errorLog" title="'errorLog'"> <el-card id="errorLog" title="'errorLog'">
<template v-slot:header> <template v-slot:header>
<span class="title">{{ $t('report.test_error_log') }}</span> <span class="title">{{ $t('report.test_error_log') }}</span>
@ -52,11 +59,13 @@ import MsReportExportTemplate from "metersphere-frontend/src/components/report/M
import MsReportTestDetails from "./components/TestDetails"; import MsReportTestDetails from "./components/TestDetails";
import MonitorCard from "./components/MonitorCard"; import MonitorCard from "./components/MonitorCard";
import MsTag from "metersphere-frontend/src/components/MsTag"; import MsTag from "metersphere-frontend/src/components/MsTag";
import SamplesTabs from "@/business/report/components/samples/SamplesTabs.vue";
export default { export default {
name: "MsPerformanceReportExport", name: "MsPerformanceReportExport",
components: { components: {
SamplesTabs,
MonitorCard, MonitorCard,
MsReportExportTemplate, MsReportExportTemplate,
MsReportTitle, MsReportTitle,
@ -66,7 +75,7 @@ export default {
MsReportTestOverview, MsReportTestOverview,
MsTag, MsTag,
}, },
props: ['report', 'title', 'projectEnvMap'] props: ['report', 'title', 'projectEnvMap', 'haveErrorSamples', 'errorSamples']
} }
</script> </script>

View File

@ -124,6 +124,7 @@
</div> </div>
<ms-performance-report-export :title="reportName" id="performanceReportExport" v-show="reportExportVisible" <ms-performance-report-export :title="reportName" id="performanceReportExport" v-show="reportExportVisible"
:error-samples="errorSamples" :have-error-samples="haveErrorSamples"
:project-env-map="allProjectEnvMap" :project-env-map="allProjectEnvMap"
:report="report"/> :report="report"/>
@ -389,6 +390,9 @@ export default {
this.$nextTick(function () { this.$nextTick(function () {
setTimeout(() => { setTimeout(() => {
let ids = ['testOverview', 'testDetails', 'requestStatistics', 'errorLog', 'monitorCard']; let ids = ['testOverview', 'testDetails', 'requestStatistics', 'errorLog', 'monitorCard'];
if (this.haveErrorSamples) {
ids = ['testOverview', 'testDetails', 'requestStatistics', 'errorSamples', 'monitorCard'];
}
let promises = []; let promises = [];
ids.forEach(id => { ids.forEach(id => {
let promise = html2canvas(document.getElementById(id), {scale: 2}); let promise = html2canvas(document.getElementById(id), {scale: 2});

View File

@ -50,14 +50,18 @@ export default {
datetimeFormat, datetimeFormat,
handleClose(done) { handleClose(done) {
this.activeName = '1';
this.sampleRecord = [];
done(); done();
}, },
openRecord(samples) { openRecord(samples) {
this.sampleRecord = []; this.sampleRecord = [];
this.$nextTick(() => {
samples.forEach(sample => { samples.forEach(sample => {
this.sampleRecord.push(sample); this.sampleRecord.push(sample);
}); });
this.drawer = true; this.drawer = true;
})
}, },
}, },
} }