监管权限

master
lion 3 months ago
parent 3ed9175550
commit dbdf5650b4

@ -12,6 +12,7 @@ const getDefaultState = () => {
yearHoliday: 0, yearHoliday: 0,
department: {}, department: {},
role: [], role: [],
roles:[]
} }
} }
@ -33,6 +34,9 @@ const mutations = {
SET_ROLE: (state, role) => { SET_ROLE: (state, role) => {
state.role = role state.role = role
}, },
SET_ROLES: (state, roles) => {
state.roles = roles
},
SET_ADMIN_ID: (state, id) => { SET_ADMIN_ID: (state, id) => {
state.adminId = id state.adminId = id
}, },
@ -69,13 +73,17 @@ const actions = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getInfo(getToken()).then(response => { 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_DEPARTMENT',department)
commit('SET_NAME', name) commit('SET_NAME', name)
commit('SET_AVATAR', avatar) commit('SET_AVATAR', avatar)
commit('SET_ADMIN_ID', id) commit('SET_ADMIN_ID', id)
commit('SET_ROLE', role) commit('SET_ROLE', role)
commit('SET_ROLES', rolesArr)
commit('SET_USERNAME', username) commit('SET_USERNAME', username)
commit('SET_YEAR_HOLIDAY', year_holiday??0) commit('SET_YEAR_HOLIDAY', year_holiday??0)
resolve(response) resolve(response)

@ -930,7 +930,8 @@ export default {
}, },
computed: { computed: {
menuConfig() { 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 { return {
className: 'my-menus', className: 'my-menus',
body: { body: {

Loading…
Cancel
Save