2021-11-09 02:23:55 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
|
<title>角色授权</title>
|
2022-01-25 09:18:53 +00:00
|
|
|
<link rel="stylesheet" href="${springMacroRequestContext.contextPath}/admin/system/component/pear/css/pear.css" />
|
2021-11-09 02:23:55 +00:00
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<form class="layui-form" action="">
|
|
|
|
|
<div class="mainBox">
|
|
|
|
|
<div class="main-container">
|
|
|
|
|
<div class="main-container">
|
|
|
|
|
<ul id="role-power" class="dtree" data-id="0"></ul>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="bottom">
|
|
|
|
|
<div class="button-container">
|
|
|
|
|
<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="power-save">
|
|
|
|
|
<i class="layui-icon layui-icon-ok"></i>
|
|
|
|
|
提交
|
|
|
|
|
</button>
|
|
|
|
|
<button type="reset" class="pear-btn pear-btn-sm">
|
|
|
|
|
<i class="layui-icon layui-icon-refresh"></i>
|
|
|
|
|
重置
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
2022-01-25 09:18:53 +00:00
|
|
|
<script src="${springMacroRequestContext.contextPath}/admin/system/component/layui/layui.js"></script>
|
|
|
|
|
<script src="${springMacroRequestContext.contextPath}/admin/system/component/pear/pear.js"></script>
|
|
|
|
|
<script src="${springMacroRequestContext.contextPath}/admin/system/admin/js/mystyle-admin.js"></script>
|
2021-11-09 02:23:55 +00:00
|
|
|
<script>
|
|
|
|
|
layui.use(['dtree', 'form', 'jquery'], function () {
|
|
|
|
|
let dtree = layui.dtree;
|
|
|
|
|
let form = layui.form;
|
|
|
|
|
let $ = layui.jquery;
|
|
|
|
|
dtree.render({
|
|
|
|
|
elem: "#role-power",
|
|
|
|
|
method: "get",
|
2021-11-09 10:23:27 +00:00
|
|
|
url: role_getRolePower_url + '&roleId=${role.id}',
|
2021-11-09 02:23:55 +00:00
|
|
|
dataFormat: "list",
|
|
|
|
|
checkbar: true,
|
|
|
|
|
skin: "layui",
|
|
|
|
|
initLevel: "1",
|
|
|
|
|
checkbarType: "self",
|
|
|
|
|
response: {treeId: "id", parentId: "parent_id", title: "title"},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
form.on('submit(power-save)', function (data) {
|
|
|
|
|
let param = dtree.getCheckbarNodesParam("role-power");
|
|
|
|
|
let ids = '';
|
|
|
|
|
for (let i = 0; i < param.length; i++) {
|
|
|
|
|
let id = param[i].nodeId;
|
|
|
|
|
ids += id + ',';
|
|
|
|
|
}
|
|
|
|
|
ids = ids.substr(0, ids.length - 1);
|
|
|
|
|
data.field.roleId = '${role.id}';
|
|
|
|
|
data.field.powerIds = ids;
|
2021-11-09 10:23:27 +00:00
|
|
|
data.field.access_token = access_token;
|
2021-11-09 02:23:55 +00:00
|
|
|
$.ajax({
|
2021-11-09 10:23:27 +00:00
|
|
|
url: role_saveRolePower_url,
|
2021-11-09 02:23:55 +00:00
|
|
|
data: data.field,
|
|
|
|
|
dataType: 'json',
|
2021-11-09 10:23:27 +00:00
|
|
|
type: 'post',
|
2021-11-09 02:23:55 +00:00
|
|
|
success: function (result) {
|
|
|
|
|
if (result.flag) {
|
|
|
|
|
layer.msg(result.message, {icon: 1, time: 1000}, function () {
|
|
|
|
|
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
layer.msg(result.message, {icon: 2, time: 1000});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|