fix(接口测试): 修复修改环境通用配置参数值不生效的缺陷

--bug=1029593 --user=王孝刚 【接口测试】github#26430,接口测试-选择环境配置,修改通用配置里的参数值后没有生效
https://www.tapd.cn/55049933/s/1410282
This commit is contained in:
wxg0103 2023-08-31 10:00:05 +08:00 committed by fit2-zhao
parent 98b52d0c32
commit e84d8c93c1
3 changed files with 12 additions and 1 deletions

View File

@ -1,7 +1,7 @@
<template>
<div>
<el-form :model="commonConfig" :rules="rules" ref="commonConfig" :disabled="isReadOnly" label-width="30px">
<ms-api-scenario-variables :show-copy="false" :items="commonConfig.variables" :is-read-only="isReadOnly"/>
<ms-api-scenario-variables :show-copy="false" :items="commonConfig.variables" :is-read-only="isReadOnly" ref="apiScenario"/>
<el-form-item>
<el-switch v-model="commonConfig.enableHost" active-text="Hosts"/>
<el-tooltip class="hostItem" effect="dark" :content="$t('api_test.home_page.host_config')" placement="right">
@ -70,6 +70,11 @@ export default {
}
},
methods: {
mergeData() {
if (this.$refs.apiScenario) {
this.commonConfig.variables = this.$refs['apiScenario'].allData;
}
},
validate() {
let isValidate = false;
this.$refs['commonConfig'].validate((valid) => {

View File

@ -350,6 +350,9 @@ export default {
save() {
this.$refs['environment'].validate((valid) => {
if (valid && this.$refs.commonConfig.validate() && this.$refs.httpConfig.validate()) {
if (this.$refs.commonConfig) {
this.$refs.commonConfig.mergeData();
}
this._save(this.environment);
}
});

View File

@ -350,6 +350,9 @@ export default {
save() {
this.$refs['environment'].validate((valid) => {
if (valid && this.$refs.commonConfig.validate() && this.$refs.httpConfig.validate()) {
if (this.$refs.commonConfig) {
this.$refs.commonConfig.mergeData();
}
this._save(this.environment);
}
});