From 5892cd3f2961b5220396488ad7e7740913bcafc7 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Sun, 17 May 2020 10:26:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=8A=A5=E5=91=8A=E7=BC=BA?= =?UTF-8?q?=E9=99=B7=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../track/service/TestPlanService.java | 7 +++++ .../view/comonents/TestPlanTestCaseEdit.vue | 26 +++++++++---------- 2 files changed, 20 insertions(+), 13 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 c90fe9e411..3b479d9492 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java @@ -1,6 +1,7 @@ package io.metersphere.track.service; +import com.alibaba.fastjson.JSON; import io.metersphere.base.domain.*; import io.metersphere.base.mapper.TestCaseMapper; import io.metersphere.base.mapper.TestCaseNodeMapper; @@ -296,12 +297,18 @@ public class TestPlanService { moduleResult = new TestCaseReportModuleResultDTO(); moduleResult.setCaseCount(0); moduleResult.setPassCount(0); + moduleResult.setFlawCount(0); moduleResult.setModuleId(rootNodeId); } moduleResult.setCaseCount(moduleResult.getCaseCount() + 1); if (StringUtils.equals(testCase.getStatus(), TestPlanTestCaseStatus.Pass.name())) { moduleResult.setPassCount(moduleResult.getPassCount() + 1); } + if (StringUtils.isNotBlank(testCase.getFlaw())) { + if (JSON.parseObject(testCase.getFlaw()).getBoolean("hasFlaw")) { + moduleResult.setFlawCount(moduleResult.getFlawCount() + 1); + }; + } moduleResultMap.put(rootNodeId, moduleResult); return; } diff --git a/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseEdit.vue b/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseEdit.vue index a251b2f601..2e972a0412 100644 --- a/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseEdit.vue +++ b/frontend/src/business/components/track/plan/view/comonents/TestPlanTestCaseEdit.vue @@ -137,19 +137,19 @@ - + - + - + @@ -196,7 +196,6 @@ index: 0, testCases: [], editor: ClassicEditor, - hasFlaw: false }; }, props: { @@ -230,7 +229,7 @@ param.results.push(result); }); param.results = JSON.stringify(param.results); - param.flaw = this.testCase.flaw; + param.flaw = JSON.stringify(this.testCase.flaw); this.$post('/test/plan/case/edit', param, () => { if (isContinuous) { this.updateTestCases(param); @@ -257,6 +256,12 @@ Object.assign(item, testCase); item.results = JSON.parse(item.results); item.steps = JSON.parse(item.steps); + if (item.flaw) { + item.flaw = JSON.parse(item.flaw); + } else { + item.flaw = {}; + item.flaw.hasFlaw = false; + } item.steptResults = []; for (let i = 0; i < item.steps.length; i++){ if(item.results[i]){ @@ -269,11 +274,6 @@ }, openTestCaseEdit(testCase) { this.showDialog = true; - if (testCase.flaw) { - this.hasFlaw = true; - } else { - this.hasFlaw = false; - } this.initData(testCase); }, updateTestCases(testCase) { @@ -295,7 +295,7 @@ }); }, flawChange() { - if (this.hasFlaw && !this.testCase.flaw) { + if (this.testCase.flaw.hasFlaw) { let desc = this.addPLabel('[' + '操作步骤' + ']'); let result = this.addPLabel('[' + '预期结果' + ']'); let executeResult = this.addPLabel('[' + '实际结果' + ']'); @@ -305,7 +305,7 @@ result += this.addPLabel(stepPrefix + (step.result == undefined ? '' : step.result)); executeResult += this.addPLabel(stepPrefix + (step.executeResult == undefined ? '' : step.executeResult)); }); - this.testCase.flaw = desc + this.addPLabel('') + result + this.addPLabel('') + executeResult + this.addPLabel(''); + this.testCase.flaw.content = desc + this.addPLabel('') + result + this.addPLabel('') + executeResult + this.addPLabel(''); } }, addPLabel(str) {