const arr = [
{id: "5cbd75c2ba0ba2186bf8cd97", name: "首页", permission: "menu-home", description: ""},
{id: "5cbd75ceba0ba2186bf8cd98", name: "流程选择", permission: "menu-processSelect", description: ""},
{id: "5d47e09fba0ba22579325eda", name: "产品管理", permission: "menu-productManage", description: ""},
{id: "5d47e25dba0ba22579325edb", name: "流程管理", permission: "menu-processManage", description: "流程管理一级菜单"},
{id: "5d47e3eaba0ba22579325edc", name: "流程管理—风控管理", permission: "menu-processManage_riskControl", description: ""},
{id: "5d47e45fba0ba22579325edd", name: "流程管理—流程分配", permission: "menu-processManage_processAssign", description: ""},
{id: "5d47e47bba0ba22579325ede", name: "流程管理—任务池", permission: "menu-processManage_taskPool", description: ""},
{id: "5d47e49fba0ba22579325edf", name: "职责分配", permission: "menu-dutyAssign", description: ""},
{id: "5d47e4f8ba0ba22579325ee0", name: "审批管理", permission: "menu-approvalManage", description: ""},
{id: "5d47e571ba0ba22579325ee1", name: "审批管理—初审", permission: "menu-approvalManage_firstAudit", description: ""},
{id: "5d47e617ba0ba22579325ee2", name: "审批管理—初审—待处理", permission: "menu-approvalManage_firstAudit_pending", description: ""},
{id: "5d47fedeba0ba22579325ee9", name: "审批管理—初审—已处理", permission: "menu-approvalManage_firstAudit_processed", description: ""},
{id: "5d47ff18ba0ba22579325eea", name: "审批管理—初审—已挂起", permission: "menu-approvalManage_firstAudit_hangup", description: ""},
{id: "5d47ff49ba0ba22579325eeb", name: "审批管理—终审—已挂起", permission: "menu-approvalManage_lastAudit_hangup", description: ""},
{id: "5d47ff69ba0ba22579325eec", name: "审批管理—终审—待处理", permission: "menu-approvalManage_lastAudit_pending", description: ""},
{id: "5d47ff93ba0ba22579325eed", name: "审批管理—终审—已处理", permission: "menu-approvalManage_lastAudit_processed", description: ""},
{id: "5d48011bba0ba22579325eee", name: "审批管理—终审", permission: "menu-approvalManage_lastAudit", description: ""}
]
// 根据permission字段中隐含的父子关系,将这个json,转化成treeJson。
用了一个很笨的方法写的,感觉很不优雅。求大佬们优秀的解答