fix(项目设置): 修复环境配置中http配置模块条件控制台报错的缺陷 (#15993)

--bug=1015066 --user=王孝刚 [接口测试]#15958v1.20.10 环境配置 - http配置 - 启用条件选择模块 -
选择模块保存后无法删除 https://www.tapd.cn/55049933/s/1205075

Co-authored-by: wxg0103 <727495428@qq.com>
This commit is contained in:
MeterSphere Bot 2022-07-21 11:32:13 +08:00 committed by GitHub
parent d084fb13a3
commit 8964dec435
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 58 additions and 52 deletions

View File

@ -46,53 +46,53 @@
<el-col :span="12">
<div style="border:1px #DCDFE6 solid; min-height: 400px;border-radius: 4px ;width: 100% ;">
<ms-table
v-loading="loading"
row-key="id"
:data="variables"
:total="variables.length"
:screen-height="screenHeight"
:batch-operators="batchButtons"
:remember-order="true"
:highlightCurrentRow="true"
:fields.sync="fields"
:field-key="tableHeaderKey"
@handleRowClick="handleRowClick"
@refresh="onChange"
ref="variableTable">
v-loading="loading"
row-key="id"
:data="variables"
:total="variables.length"
:screen-height="screenHeight"
:batch-operators="batchButtons"
:remember-order="true"
:highlightCurrentRow="true"
:fields.sync="fields"
:field-key="tableHeaderKey"
@handleRowClick="handleRowClick"
@refresh="onChange"
ref="variableTable">
<span v-for="item in fields" :key="item.key">
<ms-table-column
prop="num"
:field="item"
:fields-width="fieldsWidth"
sortable
label="ID"
min-width="60">
prop="num"
:field="item"
:fields-width="fieldsWidth"
sortable
label="ID"
min-width="60">
</ms-table-column>
<ms-table-column
prop="name"
:field="item"
:fields-width="fieldsWidth"
:label="$t('api_test.variable_name')"
min-width="100"
sortable>
prop="name"
:field="item"
:fields-width="fieldsWidth"
:label="$t('api_test.variable_name')"
min-width="100"
sortable>
</ms-table-column>
<ms-table-column
prop="type"
:field="item"
:fields-width="fieldsWidth"
:label="$t('test_track.case.type')"
min-width="70"
sortable>
prop="type"
:field="item"
:fields-width="fieldsWidth"
:label="$t('test_track.case.type')"
min-width="70"
sortable>
<template v-slot:default="scope">
<span>{{ types.get(scope.row.type) }}</span>
</template>
</ms-table-column>
<ms-table-column
prop="value"
:field="item"
:fields-width="fieldsWidth"
:label="$t('api_test.value')"
sortable>
prop="value"
:field="item"
:fields-width="fieldsWidth"
:label="$t('api_test.value')"
sortable>
</ms-table-column>
</span>
</ms-table>
@ -368,7 +368,7 @@ export default {
this.editData = {delimiter: ",", quotedData: 'false', files: []};
this.editData.type = this.selectType;
this.showDelete = false;
if (this.editData.type === 'CSV') {
if (this.editData.type === 'CSV' && this.$refs.csv) {
this.$refs.csv.cleanPreview();
}
this.$refs.variableTable.cancelCurrentRow();
@ -455,7 +455,7 @@ export default {
this.variables.forEach(item => {
if (this.searchType && this.searchType != "" && this.selectVariable && this.selectVariable != "") {
if ((item.type && item.type.toLowerCase().indexOf(this.searchType.toLowerCase()) == -1 && this.searchType != 'ALL')
|| (item.name && item.name.toLowerCase().indexOf(this.selectVariable.toLowerCase()) == -1)) {
|| (item.name && item.name.toLowerCase().indexOf(this.selectVariable.toLowerCase()) == -1)) {
item.hidden = true;
} else {
item.hidden = undefined;

View File

@ -1,7 +1,8 @@
<template>
<div v-loading="loading">
<div class="mask" v-show="isShowSelect"></div>
<el-popover placement="bottom-start" :width="popoverWidth" trigger="manual" v-model="isShowSelect" @hide="popoverHide" v-outside-click="outsideClick">
<el-popover placement="bottom-start" :width="popoverWidth" trigger="manual" v-model="isShowSelect"
@hide="popoverHide" v-outside-click="outsideClick">
<el-input
size="mini"
prefix-icon="el-icon-search"
@ -32,7 +33,9 @@
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
<el-row>
<el-button v-if="multiple" class="ok" @click="isShowSelect=false" size="mini" type="text">{{ $t('commons.confirm') }}</el-button>
<el-button v-if="multiple" class="ok" @click="isShowSelect=false" size="mini" type="text">
{{ $t('commons.confirm') }}
</el-button>
</el-row>
</el-popover>
</div>
@ -271,8 +274,11 @@ export default {
});
this.returnDatas = t;
}
this.selectNodeIds = [];
this.getChildNodeId(data, this.selectNodeIds);
if (data) {
this.getChildNodeId(data, this.selectNodeIds);
}
},
getChildNodeId(rootNode, nodeIds) {
//ID
@ -318,7 +324,7 @@ export default {
this.options = [];
thisKeys.map((item) => {//option
let node = this.$refs.tree.getNode(item); // node
if(node){
if (node) {
t.push(node.data);
this.options.push({label: node.label, value: node.key});
return {label: node.label, value: node.key};
@ -429,26 +435,26 @@ export default {
},
deep: true
},
defaultKey:{
handler:function(){
defaultKey: {
handler: function () {
this.init();
if(this.data && this.data.length > 0){
if(this.defaultKey instanceof Array){
if (this.data && this.data.length > 0) {
if (this.defaultKey instanceof Array) {
this.$refs.tree.setCheckedKeys(this.defaultKey);
}
}
},
deep:true
deep: true
},
data:{
handler:function(){
if(this.defaultKey && this.defaultKey.length > 0 && this.defaultKey instanceof Array){
if(this.defaultKey instanceof Array){
data: {
handler: function () {
if (this.defaultKey && this.defaultKey.length > 0 && this.defaultKey instanceof Array) {
if (this.defaultKey instanceof Array) {
this.$refs.tree.setCheckedKeys(this.defaultKey);
}
}
},
deep:true
deep: true
},
filterText(val) {
this.$nextTick(() => {