若依 3.0
This commit is contained in:
152
ruoyi-admin/src/main/resources/templates/system/role/add.html
Normal file
152
ruoyi-admin/src/main/resources/templates/system/role/add.html
Normal file
@@ -0,0 +1,152 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<link th:href="@{/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css}" rel="stylesheet"/>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-role-add">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label ">角色名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="roleName" id="roleName"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">权限字符:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="roleKey" id="roleKey">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">显示顺序:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="roleSort" id="roleSort">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">状态:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="onoffswitch">
|
||||
<input type="checkbox" th:checked="true" class="onoffswitch-checkbox" id="status" name="status">
|
||||
<label class="onoffswitch-label" for="status">
|
||||
<span class="onoffswitch-inner"></span>
|
||||
<span class="onoffswitch-switch"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">备注:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="remark" name="remark" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">菜单权限</label>
|
||||
<div class="col-sm-8">
|
||||
<div id="menuTrees" class="ztree"></div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
var url = ctx + "system/menu/roleMenuTreeData";
|
||||
var options = {
|
||||
id: "menuTrees",
|
||||
url: url,
|
||||
check: { enable: true, nocheckInherit: true, chkboxType: { "Y": "ps", "N": "ps" } },
|
||||
expandLevel: 0
|
||||
};
|
||||
$.tree.init(options);
|
||||
});
|
||||
|
||||
$("#form-role-add").validate({
|
||||
rules:{
|
||||
roleName:{
|
||||
required:true,
|
||||
remote: {
|
||||
url: ctx + "system/role/checkRoleNameUnique",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {
|
||||
"roleName" : function() {
|
||||
return $.common.trim($("#roleName").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function(data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
roleKey:{
|
||||
required:true,
|
||||
remote: {
|
||||
url: ctx + "system/role/checkRoleKeyUnique",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {
|
||||
"roleName" : function() {
|
||||
return $.common.trim($("#roleName").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function(data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
roleSort:{
|
||||
required:true,
|
||||
digits:true
|
||||
},
|
||||
},
|
||||
messages: {
|
||||
"roleName": {
|
||||
remote: "角色名称已经存在"
|
||||
},
|
||||
"roleKey": {
|
||||
remote: "角色权限已经存在"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
add();
|
||||
}
|
||||
}
|
||||
|
||||
function add() {
|
||||
var roleName = $("input[name='roleName']").val();
|
||||
var roleKey = $("input[name='roleKey']").val();
|
||||
var roleSort = $("input[name='roleSort']").val();
|
||||
var status = $("input[name='status']").is(':checked') == true ? 0 : 1;
|
||||
var remark = $("input[name='remark']").val();
|
||||
var menuIds = $.tree.getCheckedNodes();
|
||||
$.ajax({
|
||||
cache : true,
|
||||
type : "POST",
|
||||
url : ctx + "system/role/add",
|
||||
data : {
|
||||
"roleName": roleName,
|
||||
"roleKey": roleKey,
|
||||
"roleSort": roleSort,
|
||||
"status": status,
|
||||
"remark": remark,
|
||||
"menuIds": menuIds
|
||||
},
|
||||
async : false,
|
||||
error : function(request) {
|
||||
$.modal.alertError("系统错误");
|
||||
},
|
||||
success : function(data) {
|
||||
$.operate.saveSuccess(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
161
ruoyi-admin/src/main/resources/templates/system/role/edit.html
Normal file
161
ruoyi-admin/src/main/resources/templates/system/role/edit.html
Normal file
@@ -0,0 +1,161 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<link th:href="@{/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css}" rel="stylesheet"/>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-role-edit" th:object="${role}">
|
||||
<input id="roleId" name="roleId" type="hidden" th:field="*{roleId}"/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label ">角色名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="roleName" id="roleName" th:field="*{roleName}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">权限字符:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="roleKey" id="roleKey" th:field="*{roleKey}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">显示顺序:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="roleSort" id="roleSort" th:field="*{roleSort}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">状态:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="onoffswitch">
|
||||
<input type="checkbox" th:checked="${role.status == '0' ? true : false}" class="onoffswitch-checkbox" id="status" name="status">
|
||||
<label class="onoffswitch-label" for="status">
|
||||
<span class="onoffswitch-inner"></span>
|
||||
<span class="onoffswitch-switch"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">备注:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="remark" name="remark" class="form-control" type="text" th:field="*{remark}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">菜单权限</label>
|
||||
<div class="col-sm-8">
|
||||
<div id="menuTrees" class="ztree"></div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
var url = ctx + "system/menu/roleMenuTreeData?roleId=" + $("#roleId").val();
|
||||
var options = {
|
||||
id: "menuTrees",
|
||||
url: url,
|
||||
check: { enable: true, nocheckInherit: true, chkboxType: { "Y": "ps", "N": "ps" } },
|
||||
expandLevel: 0
|
||||
};
|
||||
$.tree.init(options);
|
||||
});
|
||||
|
||||
$("#form-role-edit").validate({
|
||||
rules:{
|
||||
roleName:{
|
||||
required:true,
|
||||
remote: {
|
||||
url: ctx + "system/role/checkRoleNameUnique",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {
|
||||
"roleId": function() {
|
||||
return $("#roleId").val();
|
||||
},
|
||||
"roleName": function() {
|
||||
return $.common.trim($("#roleName").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function(data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
roleKey:{
|
||||
required:true,
|
||||
remote: {
|
||||
url: ctx + "system/role/checkRoleKeyUnique",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {
|
||||
"roleId": function() {
|
||||
return $("#roleId").val();
|
||||
},
|
||||
"roleKey": function() {
|
||||
return $.common.trim($("#roleKey").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function(data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
roleSort:{
|
||||
required:true,
|
||||
digits:true
|
||||
},
|
||||
},
|
||||
messages: {
|
||||
"roleName": {
|
||||
remote: "角色名称已经存在"
|
||||
},
|
||||
"roleKey": {
|
||||
remote: "角色权限已经存在"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function edit() {
|
||||
var roleId = $("input[name='roleId']").val();
|
||||
var roleName = $("input[name='roleName']").val();
|
||||
var roleKey = $("input[name='roleKey']").val();
|
||||
var roleSort = $("input[name='roleSort']").val();
|
||||
var status = $("input[name='status']").is(':checked') == true ? 0 : 1;
|
||||
var remark = $("input[name='remark']").val();
|
||||
var menuIds = $.tree.getCheckedNodes();
|
||||
$.ajax({
|
||||
cache : true,
|
||||
type : "POST",
|
||||
url : ctx + "system/role/edit",
|
||||
data : {
|
||||
"roleId": roleId,
|
||||
"roleName": roleName,
|
||||
"roleKey": roleKey,
|
||||
"roleSort": roleSort,
|
||||
"status": status,
|
||||
"remark": remark,
|
||||
"menuIds": menuIds
|
||||
},
|
||||
async : false,
|
||||
error : function(request) {
|
||||
$.modal.alertError("系统错误");
|
||||
},
|
||||
success : function(data) {
|
||||
$.operate.saveSuccess(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
edit();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
137
ruoyi-admin/src/main/resources/templates/system/role/role.html
Normal file
137
ruoyi-admin/src/main/resources/templates/system/role/role.html
Normal file
@@ -0,0 +1,137 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<body class="gray-bg">
|
||||
|
||||
<div class="container-div">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 search-collapse">
|
||||
<form id="role-form">
|
||||
<div class="select-list">
|
||||
<ul>
|
||||
<li>
|
||||
角色名称:<input type="text" name="roleName"/>
|
||||
</li>
|
||||
<li>
|
||||
权限字符:<input type="text" name="roleKey"/>
|
||||
</li>
|
||||
<li>
|
||||
角色状态:<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
|
||||
<option value="">所有</option>
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</li>
|
||||
<li class="select-time">
|
||||
<label>创建时间: </label>
|
||||
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
|
||||
<span>-</span>
|
||||
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
|
||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
|
||||
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:role:add">
|
||||
<i class="fa fa-plus"></i> 新增
|
||||
</a>
|
||||
<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="system:role:edit">
|
||||
<i class="fa fa-edit"></i> 修改
|
||||
</a>
|
||||
<a class="btn btn-danger btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:role:remove">
|
||||
<i class="fa fa-remove"></i> 删除
|
||||
</a>
|
||||
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:role:export">
|
||||
<i class="fa fa-download"></i> 导出
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table" data-mobile-responsive="true"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div th:include="include :: footer"></div>
|
||||
<script th:inline="javascript">
|
||||
var editFlag = [[${@permission.hasPermi('system:role:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('system:role:remove')}]];
|
||||
var datas = [[${@dict.getType('sys_normal_disable')}]];
|
||||
var prefix = ctx + "system/role";
|
||||
|
||||
|
||||
$(function() {
|
||||
var options = {
|
||||
url: prefix + "/list",
|
||||
createUrl: prefix + "/add",
|
||||
updateUrl: prefix + "/edit/{id}",
|
||||
removeUrl: prefix + "/remove",
|
||||
exportUrl: prefix + "/export",
|
||||
sortName: "roleSort",
|
||||
modalName: "角色",
|
||||
search: false,
|
||||
showExport: false,
|
||||
columns: [{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
field: 'roleId',
|
||||
title: '角色编号'
|
||||
},
|
||||
{
|
||||
field: 'roleName',
|
||||
title: '角色名称',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field: 'roleKey',
|
||||
title: '权限字符',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field: 'roleSort',
|
||||
title: '显示顺序',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '状态',
|
||||
align: 'center',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(datas, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
formatter: function(value, row, index) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.roleId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
||||
actions.push('<a class="btn btn-primary btn-xs ' + editFlag + '" href="#" onclick="rule(\'' + row.roleId + '\')"><i class="fa fa-check-square-o"></i>数据权限</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.roleId + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||
return actions.join('');
|
||||
}
|
||||
}]
|
||||
};
|
||||
$.table.init(options);
|
||||
});
|
||||
|
||||
/*角色管理-分配数据权限*/
|
||||
function rule(roleId) {
|
||||
var url = prefix + '/rule/' + roleId;
|
||||
$.modal.open("分配数据权限", url);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
104
ruoyi-admin/src/main/resources/templates/system/role/rule.html
Normal file
104
ruoyi-admin/src/main/resources/templates/system/role/rule.html
Normal file
@@ -0,0 +1,104 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<link th:href="@{/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css}" rel="stylesheet"/>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-role-edit" th:object="${role}">
|
||||
<input id="roleId" name="roleId" type="hidden" th:field="*{roleId}"/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label ">角色名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="roleName" id="roleName" th:field="*{roleName}" readonly="true"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">权限字符:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="roleKey" id="roleKey" th:field="*{roleKey}" readonly="true">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">数据范围:</label>
|
||||
<div class="col-sm-8">
|
||||
<select id="dataScope" name="dataScope" class="form-control m-b">
|
||||
<option value="1" th:field="*{dataScope}">全部数据权限</option>
|
||||
<option value="2" th:field="*{dataScope}">自定数据权限</option>
|
||||
</select>
|
||||
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 特殊情况下,设置为“自定数据权限”</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" id="roleRule" style="display: none">
|
||||
<label class="col-sm-3 control-label">数据权限</label>
|
||||
<div class="col-sm-8">
|
||||
<div id="deptTrees" class="ztree"></div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
$(function() {
|
||||
var url = ctx + "system/dept/roleDeptTreeData?roleId=" + $("#roleId").val();
|
||||
var options = {
|
||||
id: "deptTrees",
|
||||
url: url,
|
||||
check: { enable: true, nocheckInherit: true, chkboxType: { "Y": "ps", "N": "ps" } },
|
||||
expandLevel: 2
|
||||
};
|
||||
$.tree.init(options);
|
||||
$("#dataScope").change();
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
edit();
|
||||
}
|
||||
}
|
||||
|
||||
function edit() {
|
||||
var roleId = $("input[name='roleId']").val();
|
||||
var roleName = $("input[name='roleName']").val();
|
||||
var roleKey = $("input[name='roleKey']").val();
|
||||
var dataScope = $("#dataScope").val();
|
||||
var deptIds = $.tree.getCheckedNodes();
|
||||
$.ajax({
|
||||
cache : true,
|
||||
type : "POST",
|
||||
url : ctx + "system/role/rule",
|
||||
data : {
|
||||
"roleId": roleId,
|
||||
"roleName": roleName,
|
||||
"roleKey": roleKey,
|
||||
"dataScope": dataScope,
|
||||
"deptIds": deptIds
|
||||
},
|
||||
async : false,
|
||||
error : function(request) {
|
||||
$.modal.alertError("系统错误");
|
||||
},
|
||||
success : function(data) {
|
||||
$.operate.saveSuccess(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$("#dataScope").change(function(event){
|
||||
var dataScope = $(event.target).val();
|
||||
dataScopeVisible(dataScope);
|
||||
});
|
||||
|
||||
function dataScopeVisible(dataScope) {
|
||||
if (dataScope == 2) {
|
||||
$("#roleRule").show();
|
||||
} else {
|
||||
$._tree.checkAllNodes(false);
|
||||
$("#roleRule").hide();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user