fix(接口自动化): 次数循环成功后继续循环 开关校验问题修复

This commit is contained in:
fit2-zhao 2021-03-23 16:35:47 +08:00
parent 08c9cc09df
commit 3dba18779f
1 changed files with 31 additions and 0 deletions

View File

@ -90,6 +90,7 @@
import ApiResponseComponent from "./ApiResponseComponent";
import MsRun from "../DebugRun";
import {getUUID} from "@/common/js/utils";
import {ELEMENT_TYPE, ELEMENTS} from "../Setting";
export default {
name: "MsLoopController",
@ -186,7 +187,37 @@
this.controller.countController.proceed = true;
return;
}
//
if (this.controller.hashTree && this.controller.hashTree.length === 1
&& this.controller.hashTree[0].hashTree && this.controller.hashTree[0].hashTree.length > 0) {
let count = 0;
this.controller.hashTree[0].hashTree.forEach(item => {
if (ELEMENTS.get("AllSamplerProxy").indexOf(item.type) != -1) {
count++;
}
if (item.hashTree && item.hashTree.length > 0) {
this.recursive(item.hashTree, count);
}
})
if (count > 1) {
this.$warning("当前循环下超过一个请求,不能关闭状态")
this.controller.countController.proceed = true;
return;
}
}
},
recursive(arr, count) {
for (let i in arr) {
if (ELEMENTS.get("AllSamplerProxy").indexOf(arr[i].type) != -1) {
count++;
}
if (arr[i].hashTree && arr[i].hashTree.length > 0) {
this.recursive(arr[i].hashTree, count);
}
}
},
runDebug() {
if (!this.controller.hashTree || this.controller.hashTree.length < 1) {
this.$warning("当前循环下没有请求,不能执行")