| | |
| | | |
| | | export * from './tree'; |
| | | |
| | | export type TreeModuleDtoGroupDto = API.ModuleDto & { |
| | | export type TreeModuleDtoGroupDto = API.GetMenusQueryResultItem & { |
| | | children?: TreeModuleDtoGroupDto[]; |
| | | parentNode?: TreeModuleDtoGroupDto; |
| | | hasCheck?: boolean; |
| | | }; |
| | | |
| | | export class ModuleUtils { |
| | | static convertToModuleGroup(data: API.ModuleDto[]) { |
| | | static convertToModuleGroup(data: API.GetMenusQueryResultItem[]) { |
| | | const moduleTreeStore = new TreeStore<TreeModuleDtoGroupDto>({ |
| | | data: TreeStore.formatListToTree(data, null), |
| | | }); |
| | |
| | | if (module) { |
| | | const moduleTreeNode = moduleTreeStore.getNode(module.id); |
| | | const siblingsNodes = moduleTreeNode.parent.childNodes; |
| | | return siblingsNodes[siblingsNodes.length - 1].data.sortCode; |
| | | return siblingsNodes[siblingsNodes.length - 1].data.sort; |
| | | } else { |
| | | return moduleTreeStore.root.childNodes.length; |
| | | } |
| | |
| | | const moduleTreeNode = moduleTreeStore.getNode(module.id); |
| | | const childNodes = moduleTreeNode.childNodes; |
| | | const lastChildNode = childNodes[childNodes.length - 1]; |
| | | return lastChildNode ? lastChildNode.data.sortCode : 0; |
| | | return lastChildNode ? lastChildNode.data.sort : 0; |
| | | } |
| | | |
| | | static getParentModule( |