fix(测试跟踪): 修复测试计划分享报告中接口用例执行报告总是显示最新报告的问题

https://www.tapd.cn/55049933/bugtrace/bugs/view?bug_id=1155049933001022575
This commit is contained in:
song-tianyang 2023-03-24 18:14:55 +08:00 committed by 建国
parent d5692b137f
commit ef0676672c
3 changed files with 29 additions and 7 deletions

View File

@ -317,4 +317,9 @@ public class ShareController {
shareInfoService.validateExpired(shareId);
return apiReportService.selectReportContent(stepId);
}
@GetMapping("/api/definition/report/by/id/{reportId}")
public APIReportResult getApiReport(@PathVariable String reportId) {
return apiDefinitionService.getReportById(reportId);
}
}

View File

@ -76,7 +76,7 @@ import {
} from "@/network/test-plan";
import MsTable from "@/business/components/common/components/table/MsTable";
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
import {getApiReport, getShareApiReport} from "@/network/api";
import {getApiReport, getShareApiReport, getShareApiReportByReportId} from "@/network/api";
import MsRequestResultTail from "@/business/components/api/definition/components/response/RequestResultTail";
import MsAsideContainer from "@/business/components/common/components/MsAsideContainer";
import MsMainContainer from "@/business/components/common/components/MsMainContainer";
@ -178,12 +178,25 @@ export default {
this.response = JSON.parse(row.response);
}
} else if (this.isShare) {
getShareApiReport(this.shareId, row.id, (data) => {
if (data && data.content) {
this.showResponse = true;
this.response = JSON.parse(data.content);
}
});
if (row.reportId) {
getShareApiReportByReportId(row.reportId, (data) => {
if (data && data.content) {
this.showResponse = true;
try {
this.response = JSON.parse(data.content);
} catch (e) {
this.response = {};
}
}
});
}else {
getShareApiReport(this.shareId, row.id, (data) => {
if (data && data.content) {
this.showResponse = true;
this.response = JSON.parse(data.content);
}
});
}
} else {
if (row.reportId) {
let url = "/api/definition/report/get/" + row.reportId;

View File

@ -24,6 +24,10 @@ export function getShareApiReport(shareId, testId, callback) {
return testId ? baseGet('/share/api/definition/report/getReport/' + shareId + '/' + testId, callback) : {};
}
export function getShareApiReportByReportId(reportId,callback) {
return baseGet("/share/api/definition/report/by/id/" + reportId,callback);
}
export function getShareScenarioReport(shareId, reportId, callback) {
return reportId ? baseGet('/share/api/scenario/report/get/' + shareId + '/' + reportId, callback) : {};
}