完成租户的部门用户权限管理

pull/1/head
面包骑士 2024-09-22 23:16:47 +08:00
parent 7bddb24d08
commit 57ce2e523c
4 changed files with 39 additions and 11 deletions

View File

@ -105,6 +105,7 @@
<el-table-column align="center" type="selection" width="55"/>
<el-table-column label="角色编号" prop="roleId" width="120"/>
<el-table-column :show-overflow-tooltip="true" label="角色名称" prop="roleName" width="150"/>
<el-table-column v-show="getEntCode() === 'FIRM'" align="center" label="租户编码" prop="firmCode"/>
<el-table-column :show-overflow-tooltip="true" label="权限字符" prop="roleKey" width="150"/>
<el-table-column label="显示顺序" prop="roleSort" width="100"/>
<el-table-column align="center" label="状态" width="100">
@ -277,6 +278,7 @@ import {
updateRole
} from "@/api/system/role";
import {roleMenuTreeselect, treeselect as menuTreeselect} from "@/api/system/menu";
import {getEntCode} from "@/utils/auth";
export default {
name: "Role",
@ -368,6 +370,7 @@ export default {
this.getList();
},
methods: {
getEntCode,
/** 查询角色列表 */
getList() {
this.loading = true;

View File

@ -26,6 +26,7 @@
</el-table-column>
<el-table-column :reserve-selection="true" type="selection" width="55"></el-table-column>
<el-table-column align="center" label="角色编号" prop="roleId"/>
<el-table-column v-show="getEntCode() === 'FIRM'" align="center" label="租户编码" prop="firmCode"/>
<el-table-column align="center" label="角色名称" prop="roleName"/>
<el-table-column align="center" label="权限字符" prop="roleKey"/>
<el-table-column align="center" label="创建时间" prop="createTime" width="180">
@ -48,6 +49,7 @@
<script>
import {getAuthRole, updateAuthRole} from "@/api/system/user";
import {getEntCode} from "@/utils/auth";
export default {
name: "AuthRole",
@ -87,6 +89,7 @@ export default {
}
},
methods: {
getEntCode,
/** 单击选中行数据 */
clickRow(row) {
this.$refs.table.toggleRowSelection(row);

View File

@ -151,6 +151,7 @@
prop="nickName"/>
<el-table-column v-if="columns[3].visible" key="deptName" :show-overflow-tooltip="true" align="center" label="部门"
prop="dept.deptName"/>
<el-table-column v-show="getEntCode() === 'FIRM'" align="center" label="租户编码" prop="firmCode"/>
<el-table-column v-if="columns[4].visible" key="phonenumber" align="center" label="手机号码"
prop="phonenumber" width="120"/>
<el-table-column v-if="columns[5].visible" key="status" align="center" label="状态">
@ -228,7 +229,10 @@
</el-col>
<el-col :span="12">
<el-form-item label="归属部门" prop="deptId">
<treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门"/>
<treeselect v-model="form.deptId" :options="deptOptions"
:show-count="true"
placeholder="请选择归属部门"
@change="checkRole()"/>
</el-form-item>
</el-col>
</el-row>
@ -371,7 +375,7 @@ import {
resetUserPwd,
updateUser
} from "@/api/system/user";
import {getToken} from "@/utils/auth";
import {getEntCode, getToken, setEntCode} from "@/utils/auth";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {listDept} from "@/api/system/dept";
@ -412,6 +416,7 @@ export default {
postOptions: [],
//
roleOptions: [],
roleListAll: [],
//
form: {},
defaultProps: {
@ -496,6 +501,7 @@ export default {
});
},
methods: {
getEntCode,
/** 查询用户列表 */
getList() {
this.loading = true;
@ -565,6 +571,21 @@ export default {
};
this.resetForm("form");
},
//
checkRole() {
console.log(this.roleOptions)
console.log(this.roleListAll)
let firmCode = ''
this.roleListAll.forEach(item => {
if (this.form.deptId === item.deptId) {
firmCode = item.firmCode;
}
})
console.log(firmCode)
this.roleOptions = this.roleListAll.filter(item => item.firmCode === firmCode);
console.log(this.roleOptions)
console.log(this.roleListAll)
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
@ -602,7 +623,8 @@ export default {
this.reset();
getUser().then(response => {
this.postOptions = response.data.posts;
this.roleOptions = response.data.roles;
this.roleOptions = response.data.roles.filter(item => item.firmCode === getEntCode());
this.roleListAll = response.data.roles;
this.open = true;
this.title = "添加用户";
this.form.password = this.initPassword;

View File

@ -41,14 +41,14 @@ module.exports = {
['^' + process.env.VUE_APP_BASE_API]: ''
}
},
'/browser': {
target:'http://192.168.138.130:12800',//这里是路由和报错报告的代理
changeOrigin: true
},
'/v3':{
target:'http://192.168.138.130:12800',
changeOrigin: true//这里是追踪报告的代理
}
// '/browser': {
// target:'http://192.168.138.130:12800',//这里是路由和报错报告的代理
// changeOrigin: true
// },
// '/v3':{
// target:'http://192.168.138.130:12800',
// changeOrigin: true//这里是追踪报告的代理
// }
},
disableHostCheck: true
},