| | |
| | | import { login, logout, getInfo } from "@/api/login"; |
| | | import { getConfig, getConfigKey, listConfig } from "@/api/system/config"; |
| | | import { getToken, setToken, removeToken } from "@/utils/auth"; |
| | | |
| | | const user = { |
| | |
| | | belongDepts: [], |
| | | roles: [], |
| | | permissions: [], |
| | | visitAgain: 1, //1开启2不开启再次随访 |
| | | satisfactionCategories: {}, |
| | | // 服务类型 |
| | | Serviceauthority: [ |
| | |
| | | }, |
| | | SET_nickNAME: (state, name) => { |
| | | state.nickName = name; |
| | | }, |
| | | SET_visitAgain: (state, visitAgain) => { |
| | | state.visitAgain = visitAgain; |
| | | }, |
| | | SET_Id: (state, Id) => { |
| | | state.Id = Id; |
| | |
| | | }, |
| | | |
| | | // 获取用户信息 |
| | | GetInfo({ commit, state }) { |
| | | GetInfo({ commit, state, dispatch }) { |
| | | return new Promise((resolve, reject) => { |
| | | getInfo() |
| | | .then((res) => { |
| | |
| | | commit("SET_Id", user.userId); |
| | | commit("SET_hisUserId", user.hisUserId); |
| | | commit("SET_satisfactionCategories", user.satisfactionCategories); |
| | | |
| | | // if (user.userName == "admin") { |
| | | // commit("SET_leaveldeptcodes", []); |
| | | // commit("SET_leavehospitaldistrictcodes", []); |
| | | // } else { |
| | | // commit("SET_leavehospitaldistrictcodes", user.belongWards); |
| | | // commit("SET_leaveldeptcodes", user.belongDepts); |
| | | // } |
| | | commit("SET_leavehospitaldistrictcodes", user.belongWards); |
| | | commit("SET_leaveldeptcodes", user.belongDepts); |
| | | commit("SET_AVATAR", avatar); |
| | | // 正确调用方式:通过 dispatch |
| | | dispatch("GetConfig") |
| | | .then(() => { |
| | | resolve(res); |
| | | }) |
| | | .catch((error) => { |
| | | reject(error); |
| | | }); |
| | | }) |
| | | .catch((error) => { |
| | | reject(error); |
| | | }); |
| | | }); |
| | | }, |
| | | // 获取参数信息 |
| | | GetConfig({ commit, state }) { |
| | | return new Promise((resolve, reject) => { |
| | | listConfig({ configName: "再次随访" }) |
| | | .then((res) => { |
| | | if (res.rows && res.rows.length > 0) |
| | | commit("SET_visitAgain", res.rows[0].configValue); |
| | | resolve(res); |
| | | }) |
| | | .catch((error) => { |
| | |
| | | }); |
| | | }); |
| | | }, |
| | | |
| | | // 退出系统 |
| | | LogOut({ commit, state }) { |
| | | return new Promise((resolve, reject) => { |