dataTOTree (data,val) { const map = {}; data.forEach((item) => { map[item.currentNode] = item; }); data.forEach((item) => { const parent = map[item.parentNode]; if (parent) { (parent.children || (parent.children = [])).push(item); } else { val.push(item); } }); }