Complete main UI #37

Merged
FatttSnake merged 192 commits from FatttSnake into dev 2024-02-23 16:31:17 +08:00
3 changed files with 24 additions and 24 deletions
Showing only changes of commit e30a8c7b00 - Show all commits

12
src/global.d.ts vendored
View File

@@ -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[]
}

View File

@@ -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
)
)

View File

@@ -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<string, _DataNode[]>()
const menuChildrenMap = new Map<string, _DataNode[]>()
const elementChildrenMap = new Map<string, _DataNode[]>()
const funcChildrenMap = new Map<string, _DataNode[]>()
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])
}
})