| | |
| | | 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(), |
| | |
| | | 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); |
| | | // 正确调用方式:通过 dispatch |
| | | dispatch("GetConfig") |