From 03d03649df4ac462462508ed01e69b5f9f8efc97 Mon Sep 17 00:00:00 2001 From: chenqi Date: Thu, 4 Jun 2026 15:07:38 +0800 Subject: [PATCH] =?UTF-8?q?refactor(layout):=20=E9=87=8D=E6=9E=84=E9=A1=B6?= =?UTF-8?q?=E9=83=A8=E8=8F=9C=E5=8D=95=E5=AF=BC=E8=88=AA=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改Settings组件中的导航类型监听逻辑,修正响应式值访问方式 - 重写TopBar组件的菜单渲染结构,实现更灵活的子菜单展示 - 添加菜单选择事件处理器,支持多种路由跳转模式 - 优化菜单激活状态计算逻辑,改进侧边栏路由过滤机制 - 调整样式布局,适配顶部菜单与内容区域的定位关系 - 移除旧的SidebarItem组件引用,简化代码结构 --- .../src/layout/components/Settings/index.vue | 14 +- .../src/layout/components/TopBar/index.vue | 290 +++++++++++++++--- openhis-ui-vue3/src/layout/index.vue | 6 +- 3 files changed, 260 insertions(+), 50 deletions(-) diff --git a/openhis-ui-vue3/src/layout/components/Settings/index.vue b/openhis-ui-vue3/src/layout/components/Settings/index.vue index 7470cd056..f81c15c91 100755 --- a/openhis-ui-vue3/src/layout/components/Settings/index.vue +++ b/openhis-ui-vue3/src/layout/components/Settings/index.vue @@ -167,20 +167,20 @@ function handleNavType(val) { } /** 菜单导航设置 */ -watch(() => navType, val => { - if (val.value == 1) { - // 纯左侧菜单 +watch(() => navType.value, val => { + if (val == 1) { + // 纯左侧菜单:显示侧边栏,使用全部路由 appStore.sidebar.opened = true appStore.toggleSideBarHide(false) permissionStore.setSidebarRouters(permissionStore.defaultRoutes) } - if (val.value == 2) { - // 混合菜单:顶部显示一级菜单,左侧显示子菜单 + if (val == 2) { + // 混合菜单:顶部显示一级菜单,侧边栏由 TopNav activeRoutes 自动过滤 appStore.sidebar.opened = true appStore.toggleSideBarHide(false) - permissionStore.setSidebarRouters(permissionStore.defaultRoutes) + // 保留当前 sidebarRouters,TopNav 组件会根据当前路由自动筛选 } - if (val.value == 3) { + if (val == 3) { // 纯顶部菜单:隐藏侧边栏 appStore.sidebar.opened = false appStore.toggleSideBarHide(true) diff --git a/openhis-ui-vue3/src/layout/components/TopBar/index.vue b/openhis-ui-vue3/src/layout/components/TopBar/index.vue index e42f28f55..213a457f1 100644 --- a/openhis-ui-vue3/src/layout/components/TopBar/index.vue +++ b/openhis-ui-vue3/src/layout/components/TopBar/index.vue @@ -1,68 +1,267 @@ diff --git a/openhis-ui-vue3/src/layout/index.vue b/openhis-ui-vue3/src/layout/index.vue index fa8e472cf..2dbf35a71 100755 --- a/openhis-ui-vue3/src/layout/index.vue +++ b/openhis-ui-vue3/src/layout/index.vue @@ -16,7 +16,7 @@
@@ -149,6 +149,10 @@ defineExpose({ box-sizing: border-box; } +.has-topbar .fixed-header { + top: 100px; +} + .sidebar-hidden { .fixed-header { left: 0 !important;