Skip to content

Commit

Permalink
update: 完善 系统-角色管理-分配权限 的操作逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
Wizzercn committed Nov 29, 2018
1 parent f678f35 commit bae38c3
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public Object menuAll(HttpServletRequest req) {
@RequiresPermissions("sys.manager.role")
public Object menuRole(String roleId, HttpServletRequest req) {
try {
List<Sys_menu> userList = sysUserService.getMenusAndButtons(StringUtil.getPlatformUid());
List<Sys_menu> userList = sysRoleService.getMenusAndButtons(roleId);
List<Sys_menu> list;
if (shiroUtil.hasRole("sysadmin")) {
list = sysMenuService.query(Cnd.orderBy().asc("location").asc("path"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,15 @@
</el-switch>
</el-form-item>
<el-form-item prop="" label="分配权限">
<el-row style="margin-bottom: 3px;">
<el-button size="small" @click="addRoleSelAll">全选</el-button>
<el-button size="small" @click="addRoleSelClear">清空</el-button>
</el-row>
<el-tree
ref="addMenuTree"
:data="addMenuData"
show-checkbox
check-strictly
node-key="id"
:props="defaultProps"
>
Expand Down Expand Up @@ -272,6 +277,10 @@
:title="menuDialogTitle"
:visible.sync="menuDialogVisible"
width="70%">
<el-row style="margin-bottom: 3px;">
<el-button size="small" @click="menuRoleSelAll">全选</el-button>
<el-button size="small" @click="menuRoleSelClear">清空</el-button>
</el-row>
<el-tree
ref="doMenuTree"
:data="doMenuData"
Expand Down Expand Up @@ -918,6 +927,35 @@
});
}
}, "json");
},
getTreeAllIds:function(ids,obj){
var self=this;
if(obj&&obj.length>0){
obj.forEach(function (o) {
ids.push(o.id);
if(o.children){
self.getTreeAllIds(ids,o.children);
}
});
}
},
addRoleSelAll:function () {
var self=this;
var ids=[];
self.getTreeAllIds(ids,self.addMenuData);
self.$refs["addMenuTree"].setCheckedKeys(ids);
},
addRoleSelClear:function () {
this.$refs["addMenuTree"].setCheckedKeys([]);
},
menuRoleSelAll:function () {
var self=this;
var ids=[];
self.getTreeAllIds(ids,self.doMenuData);
self.$refs["doMenuTree"].setCheckedKeys(ids);
},
menuRoleSelClear:function () {
this.$refs["doMenuTree"].setCheckedKeys([]);
}
},
created: function () {
Expand Down

0 comments on commit bae38c3

Please sign in to comment.