diff --git a/admin-frontend-vue/src/pages/account/MenusPage.vue b/admin-frontend-vue/src/pages/account/MenusPage.vue index 8a24be10..6bae6db9 100644 --- a/admin-frontend-vue/src/pages/account/MenusPage.vue +++ b/admin-frontend-vue/src/pages/account/MenusPage.vue @@ -8,6 +8,7 @@ import { menuDeleteReason, menuFormFromNode, menuParentChangeReason, + menuTypeLabel, nextSiblingSort, siblingOrderAfterMove, validateMenuManageForm, @@ -23,6 +24,17 @@ const editingNode = ref(null) const menuForm = reactive(createMenuForm(null, 0)) const parentOptions = computed(() => flattenMenuNodes(rows.value)) const dialogTitle = computed(() => (editingNode.value ? '编辑菜单' : '新增菜单')) +/** 节点 id -> 名称,供「上级菜单」列展示。 */ +const nameById = computed(() => { + const map = new Map() + for (const node of flattenMenuNodes(rows.value)) map.set(node.id, node.name) + return map +}) + +function parentNameOf(node: MenuManageNode): string { + if (node.parentId == null) return '—' + return nameById.value.get(node.parentId) ?? `#${node.parentId}` +} async function loadMenus() { loading.value = true @@ -124,17 +136,29 @@ onMounted(loadMenus) - - - - + + + + + + + + + + + + - +