初始版本
This commit is contained in:
157
src/main/webapp/WEB-INF/template/role/add.html
Normal file
157
src/main/webapp/WEB-INF/template/role/add.html
Normal file
@@ -0,0 +1,157 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||
|
||||
<!--module="role" moduleName="角色"-->
|
||||
<form id="addForm" action="role/save.html" returnUrl="role/list.html" enctype="multipart/form-data" method="post">
|
||||
<div class="appPage addPage">
|
||||
<style>
|
||||
.authorities-wrapper {
|
||||
width: initial !important;
|
||||
height: auto !important;
|
||||
padding: 6px 10px !important;
|
||||
}
|
||||
|
||||
.authorities-wrapper .authorities {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.common-single-checkbox {
|
||||
margin: 0 4px 0 10px;
|
||||
}
|
||||
|
||||
.dataRange-wrapper {
|
||||
padding: 6px 10px !important;
|
||||
}
|
||||
</style>
|
||||
<div class="head">
|
||||
<h1 class="page-title">添加角色</h1>
|
||||
<div class="btnGroup">
|
||||
<a class="btn" href="javascript:Nav.return('role/list.html')" th:text="#{common.back}"></a>
|
||||
<input type="submit" class="btn submit" th:value="#{common.save}"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tabBody">
|
||||
<ul class="tagSwitch">
|
||||
<li tagindex="1" class="tag active">功能权限</li>
|
||||
<li tagindex="2" class="tag">数据权限</li>
|
||||
</ul>
|
||||
<div class="tagContents">
|
||||
<div tagindex="1" class="submitBody tagContent active">
|
||||
<div>
|
||||
<label for="name">英文角色名</label>
|
||||
<input class=text id="name" name="name" type=text autocomplete="off">
|
||||
</div>
|
||||
<div>
|
||||
<label for="chineseName">中文角色名</label>
|
||||
<input class=text id="chineseName" name="chineseName" type=text autocomplete="off">
|
||||
</div>
|
||||
<div>
|
||||
<label for="description">功能描述</label>
|
||||
<input class=text id="description" name="description" type=text autocomplete="off">
|
||||
</div>
|
||||
<div class="authorities-wrapper">
|
||||
</div>
|
||||
</div>
|
||||
<div tagindex="2" class="submitBody tagContent">
|
||||
<div class="dataRange-wrapper single-checkbox-group" data-name="dataRange">
|
||||
<th:block th:each="item : ${dataRanges}">
|
||||
<div class="common-single-checkbox" th:data-name="${item}"></div>
|
||||
<span th:text="${item.name}"></span>
|
||||
</th:block>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script src="/resources/js/permissionData.js?v=240329"></script>
|
||||
<script>
|
||||
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;
|
||||
$fieldSet.append('<span class="common-single-checkbox" data-name="authorities" data-value="' + value + '"></span><span>' + item.text + '</span>\n')
|
||||
}
|
||||
$authorities.append($fieldSet.prop('outerHTML'));
|
||||
$authoritiesWrapper.append($authorities.prop('outerHTML'));
|
||||
}
|
||||
|
||||
var $selectAll = $(".selectAll");
|
||||
$selectAll.click(function () {
|
||||
var $authorities = $(this).parents('.authorities');
|
||||
var $selects = $authorities.find('.common-single-checkbox[data-flag=true]');
|
||||
var $notSelects = $authorities.find('.common-single-checkbox[data-flag=false]');
|
||||
if ($notSelects.length === 0) {
|
||||
$selects.click();
|
||||
} else {
|
||||
$notSelects.click();
|
||||
}
|
||||
});
|
||||
|
||||
var $addForm = $("#addForm");
|
||||
$addForm.validate({
|
||||
rules: {
|
||||
name: {
|
||||
required: true,
|
||||
remote: {
|
||||
url: "role/nameIsExist.html",
|
||||
type: "post"
|
||||
}
|
||||
},
|
||||
chineseName: {
|
||||
required: true,
|
||||
remote: {
|
||||
url: "role/chineseNameIsExist.html",
|
||||
type: "post"
|
||||
}
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
name: {
|
||||
required: "英文角色名不能为空",
|
||||
remote: "英文角色名已存在"
|
||||
},
|
||||
chineseName: {
|
||||
required: "中文角色名不能为空",
|
||||
remote: "中文角色名已存在"
|
||||
}
|
||||
},
|
||||
submitHandler: function (form) {
|
||||
Dialog.waiting();
|
||||
$(form).ajaxSubmit(function () {
|
||||
Dialog.success();
|
||||
var returnUrl = $(form).attr("returnUrl");
|
||||
Nav.go(returnUrl);
|
||||
});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// var list = [];
|
||||
// var $authoritiesWrapper = $(".authorities-wrapper");
|
||||
// $authoritiesWrapper.find('.authorities').each(function () {
|
||||
// var obj = {};
|
||||
// obj.entityName = $(this).find('a').text().split("权限全选")[0];
|
||||
// var itemList = [];
|
||||
// $(this).find('.common-single-checkbox').each(function () {
|
||||
// var value = $(this).attr('data-value');
|
||||
// obj.entity = value.split(':')[0];
|
||||
// itemList.push({
|
||||
// text: $(this).next().text(),
|
||||
// value: value.split(':')[1]
|
||||
// })
|
||||
// });
|
||||
// obj.itemList = itemList;
|
||||
// list.push(obj);
|
||||
// });
|
||||
</script>
|
||||
</html>
|
||||
Reference in New Issue
Block a user