fix(接口测试): 修复清空环境模块信息,没有生效的缺陷

This commit is contained in:
wxg0103 2023-04-24 13:49:33 +08:00 committed by fit2-zhao
parent dffd2c266f
commit 2d8f0a908d
2 changed files with 13 additions and 3 deletions

View File

@ -32,7 +32,7 @@
</el-radio-group> </el-radio-group>
<div v-if="condition.type === 'MODULE'" style="margin-top: 6px"> <div v-if="condition.type === 'MODULE'" style="margin-top: 6px">
<ms-select-tree size="small" :data="moduleOptions" :default-key="condition.ids" @getValue="setModule" <ms-select-tree size="small" :data="moduleOptions" :default-key="condition.ids" @getValue="setModule"
:obj="moduleObj" clearable :checkStrictly="true" multiple v-if="!loading"/> :obj="moduleObj" clearable :checkStrictly="true" multiple v-if="!loading" @clean="clean"/>
</div> </div>
<div v-if="condition.type === 'PATH'" style="margin-top: 6px"> <div v-if="condition.type === 'PATH'" style="margin-top: 6px">
<el-input v-model="pathDetails.name" :placeholder="$t('api_test.value')" clearable size="small"> <el-input v-model="pathDetails.name" :placeholder="$t('api_test.value')" clearable size="small">
@ -326,6 +326,10 @@ export default {
}); });
} }
}, },
clean() {
this.condition.details = [];
this.condition.ids = [];
},
update() { update() {
const index = this.httpConfig.conditions.findIndex((d) => d.id === this.condition.id); const index = this.httpConfig.conditions.findIndex((d) => d.id === this.condition.id);
this.validateSocket(this.condition.socket); this.validateSocket(this.condition.socket);
@ -451,6 +455,7 @@ export default {
if (socket.startsWith("${")){ if (socket.startsWith("${")){
let split = socket.split(":"); let split = socket.split(":");
this.condition.domain = split[0]; this.condition.domain = split[0];
return true;
} }
this.condition.port = url.port; this.condition.port = url.port;
let path = url.pathname === "/" ? "" : url.pathname; let path = url.pathname === "/" ? "" : url.pathname;

View File

@ -32,7 +32,7 @@
</el-radio-group> </el-radio-group>
<div v-if="condition.type === 'MODULE'" style="margin-top: 6px"> <div v-if="condition.type === 'MODULE'" style="margin-top: 6px">
<ms-select-tree size="small" :data="moduleOptions" :default-key="condition.ids" @getValue="setModule" <ms-select-tree size="small" :data="moduleOptions" :default-key="condition.ids" @getValue="setModule"
:obj="moduleObj" clearable :checkStrictly="true" multiple v-if="!loading"/> :obj="moduleObj" clearable :checkStrictly="true" multiple v-if="!loading" @clean="clean"/>
</div> </div>
<div v-if="condition.type === 'PATH'" style="margin-top: 6px"> <div v-if="condition.type === 'PATH'" style="margin-top: 6px">
<el-input v-model="pathDetails.name" :placeholder="$t('api_test.value')" clearable size="small"> <el-input v-model="pathDetails.name" :placeholder="$t('api_test.value')" clearable size="small">
@ -62,7 +62,7 @@
{{ $t('commons.add') }} {{ $t('commons.add') }}
</el-button> </el-button>
<div v-else> <div v-else>
<el-button type="primary" style="float: right;margin-left: 10px" size="mini" @click="clear"> <el-button type="primary" style="float: right;margin-left: 10px" size="mini" @click="clear()">
{{ $t('commons.clear') }} {{ $t('commons.clear') }}
</el-button> </el-button>
<el-button type="primary" style="float: right" size="mini" @click="update(condition)">{{ <el-button type="primary" style="float: right" size="mini" @click="update(condition)">{{
@ -331,6 +331,10 @@ export default {
}); });
} }
}, },
clean() {
this.condition.details = [];
this.condition.ids = [];
},
update() { update() {
const index = this.httpConfig.conditions.findIndex((d) => d.id === this.condition.id); const index = this.httpConfig.conditions.findIndex((d) => d.id === this.condition.id);
this.validateSocket(this.condition.socket); this.validateSocket(this.condition.socket);
@ -456,6 +460,7 @@ export default {
if (socket.startsWith("${")){ if (socket.startsWith("${")){
let split = socket.split(":"); let split = socket.split(":");
this.condition.domain = split[0]; this.condition.domain = split[0];
return true;
} }
this.condition.port = url.port; this.condition.port = url.port;
let path = url.pathname === "/" ? "" : url.pathname; let path = url.pathname === "/" ? "" : url.pathname;