const arr = [
{ id: 1, name: '部门A', parentId: 0 },
{ id: 2, name: '部门B', parentId: 1 },
{ id: 3, name: '部门C', parentId: 1 },
{ id: 4, name: '部门D', parentId: 2 },
{ id: 5, name: '部门E', parentId: 2 },
{ id: 6, name: '部门F', parentId: 3 },
{ id: 10, name: '部门G', parentId: 0 },
{ id: 12, name: '部门H', parentId: 10 },
{ id: 23, name: '部门I', parentId: 10 },
{ id: 34, name: '部门J', parentId: 12 },
{ id: 45, name: '部门K', parentId: 12 },
{ id: 56, name: '部门L', parentId: 23 },
]
这种结构不行