|
|
|
|
@ -1,5 +1,21 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div class="app-container">
|
|
|
|
|
|
|
|
|
|
<div class="company" v-if="!$store.state.user.tenantId">
|
|
|
|
|
<el-input
|
|
|
|
|
style="width: 200px"
|
|
|
|
|
placeholder="公司名称"
|
|
|
|
|
prefix-icon="el-icon-search"
|
|
|
|
|
v-model="gsInfo.tenantName"
|
|
|
|
|
@keyup.enter.native="getGsInfoList">
|
|
|
|
|
</el-input>
|
|
|
|
|
<div class="cp-content" style="width: 200px">
|
|
|
|
|
<div :class="gsInfo.active_id===item.id?'cp-item active':'cp-item'" @click="changCompany(item.id)" v-for="item in gsInfo.list">{{ item.name }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div :class="$store.state.user.tenantId?'content-all':'content'">
|
|
|
|
|
|
|
|
|
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
|
|
|
|
|
<el-form-item label="角色名称" prop="roleName">
|
|
|
|
|
<el-input
|
|
|
|
|
@ -156,6 +172,8 @@
|
|
|
|
|
@pagination="getList"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 添加或修改角色配置对话框 -->
|
|
|
|
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
|
|
|
|
@ -249,18 +267,26 @@
|
|
|
|
|
<el-button @click="cancelDataScope">取 消</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { listRole, getRole, delRole, addRole, updateRole, dataScope, changeRoleStatus, deptTreeSelect } from "@/api/system/role";
|
|
|
|
|
import { treeselect as menuTreeselect, roleMenuTreeselect } from "@/api/system/menu";
|
|
|
|
|
import { listTenant } from "@/api/pay/tenant";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "Role",
|
|
|
|
|
dicts: ['sys_normal_disable'],
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
// 公司信息
|
|
|
|
|
gsInfo:{
|
|
|
|
|
tenantName:'',
|
|
|
|
|
active_id:this.$store.state.user.tenantId,
|
|
|
|
|
list:[]
|
|
|
|
|
},
|
|
|
|
|
// 遮罩层
|
|
|
|
|
loading: true,
|
|
|
|
|
// 选中数组
|
|
|
|
|
@ -343,12 +369,37 @@ export default {
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
if (!this.$store.state.user.tenantId) {
|
|
|
|
|
this.getGsInfoList()
|
|
|
|
|
}else {
|
|
|
|
|
this.gsInfo.active_id = this.$store.state.user.tenantId
|
|
|
|
|
this.getList();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
// 获取左侧公司列表
|
|
|
|
|
getGsInfoList(){
|
|
|
|
|
listTenant({ name: this.gsInfo.tenantName }).then(response => {
|
|
|
|
|
if(response.rows.length>0){
|
|
|
|
|
this.gsInfo.list = response.rows;
|
|
|
|
|
this.gsInfo.active_id = this.gsInfo.list[0].id
|
|
|
|
|
this.getList()
|
|
|
|
|
}else{
|
|
|
|
|
this.$alert(`没有查到相关公司,暂无数据!`, `提示`, {
|
|
|
|
|
type: 'warning'
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 选择公司
|
|
|
|
|
changCompany(id){
|
|
|
|
|
this.gsInfo.active_id = id
|
|
|
|
|
this.getList()
|
|
|
|
|
},
|
|
|
|
|
/** 查询角色列表 */
|
|
|
|
|
getList() {
|
|
|
|
|
this.loading = true;
|
|
|
|
|
this.queryParams.tenantId = this.gsInfo.active_id;
|
|
|
|
|
listRole(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
|
|
|
|
this.roleList = response.rows;
|
|
|
|
|
this.total = response.total;
|
|
|
|
|
@ -556,6 +607,7 @@ export default {
|
|
|
|
|
submitForm: function() {
|
|
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
this.form.tenantId = this.gsInfo.active_id;
|
|
|
|
|
if (this.form.roleId != undefined) {
|
|
|
|
|
this.form.menuIds = this.getMenuAllCheckedKeys();
|
|
|
|
|
updateRole(this.form).then(response => {
|
|
|
|
|
@ -605,3 +657,42 @@ export default {
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.app-container {
|
|
|
|
|
display: flex;
|
|
|
|
|
.company {
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
width: 230px;
|
|
|
|
|
height: calc(100vh - 115px);
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
.cp-content {
|
|
|
|
|
margin-top: 20px;
|
|
|
|
|
.cp-item {
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
padding: 6px 10px 6px 5px;
|
|
|
|
|
color: #424242;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
&:hover {
|
|
|
|
|
background: #f6f6f6;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.active{
|
|
|
|
|
background: #edf6ff;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.content{
|
|
|
|
|
padding-left: 15px;
|
|
|
|
|
width: calc(100% - 250px);
|
|
|
|
|
.el-button--medium {
|
|
|
|
|
padding: 2px 0px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.content-all{
|
|
|
|
|
width: 100%;
|
|
|
|
|
.el-button--medium {
|
|
|
|
|
padding: 2px 0px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|