From fb34ba28cb908bd328cf6690ab0b19a56428f4e2 Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期五, 13 十一月 2026 10:56:55 +0800
Subject: [PATCH] 测试完成

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

diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index f8dec16..80048fc 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -2,11 +2,29 @@
 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(),
     name: "",
     nickName: "",
+    orgname: localStorage.getItem("orgname") || "",
     Id: "",
     avatar: "",
     hisUserId: "",
@@ -93,6 +111,9 @@
     },
     SET_nickNAME: (state, name) => {
       state.nickName = name;
+    },
+    SET_ORGNAME: (state, orgname) => {
+      state.orgname = orgname;
     },
     SET_visitAgain: (state, visitAgain) => {
       state.visitAgain = visitAgain;
@@ -270,6 +291,8 @@
               localStorage.setItem("YongHuID", "");
               localStorage.setItem("YongHuXM", "");
             }
+            // 鍚屾鍒� Vuex锛屼緵鍏ㄥ眬 getter锛堝 isTongdeOrg锛変娇鐢�
+            commit("SET_ORGNAME", localStorage.getItem("orgname") || orgname);
             resolve();
           })
           .catch((error) => {
@@ -300,8 +323,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