计算树状图层级专用方法
计算树状图层级专门用的方法,主要用于获取指定的level的信息
function calMsdCataLogLevel(items:any, targetId:any, level = 0) {
for (let item of items) {
if (item.id === targetId) {
return level;
}
if (item.children) {
let found:any = calMsdCataLogLevel(item.children, targetId, level + 1);
if (found !== -1) {
return found;
}
}
}
return -1;
}