const flattenChildren = (children: any[], stepListchildren: Record<string, string>) => {
children.forEach((child: any) => {
stepListchildren[child.code] = child.label;
if (Array.isArray(child.children)) {
flattenChildren(child.children, stepListchildren);
}
});
};
const getListAll = async () => {
const res = await listAll({});
console.log('🚀 ~ getListAll ~ res:', res);
res.forEach((item: any) => {
stepList.value[item.code] = item.label;
if (Array.isArray(item.children)) {
flattenChildren(item.children, stepListchildren.value);
}
});
// console.log("🚀 ~ stepListchildren:", stepListchildren.value);
};
getListAll();