<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>关联角色</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		var validateForm;
		function doSubmit(){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
		  if(validateForm.form()){
			  $("#inputForm").submit();
			  return true;
		  }
	
		  return false;
		}
		$(document).ready(function() {
            //初始化加载
            var processKey = "${workActivityMenu.processKey}";
            validateForm = $("#inputForm").validate({
                submitHandler: function(form){
                    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);
                    }
                }
            });
            if(processKey){
                showlink(processKey);
            }
		});

	</script>
</head>
<body>
<div class="single-form">
	<div class="container">
	<form:form id="inputForm" modelAttribute="role" action="${ctx}/sys/role/relation" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<form:hidden path="office.id"/>

		<div class="form-group layui-row first">
			<div class="form-group-label"><h2>关联角色</h2></div>
			<div class="layui-item layui-col-sm12">
				<label class="layui-form-label">岗位名称：</label>
				<div class="layui-input-block">
					<input readonly="true" htmlEscape="false" class="layui-input form-control" value="${role.name}" />
				</div>
			</div>
			<div class="layui-item layui-col-sm12">
				<label class="layui-form-label">归属部门：</label>
				<div class="layui-input-block">
					<input readonly="true" htmlEscape="false" class="layui-input form-control" value="${role.office.name}" />
				</div>
			</div>
			<div class="layui-item layui-col-sm12">
				<label class="layui-form-label">选择角色：</label>
				<div class="layui-input-block with-icon">
					<sys:treeselectRole id="roleActivityIds" name="roleActivityIds" value="${role.roleActivityIds}" labelName="roleActivityNames" labelValue="${role.roleActivityNames}"
										title="选择角色" url="/sys/office/treeDataRoleActivity?type=3&isAll=false&role=${role.id}" cssClass="form-control layui-input" notAllowSelectParent="true" checked="true"/>
					<label id="roleIdList-error" class="error" for="roleActivityList"></label>
				</div>
			</div>
		</div>
	</form:form>
	</div>
</div>
</body>
</html>