...
|
...
|
@@ -153,33 +153,64 @@ |
|
|
</div>
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
|
|
<!--权限设置界面-->
|
|
|
<el-dialog title="岗位的权限设置"
|
|
|
:visible.sync="PermFormVisible"
|
|
|
:close-on-click-modal="false"
|
|
|
top="5vh" width="75%"
|
|
|
>
|
|
|
<el-row>
|
|
|
<el-col :span="4" >
|
|
|
<el-button type="primary" @click.native="treeMerge(false)">合并节点</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="4">
|
|
|
<el-button type="success" @click.native="treeMerge(true)">展开节点</el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-divider></el-divider>
|
|
|
<el-form :model="permForm" style="width: 95%" ref="permForm">
|
|
|
<el-tree :data="permissons" :props="treeDefaultProps"
|
|
|
@check="clickDeal"
|
|
|
:default-expand-all = "treeExpand"
|
|
|
show-checkbox highlight-current
|
|
|
node-key="permissionId" ref="tree">
|
|
|
</el-tree>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button @click.native="PermFormVisible = false">取消</el-button>
|
|
|
<el-button type="primary" @click.native="setPermSubmit" :loading="addLoading">提交</el-button>
|
|
|
</div>
|
|
|
<template>
|
|
|
<el-tabs style="border: 0px;background-color: rgba(0,0,0,0)" v-model="activeName" @tab-click="handleClick">
|
|
|
<el-tab-pane style="border: 0px;background-color: rgba(0,0,0,0)" label="权限管理" name="first">
|
|
|
<el-row>
|
|
|
<el-col :span="4" >
|
|
|
<el-button type="primary" @click.native="treeMerge(false)">合并节点</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="4">
|
|
|
<el-button type="success" @click.native="treeMerge(true)">展开节点</el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-divider></el-divider>
|
|
|
<el-form :model="permForm" style="width: 95%" ref="permForm">
|
|
|
<el-tree :data="permissons" :props="treeDefaultProps"
|
|
|
@check="clickDeal"
|
|
|
:default-expand-all = "treeExpand"
|
|
|
show-checkbox highlight-current
|
|
|
node-key="permissionId" ref="tree">
|
|
|
</el-tree>
|
|
|
</el-form>
|
|
|
<div align="center" class="dialog-footer" style="margin-bottom: 20px">
|
|
|
<el-button @click.native="PermFormVisible = false">取消</el-button>
|
|
|
<el-button type="primary" @click.native="setPermSubmit" :loading="addLoading">提交</el-button>
|
|
|
</div>
|
|
|
</el-tab-pane>
|
|
|
<el-tab-pane label="数据权限" name="second">
|
|
|
<!-- <el-row>-->
|
|
|
<!-- <el-col :span="4" >-->
|
|
|
<!-- <el-button type="primary" @click.native="treeMerges(false)">合并节点</el-button>-->
|
|
|
<!-- </el-col>-->
|
|
|
<!-- <el-col :span="4">-->
|
|
|
<!-- <el-button type="success" @click.native="treeMerges(true)">展开节点</el-button>-->
|
|
|
<!-- </el-col>-->
|
|
|
<!-- </el-row>-->
|
|
|
<el-divider></el-divider>
|
|
|
<el-form :model="permForms" style="width: 95%" ref="permForm">
|
|
|
<el-tree :data="departmentNameList" :props="treeDefaultPropss"
|
|
|
@check="clickDeal"
|
|
|
:default-expand-all = "treeExpands"
|
|
|
show-checkbox highlight-current
|
|
|
node-key="dataPermId" ref="trees">
|
|
|
</el-tree>
|
|
|
</el-form>
|
|
|
<div align="center" class="dialog-footer" style="margin-bottom: 20px">
|
|
|
<el-button @click.native="PermFormVisible = false">取消</el-button>
|
|
|
<el-button type="primary" :loading="addLoading">提交</el-button>
|
|
|
</div>
|
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
</section>
|
|
|
</template>
|
...
|
...
|
@@ -188,13 +219,16 @@ |
|
|
import util from '../../common/js/util'
|
|
|
import NProgress from 'nprogress'
|
|
|
import { getList, remove, batchRemove, edit, add, updateRolePerm } from '../../api/role_api';
|
|
|
import { getList as getDepartmentList} from '../../api/department';
|
|
|
import { getList as getDepartmentList } from '@/api/user/data_perm_api.js'
|
|
|
|
|
|
// import { getList as getDepartmentList} from '../../api/department';
|
|
|
import { getList as permList } from '../../api/perm_api';
|
|
|
import moment from 'moment'
|
|
|
export default {
|
|
|
name:'Role',
|
|
|
data() {
|
|
|
return {
|
|
|
activeName: 'first',
|
|
|
filters: {
|
|
|
roleName: ''
|
|
|
},
|
...
|
...
|
@@ -224,11 +258,17 @@ |
|
|
children: 'children',
|
|
|
label: 'name',
|
|
|
},
|
|
|
treeDefaultPropss: {
|
|
|
children: 'children',
|
|
|
label: 'perm_des',
|
|
|
},
|
|
|
treeExpand: true,
|
|
|
departmentNameList:[],
|
|
|
treeExpands: true,
|
|
|
roles: [],
|
|
|
permissons: [],
|
|
|
departmentNameList:[],
|
|
|
permIds: [],
|
|
|
permIdss: [],
|
|
|
total: 0,
|
|
|
pageNum: 1,
|
|
|
pageSize: 5,
|
...
|
...
|
@@ -272,7 +312,14 @@ |
|
|
roleName: '',
|
|
|
roleSign: 1,
|
|
|
permissions: []
|
|
|
}
|
|
|
},
|
|
|
permForms: {
|
|
|
roleId: 1,
|
|
|
description: '',
|
|
|
roleName: '',
|
|
|
roleSign: 1,
|
|
|
departmentNameList: []
|
|
|
},
|
|
|
|
|
|
}
|
|
|
},
|
...
|
...
|
@@ -310,6 +357,12 @@ |
|
|
this.$refs.tree.store._getAllNodes()[i].expanded=this.treeExpand;
|
|
|
}
|
|
|
},
|
|
|
treeMerges: function (expand) {
|
|
|
this.treeExpands = expand;
|
|
|
for(var i=0;i<this.$refs.trees.store._getAllNodes().length;i++){
|
|
|
this.$refs.trees.store._getAllNodes()[i].expanded=this.treeExpands;
|
|
|
}
|
|
|
},
|
|
|
handleCurrentChange(val) {
|
|
|
this.pageNum = val;
|
|
|
this.getRoles();
|
...
|
...
|
@@ -342,31 +395,46 @@ |
|
|
|
|
|
},
|
|
|
|
|
|
//获取部门列表
|
|
|
getdepartmentNames() {
|
|
|
|
|
|
this.listLoading = true;
|
|
|
//NProgress.start();
|
|
|
getDepartmentList().then((res) => {
|
|
|
this.total = res.data.total;
|
|
|
this.departmentNameList = res.data.list;
|
|
|
this.listLoading = false;
|
|
|
//NProgress.done();
|
|
|
}).catch((error) => {
|
|
|
|
|
|
this.listLoading = false;
|
|
|
if(null!= error.response && error.response!==undefined){
|
|
|
let status= error.response.status;
|
|
|
let msg = error.response.statusText;
|
|
|
alert(status+msg);
|
|
|
}else {
|
|
|
alert(error);
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
//获取数据权限列表
|
|
|
// getdepartmentNames() {
|
|
|
//
|
|
|
// this.listLoading = true;
|
|
|
// //NProgress.start();
|
|
|
// getDepartmentList().then((res) => {
|
|
|
// // this.total = res.data.total;
|
|
|
// this.departmentNameList = res.data.list;
|
|
|
// console.log(this.departmentNameList);
|
|
|
//
|
|
|
// this.listLoading = false;
|
|
|
// //NProgress.done();
|
|
|
// }).catch((error) => {
|
|
|
//
|
|
|
// this.listLoading = false;
|
|
|
// if(null!= error.response && error.response!==undefined){
|
|
|
// let status= error.response.status;
|
|
|
// let msg = error.response.statusText;
|
|
|
// alert(status+msg);
|
|
|
// }else {
|
|
|
// alert(error);
|
|
|
// }
|
|
|
//
|
|
|
// });
|
|
|
//
|
|
|
// },
|
|
|
getDataList() {
|
|
|
let para = {
|
|
|
pageNum: 1,
|
|
|
pageSize: 700
|
|
|
};
|
|
|
getDepartmentList(para).then(res => {
|
|
|
this.$message.success('获取列表成功')
|
|
|
this.departmentNameList = res.list
|
|
|
console.log(this.departmentNameList);
|
|
|
// this.total = res.total
|
|
|
}).catch(error => {
|
|
|
this.$message.error(error)
|
|
|
})
|
|
|
},
|
|
|
//获取权限列表
|
|
|
getPermList() {
|
|
|
let para = {
|
...
|
...
|
@@ -426,6 +494,7 @@ |
|
|
this.addForm = Object.assign({}, row);
|
|
|
// this.getdepartmentNames();
|
|
|
},
|
|
|
// 配置权限管理
|
|
|
setPerm: function (index, row) {
|
|
|
this.PermFormVisible = true;
|
|
|
this.getPermList();
|
...
|
...
|
@@ -440,13 +509,32 @@ |
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
|
//反向适配
|
|
|
this.$refs.tree.setCheckedKeys(this.permIds);
|
|
|
});
|
|
|
},
|
|
|
// 配置数据权限
|
|
|
handleClick(tab, row) {
|
|
|
if (tab.name === 'second'){
|
|
|
this.getDataList();
|
|
|
var _this = this;
|
|
|
this.permIdss = [];
|
|
|
this.permForms = Object.assign({}, row);
|
|
|
let rolePermss = this.permForms.departmentNameList;
|
|
|
if (util.checkNull(rolePermss)){
|
|
|
rolePermss.forEach(function (perm,v_index,v_arr) {
|
|
|
if(util.checkNull(perm)){
|
|
|
_this.permIdss[v_index] = perm.dataPermId;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
this.$nextTick(() => {
|
|
|
//反向适配
|
|
|
this.$refs.trees.setCheckedKeys(this.permIdss);
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
//显示新增界面,每次点开初始化数据
|
|
|
handleAdd: function (index,row) {
|
|
|
this.addFormVisible = true;
|
...
|
...
|
@@ -675,6 +763,8 @@ |
|
|
}
|
|
|
};
|
|
|
this.isExpansion=true;
|
|
|
// this.getdepartmentNames();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|