From a53347707a4515db92dd4eb1064efdb65975bf63 Mon Sep 17 00:00:00 2001 From: WangXu10 Date: Mon, 27 Mar 2023 13:40:54 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA)?= =?UTF-8?q?=EF=BC=9A=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B=E5=85=B3=E8=81=94?= =?UTF-8?q?=E7=9A=84devops=E9=9C=80=E6=B1=82,=E4=BF=9D=E5=AD=98=E5=90=8E?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1022341 --user=王旭 【测试跟踪】github#21508,功能用例关联的devops需求,保存后回显为空 https://www.tapd.cn/55049933/s/1355940 --- .../case/components/BaseEditItemComponent.vue | 72 +++++++++++++++---- 1 file changed, 58 insertions(+), 14 deletions(-) diff --git a/test-track/frontend/src/business/case/components/BaseEditItemComponent.vue b/test-track/frontend/src/business/case/components/BaseEditItemComponent.vue index d32fd045d2..72ac27c10c 100644 --- a/test-track/frontend/src/business/case/components/BaseEditItemComponent.vue +++ b/test-track/frontend/src/business/case/components/BaseEditItemComponent.vue @@ -315,30 +315,74 @@ export default { }, getStoryPlatform() { let demandOptions = this.contentObject.content.demandOptions || []; + let optionPlatform = ""; if (demandOptions.length > 0) { - let demand = demandOptions.find((item) => { - return item.value === this.contentObject.content.demandId; - }); - if (demand) { - return this.handleDemandOptionPlatform(demand); + for (let i = 0; i < demandOptions.length; i++) { + if (demandOptions[i].value === this.contentObject.content.demandId) { + optionPlatform = this.handleDemandOptionPlatform(demandOptions[i]); + break; + } + if (demandOptions[i].children && demandOptions[i].children.length > 0) { + optionPlatform = this.findChilder( + demandOptions[i].children, + this.contentObject.content.demandId, + ); + } } } - return ""; + return optionPlatform; + }, + findChilder(data, demandId) { + let optionPlatform = ""; + if (data.children && data.children.length > 0) { + this.findChilder( + data.children, + demandId + ); + } + data.forEach((item) => { + if (item.value === demandId) { + optionPlatform = this.handleDemandOptionPlatform(item); + } + }); + return optionPlatform; }, getStoryLabel() { let demandOptions = this.contentObject.content.demandOptions || []; + let optionPlatform = ""; if (demandOptions.length > 0) { - let demand = demandOptions.find((item) => { - return item.value === this.contentObject.content.demandId; - }); - if (demand) { - if (demand.value === "other") { - return this.$t("test_track.case.other"); + for (let i = 0; i < demandOptions.length; i++) { + if (demandOptions[i].value === this.contentObject.content.demandId) { + optionPlatform = this.handleDemandOptionLabel(demandOptions[i]); + break; + } + if (demandOptions[i].children && demandOptions[i].children.length > 0) { + optionPlatform = this.findDemandOptionLabelChilder( + demandOptions[i].children, + this.contentObject.content.demandId, + ); + } + if (demandOptions[i].value === "other") { + optionPlatform = this.$t("test_track.case.other"); } - return this.handleDemandOptionLabel(demand); } } - return ""; + return optionPlatform; + }, + findDemandOptionLabelChilder(data, demandId) { + let optionPlatform = ""; + if (data.children && data.children.length > 0) { + this.findChilder( + data.children, + demandId + ); + } + data.forEach((item) => { + if (item.value === demandId) { + optionPlatform = this.handleDemandOptionLabel(item); + } + }); + return optionPlatform; }, handleDemandOptionPlatform(data) { if (data.platform) {