A1A2菜单配置

This commit is contained in:
2024-04-29 15:06:25 +08:00
parent 5d03d57310
commit fe2ada25b2
4 changed files with 47 additions and 13 deletions

View File

@@ -30,21 +30,42 @@
export default {
data() {
return {
roles: this.$store.getters.saveRoles,
userName: '',
menuList: [
// {id: '1', name: '人工排产', icon: 'RF01', path: '/pages/modules/man-paichan'},
// {id: '2', name: '涂线板', icon: 'RF02', path: '/pages/modules/wire-board'},
// {id: '3', name: '物料库存', icon: 'RF03', path: '/pages/modules/mater-inventory'}
// {id: '1', name: '原材料入库', icon: 'RF03', path: '/pages/modules/rawmater-instore'},
{id: '2', name: '原材料出库', icon: 'RF07', path: '/pages/modules/rawmater-outstore'},
{id: '3', name: '搬运任务', icon: 'RF01', path: '/pages/modules/carry-task'},
// {id: '4', name: '组盘解绑', icon: 'RF04', path: '/pages/modules/zupan-unbind'},
{id: '5', name: '指令管理', icon: 'RF02', path: '/pages/modules/zlmanage'},
{id: '6', name: '任务管理', icon: 'RF09', path: '/pages/modules/taskmanage'}
]
menuList: []
};
},
created () {
console.log(this.$store.getters.saveRoles, '11111')
if (this.roles === 'A1,A2,') {
this.menuList = [
// {id: '1', name: '人工排产', icon: 'RF01', path: '/pages/modules/man-paichan'},
// {id: '2', name: '涂线板', icon: 'RF02', path: '/pages/modules/wire-board'},
// {id: '3', name: '物料库存', icon: 'RF03', path: '/pages/modules/mater-inventory'}
{id: '1', name: '原材料入库', icon: 'RF03', path: '/pages/modules/rawmater-instore'},
{id: '2', name: '原材料出库', icon: 'RF07', path: '/pages/modules/rawmater-outstore'},
{id: '3', name: '搬运任务', icon: 'RF01', path: '/pages/modules/carry-task'},
{id: '4', name: '组盘解绑', icon: 'RF04', path: '/pages/modules/zupan-unbind'},
{id: '5', name: '指令管理', icon: 'RF02', path: '/pages/modules/zlmanage'},
{id: '6', name: '任务管理', icon: 'RF09', path: '/pages/modules/taskmanage'}
]
}
if (this.roles === 'A1') {
this.menuList = [
{id: '1', name: '原材料入库', icon: 'RF03', path: '/pages/modules/rawmater-instore'},
{id: '2', name: '原材料出库', icon: 'RF07', path: '/pages/modules/rawmater-outstore'},
{id: '5', name: '指令管理', icon: 'RF02', path: '/pages/modules/zlmanage'},
{id: '6', name: '任务管理', icon: 'RF09', path: '/pages/modules/taskmanage'}
]
}
if (this.roles === 'A2') {
this.menuList = [
{id: '3', name: '搬运任务', icon: 'RF01', path: '/pages/modules/carry-task'},
{id: '4', name: '组盘解绑', icon: 'RF04', path: '/pages/modules/zupan-unbind'},
{id: '5', name: '指令管理', icon: 'RF02', path: '/pages/modules/zlmanage'},
{id: '6', name: '任务管理', icon: 'RF09', path: '/pages/modules/taskmanage'}
]
}
this.$store.dispatch('setPublicObj', '')
if (this.$store.getters.userInfo) {
this.userName = JSON.parse(this.$store.getters.userInfo).username

View File

@@ -104,6 +104,7 @@
}
this.$store.dispatch('saveUserInfo', JSON.stringify(res.user.user))
this.$store.dispatch('saveToken', res.token)
this.$store.dispatch('saveRoles', res.roles)
uni.redirectTo({
url: '/pages/home/home'
})

View File

@@ -9,7 +9,8 @@ const state = {
setPrintName: uni.getStorageSync('setPrintName') || '',
loginName: uni.getStorageSync('loginName') ? uni.getStorageSync('loginName') : '',
userInfo: uni.getStorageSync('userInfo') ? uni.getStorageSync('userInfo') : '',
saveToken: uni.getStorageSync('saveToken') || ''
saveToken: uni.getStorageSync('saveToken') || '',
saveRoles: uni.getStorageSync('saveRoles') || ''
}
const getters = {
baseUrl: state => state.baseUrl,
@@ -18,7 +19,8 @@ const getters = {
setPrintName: state => state.setPrintName,
loginName: state => state.loginName,
userInfo: state => state.userInfo,
saveToken: state => state.saveToken
saveToken: state => state.saveToken,
saveRoles: state => state.saveRoles
}
const actions = {
setConfig ({commit}, res) {
@@ -43,11 +45,16 @@ const actions = {
delUserInfo({commit}, res) {
uni.removeStorageSync('userInfo')
uni.removeStorageSync('saveToken')
uni.removeStorageSync('saveRoles')
commit(types.DEL_USER_INFO, res)
},
saveToken({commit}, res) {
uni.setStorageSync('saveToken', res)
commit(types.SAVE_TOKEN, res)
},
saveRoles({commit}, res) {
uni.setStorageSync('saveRoles', res)
commit(types.SAVE_ROLES, res)
}
}
const mutations = {
@@ -69,9 +76,13 @@ const mutations = {
[types.DEL_USER_INFO] (state, res) {
state.userInfo = res
state.saveToken = res
state.saveRoles = res
},
[types.SAVE_TOKEN] (state, res) {
state.saveToken = res
},
[types.SAVE_ROLES] (state, res) {
state.saveRoles = res
}
}

View File

@@ -7,6 +7,7 @@ export const COM_CONFIG = 'COM_CONFIG'
export const SAVE_USER_INFO = 'SAVE_USER_INFO'
export const DEL_USER_INFO = 'DEL_USER_INFO'
export const SAVE_TOKEN = 'SAVE_TOKEN'
export const SAVE_ROLES = 'SAVE_ROLES'
/**
* data