fix(接口定义): 修复esb格式的数据保存console报错的缺陷 (#18183)
--bug=1017169 --user=王孝刚 【接口测试】编辑tcp-esb格式接口,保存时console报错 https://www.tapd.cn/55049933/s/1249939 Co-authored-by: wxg0103 <727495428@qq.com>
This commit is contained in:
parent
cf5a14ddcb
commit
d695c65e03
|
@ -207,6 +207,12 @@ export default {
|
|||
});
|
||||
}
|
||||
},
|
||||
'basisData.method': {
|
||||
handler(v) {
|
||||
this.changeApiProtocol(v);
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
openHis() {
|
||||
|
@ -215,49 +221,12 @@ export default {
|
|||
callback() {
|
||||
this.validated = true;
|
||||
},
|
||||
refreshEsbDataStruct(esbDataStruct) {
|
||||
if (esbDataStruct && esbDataStruct.length > 0) {
|
||||
esbDataStruct.forEach(row => {
|
||||
row.status = "";
|
||||
if (row.children == null || row.children.length === 0) {
|
||||
row.children = [];
|
||||
} else if (row.children.length > 0) {
|
||||
this.refreshEsbDataStruct(row.children);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
checkEsbDataStructData(esbDataStruct) {
|
||||
let allCheckResult = true;
|
||||
if (esbDataStruct && esbDataStruct.length > 0) {
|
||||
for (let i = 0; i < esbDataStruct.length; i++) {
|
||||
let row = esbDataStruct[i];
|
||||
allCheckResult = this.$refs.esbTable.validateRowData(row);
|
||||
if (allCheckResult) {
|
||||
if (row.children != null && row.children.length > 0) {
|
||||
allCheckResult = this.checkEsbDataStructData(row.children);
|
||||
if (!allCheckResult) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return allCheckResult;
|
||||
},
|
||||
validateEsbDataStruct(esbDataStruct) {
|
||||
this.refreshEsbDataStruct(esbDataStruct);
|
||||
const result = this.checkEsbDataStructData(esbDataStruct);
|
||||
return result;
|
||||
},
|
||||
saveApi() {
|
||||
if (this.basisData.tags instanceof Array) {
|
||||
this.basisData.tags = JSON.stringify(this.basisData.tags);
|
||||
}
|
||||
if (this.basisData.method == 'ESB') {
|
||||
let validataResult = this.validateEsbDataStruct(this.request.esbDataStruct);
|
||||
if (this.basisData.method === 'ESB') {
|
||||
let validataResult = this.$refs.esbDefinition.validateEsbDataStruct(this.request.esbDataStruct);
|
||||
if (!validataResult) {
|
||||
return;
|
||||
}
|
||||
|
@ -291,7 +260,7 @@ export default {
|
|||
if (this.basisData.tags instanceof Array) {
|
||||
this.basisData.tags = JSON.stringify(this.basisData.tags);
|
||||
}
|
||||
if (this.basisData.method == 'ESB') {
|
||||
if (this.basisData.method === 'ESB') {
|
||||
let validataResult = this.$refs.esbDefinition.validateEsbDataStruct(this.request.esbDataStruct);
|
||||
if (!validataResult) {
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue