fix: 保存报告打开重新加载

This commit is contained in:
chenjianxing 2021-08-26 18:14:46 +08:00 committed by jianxing
parent 0675e591e3
commit 41d308493b
8 changed files with 28 additions and 20 deletions

View File

@ -110,9 +110,9 @@ export default {
getScenarioApiCase() { getScenarioApiCase() {
if (this.isTemplate || this.isDb) { if (this.isTemplate || this.isDb) {
if (this.isAll) { if (this.isAll) {
this.apiCases = this.report.apiAllCases; this.apiCases = this.report.apiAllCases ? this.report.apiAllCases : [];
} else { } else {
this.apiCases = this.report.apiFailureCases; this.apiCases = this.report.apiFailureCases ? this.report.apiFailureCases : [];
} }
} else if (this.isShare) { } else if (this.isShare) {
if (this.isAll) { if (this.isAll) {

View File

@ -106,9 +106,9 @@ export default {
getScenarioApiCase() { getScenarioApiCase() {
if (this.isTemplate || this.isDb) { if (this.isTemplate || this.isDb) {
if (this.isAll) { if (this.isAll) {
this.scenarioCases = this.report.scenarioAllCases; this.scenarioCases = this.report.scenarioAllCases ? this.report.scenarioAllCases : [];
} else { } else {
this.scenarioCases = this.report.scenarioFailureCases; this.scenarioCases = this.report.scenarioFailureCases ? this.report.scenarioFailureCases : [];
} }
} else if (this.isShare) { } else if (this.isShare) {
if (this.isAll) { if (this.isAll) {

View File

@ -106,9 +106,9 @@ export default {
getFunctionalTestCase() { getFunctionalTestCase() {
if (this.isTemplate || this.isDb) { if (this.isTemplate || this.isDb) {
if (this.isAll) { if (this.isAll) {
this.testCases = this.report.functionAllCases; this.testCases = this.report.functionAllCases ? this.report.functionAllCases : [];
} else { } else {
this.testCases = this.report.functionFailureCases; this.testCases = this.report.functionFailureCases ? this.report.functionFailureCases : [];
} }
} else if (this.isShare) { } else if (this.isShare) {
if (this.isAll) { if (this.isAll) {

View File

@ -87,7 +87,7 @@ export default {
methods: { methods: {
getIssues() { getIssues() {
if (this.isTemplate || this.isDb) { if (this.isTemplate || this.isDb) {
this.data = this.report.issueList; this.data = this.report.issueList ? this.report.issueList : [];
} else if (this.isShare) { } else if (this.isShare) {
this.result = getShareIssuesByPlanId(this.shareId, this.planId, (data) => { this.result = getShareIssuesByPlanId(this.shareId, this.planId, (data) => {
this.data = data; this.data = data;

View File

@ -88,9 +88,9 @@ export default {
getFailureTestCase() { getFailureTestCase() {
if (this.isTemplate || this.isDb) { if (this.isTemplate || this.isDb) {
if (this.isAll) { if (this.isAll) {
this.loadTestCases = this.report.loadAllCases; this.loadTestCases = this.report.loadAllCases ? this.report.loadAllCases : [];
} else { } else {
this.loadTestCases = this.report.loadFailureCases; this.loadTestCases = this.report.loadFailureCases ? this.report.loadFailureCases : [];
} }
} else if (this.isShare) { } else if (this.isShare) {
if (this.isAll) { if (this.isAll) {

View File

@ -23,7 +23,7 @@
</el-row> </el-row>
<el-scrollbar> <el-scrollbar>
<div class="container"> <div class="container">
<test-plan-report-content :is-db="true" :report-id="report.id" :plan-id="report.testPlanId"/> <test-plan-report-content v-if="showReport" :is-db="true" :report-id="report.id" :plan-id="report.testPlanId"/>
</div> </div>
</el-scrollbar> </el-scrollbar>
</template> </template>
@ -43,7 +43,8 @@ export default {
result: {}, result: {},
showDialog: false, showDialog: false,
report: {}, report: {},
isTestManagerOrTestUser: false isTestManagerOrTestUser: false,
showReport: false
} }
}, },
mounted() { mounted() {
@ -61,7 +62,12 @@ export default {
// this.handleClose(); // this.handleClose();
// }, // },
open(report) { open(report) {
this.report = report; this.showReport = false;
//
this.$nextTick(() => {
this.showReport = true;
this.report = report;
});
this.showDialog = true; this.showDialog = true;
// this.listenGoBack(); // this.listenGoBack();
}, },

View File

@ -23,7 +23,7 @@
</el-row> </el-row>
<el-scrollbar> <el-scrollbar>
<div class="container"> <div class="container">
<test-plan-report-content :plan-id="plan.id"/> <test-plan-report-content v-if="showReport" :plan-id="plan.id"/>
</div> </div>
</el-scrollbar> </el-scrollbar>
</template> </template>
@ -43,7 +43,8 @@ export default {
result: {}, result: {},
showDialog: false, showDialog: false,
plan: {}, plan: {},
isTestManagerOrTestUser: false isTestManagerOrTestUser: false,
showReport: false
} }
}, },
mounted() { mounted() {
@ -61,9 +62,10 @@ export default {
// this.handleClose(); // this.handleClose();
// }, // },
open(plan) { open(plan) {
this.showReport = false;
// //
this.plan = {id: null}
this.$nextTick(() => { this.$nextTick(() => {
this.showReport = true;
this.plan = plan; this.plan = plan;
}); });
this.showDialog = true; this.showDialog = true;

View File

@ -71,10 +71,10 @@ export function getSharePerformanceReportResponseCodeChart(shareId, reportId, ca
} }
export function getPerformanceReportDetailContent(reportKey, reportId, callback) { export function getPerformanceReportDetailContent(reportKey, reportId, callback) {
return reportId ? baseGet('/performance/report/content/' + reportKey + '/' + reportId, callback) : new Promise(()=>{}); return reportId ? baseGet('/performance/report/content/' + reportKey + '/' + reportId, callback) : new Promise(() => {});
} }
export function getSharePerformanceReportDetailContent(shareId, reportKey, reportId, callback) { export function getSharePerformanceReportDetailContent(shareId, reportKey, reportId, callback) {
return reportId ? baseGet('/share/performance/report/content/' + shareId + '/' + reportKey + '/' + reportId, callback) : new Promise(()=>{}); return reportId ? baseGet('/share/performance/report/content/' + shareId + '/' + reportKey + '/' + reportId, callback) : new Promise(() => {});
} }
export function getPerformanceReportContent(reportId, callback) { export function getPerformanceReportContent(reportId, callback) {
@ -113,15 +113,15 @@ export function getSharePerformanceReportLogResourceDetail(shareId, reportId, re
} }
export function getPerformanceMetricQueryResource(resourceId, callback) { export function getPerformanceMetricQueryResource(resourceId, callback) {
return resourceId ? baseGet('/metric/query/resource/' + resourceId, callback) : new Promise(()=>{}); return resourceId ? baseGet('/metric/query/resource/' + resourceId, callback) : new Promise(() => {});
} }
export function getSharePerformanceMetricQueryResource(shareId, resourceId, callback) { export function getSharePerformanceMetricQueryResource(shareId, resourceId, callback) {
return resourceId ? baseGet('/share/metric/query/resource/' + shareId + '/' + resourceId, callback) : new Promise(()=>{}); return resourceId ? baseGet('/share/metric/query/resource/' + shareId + '/' + resourceId, callback) : new Promise(() => {});
} }
export function getPerformanceMetricQuery(resourceId, callback) { export function getPerformanceMetricQuery(resourceId, callback) {
return resourceId ? baseGet('/metric/query/' + resourceId, callback) : {}; return resourceId ? baseGet('/metric/query/' + resourceId, callback) : {};
} }
export function getSharePerformanceMetricQuery(shareId, resourceId, callback) { export function getSharePerformanceMetricQuery(shareId, resourceId, callback) {
return resourceId ? baseGet('/share/metric/query/' + shareId + '/' + resourceId, callback) : new Promise(()=>{}); return resourceId ? baseGet('/share/metric/query/' + shareId + '/' + resourceId, callback) : new Promise(() => {});
} }