fix(接口测试): 回退接口测试报告过滤筛选不过滤子级
This commit is contained in:
parent
00a3c58939
commit
e9cfdf112c
|
@ -97,31 +97,29 @@
|
||||||
ScenarioStepType.CUSTOM_REQUEST,
|
ScenarioStepType.CUSTOM_REQUEST,
|
||||||
ScenarioStepType.SCRIPT,
|
ScenarioStepType.SCRIPT,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
function searchStep() {
|
function searchStep() {
|
||||||
const splitLevel = props.keyWords.split('-');
|
const splitLevel = props.keyWords.split('-');
|
||||||
const stepTypeStatus = splitLevel[1];
|
const stepTypeStatus = splitLevel[1];
|
||||||
expandedKeys.value = [];
|
const stepType = splitLevel[0] === 'CUSTOM_REQUEST' ? ['API', 'API_CASE', 'CUSTOM_REQUEST'] : splitLevel[0];
|
||||||
|
|
||||||
const search = (_data: ScenarioItemType[]) => {
|
const search = (_data: ScenarioItemType[]) => {
|
||||||
const result: ScenarioItemType[] = [];
|
const result: ScenarioItemType[] = [];
|
||||||
|
|
||||||
_data.forEach((item) => {
|
_data.forEach((item) => {
|
||||||
const isStepChildren = item.children && item?.children.length && showApiType.value.includes(item.stepType);
|
const isStepChildren = item.children && item?.children.length && showApiType.value.includes(item.stepType);
|
||||||
if (
|
if (
|
||||||
(item.status && item.status === stepTypeStatus && stepTypeStatus !== 'scriptIdentifier') ||
|
stepType.includes(item.stepType) &&
|
||||||
(stepTypeStatus.includes('scriptIdentifier') && item.scriptIdentifier)
|
((item.status && item.status === stepTypeStatus && stepTypeStatus !== 'scriptIdentifier') ||
|
||||||
|
(stepTypeStatus.includes('scriptIdentifier') && item.scriptIdentifier))
|
||||||
) {
|
) {
|
||||||
let tempArray: ScenarioItemType[] = [];
|
|
||||||
if (!isStepChildren && item.children && item.children.length) {
|
|
||||||
tempArray = search(item.children);
|
|
||||||
}
|
|
||||||
const resItem = {
|
const resItem = {
|
||||||
...item,
|
...item,
|
||||||
expanded: false,
|
expanded: false,
|
||||||
stepChildren: isStepChildren ? cloneDeep(item.children) : [],
|
stepChildren: isStepChildren ? cloneDeep(item.children) : [],
|
||||||
children: tempArray,
|
children: isStepChildren ? [] : item.children,
|
||||||
};
|
};
|
||||||
result.push(resItem);
|
result.push(resItem);
|
||||||
} else if (item.children && splitLevel[0] === ScenarioStepType.CUSTOM_REQUEST) {
|
} else if (item.children) {
|
||||||
const filterData = search(item.children);
|
const filterData = search(item.children);
|
||||||
if (filterData.length) {
|
if (filterData.length) {
|
||||||
const filterItem = {
|
const filterItem = {
|
||||||
|
@ -129,14 +127,17 @@
|
||||||
expanded: false,
|
expanded: false,
|
||||||
children: filterData,
|
children: filterData,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isStepChildren) {
|
if (isStepChildren) {
|
||||||
filterItem.stepChildren = cloneDeep(item.children);
|
filterItem.stepChildren = cloneDeep(item.children);
|
||||||
|
|
||||||
filterItem.children = [];
|
filterItem.children = [];
|
||||||
}
|
}
|
||||||
result.push(filterItem);
|
result.push(filterItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue