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