From 405eb63997382fdc3d0d0eb8953cf5563bd363da Mon Sep 17 00:00:00 2001 From: haifeng414 Date: Thu, 20 Feb 2020 20:00:46 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E7=BC=96=E8=BE=91=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6=E5=90=8E=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E8=BF=90=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/metersphere/controller/LoadTestController.java | 4 ++-- .../src/main/java/io/metersphere/service/LoadTestService.java | 4 +++- .../src/performance/components/testPlan/CreateTestPlan.vue | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/io/metersphere/controller/LoadTestController.java b/backend/src/main/java/io/metersphere/controller/LoadTestController.java index 9e99fcb198..f6ca0c0f97 100644 --- a/backend/src/main/java/io/metersphere/controller/LoadTestController.java +++ b/backend/src/main/java/io/metersphere/controller/LoadTestController.java @@ -41,11 +41,11 @@ public class LoadTestController { } @PostMapping(value = "/edit", consumes = {"multipart/form-data"}) - public void edit( + public String edit( @RequestPart("request") EditTestPlanRequest request, @RequestPart(value = "file", required = false) MultipartFile file ) { - loadTestService.edit(request, file); + return loadTestService.edit(request, file); } @PostMapping("/delete") diff --git a/backend/src/main/java/io/metersphere/service/LoadTestService.java b/backend/src/main/java/io/metersphere/service/LoadTestService.java index 8726e06a62..0e33a5f767 100644 --- a/backend/src/main/java/io/metersphere/service/LoadTestService.java +++ b/backend/src/main/java/io/metersphere/service/LoadTestService.java @@ -124,7 +124,7 @@ public class LoadTestService { return fileMetadata; } - public void edit(EditTestPlanRequest request, MultipartFile file) { + public String edit(EditTestPlanRequest request, MultipartFile file) { // 新选择了一个文件,删除原来的文件 if (file != null) { fileService.deleteFileByTestId(request.getId()); @@ -147,6 +147,8 @@ public class LoadTestService { loadTest.setLoadConfiguration(request.getLoadConfiguration()); loadTestMapper.updateByPrimaryKeySelective(loadTest); } + + return request.getId(); } public void run(RunTestPlanRequest request) { diff --git a/frontend/src/performance/components/testPlan/CreateTestPlan.vue b/frontend/src/performance/components/testPlan/CreateTestPlan.vue index eeaeb4e8ba..9fc1425062 100644 --- a/frontend/src/performance/components/testPlan/CreateTestPlan.vue +++ b/frontend/src/performance/components/testPlan/CreateTestPlan.vue @@ -103,7 +103,8 @@ let options = this.getSaveOption(); - this.result = this.$request(options, () => { + this.result = this.$request(options, (response) => { + this.testPlan.id = response.data; this.$message({ message: '保存成功!', type: 'success'