优化菜单设置权限功能,懒人版一件选中权限

master
lemon橪 2021-08-06 11:58:53 +08:00
parent 1fe7c050a4
commit 4c217b85e9
1 changed files with 39 additions and 32 deletions

View File

@ -76,10 +76,10 @@
<!-- 保存权限弹出选择权限 -->
<Modal width="800" v-model="selectIsSuperModel" title="选择菜单权限" :loading="superModelLoading" @on-ok="saveRole">
<!-- <div class="btns">
<Button type="primary" class="btn-item">一键选中·数据权限</Button>
<Button class="btn-item">一键选中·查看权</Button>
</div> -->
<div class="btns">
<Button type="primary" @click="setRole()" class="btn-item">一键选中·数据权限</Button>
<Button class="btn-item" @click="setRole('onlyView')">·</Button>
</div>
<div class="role-list">
<div class="role-item" v-for="(item, index) in saveRoleWay" :key="index">
<div class="title">{{ item.title }}</div>
@ -337,6 +337,17 @@ export default {
this.getRoleList();
},
/**
* 设置权限
*/
setRole(val) {
let enable;
val == "onlyView" ? (enable = false) : (enable = true);
this.saveRoleWay.map((item) => {
item.isSuper = enable;
});
},
/**
* 查询所有角色
*/
@ -515,7 +526,7 @@ export default {
}
//
this.checkPermTree(this.permData, rolePerms);
console.warn(this.permData);
this.permModalVisible = true;
},
//
@ -535,7 +546,6 @@ export default {
},
//
hasPerm(p, rolePerms) {
console.log(p, rolePerms);
if (!rolePerms) return false;
let flag = false;
for (let i = 0; i < rolePerms.length; i++) {
@ -568,7 +578,6 @@ export default {
let way = [];
selectedNodes.forEach((e) => {
console.log(e);
let perm = {
title: e.title,
isSuper: e.isSuper,
@ -718,7 +727,7 @@ export default {
.btns {
display: flex;
align-items: center;
justify-content: space-between;
justify-content: center;
}
.btn-item {
margin-right: 20px;
@ -742,9 +751,7 @@ export default {
margin-left: 8px;
}
.title {
font-weight: bold;
margin-right: 20px;
}
</style>