fix(接口自动化): 引用请求允许执行和复制操作
This commit is contained in:
parent
1f408959bc
commit
344e615ddb
|
@ -1,6 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<el-card class="api-component">
|
<el-card class="api-component">
|
||||||
<fieldset :disabled="data.disabled" class="ms-fieldset">
|
|
||||||
|
|
||||||
<div class="header" @click="active(data)">
|
<div class="header" @click="active(data)">
|
||||||
|
|
||||||
|
@ -16,7 +15,7 @@
|
||||||
<i class="icon el-icon-arrow-right" :class="{'is-active': data.active}"
|
<i class="icon el-icon-arrow-right" :class="{'is-active': data.active}"
|
||||||
@click="active(data)" v-if="data.type!='scenario'"/>
|
@click="active(data)" v-if="data.type!='scenario'"/>
|
||||||
<el-input :draggable="draggable" v-if="isShowInput && isShowNameInput" size="small" v-model="data.name" class="name-input"
|
<el-input :draggable="draggable" v-if="isShowInput && isShowNameInput" size="small" v-model="data.name" class="name-input"
|
||||||
@blur="isShowInput = false" :placeholder="$t('commons.input_name')" ref="nameEdit"/>
|
@blur="isShowInput = false" :placeholder="$t('commons.input_name')" ref="nameEdit" :disabled="data.disabled"/>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
{{data.name}}
|
{{data.name}}
|
||||||
<i class="el-icon-edit" style="cursor:pointer" @click="editName" v-tester v-if="data.referenced!='REF' && !data.disabled"/>
|
<i class="el-icon-edit" style="cursor:pointer" @click="editName" v-tester v-if="data.referenced!='REF' && !data.disabled"/>
|
||||||
|
@ -40,14 +39,15 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
|
<fieldset :disabled="data.disabled" class="ms-fieldset">
|
||||||
<el-collapse-transition>
|
<el-collapse-transition>
|
||||||
<div v-if="data.active && showCollapse" :draggable="draggable">
|
<div v-if="data.active && showCollapse" :draggable="draggable">
|
||||||
<el-divider></el-divider>
|
<el-divider></el-divider>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
</el-collapse-transition>
|
</el-collapse-transition>
|
||||||
</div>
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
|
||||||
</el-card>
|
</el-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,14 +1,22 @@
|
||||||
<template>
|
<template>
|
||||||
<el-dialog :title="$t('api_test.scenario.variables')" :close-on-click-modal="false"
|
<el-dialog :title="$t('api_test.scenario.variables')" :close-on-click-modal="false"
|
||||||
:visible.sync="visible" class="environment-dialog" width="60%"
|
:visible.sync="visible" class="environment-dialog" width="850px"
|
||||||
@close="close">
|
@close="close" v-loading="loading">
|
||||||
<div>
|
<div>
|
||||||
|
<el-input placeholder="变量名称搜索" style="width: 50%;margin: 0px 0px 20px" v-model="selectVariable" size="small" @change="filter" @keyup.enter="filter">
|
||||||
|
<el-select v-model="searchType" slot="prepend" placeholder="类型" style="width: 90px" @change="filter">
|
||||||
|
<el-option value="CONSTANT" label="常量"></el-option>
|
||||||
|
<el-option value="LIST" label="列表"></el-option>
|
||||||
|
<el-option value="CSV" label="CSV"></el-option>
|
||||||
|
<el-option value="COUNTER" label="计数器"></el-option>
|
||||||
|
<el-option value="RANDOM" label="随机数"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-input>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<div style="border:1px #DCDFE6 solid; min-height: 400px;border-radius: 4px ;width: 100% ;">
|
<div style="border:1px #DCDFE6 solid; min-height: 400px;border-radius: 4px ;width: 100% ;">
|
||||||
|
|
||||||
<el-table ref="table" border :data="variables" class="adjust-table" @select-all="select" @select="select"
|
<el-table ref="table" border :data="variables" class="adjust-table" @select-all="select" @select="select"
|
||||||
v-loading="loading" @row-click="edit">
|
v-loading="loading" @row-click="edit" height="400px" :row-class-name="tableRowClassName">
|
||||||
<el-table-column type="selection" width="38"/>
|
<el-table-column type="selection" width="38"/>
|
||||||
<el-table-column prop="num" label="ID" sortable/>
|
<el-table-column prop="num" label="ID" sortable/>
|
||||||
<el-table-column prop="name" :label="$t('api_test.variable_name')" sortable show-overflow-tooltip/>
|
<el-table-column prop="name" :label="$t('api_test.variable_name')" sortable show-overflow-tooltip/>
|
||||||
|
@ -49,8 +57,6 @@
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -63,7 +69,7 @@
|
||||||
import MsEditRandom from "./EditRandom";
|
import MsEditRandom from "./EditRandom";
|
||||||
import MsEditListValue from "./EditListValue";
|
import MsEditListValue from "./EditListValue";
|
||||||
import MsEditCsv from "./EditCsv";
|
import MsEditCsv from "./EditCsv";
|
||||||
import {getUUID} from "@/common/js/utils";
|
import {_filter, getUUID} from "@/common/js/utils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsVariableList",
|
name: "MsVariableList",
|
||||||
|
@ -80,6 +86,9 @@
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
variables: [],
|
variables: [],
|
||||||
|
searchType: "",
|
||||||
|
selectVariable: "",
|
||||||
|
condition: {},
|
||||||
types: new Map([
|
types: new Map([
|
||||||
['CONSTANT', '常量'],
|
['CONSTANT', '常量'],
|
||||||
['LIST', '列表'],
|
['LIST', '列表'],
|
||||||
|
@ -105,6 +114,12 @@
|
||||||
edit(row) {
|
edit(row) {
|
||||||
this.editData = row;
|
this.editData = row;
|
||||||
},
|
},
|
||||||
|
tableRowClassName(row) {
|
||||||
|
if (row.row.hidden) {
|
||||||
|
return 'ms-variable-hidden-row';
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
},
|
||||||
addParameters(v) {
|
addParameters(v) {
|
||||||
v.id = getUUID();
|
v.id = getUUID();
|
||||||
if (v.type === 'CSV') {
|
if (v.type === 'CSV') {
|
||||||
|
@ -133,10 +148,13 @@
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
let saveVariables = [];
|
let saveVariables = [];
|
||||||
this.variables.forEach(item => {
|
this.variables.forEach(item => {
|
||||||
|
item.hidden = undefined;
|
||||||
if (item.name && item.name != "") {
|
if (item.name && item.name != "") {
|
||||||
saveVariables.push(item);
|
saveVariables.push(item);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
this.selectVariable = "";
|
||||||
|
this.searchType = "";
|
||||||
this.$emit('setVariables', saveVariables);
|
this.$emit('setVariables', saveVariables);
|
||||||
},
|
},
|
||||||
deleteVariable() {
|
deleteVariable() {
|
||||||
|
@ -149,11 +167,46 @@
|
||||||
const index = this.variables.findIndex(d => d.id === row);
|
const index = this.variables.findIndex(d => d.id === row);
|
||||||
this.variables.splice(index, 1);
|
this.variables.splice(index, 1);
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
filter() {
|
||||||
|
let datas = [];
|
||||||
|
this.variables.forEach(item => {
|
||||||
|
if (this.searchType && this.searchType != "" && this.selectVariable && this.selectVariable != "") {
|
||||||
|
if ((item.type && item.type.toLowerCase().indexOf(this.searchType.toLowerCase()) == -1) || (item.name && item.name.toLowerCase().indexOf(this.selectVariable.toLowerCase()) == -1)) {
|
||||||
|
item.hidden = true;
|
||||||
|
} else {
|
||||||
|
item.hidden = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (this.selectVariable && this.selectVariable != "") {
|
||||||
|
if (item.name && item.name.toLowerCase().indexOf(this.selectVariable.toLowerCase()) == -1) {
|
||||||
|
item.hidden = true;
|
||||||
|
} else {
|
||||||
|
item.hidden = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (this.searchType && this.searchType != "") {
|
||||||
|
if (item.type && item.type.toLowerCase().indexOf(this.searchType.toLowerCase()) == -1) {
|
||||||
|
item.hidden = true;
|
||||||
|
} else {
|
||||||
|
item.hidden = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
datas.push(item);
|
||||||
|
})
|
||||||
|
this.variables = datas;
|
||||||
|
},
|
||||||
|
createFilter(queryString) {
|
||||||
|
return item => {
|
||||||
|
return (item.type && item.type.toLowerCase().indexOf(queryString.toLowerCase()) !== -1);
|
||||||
|
};
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style>
|
||||||
|
.ms-variable-hidden-row {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue