fix(系统设置): 修复环境类型不能修改问题。

This commit is contained in:
fit2-zhao 2021-05-08 13:39:46 +08:00 committed by fit2-zhao
parent 17c16e0989
commit f2e6767f6d
6 changed files with 17 additions and 3 deletions

View File

@ -6,6 +6,7 @@
<ms-node-tree
v-loading="result.loading"
:tree-nodes="data"
:allLabel="$t('commons.all_module_title')"
:type="isReadOnly ? 'view' : 'edit'"
@add="add"
@edit="edit"

View File

@ -7,6 +7,7 @@
v-loading="result.loading"
:tree-nodes="data"
:type="isReadOnly ? 'view' : 'edit'"
:allLabel="$t('commons.all_module_title')"
@add="add"
@edit="edit"
@drag="drag"

View File

@ -15,7 +15,7 @@
</el-form-item>
<el-form-item prop="enable">
<span class="ms-env-span">{{$t('api_test.environment.condition_enable')}}</span>
<el-radio-group v-model="condition.type" @change="typeChange" :disabled="condition.id!==undefined && condition.id!==''">
<el-radio-group v-model="condition.type" @change="typeChange">
<el-radio label="NONE">{{ $t('api_test.definition.document.data_set.none') }}</el-radio>
<el-radio label="MODULE">{{$t('test_track.module.module')}}</el-radio>
<el-radio label="PATH">{{$t('api_test.definition.api_path')}}</el-radio>
@ -123,6 +123,7 @@
loading: false,
pathDetails: new KeyValue({name: "", value: "contains"}),
condition: {type: "NONE", details: [new KeyValue({name: "", value: "contains"})], protocol: "http", socket: "", domain: "", port: 0, headers: [new KeyValue()]},
beforeCondition: {}
};
},
watch: {
@ -201,8 +202,14 @@
});
}
}
this.beforeCondition = JSON.parse(JSON.stringify(this.condition));
},
typeChange() {
if (this.condition.type === "NONE" && this.condition.id && this.checkNode(this.condition.id)) {
this.condition.type = this.beforeCondition.type;
this.$warning("启用条件为 '无' 的域名已经存在!");
return;
}
switch (this.condition.type) {
case "NONE":
this.condition.details = [];
@ -263,11 +270,13 @@
this.loading = false
});
},
checkNode() {
checkNode(id) {
let index = 1;
this.httpConfig.conditions.forEach(item => {
if (item.type === "NONE") {
index++;
if(!id || id !== item.id) {
index++;
}
}
})
return index > 1;

View File

@ -155,6 +155,7 @@ export default {
node_name_tip: "The name cannot contain'\\'",
more_operator: "More operator",
mock: "Mock settings",
all_module_title: "All module",
table: {
select_tip: "Item {0} data is selected"
},

View File

@ -156,6 +156,7 @@ export default {
node_name_tip: "名称不能包含'\\'",
more_operator: "更多操作",
mock: "Mock 设置",
all_module_title: "全部模块",
table: {
select_tip: "已选中 {0} 条数据"
},

View File

@ -156,6 +156,7 @@ export default {
node_name_tip: "名稱不能包含'\\'",
more_operator: "更多操作",
mock: "Mock 設置",
all_module_title: "全部模塊",
table: {
select_tip: "已選中 {0} 條數據"
},