diff --git a/src/global.d.ts b/src/global.d.ts index a3ac17f..76bf786 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -73,7 +73,7 @@ interface UserWithPowerInfoVo { userInfo: UserInfoVo modules: ModuleVo[] menus: MenuVo[] - elements: ElementVo[] + funcs: FuncVo[] operations: OperationVo[] } @@ -117,19 +117,19 @@ interface MenuVo { children: MenuVo[] } -interface ElementVo { +interface FuncVo { id: number name: string parentId: number menuId: number - children: ElementVo[] + children: FuncVo[] } interface OperationVo { id: number name: string code: string - elementId: number + funcId: number } interface RoleVo { @@ -241,7 +241,7 @@ interface RoleWithPowerGetVo { updateTime: string modules: ModuleVo[] menus: MenuVo[] - elements: ElementVo[] + funcs: FuncVo[] operations: OperationVo[] tree: _DataNode[] } @@ -261,7 +261,7 @@ interface RoleAddEditParam { interface PowerSetVo { moduleList: ModuleVo[] menuList: MenuVo[] - elementList: ElementVo[] + funcList: FuncVo[] operationList: OperationVo[] } diff --git a/src/pages/system/Role.tsx b/src/pages/system/Role.tsx index cf34831..6c24f2f 100644 --- a/src/pages/system/Role.tsx +++ b/src/pages/system/Role.tsx @@ -411,7 +411,7 @@ const Role: React.FC = () => { value.tree = powerListToPowerTree( value.modules, value.menus, - value.elements, + value.funcs, value.operations ) @@ -454,7 +454,7 @@ const Role: React.FC = () => { powerListToPowerTree( powerSet.moduleList, powerSet.menuList, - powerSet.elementList, + powerSet.funcList, powerSet.operationList ) ) diff --git a/src/util/auth.tsx b/src/util/auth.tsx index 082abd0..a9e80db 100644 --- a/src/util/auth.tsx +++ b/src/util/auth.tsx @@ -133,22 +133,22 @@ export const verifyCaptcha = (value: string) => { export const powerListToPowerTree = ( modules: ModuleVo[], menus: MenuVo[], - elements: ElementVo[], + funcs: FuncVo[], operations: OperationVo[] ): _DataNode[] => { const moduleChildrenMap = new Map() const menuChildrenMap = new Map() - const elementChildrenMap = new Map() + const funcChildrenMap = new Map() operations.forEach((operation) => { - if (elementChildrenMap.get(String(operation.elementId))) { - elementChildrenMap.get(String(operation.elementId))?.push({ + if (funcChildrenMap.get(String(operation.funcId))) { + funcChildrenMap.get(String(operation.funcId))?.push({ title: operation.name, key: operation.id, value: operation.id }) } else { - elementChildrenMap.set(String(operation.elementId), [ + funcChildrenMap.set(String(operation.funcId), [ { title: operation.name, key: operation.id, @@ -158,21 +158,21 @@ export const powerListToPowerTree = ( } }) - const elementTrees = parentToTree( - elements.map((element) => ({ - title: element.name, - key: element.id, - value: element.id, - parentId: element.parentId, - children: elementChildrenMap.get(String(element.id)) + const funcTrees = parentToTree( + funcs.map((func) => ({ + title: func.name, + key: func.id, + value: func.id, + parentId: func.parentId, + children: funcChildrenMap.get(String(func.id)) })) ) - elementTrees.forEach((element) => { - if (menuChildrenMap.get(String(floorNumber(element.key as number, 5)))) { - menuChildrenMap.get(String(floorNumber(element.key as number, 5)))?.push(element) + funcTrees.forEach((func) => { + if (menuChildrenMap.get(String(floorNumber(func.key as number, 5)))) { + menuChildrenMap.get(String(floorNumber(func.key as number, 5)))?.push(func) } else { - menuChildrenMap.set(String(floorNumber(element.key as number, 5)), [element]) + menuChildrenMap.set(String(floorNumber(func.key as number, 5)), [func]) } })