fix(接口测试): mock函数选择了右侧的具体函数后,此想取消是无法取消的

--bug=1009628 --user=王孝刚 【接口测试】github#9371,mock函数选择了右侧的具体函数后,此想取消是无法取消的
https://www.tapd.cn/55049933/s/1092702
This commit is contained in:
wxg0103 2022-01-17 10:39:57 +08:00 committed by jianxing
parent d90308c668
commit f2f85d7b55
2 changed files with 24 additions and 2 deletions

View File

@ -24,7 +24,7 @@
<el-row>
<el-col :span="12">
<el-radio size="mini" v-model="itemFunc.name" :label="func.name"
@change="methodChange(itemFunc, func)"/>
@change="methodChange(itemFunc, func)" @click.native.prevent="radioClick(itemFunc, func)"/>
</el-col>
<el-col :span="12" v-if="itemFunc.name === func.name">
<div v-for="(p, pIndex) in itemFunc.params" :key="`${itemIndex}-${funcIndex}-${pIndex}`">
@ -507,6 +507,17 @@
this.mockVariableFuncs.push(JSON.parse(JSON.stringify(func)));
this.showPreview();
},
radioClick(itemFunc, func) {
if (itemFunc.name === func.name) {
let index = this.mockVariableFuncs.indexOf(itemFunc);
this.mockVariableFuncs = this.mockVariableFuncs.slice(0, index);
this.mockVariableFuncs.push({name: '', params: []});
let valindex = this.itemValue.indexOf('|'+func.name);
this.itemValue = this.itemValue.slice(0,valindex);
}else {
this.methodChange(itemFunc, func);
}
},
addFunc() {
if(this.itemValue.indexOf('@') == -1){
this.itemValue = '@' + this.itemValue;

View File

@ -22,7 +22,7 @@
<el-row>
<el-col :span="12">
<el-radio size="mini" v-model="itemFunc.name" :label="func.name"
@change="methodChange(itemFunc, func)"/>
@change="methodChange(itemFunc, func)" @click.native.prevent="radioClick(itemFunc, func)"/>
</el-col>
<el-col :span="12" v-if="itemFunc.name === func.name">
<div v-for="(p, pIndex) in itemFunc.params" :key="`${itemIndex}-${funcIndex}-${pIndex}`">
@ -250,6 +250,17 @@ export default {
this.mockVariableFuncs.push(JSON.parse(JSON.stringify(func)));
this.showPreview();
},
radioClick(itemFunc, func) {
if (itemFunc.name === func.name) {
let index = this.mockVariableFuncs.indexOf(itemFunc);
this.mockVariableFuncs = this.mockVariableFuncs.slice(0, index);
this.mockVariableFuncs.push({name: '', params: []});
let valindex = this.itemValue.indexOf('|'+func.name);
this.itemValue = this.itemValue.slice(0,valindex);
}else {
this.methodChange(itemFunc, func);
}
},
addFunc() {
if (this.itemValue.indexOf('@') == -1) {
this.itemValue = '@' + this.itemValue;