fix(接口测试): 修复创建场景附件丢失问题

--bug=1011218 --user=赵勇 【接口自动化】-创建新场景-导入api接口-post请求-请求体格式是file-上传的excel-保存场景后文件丢失 https://www.tapd.cn/55049933/s/1118298
This commit is contained in:
fit2-zhao 2022-03-15 17:51:59 +08:00 committed by 刘瑞斌
parent 628d372feb
commit 51a9d7c1d0
1 changed files with 24 additions and 1 deletions

View File

@ -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 => {