feat(接口定义): TCP接口交互增加了对旧数据的处理以及恢复了请求参数标签配置页
--bug=1004980 --user=宋天阳 TCP协议问题汇总 https://www.tapd.cn/55049933/s/1024845
This commit is contained in:
parent
855a84d98b
commit
25f1c1ffdd
|
@ -168,7 +168,11 @@ public class TcpTreeTableDataStruct {
|
|||
|
||||
if (element != null) {
|
||||
if (this.children == null || this.children.isEmpty()) {
|
||||
element.addText(this.value);
|
||||
if(this.value == null){
|
||||
element.addText("");
|
||||
}else {
|
||||
element.addText(this.value);
|
||||
}
|
||||
} else {
|
||||
for (TcpTreeTableDataStruct child : children) {
|
||||
child.genXmlElementByChildren(element);
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<div v-if="apiProtocol=='TCP'">
|
||||
<p class="tip">{{ $t('api_test.definition.request.req_param') }} </p>
|
||||
<!-- <ms-basis-parameters :show-script="false" :request="request"/>-->
|
||||
<ms-tcp-format-parameters :show-script="false" :request="request"/>
|
||||
<ms-tcp-format-parameters :show-script="false" :request="request" ref="tcpFormatParameter"/>
|
||||
</div>
|
||||
<div v-else-if="apiProtocol=='ESB'">
|
||||
<p class="tip">{{ $t('api_test.definition.request.req_param') }} </p>
|
||||
|
@ -153,6 +153,8 @@ export default {
|
|||
if(this.request.backScript != null){
|
||||
this.basisData.backScript = JSON.stringify(this.request.backScript);
|
||||
}
|
||||
}else{
|
||||
this.$refs.tcpFormatParameter.validateXmlDataStruct();
|
||||
}
|
||||
this.$emit('saveApi', this.basisData);
|
||||
}
|
||||
|
@ -179,6 +181,8 @@ export default {
|
|||
if (this.request.backScript != null) {
|
||||
this.basisData.backScript = JSON.stringify(this.request.backScript);
|
||||
}
|
||||
}else{
|
||||
this.$refs.tcpFormatParameter.validateXmlDataStruct();
|
||||
}
|
||||
this.$emit('runTest', this.basisData);
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ export default {
|
|||
},
|
||||
add: function (r) {
|
||||
let row = this.getNewRow(null);
|
||||
this.pushTableData(row);
|
||||
this.pushTableData(row,"root");
|
||||
},
|
||||
nextRow:function (row) {
|
||||
//首先保存当前行内容
|
||||
|
@ -223,7 +223,9 @@ export default {
|
|||
if(this.tableData){
|
||||
this.$emit("initXmlTableData");
|
||||
}
|
||||
this.tableData.push(dataRow);
|
||||
this.$emit("xmlTablePushRow",dataRow);
|
||||
} else if(rowId === "root"){
|
||||
this.$emit("xmlTablePushRow",dataRow);
|
||||
}else {
|
||||
this.appendDataWithDeepForeach(this.tableData,rowId,dataRow);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,16 @@
|
|||
<div style="border:1px #DCDFE6 solid; height: 100%;border-radius: 4px ;width: 100% ;margin: 10px">
|
||||
<el-form class="tcp" :model="request" :rules="rules" ref="request" :disabled="isReadOnly" style="margin: 20px">
|
||||
<el-tabs v-model="activeName" class="request-tabs">
|
||||
<!--test-->
|
||||
<el-tab-pane name="parameters">
|
||||
<template v-slot:label>
|
||||
{{$t('api_test.definition.request.req_param')}}
|
||||
<ms-instructions-icon :content="$t('api_test.definition.request.tcp_parameter_tip')"/>
|
||||
</template>
|
||||
<ms-api-variable :is-read-only="isReadOnly" :parameters="request.parameters"/>
|
||||
</el-tab-pane>
|
||||
<!--test-->
|
||||
|
||||
<!--query 参数-->
|
||||
<el-tab-pane :label="$t('api_test.definition.document.request_body')" name="request">
|
||||
<el-radio-group v-model="reportType" size="mini" style="margin: 10px 0px;">
|
||||
|
@ -20,6 +30,7 @@
|
|||
</el-radio-group>
|
||||
<div style="min-width: 1200px;" v-if="request.reportType === 'xml'">
|
||||
<tcp-xml-table :table-data="request.xmlDataStruct" :show-options-button="true"
|
||||
@xmlTablePushRow="xmlTablePushRow"
|
||||
@initXmlTableData="initXmlTableData"
|
||||
@saveTableData="saveXmlTableData" ref="treeTable"></tcp-xml-table>
|
||||
</div>
|
||||
|
@ -221,6 +232,13 @@
|
|||
this.getEnvironments();
|
||||
|
||||
if(this.request){
|
||||
|
||||
//处理各种旧数据
|
||||
if(!this.request.xmlDataStruct && !this.request.jsonDataStruct && !this.request.rawDataStruct){
|
||||
this.request.rawDataStruct = this.request.request;
|
||||
this.request.reportType = "raw";
|
||||
}
|
||||
|
||||
if(!this.request.reportType){
|
||||
this.request.reportType = "raw";
|
||||
}else {
|
||||
|
@ -229,7 +247,6 @@
|
|||
}
|
||||
}
|
||||
this.reportType = this.request.reportType;
|
||||
|
||||
if(!this.request.xmlDataStruct){
|
||||
this.initXmlTableData();
|
||||
}
|
||||
|
@ -358,10 +375,12 @@
|
|||
this.refreshXmlTable();
|
||||
}
|
||||
},
|
||||
validateXmlDataStruct(dataStruct){
|
||||
this.refreshXmlTableDataStruct(dataStruct);
|
||||
let result = this.checkXmlTableDataStructData(dataStruct);
|
||||
return result;
|
||||
validateXmlDataStruct(){
|
||||
if(this.request.xmlDataStruct){
|
||||
this.refreshXmlTableDataStruct(this.request.xmlDataStruct);
|
||||
let result = this.checkXmlTableDataStructData(this.request.xmlDataStruct);
|
||||
return result;
|
||||
}
|
||||
},
|
||||
refreshXmlTableDataStruct(dataStruct){
|
||||
if(dataStruct && dataStruct.length > 0){
|
||||
|
@ -438,6 +457,9 @@
|
|||
this.$nextTick(() => {
|
||||
this.refreshedXmlTable = false
|
||||
})
|
||||
},
|
||||
xmlTablePushRow(row){
|
||||
this.request.xmlDataStruct.push(row);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue