<html xmlns:th="http://www.thymeleaf.org">
<head>
	<title>私塾家</title>
	<script th:include="sys/common/metaCSS" th:remove="tag"></script>
	<script th:include="sys/common/metaJS" th:remove="tag"></script>
	<script src="sys/js/jquery.validate.min.js" th:src="@{/static/sys/js/jquery.validate.min.js}"></script>
	<script src="sys/js/jquery-validation/messages_zh.js" th:src="@{/static/sys/js/jquery-validation/messages_zh.js}"></script>
	<style>
		.clearfix:after {
			visibility: hidden;
			display: block;
			font-size: 0;
			content: " ";
			clear: both;
			height: 0;
		}
		.clearfix { display: inline-table; }
		* html .clearfix { height: 1%; }
		.clearfix { display: block; }
		.fl{display:inline;float:left}
		clearfix >control-label-error{display:inline;float:left;marign-left:10px}
		label.control-label-error {
			color: Red;
		}
	</style>
</head>

<body>
<div class="place">
	<span>位置：</span>
	<ul class="placeul">
		<li><a href="#">系统销售管理</a></li>
		<li><a href="#">基础子物料管理</a></li>
	</ul>
</div>
<div class="formbody">
	<form id="roleFrom"   method="post" class="form-horizontal form-validate">
		<input  type="hidden" id="id" th:if="${sort.id}" th:value="${sort.id}" name="id">
		<input  type="hidden"  th:value="${pid}" name="pid">
		<input  type="hidden"  value="1" name="level">
		<input  type="hidden"  value="2" name="type">
		<ul class="forminfo">
			<li class="clearfix">
				<label class="fl">名称<b>*</b></label>
				<input type="text"   th:value="${sort.name}"   class="dfinput fl"  name="name">
			</li>
			<li class="clearfix">
				<label class="fl">编码<b>*</b></label>
				<input type="text"   th:value="${sort.code}"   class="dfinput fl"  name="code">
			</li>
			<li class="clearfix">
				<label class="fl">别名<b>*</b></label>
				<input type="text"   th:value="${sort.aliases}"   class="dfinput fl"  name="aliases">
			</li>
			<li>
				<label>&nbsp;</label>
				<button type="submit" class="btn">保存</button>
				<button type="button" class="btn" onclick="window.history.go(-1);">取消</button>
			</li>
		</ul>
	</form>
</div>
</body>
<script type="text/javascript">

	$(function(){
		$("#roleFrom").validate({
			rules : {
				name : {
					required : true
				},
				code : {
					required : true
				},
				aliases : {
					required : true
				}
			},
			messages: {
				name : {
					required : "请输入参数名称"
				},
				code : {
					required : "请输入参数编码"
				},
				aliases : {
					required : "请输入参数别名"
				}

			},
			errorPlacement : function(error, element) {
				error.appendTo(element.parent());
			},
			submitHandler : function(form) {
				roleFrom();
			}
		});

	});
	function roleFrom(){
		var url="[[${sysUrl}]]/sys/bookList/saveMateriel";
		var params = $("#roleFrom").serialize();
		$.post(url,params,function(data){
			if(data != null){
				if(data.meta.success){
					layer.msg("操作成功!",{icon:1});
					setTimeout(function(){
						window.location.href ='[[${sysUrl}]]/sys/bookList/list.html';
					},1000);
				}else{
					layer.msg(data.meta.message,{icon:11});
				}
			}

		});
	}


</script>
</html>