From ff05e3ec52ed8339f74a871014a63c88ed2760ad Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Mon, 30 May 2022 11:06:26 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):?= =?UTF-8?q?=20=E8=84=91=E5=9B=BE=E7=94=A8=E4=BE=8B=E5=AD=90=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E8=B6=85=E8=BF=872=E5=B1=82=E6=97=B6=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1010712 --user=陈建星 【测试跟踪】github#9470,脑图用例子层级超过2层时,希望加上提示 无法保存 https://www.tapd.cn/55049933/s/1167696 --- .../track/common/minder/TestCaseMinder.vue | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/frontend/src/business/components/track/common/minder/TestCaseMinder.vue b/frontend/src/business/components/track/common/minder/TestCaseMinder.vue index 8ba089b656..d4907b8b46 100644 --- a/frontend/src/business/components/track/common/minder/TestCaseMinder.vue +++ b/frontend/src/business/components/track/common/minder/TestCaseMinder.vue @@ -397,8 +397,14 @@ name: "TestCaseMinder", if (childData.type === 'issue') return; if (childData.resource && childData.resource.indexOf(this.$t('test_track.case.prerequisite')) > -1) { testCase.prerequisite = childData.text; + if (childNode.children && childNode.children.length > 0) { + this.throwError('[' + testCase.name + ']前置条件下不能添加子节点!'); + } } else if (childData.resource && childData.resource.indexOf(this.$t('commons.remark')) > -1) { testCase.remark = childData.text; + if (childNode.children && childNode.children.length > 0) { + this.throwError('[' + testCase.name + ']备注下不能添加子节点!'); + } } else { // 测试步骤 let step = {}; @@ -408,7 +414,9 @@ name: "TestCaseMinder", let result = ""; childNode.children.forEach((child) => { result += child.data.text; - if (child.data.changed) isChange = true; + if (child.data.changed) { + isChange = true; + } }) step.result = result; } @@ -419,7 +427,15 @@ name: "TestCaseMinder", testCase.expectedResult = step.result; } } - if (childData.changed) isChange = true; + if (childData.changed) { + isChange = true; + } + + childNode.children.forEach((child) => { + if (child.children && child.children.length > 0) { + this.throwError('['+ testCase.name + ']用例下子节点不能超过两层!'); + } + }); }) } testCase.steps = JSON.stringify(steps);