fix(接口自动化): 解决保存报错问题

--user=郭雨琦 解决保存报错问题
This commit is contained in:
guoyuqi 2022-01-20 14:21:58 +08:00 committed by song-tianyang
parent 4b703355c7
commit c4ed4d768a
3 changed files with 10 additions and 7 deletions

View File

@ -71,11 +71,14 @@ export default {
this.currentScenario[this.prop] = this.innerTags;
},
'currentScenario.tags'() {
if(Object.prototype.toString.call(this.currentScenario.tags)==="[object String]"){
this.innerTags = JSON.parse(this.currentScenario.tags);
}else{
this.innerTags = this.currentScenario.tags
if(this.prop==='tags'){
if(!this.currentScenario[this.prop]||this.currentScenario[this.prop]===''||this.currentScenario[this.prop].length===0){
if(this.innerTags.length!==0){
this.innerTags=[];
}
}
}
},
},
methods: {

View File

@ -251,7 +251,7 @@ export default {
},
saveApi(data) {
this.$emit("saveApi", data);
if (data != null && data.tags != 'null' && data.tags != undefined) {
if (data != null && data.tags !== 'null' && data.tags !== undefined) {
if (Object.prototype.toString.call(data.tags)==="[object String]") {
data.tags = JSON.parse(data.tags);
}

View File

@ -55,7 +55,7 @@
<div v-if="oldApiProtocol==='TCP'">
<p class="tip">{{ $t('api_test.definition.request.req_param') }} </p>
<ms-tcp-format-parameters :show-script="false" :request="oldRequest" :is-read-only="true" ref="tcpFormatParameter"/>
<ms-tcp-format-parameters :show-script="false" :request="oldRequest" ref="tcpFormatParameter"/>
</div>
<div v-else-if="oldApiProtocol==='ESB'">
<p class="tip">{{ $t('api_test.definition.request.req_param') }} </p>
@ -132,7 +132,7 @@
<!-- 请求参数 -->
<div v-if="apiProtocol=='TCP'">
<p class="tip">{{ $t('api_test.definition.request.req_param') }} </p>
<ms-tcp-format-parameters :show-script="false" :request="request" :is-read-only="true" ref="tcpFormatParameter"/>
<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>