From 7aa5a6fc5c5968db9e4c0f00917edf5b879c6281 Mon Sep 17 00:00:00 2001 From: Coooder-X <55648333+Coooder-X@users.noreply.github.com> Date: Mon, 1 Feb 2021 14:26:51 +0800 Subject: [PATCH 1/6] =?UTF-8?q?fix:=20(=E6=B5=8B=E8=AF=95=E8=AE=A1?= =?UTF-8?q?=E5=88=92)=20=E4=BF=AE=E5=A4=8D=20=E6=B5=8B=E8=AF=95=E8=AE=A1?= =?UTF-8?q?=E5=88=92-=E4=BF=AE=E6=94=B9=E7=8A=B6=E6=80=81=E5=90=8E?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=98=BE=E7=A4=BA=E6=9C=89=E8=AF=AF=20(#1291?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../track/service/TestPlanService.java | 33 ++++++++++++++----- .../track/plan/components/TestPlanList.vue | 12 ++++++- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java index c6651c55f2..7917a3f2b9 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java @@ -168,20 +168,35 @@ public class TestPlanService { public int editTestPlan(TestPlanDTO testPlan) { editTestPlanProject(testPlan); - testPlan.setUpdateTime(System.currentTimeMillis()); checkTestPlanExist(testPlan); - //进行中状态,写入实际开始时间 - if (TestPlanStatus.Underway.name().equals(testPlan.getStatus())) { - testPlan.setActualStartTime(System.currentTimeMillis()); - } else if (TestPlanStatus.Completed.name().equals(testPlan.getStatus())) { - //已完成,写入实际完成时间 - testPlan.setActualEndTime(System.currentTimeMillis()); - + TestPlan res = testPlanMapper.selectByPrimaryKey(testPlan.getId()); // 先查一次库 + if (!res.getStatus().equals(testPlan.getStatus())) { // 若有改变才更新时间 + res.setUpdateTime(System.currentTimeMillis()); + if (TestPlanStatus.Underway.name().equals(testPlan.getStatus())) { + if (res.getStatus().equals(TestPlanStatus.Prepare.name())) { + res.setActualStartTime(System.currentTimeMillis()); + } // 未开始->进行中,写入实际开始时间 + else if (res.getStatus().equals(TestPlanStatus.Completed.name())) { + res.setActualEndTime(null); + } // 已完成->进行中,结束时间置空 + } + else if (!res.getStatus().equals(TestPlanStatus.Prepare.name()) && + testPlan.getStatus().equals(TestPlanStatus.Prepare.name())) { + res.setActualStartTime(null); + res.setActualEndTime(null); + } // 非未开始->未开始,时间都置空 + else if (TestPlanStatus.Completed.name().equals(testPlan.getStatus()) && + !TestPlanStatus.Completed.name().equals(res.getStatus())) { + //已完成,写入实际完成时间 + res.setActualEndTime(System.currentTimeMillis()); + } + res.setStatus(testPlan.getStatus()); } + List userIds = new ArrayList<>(); userIds.add(testPlan.getPrincipal()); AddTestPlanRequest testPlans = new AddTestPlanRequest(); - int i = testPlanMapper.updateByPrimaryKeySelective(testPlan); + int i = testPlanMapper.updateByPrimaryKey(res); // 更新 if (!StringUtils.isBlank(testPlan.getStatus())) { BeanUtils.copyBean(testPlans, getTestPlan(testPlan.getId())); String context = getTestPlanContext(testPlans, NoticeConstants.Event.UPDATE); diff --git a/frontend/src/business/components/track/plan/components/TestPlanList.vue b/frontend/src/business/components/track/plan/components/TestPlanList.vue index b6f68ba8c7..80fa8678ba 100644 --- a/frontend/src/business/components/track/plan/components/TestPlanList.vue +++ b/frontend/src/business/components/track/plan/components/TestPlanList.vue @@ -257,7 +257,17 @@ export default { statusChange(param) { this.$post('/test/plan/edit', param, () => { for (let i = 0; i < this.tableData.length; i++) { - if (this.tableData[i].id == param.id) { + if (this.tableData[i].id == param.id) { // 手动修改当前状态后,前端结束时间先用当前时间,等刷新后变成后台数据(相等) + if (this.tableData[i].status !== "Completed" && param.status === "Completed") { + this.tableData[i].actualEndTime = new Date(); + } // 非完成->已完成,结束时间=null + else if (this.tableData[i].status !== "Underway" && param.status === "Underway") { + this.tableData[i].actualStartTime = new Date(); + this.tableData[i].actualEndTime = ""; + } // 非进行中->进行中,结束时间=null + else if (this.tableData[i].status !== "Prepare" && param.status === "Prepare") { + this.tableData[i].actualStartTime = this.tableData[i].actualEndTime = ""; + } // 非未开始->未开始,结束时间=null this.tableData[i].status = param.status; break; } From f9f897c027cc666447b32136241efce6ecb9a662 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Mon, 1 Feb 2021 15:21:22 +0800 Subject: [PATCH 2/6] =?UTF-8?q?refactor(=E6=B5=8B=E8=AF=95=E8=AE=A1?= =?UTF-8?q?=E5=88=92):=20=E6=B8=85=E7=90=86=E6=97=A0=E7=94=A8=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../view/comonents/load/LoadCaseReportView.vue | 9 --------- .../view/comonents/load/TestCaseLoadRelevance.vue | 6 ------ .../view/comonents/load/TestPlanLoadCaseList.vue | 15 --------------- .../comonents/load/TestPlanLoadCaseListHeader.vue | 2 +- frontend/src/i18n/en-US.js | 1 + frontend/src/i18n/zh-CN.js | 1 + frontend/src/i18n/zh-TW.js | 1 + 7 files changed, 4 insertions(+), 31 deletions(-) diff --git a/frontend/src/business/components/track/plan/view/comonents/load/LoadCaseReportView.vue b/frontend/src/business/components/track/plan/view/comonents/load/LoadCaseReportView.vue index 37f1c6c830..8ab8179838 100644 --- a/frontend/src/business/components/track/plan/view/comonents/load/LoadCaseReportView.vue +++ b/frontend/src/business/components/track/plan/view/comonents/load/LoadCaseReportView.vue @@ -18,20 +18,12 @@ @click="dialogFormVisible=true"> {{ $t('report.test_stop_now') }} - - - - {{ $t('test_track.plan_view.export_report') }} {{ $t('report.downloadJtl') }} - - - - @@ -159,7 +151,6 @@ export default { this.testName = data.testName; this.projectId = data.projectId; this.projectName = data.projectName; - // if (callback) callback(res); } else { this.$error(this.$t('report.not_exist')); diff --git a/frontend/src/business/components/track/plan/view/comonents/load/TestCaseLoadRelevance.vue b/frontend/src/business/components/track/plan/view/comonents/load/TestCaseLoadRelevance.vue index ad0e39f6f1..83e55af9a2 100644 --- a/frontend/src/business/components/track/plan/view/comonents/load/TestCaseLoadRelevance.vue +++ b/frontend/src/business/components/track/plan/view/comonents/load/TestCaseLoadRelevance.vue @@ -13,7 +13,6 @@ ref="nodeTree"/> - - - - - - {{ scope.row.createTime | timestampFormatDate }} - - - - - - - -