fix(接口定义): 修复接口定义esb,sql保存失败的缺陷 (#17966)
--bug=1016832 --user=王孝刚 【接口测试】创建、编辑 TCP-ESB / SQL / DUBBO 接口报错 https://www.tapd.cn/55049933/s/1244488 Co-authored-by: wxg0103 <727495428@qq.com>
This commit is contained in:
parent
db2acf70d0
commit
1058e54655
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div v-loading="isloading">
|
||||
<el-form ref="apiForm" :model="basicForm" :rules="rules" class="case-form" label-position="right"
|
||||
label-width="100px"
|
||||
label-width="80px"
|
||||
size="small"
|
||||
style="margin-left: 5px;margin-right: 5px">
|
||||
<ms-form-divider :title="$t('test_track.plan_view.base_info')"/>
|
||||
|
@ -64,10 +64,9 @@
|
|||
size="small" type="textarea"/>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
|
||||
<!-- 自定义字段 -->
|
||||
<el-form v-if="isFormAlive" ref="customFieldForm" :model="customFieldForm" :rules="customFieldRules"
|
||||
class="case-form" label-position="right" label-width="100px"
|
||||
class="case-form" label-position="right" label-width="80px"
|
||||
size="small">
|
||||
<custom-filed-form-row :default-open="defaultOpen"
|
||||
:disabled="readOnly"
|
||||
|
|
|
@ -165,14 +165,7 @@ export default {
|
|||
callback() {
|
||||
this.validated = true;
|
||||
},
|
||||
validateApi() {
|
||||
this.validated = false;
|
||||
this.basisData.method = this.request.protocol;
|
||||
this.$refs['basicForm'].validate();
|
||||
},
|
||||
saveApi() {
|
||||
this.validateApi();
|
||||
if (this.validated) {
|
||||
this.basisData.request = this.request;
|
||||
if (this.basisData.tags instanceof Array) {
|
||||
this.basisData.tags = JSON.stringify(this.basisData.tags);
|
||||
|
@ -180,11 +173,10 @@ export default {
|
|||
this.$emit('saveApi', this.basisData);
|
||||
this.$store.state.apiStatus.set("fromChange", false);
|
||||
this.$store.state.apiMap.set(this.basisData.id, this.$store.state.apiStatus);
|
||||
} else {
|
||||
if (this.$refs.versionHistory) {
|
||||
this.$refs.versionHistory.loading = false;
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
runTest() {
|
||||
this.validateApi();
|
||||
|
|
|
@ -172,13 +172,7 @@ export default {
|
|||
callback() {
|
||||
this.validated = true;
|
||||
},
|
||||
validateApi() {
|
||||
this.validated = false;
|
||||
this.$refs['basicForm'].validate();
|
||||
},
|
||||
saveApi() {
|
||||
this.validateApi();
|
||||
if (this.validated) {
|
||||
this.basisData.method = this.basisData.protocol;
|
||||
if (this.basisData.tags instanceof Array) {
|
||||
this.basisData.tags = JSON.stringify(this.basisData.tags);
|
||||
|
@ -186,11 +180,9 @@ export default {
|
|||
this.$emit('saveApi', this.basisData);
|
||||
this.$store.state.apiStatus.set("fromChange", false);
|
||||
this.$store.state.apiMap.set(this.basisData.id, this.$store.state.apiStatus);
|
||||
} else {
|
||||
if (this.$refs.versionHistory) {
|
||||
this.$refs.versionHistory.loading = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
runTest() {
|
||||
this.validateApi();
|
||||
|
|
|
@ -215,12 +215,49 @@ 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.$refs.esbDefinition.validateEsbDataStruct(this.request.esbDataStruct);
|
||||
let validataResult = this.validateEsbDataStruct(this.request.esbDataStruct);
|
||||
if (!validataResult) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue