(tree = RouteMenu)
| 14 | * @author: 白雾茫茫丶 |
| 15 | */ |
| 16 | const getRouteNames = (tree = RouteMenu): string[] => { |
| 17 | // 收集当前层级的所有 name 属性 |
| 18 | let result: string[] = [] |
| 19 | // 遍历收集 |
| 20 | forEach(tree, (node: API.MENUMANAGEMENT) => { |
| 21 | result.push(node.name); |
| 22 | if (node?.routes?.length) { |
| 23 | result = result.concat(getRouteNames(node.routes)); |
| 24 | } |
| 25 | }); |
| 26 | return result |
| 27 | } |
| 28 | return { |
| 29 | // 判断是否有操作权限 |
| 30 | operationPermission: (data: string) => Permissions ? Permissions.includes(data) : false, |