From 30c031282ebb1bf80646c947235fb4a19360f77a Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期二, 21 一月 2025 17:34:20 +0800
Subject: [PATCH] 顶部展示部门

---
 src/store/modules/user.js        |    5 +++++
 src/layout/components/Navbar.vue |    3 +++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue
index 1155780..d224b3a 100644
--- a/src/layout/components/Navbar.vue
+++ b/src/layout/components/Navbar.vue
@@ -5,6 +5,9 @@
             <span>灏勬椽鏅烘収椤圭洰绠$悊绯荤粺</span>
         </div>
         <div class="right-menu flex align-center">
+          <div style="color: rgb(49,48,48);margin-right: 30px;font-size: 16px">
+            <span style="padding-bottom: 4px;letter-spacing: 1px;border-bottom: 1px solid #fa926d;min-width: 100px">{{this.$store.state.user.deptName}}</span>
+          </div>
             <template>
                 <search-menu ref="searchMenuRef" />
                 <el-tooltip content="鎼滅储" effect="dark" placement="bottom">
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 7906a53..3a8f745 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -8,6 +8,7 @@
     name: '',
     avatar: '',
     deptId: null,
+    deptName: '',
     roles: [],
     roleIds: [],
     permissions: []
@@ -34,6 +35,9 @@
     },
     SET_DEPT: (state, deptId) => {
       state.deptId = deptId
+    },
+    SET_DEPT_NAME: (state, deptName) => {
+      state.deptName = deptName
     },
     SET_PERMISSIONS: (state, permissions) => {
       state.permissions = permissions
@@ -74,6 +78,7 @@
           commit('SET_ROLE_IDS', user.roles.map(role => role.roleId))
           commit('SET_NAME', user.userName)
           commit('SET_DEPT', user.deptId)
+          commit('SET_DEPT_NAME', user.dept ? user.dept.deptName : '')
           commit('SET_AVATAR', avatar)
 
           resolve(res)

--
Gitblit v1.8.0