/** * 权限管理 * @description * @author nanshen * @creat 2021-09-15 10:29:34 */ import { TreeData } from "../array/ArrayUtil"; type AuthData = Omit; /** * 权限列表转权限树 * @param {T} list 权限列表 * @param fieldNames { label = "name", value = "id", parent = "pid", children = "children", rootPid = null } * @returns {T[]} * @example type Auth = { id: number; pid: null | number; name: string; }; const authList = TOOLS.auth.get.getAuthTreeByList([ { id: 1, pid: null, name: '11' }, { id: 2, pid: 1, name: '333' }, { id: 3, pid: 1, name: '22' }, ]); console.log(authList); [{ children: (2) [{…}, {…}] id: 1 idPath: "/1" key: "1" levels: 1 name: "11" namePath: "/11" pid: null title: "11" }] */ export declare function getAuthTreeByList(list: T[], fieldNames?: { label?: string; value?: string; parent?: string; children?: string; rootPid?: any; }): (T & TreeData & AuthData)[]; /** * 权限树转列表 * @param list 权限列表 */ export declare function getAuthListByTree(list: T[], children?: string): T[]; export {};