怎么将这样的数据:
[
{
"id": 1,
"key": "",
"name": "系统管理",
"level": 1,
"type": 1,
"icon": "",
"code": "A001",
"parentCode": "",
"num": "A-1",
},
{
"id": 7,
"key": "",
"name": "日志管理",
"level": 1,
"type": 1,
"icon": "",
"code": "A004",
"parentCode": "",
"num": "A-7",
},
{
"id": 8,
"key": "roleAdd",
"name": "角色管理",
"level": 2,
"type": 1,
"icon": "",
"code": "B001",
"parentCode": "A001",
"num": "1-1",
},
{
"id": 14,
"key": "logoManage",
"name": "日志管理",
"level": 2,
"type": 1,
"icon": null,
"code": "E001",
"parentCode": "A004",
"num": "1-1",
}
]
变成这样的数据:
[
{
"id": 1,
"key": "",
"name": "系统管理",
"level": 1,
"type": 1,
"icon": "",
"code": "A001",
"parentCode": "",
"num": "A-1",
"chuildren":[{
"id": 8,
"key": "roleAdd",
"name": "角色管理",
"level": 2,
"type": 1,
"icon": "",
"code": "B001",
"parentCode": "A001",
"num": "1-1",
}]
},
{
"id": 7,
"key": "",
"name": "日志管理",
"level": 1,
"type": 1,
"icon": "",
"code": "A004",
"parentCode": "",
"num": "A-7",
"children": [
{
"id": 14,
"key": "logoManage",
"name": "日志管理",
"level": 2,
"type": 1,
"icon": null,
"code": "E001",
"parentCode": "A004",
"num": "1-1",
"emp1": null,
"emp2": null,
"emp3": null,
"emp4": null
}
]
},
]