部门角色登录时 组织架构列表只显示他自己的部门

main
wanglei 2 months ago
parent 421b3366cb
commit 718f705908

@ -15,6 +15,7 @@ const user = {
pcId: null, pcId: null,
itemIds: null, itemIds: null,
voteIds: null, voteIds: null,
deptId: null,
roles: [], roles: [],
permissions: [] permissions: []
}, },
@ -44,6 +45,9 @@ const user = {
SET_VOTEIDS: (state, voteIds) => { SET_VOTEIDS: (state, voteIds) => {
state.voteIds = voteIds state.voteIds = voteIds
}, },
SET_DEPTID: (state, deptId) => {
state.deptId = deptId
},
SET_ROLES: (state, roles) => { SET_ROLES: (state, roles) => {
state.roles = roles state.roles = roles
}, },
@ -92,6 +96,7 @@ const user = {
commit('SET_PCID', user.pcId) commit('SET_PCID', user.pcId)
commit('SET_ITEMIDS', user.itemIds) commit('SET_ITEMIDS', user.itemIds)
commit('SET_VOTEIDS', user.voteIds) commit('SET_VOTEIDS', user.voteIds)
commit('SET_DEPTID', user.deptId)
/* 初始密码提示 */ /* 初始密码提示 */
/*if(res.isDefaultModifyPwd) { /*if(res.isDefaultModifyPwd) {
MessageBox.confirm('您的密码还是初始密码,请修改密码!', '安全提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { MessageBox.confirm('您的密码还是初始密码,请修改密码!', '安全提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => {

@ -1,6 +1,6 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-if="!isQueryDept" v-show="showSearch">
<el-form-item label="部门名称" prop="deptName"> <el-form-item label="部门名称" prop="deptName">
<el-input <el-input
v-model="queryParams.deptName" v-model="queryParams.deptName"
@ -114,7 +114,7 @@
<el-row> <el-row>
<el-col :span="24" v-if="form.parentId !== 0"> <el-col :span="24" v-if="form.parentId !== 0">
<el-form-item label="上级部门" prop="parentId"> <el-form-item label="上级部门" prop="parentId">
<treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级部门" /> <treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级部门" :disabled="isQueryDept"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -230,6 +230,7 @@ export default {
components: { Treeselect }, components: { Treeselect },
data() { data() {
return { return {
isQueryDept: false,
// //
loading: true, loading: true,
// //
@ -249,6 +250,7 @@ export default {
// //
queryParams: { queryParams: {
deptName: undefined, deptName: undefined,
deptId: undefined,
status: undefined status: undefined
}, },
// //
@ -299,6 +301,11 @@ export default {
} }
}, },
created() { created() {
let userInfo = this.$store.state.user;
if(userInfo.roles.length===1 && userInfo.roles[0]==='deptRole'){
this.isQueryDept = true;
this.queryParams.deptId = userInfo.deptId
}
this.getList() this.getList()
}, },
methods: { methods: {

Loading…
Cancel
Save