From 9903954c85f651dd5cc6d4b538cfe66b17fc5baa Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期三, 28 十月 2026 18:23:45 +0800
Subject: [PATCH] 提交

---
 src/store/modules/user.js |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index d98a63f..cb10ea4 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -2,6 +2,23 @@
 import { getConfig, getConfigKey, listConfig } from "@/api/system/config";
 import { getToken, setToken, removeToken } from "@/utils/auth";
 
+/**
+ * sys_user_dept 閲屽悓涓�绉戝/鐥呭尯鍙兘瀛樺湪澶ч噺閲嶅琛岋紙HIS 鍚屾/閲嶅淇濆瓨瀵艰嚧锛夛紝
+ * 鎺ュ彛浼氬師鏍疯繑鍥烇紝杩欓噷鎸夌紪鐮佸幓閲嶏紝閬垮厤涓汉涓績銆佸緟澶勭悊鍗$墖绛夊閲嶅灞曠ず
+ */
+function uniqueByCode(list) {
+  const seen = {};
+  return (list || []).filter((item) => {
+    if (!item) return false;
+    const code =
+      item.districtCode || item.deptCode || item.districtId || item.deptId;
+    const key = String(code === undefined || code === null ? "" : code);
+    if (!key || seen[key]) return false;
+    seen[key] = true;
+    return true;
+  });
+}
+
 const user = {
   state: {
     token: getToken(),
@@ -294,8 +311,8 @@
             commit("SET_Id", user.userId);
             commit("SET_hisUserId", user.hisUserId);
             commit("SET_satisfactionCategories", user.satisfactionCategories);
-            commit("SET_leavehospitaldistrictcodes", user.belongWards);
-            commit("SET_leaveldeptcodes", user.belongDepts);
+            commit("SET_leavehospitaldistrictcodes", uniqueByCode(user.belongWards));
+            commit("SET_leaveldeptcodes", uniqueByCode(user.belongDepts));
             commit("SET_AVATAR", avatar);
             // 姝g‘璋冪敤鏂瑰紡锛氶�氳繃 dispatch
             dispatch("GetConfig")

--
Gitblit v1.9.3