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 <ms-node-tree
v-loading="result.loading" v-loading="result.loading"
:tree-nodes="data" :tree-nodes="data"
:allLabel="$t('commons.all_module_title')"
:type="isReadOnly ? 'view' : 'edit'" :type="isReadOnly ? 'view' : 'edit'"
@add="add" @add="add"
@edit="edit" @edit="edit"

View File

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

View File

@ -15,7 +15,7 @@
</el-form-item> </el-form-item>
<el-form-item prop="enable"> <el-form-item prop="enable">
<span class="ms-env-span">{{$t('api_test.environment.condition_enable')}}</span> <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="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="MODULE">{{$t('test_track.module.module')}}</el-radio>
<el-radio label="PATH">{{$t('api_test.definition.api_path')}}</el-radio> <el-radio label="PATH">{{$t('api_test.definition.api_path')}}</el-radio>
@ -123,6 +123,7 @@
loading: false, loading: false,
pathDetails: new KeyValue({name: "", value: "contains"}), pathDetails: new KeyValue({name: "", value: "contains"}),
condition: {type: "NONE", details: [new KeyValue({name: "", value: "contains"})], protocol: "http", socket: "", domain: "", port: 0, headers: [new KeyValue()]}, condition: {type: "NONE", details: [new KeyValue({name: "", value: "contains"})], protocol: "http", socket: "", domain: "", port: 0, headers: [new KeyValue()]},
beforeCondition: {}
}; };
}, },
watch: { watch: {
@ -201,8 +202,14 @@
}); });
} }
} }
this.beforeCondition = JSON.parse(JSON.stringify(this.condition));
}, },
typeChange() { 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) { switch (this.condition.type) {
case "NONE": case "NONE":
this.condition.details = []; this.condition.details = [];
@ -263,11 +270,13 @@
this.loading = false this.loading = false
}); });
}, },
checkNode() { checkNode(id) {
let index = 1; let index = 1;
this.httpConfig.conditions.forEach(item => { this.httpConfig.conditions.forEach(item => {
if (item.type === "NONE") { if (item.type === "NONE") {
index++; if(!id || id !== item.id) {
index++;
}
} }
}) })
return index > 1; return index > 1;

View File

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

View File

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

View File

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