feat(接口自动化): 循环状态控制 ,当循环下只有一个请求时,可以开启/关闭; 当循环下超过一个请求时,则只能开启。

This commit is contained in:
fit2-zhao 2021-01-19 10:12:08 +08:00
parent 26edcd1e0c
commit ac4e52091d
2 changed files with 17 additions and 5 deletions

View File

@ -520,6 +520,9 @@
recursiveSorting(arr) {
for (let i in arr) {
arr[i].index = Number(i) + 1;
if (arr[i].type === ELEMENT_TYPE.LoopController && arr[i].hashTree && arr[i].hashTree.length > 1) {
arr[i].countController.proceed = true;
}
if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) {
this.recursiveSorting(arr[i].hashTree);
}
@ -528,6 +531,10 @@
sort() {
for (let i in this.scenarioDefinition) {
this.scenarioDefinition[i].index = Number(i) + 1;
if (this.scenarioDefinition[i].type === ELEMENT_TYPE.LoopController && this.scenarioDefinition[i].hashTree
&& this.scenarioDefinition[i].hashTree.length > 1) {
this.scenarioDefinition[i].countController.proceed = true;
}
if (this.scenarioDefinition[i].hashTree != undefined && this.scenarioDefinition[i].hashTree.length > 0) {
this.recursiveSorting(this.scenarioDefinition[i].hashTree);
}
@ -588,16 +595,14 @@
} else {
this.scenarioDefinition.push(request);
}
}
,
},
pushApiOrCase(data, refType, referenced) {
data.forEach(item => {
this.setApiParameter(item, refType, referenced);
});
this.sort();
this.reload();
}
,
},
getMaintainerOptions() {
let workspaceId = localStorage.getItem(WORKSPACE_ID);
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {

View File

@ -31,7 +31,7 @@
<el-col :span="8">
<span class="ms-span ms-radio">{{$t('loop.proceed')}}</span>
<el-tooltip class="item" effect="dark" content="默认为开启,当循环下只有一个请求时,可以开启/关闭;当循环下超过一个请求时,则只能开启。" placement="top">>
<el-switch v-model="controller.countController.proceed"/>
<el-switch v-model="controller.countController.proceed" @change="switchChange"/>
</el-tooltip>
</el-col>
@ -123,6 +123,13 @@
}
},
methods: {
switchChange() {
if (this.controller.hashTree && this.controller.hashTree.length > 1) {
this.$warning("当前循环下超过一个请求,不能关闭状态")
this.controller.countController.proceed = true;
return;
}
},
remove() {
this.$emit('remove', this.controller, this.node);
},