Rename table t_element to t_func
This commit is contained in:
12
src/global.d.ts
vendored
12
src/global.d.ts
vendored
@@ -73,7 +73,7 @@ interface UserWithPowerInfoVo {
|
|||||||
userInfo: UserInfoVo
|
userInfo: UserInfoVo
|
||||||
modules: ModuleVo[]
|
modules: ModuleVo[]
|
||||||
menus: MenuVo[]
|
menus: MenuVo[]
|
||||||
elements: ElementVo[]
|
funcs: FuncVo[]
|
||||||
operations: OperationVo[]
|
operations: OperationVo[]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,19 +117,19 @@ interface MenuVo {
|
|||||||
children: MenuVo[]
|
children: MenuVo[]
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ElementVo {
|
interface FuncVo {
|
||||||
id: number
|
id: number
|
||||||
name: string
|
name: string
|
||||||
parentId: number
|
parentId: number
|
||||||
menuId: number
|
menuId: number
|
||||||
children: ElementVo[]
|
children: FuncVo[]
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OperationVo {
|
interface OperationVo {
|
||||||
id: number
|
id: number
|
||||||
name: string
|
name: string
|
||||||
code: string
|
code: string
|
||||||
elementId: number
|
funcId: number
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RoleVo {
|
interface RoleVo {
|
||||||
@@ -241,7 +241,7 @@ interface RoleWithPowerGetVo {
|
|||||||
updateTime: string
|
updateTime: string
|
||||||
modules: ModuleVo[]
|
modules: ModuleVo[]
|
||||||
menus: MenuVo[]
|
menus: MenuVo[]
|
||||||
elements: ElementVo[]
|
funcs: FuncVo[]
|
||||||
operations: OperationVo[]
|
operations: OperationVo[]
|
||||||
tree: _DataNode[]
|
tree: _DataNode[]
|
||||||
}
|
}
|
||||||
@@ -261,7 +261,7 @@ interface RoleAddEditParam {
|
|||||||
interface PowerSetVo {
|
interface PowerSetVo {
|
||||||
moduleList: ModuleVo[]
|
moduleList: ModuleVo[]
|
||||||
menuList: MenuVo[]
|
menuList: MenuVo[]
|
||||||
elementList: ElementVo[]
|
funcList: FuncVo[]
|
||||||
operationList: OperationVo[]
|
operationList: OperationVo[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -411,7 +411,7 @@ const Role: React.FC = () => {
|
|||||||
value.tree = powerListToPowerTree(
|
value.tree = powerListToPowerTree(
|
||||||
value.modules,
|
value.modules,
|
||||||
value.menus,
|
value.menus,
|
||||||
value.elements,
|
value.funcs,
|
||||||
value.operations
|
value.operations
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -454,7 +454,7 @@ const Role: React.FC = () => {
|
|||||||
powerListToPowerTree(
|
powerListToPowerTree(
|
||||||
powerSet.moduleList,
|
powerSet.moduleList,
|
||||||
powerSet.menuList,
|
powerSet.menuList,
|
||||||
powerSet.elementList,
|
powerSet.funcList,
|
||||||
powerSet.operationList
|
powerSet.operationList
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -133,22 +133,22 @@ export const verifyCaptcha = (value: string) => {
|
|||||||
export const powerListToPowerTree = (
|
export const powerListToPowerTree = (
|
||||||
modules: ModuleVo[],
|
modules: ModuleVo[],
|
||||||
menus: MenuVo[],
|
menus: MenuVo[],
|
||||||
elements: ElementVo[],
|
funcs: FuncVo[],
|
||||||
operations: OperationVo[]
|
operations: OperationVo[]
|
||||||
): _DataNode[] => {
|
): _DataNode[] => {
|
||||||
const moduleChildrenMap = new Map<string, _DataNode[]>()
|
const moduleChildrenMap = new Map<string, _DataNode[]>()
|
||||||
const menuChildrenMap = 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) => {
|
operations.forEach((operation) => {
|
||||||
if (elementChildrenMap.get(String(operation.elementId))) {
|
if (funcChildrenMap.get(String(operation.funcId))) {
|
||||||
elementChildrenMap.get(String(operation.elementId))?.push({
|
funcChildrenMap.get(String(operation.funcId))?.push({
|
||||||
title: operation.name,
|
title: operation.name,
|
||||||
key: operation.id,
|
key: operation.id,
|
||||||
value: operation.id
|
value: operation.id
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
elementChildrenMap.set(String(operation.elementId), [
|
funcChildrenMap.set(String(operation.funcId), [
|
||||||
{
|
{
|
||||||
title: operation.name,
|
title: operation.name,
|
||||||
key: operation.id,
|
key: operation.id,
|
||||||
@@ -158,21 +158,21 @@ export const powerListToPowerTree = (
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const elementTrees = parentToTree(
|
const funcTrees = parentToTree(
|
||||||
elements.map((element) => ({
|
funcs.map((func) => ({
|
||||||
title: element.name,
|
title: func.name,
|
||||||
key: element.id,
|
key: func.id,
|
||||||
value: element.id,
|
value: func.id,
|
||||||
parentId: element.parentId,
|
parentId: func.parentId,
|
||||||
children: elementChildrenMap.get(String(element.id))
|
children: funcChildrenMap.get(String(func.id))
|
||||||
}))
|
}))
|
||||||
)
|
)
|
||||||
|
|
||||||
elementTrees.forEach((element) => {
|
funcTrees.forEach((func) => {
|
||||||
if (menuChildrenMap.get(String(floorNumber(element.key as number, 5)))) {
|
if (menuChildrenMap.get(String(floorNumber(func.key as number, 5)))) {
|
||||||
menuChildrenMap.get(String(floorNumber(element.key as number, 5)))?.push(element)
|
menuChildrenMap.get(String(floorNumber(func.key as number, 5)))?.push(func)
|
||||||
} else {
|
} else {
|
||||||
menuChildrenMap.set(String(floorNumber(element.key as number, 5)), [element])
|
menuChildrenMap.set(String(floorNumber(func.key as number, 5)), [func])
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user