From 51a9d7c1d09ad60e7e5f63a463f53ae89ddbdf01 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Tue, 15 Mar 2022 17:51:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=9B=E5=BB=BA=E5=9C=BA=E6=99=AF=E9=99=84?= =?UTF-8?q?=E4=BB=B6=E4=B8=A2=E5=A4=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1011218 --user=赵勇 【接口自动化】-创建新场景-导入api接口-post请求-请求体格式是file-上传的excel-保存场景后文件丢失 https://www.tapd.cn/55049933/s/1118298 --- .../automation/scenario/EditApiScenario.vue | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index f7396d53bd..e89f6f92a5 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -611,7 +611,9 @@ export default { let data = JSON.parse(res.data); if (data.hashTree) { this.sort(data.hashTree); - this.scenarioDefinition = data.hashTree; + let domainMap = new Map(); + this.getEnvDomain(data.hashTree, domainMap); + this.margeDomain(this.scenarioDefinition, domainMap); if (this.$store.state.currentApiCase) { this.$store.state.currentApiCase.resetDataSource = getUUID(); } else { @@ -622,6 +624,27 @@ export default { }) } }, + margeDomain(array, map) { + array.forEach(item => { + if (item && map.has(item.resourceId)) { + item.domain = map.get(item.resourceId); + item.resourceId = getUUID(); + } + if (item && item.hashTree && item.hashTree.length > 0) { + this.margeDomain(item.hashTree, map); + } + }) + }, + getEnvDomain(array, map) { + array.forEach(item => { + if (item && item.resourceId && item.domain) { + map.set(item.resourceId, item.domain); + } + if (item && item.hashTree && item.hashTree.length > 0) { + this.getEnvDomain(item.hashTree, map); + } + }) + }, initPlugins() { if (this.plugins) { this.plugins.forEach(item => {