|
|
|
@ -54,9 +54,12 @@
|
|
|
|
|
<template #header>
|
|
|
|
|
<span style="font-size: 16px;font-weight: bold">角色权限</span>
|
|
|
|
|
</template>
|
|
|
|
|
<el-tree ref="tree" node-key="id" :data="treeData" :props="defaultProps" show-checkbox @check="checkChange"></el-tree>
|
|
|
|
|
<el-tree ref="tree" node-key="name" default-expand-all
|
|
|
|
|
:data="treeData" :props="defaultProps" :default-checked-keys="checkedName"
|
|
|
|
|
show-checkbox @check="checkChange()">
|
|
|
|
|
</el-tree>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<el-button type="primary" @click="drawerVisible = false" size="default">确定</el-button>
|
|
|
|
|
<el-button type="primary" @click="authorChangeComfirm" size="default">确定</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-drawer>
|
|
|
|
|
<el-dialog v-model="editVisible" width="30%" title="编辑角色">
|
|
|
|
@ -99,18 +102,19 @@ export default defineComponent({
|
|
|
|
|
const drawerVisible = ref(false);
|
|
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
|
|
const defaultProps = {
|
|
|
|
|
children: 'children',
|
|
|
|
|
label: 'label',
|
|
|
|
|
disabled: 'disabled'
|
|
|
|
|
children: 'operationVoList',
|
|
|
|
|
label: 'name',
|
|
|
|
|
};
|
|
|
|
|
const treeData = ref([]);
|
|
|
|
|
const checkedName = ref([]);
|
|
|
|
|
const checkedId = ref([]);
|
|
|
|
|
return {
|
|
|
|
|
form,setForm,proxy,
|
|
|
|
|
tableData,activeId,
|
|
|
|
|
pagination,
|
|
|
|
|
statusFormatter,
|
|
|
|
|
visible,editVisible,drawerVisible,
|
|
|
|
|
defaultProps, treeData,
|
|
|
|
|
defaultProps, treeData,checkedName,checkedId
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
@ -168,15 +172,41 @@ export default defineComponent({
|
|
|
|
|
}).catch(() => {});
|
|
|
|
|
},
|
|
|
|
|
handlerAuthor(value) {
|
|
|
|
|
this.proxy.$post("/userRole/list", {roleId: value}).then(res => {
|
|
|
|
|
this.activeId = value;
|
|
|
|
|
this.proxy.$post("/userJurisdiction/findByRoleId", {roleId: value}).then(res => {
|
|
|
|
|
const data = res.data
|
|
|
|
|
this.treeData = data.rows;
|
|
|
|
|
this.treeData = data;
|
|
|
|
|
const arr = [];
|
|
|
|
|
this.treeData.forEach(ele => {
|
|
|
|
|
ele.operationVoList.forEach(e => {
|
|
|
|
|
arr.push(e.name)
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
this.checkedName = arr;
|
|
|
|
|
this.drawerVisible = true
|
|
|
|
|
}).catch(() => {});
|
|
|
|
|
},
|
|
|
|
|
checkChange() {
|
|
|
|
|
let selectedKeys = this.$refs.tree.getCheckedKeys()
|
|
|
|
|
console.log(selectedKeys)
|
|
|
|
|
let selectedKeys = this.$refs.tree.getCheckedNodes()
|
|
|
|
|
let arr = []
|
|
|
|
|
selectedKeys.forEach(ele => {
|
|
|
|
|
if(!ele.operationVoList) {
|
|
|
|
|
arr.push(ele.id)
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
console.log(arr)
|
|
|
|
|
this.checkedId = arr;
|
|
|
|
|
},
|
|
|
|
|
authorChangeComfirm() {
|
|
|
|
|
let obj = {roleId: this.activeId,jurisdictionIds: this.checkedId}
|
|
|
|
|
this.proxy.$post("/userJurisdiction/operationRoleJurisdiction", obj).then(res => {
|
|
|
|
|
if(res.code == 200) {
|
|
|
|
|
this.$message.success('修改成功');
|
|
|
|
|
this.drawerVisible = false;
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error(res.msg);
|
|
|
|
|
}
|
|
|
|
|
}).catch(() => {});
|
|
|
|
|
},
|
|
|
|
|
//删除
|
|
|
|
|
singleDel(id) {
|
|
|
|
|