master
lion 2 months ago
parent 7a8e7ae839
commit 6c20b67a91

@ -2,7 +2,7 @@
ENV = 'development'
# base api
VUE_APP_BASE_API='http://192.167.20.118:8080/'
VUE_APP_BASE_API='https://cz-hjjc-test.115.langye.net/'
#VUE_APP_BASE_API='http://czemc.localhost'
VUE_APP_UPLOAD_API='https://cz-hjjc-test.115.langye.net/api/upload-file'
VUE_APP_PREVIEW=//view.langye.net/preview/onlinePreview

@ -12,7 +12,8 @@ const getDefaultState = () => {
yearHoliday: 0,
department: {},
role: [],
roles:[]
roles: [],
moduleRoles: {}
}
}
@ -48,6 +49,9 @@ const mutations = {
},
SET_USERNAME: (state, username) => {
state.username = username
},
SET_MODULE_ROLES: (state, moduleRoles) => {
state.moduleRoles = moduleRoles
}
}
@ -72,20 +76,29 @@ const actions = {
getInfo({ commit, state }) {
return new Promise((resolve, reject) => {
getInfo(getToken()).then(response => {
const { name, avatar, id, role, roles, department, username, year_holiday } = response
const { name, avatar, id, role, roles, department, username, year_holiday, module_roles } = response
let rolesArr = []
if(roles&&roles.length>0){
rolesArr = roles.map(i=>i.name)
if (roles && roles.length > 0) {
rolesArr = roles.map(i => i.name)
}
// 处理 module_roles转换为 { module_name: roles } 格式
const moduleRolesObj = {}
if (module_roles && Array.isArray(module_roles) && module_roles.length > 0) {
module_roles.forEach(item => {
if (item.module_name && item.roles) {
moduleRolesObj[item.module_name] = item.roles
}
})
}
commit('SET_DEPARTMENT',department)
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)
commit('SET_YEAR_HOLIDAY', year_holiday ?? 0)
commit('SET_MODULE_ROLES', moduleRolesObj)
resolve(response)
}).catch(error => {
reject(error)

@ -184,7 +184,11 @@
this.my_department_id = store.state.department?store.state.department.id:''
this.dName = store.state.department?store.state.department.name:'全部科室'
if(this.my_department_id){
this.is_bgs = this.my_department_id==2?true:false
if(store.state.moduleRoles.oa.includes("考勤")){
this.is_bgs = true
}else{
this.is_bgs = false
}
this.select.department_id = this.my_department_id
}
this.getDepartmentList()

@ -169,7 +169,11 @@
this.my_department_id = store.state.department?store.state.department.id:''
this.dName = store.state.department?store.state.department.name:'全部科室'
if(this.my_department_id){
this.is_bgs = this.my_department_id==2?true:false
if(store.state.moduleRoles.oa.includes("考勤")){
this.is_bgs = true
}else{
this.is_bgs = false
}
this.select.department_id = this.my_department_id
}
this.getDepartmentList()

@ -281,7 +281,11 @@
this.my_department_id = store.state.department ? store.state.department.id : ''
this.dName = store.state.department ? store.state.department.name : '全部科室'
if (this.my_department_id) {
this.is_bgs = this.my_department_id == 2 ? true : false
if(store.state.moduleRoles.oa.includes("考勤")){
this.is_bgs = true
}else{
this.is_bgs = false
}
this.select.department_id = this.my_department_id
}

@ -236,7 +236,11 @@
this.my_department_id = store.state.department?store.state.department.id:''
this.dName = store.state.department?store.state.department.name:'全部科室'
if(this.my_department_id){
this.is_bgs = this.my_department_id==2?true:false
if(store.state.moduleRoles.oa.includes("考勤")){
this.is_bgs = true
}else{
this.is_bgs = false
}
this.select.department_id = this.my_department_id
}

@ -246,7 +246,11 @@ export default {
created() {
this.my_department_id = store.state.department?store.state.department.id:''
if(this.my_department_id){
this.is_bgs = this.my_department_id==2?true:false
if(store.state.moduleRoles.oa.includes("考勤")){
this.is_bgs = true
}else{
this.is_bgs = false
}
this.select.department_id = this.my_department_id
}

Loading…
Cancel
Save