diff --git a/src/components/NavLeft.vue b/src/components/NavLeft.vue index c9930ed9..3e6c57c1 100644 --- a/src/components/NavLeft.vue +++ b/src/components/NavLeft.vue @@ -573,7 +573,7 @@ 员工学习数据 - + { + store.commit("SET_USER_ORGS", res.data); + }) } async function initDict(key) { const list = await getDictList(key); diff --git a/src/store/index.js b/src/store/index.js index 637acc6f..502b02cb 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -17,6 +17,7 @@ export default createStore({ routerId: null, projectTemplateId: null, userInfo: {}, + userInfoOrgs: [], orgtreeList: [], faceclassPic: null, faceclassClass: [], @@ -62,6 +63,9 @@ export default createStore({ userInfo.avatar = userInfo.avatar?.includes(process.env.VUE_APP_AVATAR_PATH) ? userInfo.avatar : (process.env.VUE_APP_AVATAR_PATH + userInfo.avatar); state.userInfo = userInfo; }, + SET_USER_ORGS(state,orgs){ + state.userInfoOrgs = orgs; + }, SET_projectTemplateId(state, projectTemplateId) { state.projectTemplateId = projectTemplateId; }, diff --git a/src/utils/utils.js b/src/utils/utils.js index 9c673d54..92407261 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -57,7 +57,9 @@ export function checkOwner(per) { export function checkMenu(path = "") { return store?.state?.menus.some(t => path.split(",").some(s => "/" + s === t)); } - +export function checkOrgs(){ + return store?.state?.userInfoOrgs.length > 0 +} export function deepClone(obj) { let result = typeof obj.splice === "function" ? [] : {}; if (obj && typeof obj === "object") {