<%@ 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() {
			$("#name").focus();
			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);
					}
				}
			});
		});
	</script>
</head>
<body>
<div class="single-form">
	<div class="container">
	<form:form id="inputForm" modelAttribute="area" action="${ctx}/sys/area/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>

		<div class="form-group layui-row first">
			<div class="form-group-label"><h2>区域信息</h2></div>
			<div class="layui-item layui-col-sm6">
				<label class="layui-form-label">上级区域：</label>
				<div class="layui-input-block with-icon">
					<sys:treeselect id="area" name="parent.id" value="${area.parent.id}" labelName="parent.name" labelValue="${area.parent.name}"
									title="区域" url="/sys/area/treeData" extId="${area.id}" cssClass="form-control layui-input" allowClear="true"/>
				</div>
			</div>
			<div class="layui-item layui-col-sm6">
				<label class="layui-form-label">区域名称：</label>
				<div class="layui-input-block with-icon">
					<form:input path="name" htmlEscape="false" maxlength="50" class="form-control layui-input required"/>
				</div>
			</div>
			<div class="layui-item layui-col-sm6">
				<label class="layui-form-label"><span class="require-item">*</span>区域编码：</label>
				<div class="layui-input-block with-icon">
					<form:input path="code" htmlEscape="false" maxlength="50" class="form-control layui-input"/>
				</div>
			</div>
			<div class="layui-item layui-col-sm6">
				<label class="layui-form-label">区域类型：</label>
				<div class="layui-input-block with-icon">
					<form:select path="type" class="form-control simple-select">
					<form:options items="${fns:getDictList('sys_area_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
					</form:select>
				</div>
			</div>
			<div class="layui-item layui-col-sm12 with-textarea">
				<label class="layui-form-label">备注：</label>
				<div class="layui-input-block">
					<form:textarea path="remarks" htmlEscape="false" rows="4" maxlength="200" class="form-control"/>
				</div>
			</div>
		</div>
	</form:form>
	</div>
</div>
</body>
</html>