From 7a4302b291c6daddb283c4246f468c8f4fc2336b Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Thu, 22 Jul 2021 11:29:43 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):=20?= =?UTF-8?q?=E5=9C=BA=E6=99=AF=E6=89=A7=E8=A1=8C=E8=A7=A6=E5=8F=91=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E4=BF=AE=E6=94=B9=EF=BC=8C=E9=92=88=E5=AF=B9=E5=9C=BA?= =?UTF-8?q?=E6=99=AF=E7=BB=93=E6=9E=9C=E5=8E=86=E5=8F=B2=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/ApiScenarioReportService.java | 4 ---- .../automation/scenario/component/ApiComponent.vue | 12 ++++++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java index e24a8c14f4..38625e310f 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java @@ -207,10 +207,6 @@ public class ApiScenarioReportService { startTime = scenarioResult.getRequestResults().get(0).getStartTime(); } ApiScenarioReport report = editReport(scenarioResult, startTime); - if (!StringUtils.equals(ReportTriggerMode.API.name(), report.getTriggerMode())) { - report.setTriggerMode(ReportTriggerMode.MANUAL.name()); - apiScenarioReportMapper.updateByPrimaryKeySelective(report); - } // 报告详情内容 ApiScenarioReportDetail detail = new ApiScenarioReportDetail(); diff --git a/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue b/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue index 0c9c03e346..19abf5b607 100644 --- a/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue +++ b/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue @@ -157,8 +157,12 @@ export default { } }, created() { + // 历史数据兼容 if (!this.request.requestResult) { - this.request.requestResult = {responseResult: {}}; + this.request.requestResult = [{responseResult: {}}]; + } else if (this.request.requestResult && Object.prototype.toString.call(this.request.requestResult) !== '[object Array]') { + let obj = JSON.parse(JSON.stringify(this.request.requestResult)); + this.request.requestResult = [obj]; } // 跨项目关联,如果没有ID,则赋值本项目ID if (!this.request.projectId) { @@ -328,7 +332,11 @@ export default { if (response.data.method && response.data.method != null) { this.request.method = response.data.method; } - this.request.requestResult = requestResult; + if (requestResult && Object.prototype.toString.call(requestResult) !== '[object Array]') { + this.request.requestResult = [requestResult]; + } else { + this.request.requestResult = requestResult; + } this.request.id = response.data.id; this.request.disabled = true; this.request.root = true;