权限控制:查看角色页面添加显示表格列权限
This commit is contained in:
@@ -76,8 +76,10 @@ public class RoleController extends BaseController {
|
|||||||
|
|
||||||
@RequestMapping("/view")
|
@RequestMapping("/view")
|
||||||
public String view(ModelMap modelMap, Long id) {
|
public String view(ModelMap modelMap, Long id) {
|
||||||
modelMap.addAttribute("role", roleService.find(id));
|
Role role = roleService.find(id);
|
||||||
modelMap.addAttribute("authorities", roleService.find(id).getAuthorities());
|
modelMap.addAttribute("role", role);
|
||||||
|
modelMap.addAttribute("authorities", role.getAuthorities());
|
||||||
|
modelMap.addAttribute("tableColumnControlAuthorityList", role.getTableColumnControlAuthorityList());
|
||||||
modelMap.addAttribute("dataRanges", DataRange.values());
|
modelMap.addAttribute("dataRanges", DataRange.values());
|
||||||
return "/role/view";
|
return "/role/view";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,7 @@
|
|||||||
padding: 6px 10px !important;
|
padding: 6px 10px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.authorities-wrapper .authorities, .table-column-control-authorities-wrapper .authorities
|
.authorities-wrapper .authorities, .table-column-control-authorities-wrapper .authorities {
|
||||||
{
|
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,13 +5,13 @@
|
|||||||
<form id="addForm" action="role/update.html" returnUrl="role/list.html" enctype="multipart/form-data" method="post">
|
<form id="addForm" action="role/update.html" returnUrl="role/list.html" enctype="multipart/form-data" method="post">
|
||||||
<div class="appPage addPage">
|
<div class="appPage addPage">
|
||||||
<style>
|
<style>
|
||||||
.authorities-wrapper {
|
.authorities-wrapper, .table-column-control-authorities-wrapper {
|
||||||
width: initial !important;
|
width: initial !important;
|
||||||
height: auto !important;
|
height: auto !important;
|
||||||
padding: 6px 10px !important;
|
padding: 6px 10px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.authorities-wrapper .authorities {
|
.authorities-wrapper .authorities, .table-column-control-authorities-wrapper .authorities {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,7 +32,8 @@
|
|||||||
<div class="tabBody">
|
<div class="tabBody">
|
||||||
<ul class="tagSwitch">
|
<ul class="tagSwitch">
|
||||||
<li tagindex="1" class="tag active">功能权限</li>
|
<li tagindex="1" class="tag active">功能权限</li>
|
||||||
<li tagindex="2" class="tag">数据权限</li>
|
<li tagindex="2" class="tag">表格列权限</li>
|
||||||
|
<li tagindex="3" class="tag">数据权限</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="tagContents">
|
<div class="tagContents">
|
||||||
<div tagindex="1" class="submitBody tagContent active">
|
<div tagindex="1" class="submitBody tagContent active">
|
||||||
@@ -54,6 +55,9 @@
|
|||||||
<div class="authorities-wrapper"></div>
|
<div class="authorities-wrapper"></div>
|
||||||
</div>
|
</div>
|
||||||
<div tagindex="2" class="submitBody tagContent">
|
<div tagindex="2" class="submitBody tagContent">
|
||||||
|
<div class="table-column-control-authorities-wrapper"></div>
|
||||||
|
</div>
|
||||||
|
<div tagindex="3" class="submitBody tagContent">
|
||||||
<div class="dataRange-wrapper single-checkbox-group" data-name="dataRange">
|
<div class="dataRange-wrapper single-checkbox-group" data-name="dataRange">
|
||||||
<th:block th:each="item : ${dataRanges}">
|
<th:block th:each="item : ${dataRanges}">
|
||||||
<div class="common-single-checkbox" th:data-name="${item}"
|
<div class="common-single-checkbox" th:data-name="${item}"
|
||||||
@@ -68,11 +72,31 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script src="/resources/js/permissionData.js?v=240329"></script>
|
<script src="/resources/js/permissionData.js?v=240329"></script>
|
||||||
|
<script src="/resources/js/tableColumnControlPermissionData.js"></script>
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
var authorities = [[${authorities}]]
|
var authorities = [[${authorities}]];
|
||||||
|
var tableColumnControlAuthorityList = [[${tableColumnControlAuthorityList}]];
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
var $authoritiesWrapper = $(".authorities-wrapper");
|
// var $authoritiesWrapper = $(".authorities-wrapper");
|
||||||
|
// for (var i in permissions) {
|
||||||
|
// var permission = permissions[i];
|
||||||
|
// var $authorities = $('<div class="authorities"></div>');
|
||||||
|
// $authorities.append('<span>\n' +
|
||||||
|
// ' <a href="javascript:;" class="selectAll">' + permission.entityName + '权限全选</a>\n' +
|
||||||
|
// ' </span>');
|
||||||
|
// var $fieldSet = $('<span class="fieldSet"></span>');
|
||||||
|
// for (var j in permission.itemList) {
|
||||||
|
// var item = permission.itemList[j];
|
||||||
|
// var value = permission.entity + ':' + item.value;
|
||||||
|
// var init = authorities.indexOf(value) !== -1;
|
||||||
|
// $fieldSet.append('<span class="common-single-checkbox" data-init="' + init + '" disabled></span><span>' + item.text + '</span>\n')
|
||||||
|
// }
|
||||||
|
// $authorities.append($fieldSet.prop('outerHTML'));
|
||||||
|
// $authoritiesWrapper.append($authorities.prop('outerHTML'));
|
||||||
|
// }
|
||||||
|
|
||||||
|
function authorityWrapperInit($dom, dataName, permissions, authorities) {
|
||||||
for (var i in permissions) {
|
for (var i in permissions) {
|
||||||
var permission = permissions[i];
|
var permission = permissions[i];
|
||||||
var $authorities = $('<div class="authorities"></div>');
|
var $authorities = $('<div class="authorities"></div>');
|
||||||
@@ -83,10 +107,15 @@
|
|||||||
for (var j in permission.itemList) {
|
for (var j in permission.itemList) {
|
||||||
var item = permission.itemList[j];
|
var item = permission.itemList[j];
|
||||||
var value = permission.entity + ':' + item.value;
|
var value = permission.entity + ':' + item.value;
|
||||||
var init = authorities.indexOf(value) !== -1;
|
var init = authorities && authorities.indexOf(value) !== -1;
|
||||||
$fieldSet.append('<span class="common-single-checkbox" data-init="' + init + '" disabled></span><span>' + item.text + '</span>\n')
|
$fieldSet.append('<span class="common-single-checkbox" data-name="' + dataName +'" data-init="' + init + '" disabled></span><span>' + item.text + '</span>\n')
|
||||||
}
|
}
|
||||||
$authorities.append($fieldSet.prop('outerHTML'));
|
$authorities.append($fieldSet.prop('outerHTML'));
|
||||||
$authoritiesWrapper.append($authorities.prop('outerHTML'));
|
$dom.append($authorities.prop('outerHTML'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
authorityWrapperInit($(".authorities-wrapper"), "authorities", permissions, authorities);
|
||||||
|
authorityWrapperInit($(".table-column-control-authorities-wrapper"), "tableColumnControlAuthorityList", tableColumnControlPermissions, tableColumnControlAuthorityList);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user