修改权限 2021年11月10日10:16:24
parent
2bf3d696f7
commit
0da400a054
|
|
@ -209,4 +209,26 @@ public class UrlRequestController extends BaseController {
|
|||
}
|
||||
return this.jumpPage("admin/role/authorize");
|
||||
}
|
||||
|
||||
@GetMapping("/permission/index")
|
||||
public ModelAndView permission_index() {
|
||||
return this.jumpPage("admin/permission/list");
|
||||
}
|
||||
|
||||
@GetMapping("/permission/add")
|
||||
public ModelAndView permission_add(Model model) {
|
||||
model.addAttribute("permissionTypeList",Permission.Type.valueListMap());
|
||||
return this.jumpPage("admin/permission/add");
|
||||
}
|
||||
|
||||
@ApiIgnore
|
||||
@GetMapping("/permission/edit")
|
||||
public ModelAndView permission_edit(Model model, String permissionId) {
|
||||
if (CommonUtil.isNotNull(permissionId)) {
|
||||
Permission permission = this.permissionService.findById(Long.parseLong(permissionId));
|
||||
model.addAttribute("permission", permission);
|
||||
model.addAttribute("permissionTypeList",Permission.Type.valueListMap());
|
||||
}
|
||||
return this.jumpPage("admin/permission/edit");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ public class RolePermissionServiceImpl extends AbstractBaseServiceImpl<RolePermi
|
|||
Condition condition = new Condition(RolePermission.class);
|
||||
Example.Criteria criteria = condition.createCriteria();
|
||||
criteria.andEqualTo("role_id",roleId);
|
||||
criteria.andEqualTo("deleteStatus",false);
|
||||
return this.findByCondition(condition);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,9 @@ public class RoleServiceImpl extends AbstractBaseServiceImpl<Role> implements Ro
|
|||
if (permissionList.size() > 0){
|
||||
for (Permission permission : permissionList) {
|
||||
if (pIds.contains(permission.getId())){
|
||||
permission.setCheckArr("1");
|
||||
if (!permission.getDeleteStatus()){
|
||||
permission.setCheckArr("1");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,21 @@ var role_authorize_url = gate_way_url + "/" + admin_manager_url + "/role/authori
|
|||
var role_getRolePower_url = gate_way_url + "/" + admin_manager_url + "/role/getRolePower" + access_token_url;
|
||||
//保存角色授权
|
||||
var role_saveRolePower_url = gate_way_url + "/" + admin_manager_url + "/role/saveRolePower";
|
||||
//-----------------------------------------------------------------------------------------------------------------------------
|
||||
//权限列表
|
||||
var permission_list_url = gate_way_url + "/" + admin_manager_url + "/permission/list" + access_token_url;
|
||||
//新增权限
|
||||
var permission_add_url = gate_way_url + "/" + admin_manager_url + "/permission/add" + access_token_url;
|
||||
//修改
|
||||
var permission_edit_url = gate_way_url + "/" + admin_manager_url + "/permission/edit" + access_token_url ;
|
||||
//查询上级
|
||||
var permission_selectParent_url = gate_way_url + "/" + admin_manager_url + "/permission/selectParent";
|
||||
//权限保存
|
||||
var permission_save_url = gate_way_url + "/" + admin_manager_url+ "/permission/save";
|
||||
//删除
|
||||
var permission_delete_url = gate_way_url + "/" + admin_manager_url + "/permission/delete";
|
||||
//批量删除
|
||||
var permission_batchRemove_url = gate_way_url + "/" + admin_manager_url + "";
|
||||
|
||||
//页面跳转
|
||||
function postToPage(url, token) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<title>添加权限</title>
|
||||
<link rel="stylesheet" href="${springMacroRequestContext.contextPath}/system/component/pear/css/pear.css" />
|
||||
<link rel="stylesheet" href="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/pear/css/pear.css" />
|
||||
</head>
|
||||
<body>
|
||||
<form class="layui-form" action="">
|
||||
|
|
@ -93,20 +93,21 @@
|
|||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script src="${springMacroRequestContext.contextPath}/system/component/layui/layui.js"></script>
|
||||
<script src="${springMacroRequestContext.contextPath}/system/component/pear/pear.js"></script>
|
||||
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/layui/layui.js"></script>
|
||||
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/pear/pear.js"></script>
|
||||
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/admin/js/mystyle-admin.js"></script>
|
||||
<script>
|
||||
layui.use(['form', 'jquery', 'iconPicker', 'dtree','dictionary'], function () {
|
||||
let form = layui.form;
|
||||
let $ = layui.jquery;
|
||||
let iconPicker = layui.iconPicker;
|
||||
let dtree = layui.dtree;
|
||||
let token = localStorage.getItem("token");
|
||||
|
||||
dtree.renderSelect({
|
||||
elem: "#selectParent",
|
||||
url: "/permission/selectParent",
|
||||
url: permission_selectParent_url,
|
||||
headers:{
|
||||
token:token
|
||||
access_token:access_token
|
||||
},
|
||||
method: 'get',
|
||||
selectInputName: {nodeId: "parentId", context: "title"},
|
||||
|
|
@ -140,9 +141,9 @@
|
|||
form.on('submit(power-save)', function (data) {
|
||||
data.field.icon = "layui-icon " + data.field.icon;
|
||||
var obj = data.field;
|
||||
obj['token'] = localStorage.getItem("token");
|
||||
obj['access_token'] = localStorage.getItem("access_token");
|
||||
$.ajax({
|
||||
url: '/permission/save',
|
||||
url: permission_save_url,
|
||||
data: obj,
|
||||
type: 'post',
|
||||
success: function (result) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<title>添加权限</title>
|
||||
<link rel="stylesheet" href="${springMacroRequestContext.contextPath}/system/component/pear/css/pear.css"/>
|
||||
<link rel="stylesheet" href="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/pear/css/pear.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<form class="layui-form" action="">
|
||||
|
|
@ -103,8 +103,9 @@
|
|||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script src="${springMacroRequestContext.contextPath}/system/component/layui/layui.js"></script>
|
||||
<script src="${springMacroRequestContext.contextPath}/system/component/pear/pear.js"></script>
|
||||
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/layui/layui.js"></script>
|
||||
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/pear/pear.js"></script>
|
||||
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/admin/js/mystyle-admin.js"></script>
|
||||
<script>
|
||||
layui.use(['form', 'jquery', 'iconPicker', 'dtree', 'dictionary','layer'], function () {
|
||||
let form = layui.form;
|
||||
|
|
@ -141,9 +142,9 @@
|
|||
|
||||
dtree.renderSelect({
|
||||
elem: "#selectParent",
|
||||
url: "/permission/selectParent",
|
||||
url: permission_selectParent_url,
|
||||
headers: {
|
||||
token: token
|
||||
access_token: access_token
|
||||
},
|
||||
method: 'get',
|
||||
selectInputName: {nodeId: "parentId", context: "title"},
|
||||
|
|
@ -177,9 +178,9 @@
|
|||
form.on('submit(power-save)', function (data) {
|
||||
data.field.icon = "layui-icon " + data.field.icon;
|
||||
var obj = data.field;
|
||||
obj['token'] = localStorage.getItem("token");
|
||||
obj['access_token'] = access_token;
|
||||
$.ajax({
|
||||
url: '/permission/save',
|
||||
url: permission_save_url,
|
||||
data: obj,
|
||||
type: 'post',
|
||||
success: function (result) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>权限管理</title>
|
||||
<link rel="stylesheet" href="${springMacroRequestContext.contextPath}/system/component/pear/css/pear.css"/>
|
||||
<link rel="stylesheet" href="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/pear/css/pear.css"/>
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
<div class="layui-card">
|
||||
|
|
@ -82,8 +82,9 @@
|
|||
<i class="layui-icon {{d.icon}}"></i>
|
||||
</script>
|
||||
|
||||
<script src="${springMacroRequestContext.contextPath}/system/component/layui/layui.js"></script>
|
||||
<script src="${springMacroRequestContext.contextPath}/system/component/pear/pear.js"></script>
|
||||
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/layui/layui.js"></script>
|
||||
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/pear/pear.js"></script>
|
||||
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/admin/js/mystyle-admin.js"></script>
|
||||
<script>
|
||||
layui.use(['table', 'form', 'jquery', 'treetable'], function () {
|
||||
let table = layui.table;
|
||||
|
|
@ -91,8 +92,6 @@
|
|||
let $ = layui.jquery;
|
||||
let treetable = layui.treetable;
|
||||
|
||||
let token = localStorage.getItem("token");
|
||||
|
||||
window.render = function () {
|
||||
treetable.render({
|
||||
treeColIndex: 1,
|
||||
|
|
@ -104,7 +103,7 @@
|
|||
treeDefaultClose: true,
|
||||
toolbar: '#power-toolbar',
|
||||
elem: '#power-table',
|
||||
url: '/permission/list?token=' + localStorage.getItem("token"),
|
||||
url: permission_list_url,
|
||||
page: true,
|
||||
cols: [
|
||||
[
|
||||
|
|
@ -178,7 +177,7 @@
|
|||
title: '新增',
|
||||
shade: 0.1,
|
||||
area: ['900px', '600px'],
|
||||
content: '/permission/add?token=' + token
|
||||
content: permission_add_url
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -188,7 +187,7 @@
|
|||
title: '修改',
|
||||
shade: 0.1,
|
||||
area: ['900px', '600px'],
|
||||
content: '/permission/edit?permissionId=' + obj.data.id + '&token=' + token
|
||||
content: permission_edit_url + "&permissionId=" + obj.data.id
|
||||
});
|
||||
};
|
||||
window.remove = function (obj) {
|
||||
|
|
@ -196,10 +195,10 @@
|
|||
layer.close(index);
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
url: "/permission/delete",
|
||||
url: permission_delete_url,
|
||||
data: {
|
||||
permissionId: obj.data['id'],
|
||||
token: token
|
||||
access_token: access_token
|
||||
},
|
||||
type: 'post',
|
||||
success: function (result) {
|
||||
|
|
@ -237,10 +236,10 @@
|
|||
layer.close(index);
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
url: "/permission/batchRemove" ,
|
||||
url: permission_batchRemove_url ,
|
||||
data: {
|
||||
ids:ids,
|
||||
token:token
|
||||
access_token:access_token
|
||||
},
|
||||
type: 'post',
|
||||
success: function (result) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue