This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
k18-ntcs-web-ntc/src/main/webapp/WEB-INF/views/sys/roleForm.jsp
2018-02-02 17:58:32 +08:00

185 lines
7.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/include/taglib.jsp"%>
<html>
<head>
<title>角色管理</title>
<link href="${pageContext.request.contextPath}/static/global/plugins/jquery-ztree/3.5.12/css/zTreeStyle/zTreeStyle.min.css" rel="stylesheet" type="text/css"/>
<script src="${pageContext.request.contextPath}/static/global/plugins/jquery-ztree/3.5.12/js/jquery.ztree.all-3.5.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#name").focus();
$("#inputForm").validate({
rules: {
name: {remote: "${ctx}/sys/role/checkName?oldName=" + encodeURIComponent("${role.name}")}
},
messages: {
name: {remote: "角色名已存在"}
},
submitHandler: function(form){
var ids = [], nodes = tree.getCheckedNodes(true);
for(var i=0; i<nodes.length; i++) {
ids.push(nodes[i].id);
}
$("#menuIds").val(ids);
loading('正在提交,请稍等...');
form.submit();
},
errorContainer: "#messageBox",
errorPlacement: function(error, element) {
$("#messageBox").text("输入有误,请先更正。");
if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
error.appendTo(element.parent().parent());
} else {
error.insertAfter(element);
}
}
});
var setting = {check:{enable:true,nocheckInherit:true},view:{selectedMulti:false},
data:{simpleData:{enable:true}},callback:{beforeClick:function(id, node){
tree.checkNode(node, !node.checked, true, true);
return false;
}}};
// 用户-菜单
var zNodes=[
<c:forEach items="${menuList}" var="menu">{id:"${menu.id}", pId:"${not empty menu.parent.id?menu.parent.id:0}", name:"${not empty menu.parent.id?menu.name:'权限列表'}"},
</c:forEach>];
// 初始化树结构
var tree = $.fn.zTree.init($("#menuTree"), setting, zNodes);
// 不选择父节点
tree.setting.check.chkboxType = { "Y" : "ps", "N" : "s" };
// 默认选择节点
var ids = "${role.menuIds}".split(",");
for(var i=0; i<ids.length; i++) {
var node = tree.getNodeByParam("id", ids[i]);
try{tree.checkNode(node, true, false);}catch(e){}
}
// 默认展开全部节点
tree.expandAll(true);
});
</script>
</head>
<body>
<div class="page-content">
<div class="theme-panel hidden-xs hidden-sm">
<button type="button" class="btn btn-default" onclick="history.go(-1)">&nbsp;返回&nbsp;</button>
</div>
<h3 class="page-title">
菜单管理
</h3>
<div class="row">
<div class="col-md-12">
<div class="portlet box blue">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>角色<shiro:hasPermission name="sys:role:edit">${not empty role.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="sys:role:edit">查看</shiro:lacksPermission></div>
<div class="tools">
<a href="javascript:;" class="collapse"> </a>
<a href="#portlet-config" data-toggle="modal" class="config"> </a>
<a href="javascript:;" class="reload"> </a>
<a href="javascript:;" class="remove"> </a>
</div>
</div>
<div class="portlet-body form">
<div class="form-body">
<!-- BEGIN FORM-->
<form:form id="inputForm" modelAttribute="sysRole" action="${ctx}/sys/role/saveOrUpdate" method="post" class="form-horizontal">
<form:hidden path="id"/>
<sys:message content="${message}"/>
<div class="form-group">
<label class="col-md-3 control-label">角色名称:</label>
<div class="col-md-4">
<input id="oldName" name="oldName" type="hidden" value="${role.name}">
<form:input path="name" htmlEscape="false" maxlength="50" class="required form-control"/>
<span class="help-inline"><font color="red">*</font> </span>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">角色类型:</label>
<div class="col-md-4"><%--
<form:input path="roleType" htmlEscape="false" maxlength="50" class="required"/>
<span class="help-inline" title="activiti有3种预定义的组类型security-role、assignment、user 如果使用Activiti Explorer需要security-role才能看到manage页签需要assignment才能claim任务">
工作流组用户组类型security-role管理员、assignment可进行任务分配、user普通用户</span> --%>
<form:select path="roleType" class="form-control">
<form:option value="assignment">任务分配</form:option>
<form:option value="security-role">管理角色</form:option>
<form:option value="user">普通角色</form:option>
</form:select>
<span class="help-inline" title="activiti有3种预定义的组类型security-role、assignment、user 如果使用Activiti Explorer需要security-role才能看到manage页签需要assignment才能claim任务">
工作流组用户组类型任务分配assignment、管理角色security-role、普通角色user</span>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">数据范围:</label>
<div class="col-md-4">
<form:select path="dataScope" class="form-control">
<form:options items="${fns:getDictList('SYS_DATA_SCOPE')}" itemLabel="itemValue" itemValue="itemCode" htmlEscape="false"/>
</form:select>
<span class="help-inline">特殊情况下,设置为“按明细设置”,可进行跨机构授权</span>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">角色授权:</label>
<div class="col-md-4">
<div id="menuTree" class="ztree" style="margin-top:3px;float:left;"></div>
<form:hidden path="menuIds"/>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">备注:</label>
<div class="col-md-4">
<form:textarea path="remark" htmlEscape="false" rows="3" maxlength="200" class="form-control"/>
</div>
</div>
<div class="form-actions">
<div class="row">
<div class="col-md-offset-3 col-md-9">
<shiro:hasPermission name="sys:role:edit"><button type="submit" class="btn btn-circle blue">&nbsp;&nbsp;保存&nbsp;&nbsp;</button></shiro:hasPermission>
<button type="button" class="btn btn-circle grey-salsa btn-outline" onclick="history.go(-1)">Cancel</button>
</div>
</div>
</div>
</form:form>
<!-- END FORM-->
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>