From dbdf5650b41a066c98e1cb177bd736bfdc5715cb Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Tue, 9 Sep 2025 15:16:43 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=91=E7=AE=A1=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/user.js | 12 ++++++++++-- src/views/flow/list.vue | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 9f6ede6..0ccdf66 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -12,6 +12,7 @@ const getDefaultState = () => { yearHoliday: 0, department: {}, role: [], + roles:[] } } @@ -33,6 +34,9 @@ const mutations = { SET_ROLE: (state, role) => { state.role = role }, + SET_ROLES: (state, roles) => { + state.roles = roles + }, SET_ADMIN_ID: (state, id) => { state.adminId = id }, @@ -69,13 +73,17 @@ const actions = { return new Promise((resolve, reject) => { getInfo(getToken()).then(response => { - const { name, avatar, id, role, department, username, year_holiday } = response - + const { name, avatar, id, role, roles, department, username, year_holiday } = response + let rolesArr = [] + if(roles&&roles.length>0){ + rolesArr = roles.map(i=>i.name) + } commit('SET_DEPARTMENT',department) commit('SET_NAME', name) commit('SET_AVATAR', avatar) commit('SET_ADMIN_ID', id) commit('SET_ROLE', role) + commit('SET_ROLES', rolesArr) commit('SET_USERNAME', username) commit('SET_YEAR_HOLIDAY', year_holiday??0) resolve(response) diff --git a/src/views/flow/list.vue b/src/views/flow/list.vue index a46f254..2dc7519 100644 --- a/src/views/flow/list.vue +++ b/src/views/flow/list.vue @@ -930,7 +930,8 @@ export default { }, computed: { menuConfig() { - if (this.$store.state.user.adminId === 1) { + console.log("this.$store.state",this.$store.state,this.$store.state.user.roles.includes('全局流程监管')) + if (this.$store.state.user.roles.includes('全局流程监管')) { return { className: 'my-menus', body: {