<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>
		body {
			min-width: 180px;
		}

		.select1 {
			width: 100%;
			height: 32px;
			line-height: 32px;
			border-top: solid 1px #a7b5bc;
			border-left: solid 1px #a7b5bc;
			border-right: solid 1px #ced9df;
			border-bottom: solid 1px #ced9df;
			opacity: 1;
			margin-bottom: 10px;
		}
		.selectg {
			width: 100%;
			height: 32px;
			line-height: 32px;
			border-top: solid 1px #a7b5bc;
			border-left: solid 1px #a7b5bc;
			border-right: solid 1px #ced9df;
			border-bottom: solid 1px #ced9df;
			opacity: 1;
			margin-bottom: 10px;
		}

		.btn {
			width: 100px;
		}

		label.control-label-error {
			color: Red;
		}

		.forminfo li label {
			width: 85px;
			line-height: 34px;
			display: block;
			float: left;
		}
	</style>
</head>

<body>
<div class="formbody">
	<form id="submitFrom"   method="post" class="form-horizontal form-validate">
		<input type="hidden" name="id" th:if="${ws.id}" th:value="${ws.id}"/>
		<ul class="forminfo">
			<li class="clearfix">
				<label>人员姓名:<b>*</b></label>
				<input type="text" id="name" class="dfinput fl" name="name"  th:value="${ws.name}"/>
			</li>
			<li>
				<label>&nbsp;</label>
				<button type="submit" class="btn">保存</button>
				<button type="button" class="btn" onclick="closeWin();">取消</button>
			</li>
		</ul>
	</form>
</div>
</body>
<script type="text/javascript">

	$(function(){




		$("#submitFrom").validate({
			rules : {

				name : {
					required : true
				}
			},
			messages: {
				name : {
					required : "名字不能为空"
				},

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

	});
	function roleFrom(){
		var url="[[${sysUrl}]]/sys/lib/managerSave";
		var params = $("#submitFrom").serialize();
		$.post(url,params,function(data){
			if(data != null){
				if(data.meta.success){
					parent.layer.msg("操作成功",{icon:1});
					closeWin();
				}else{
					parent.layer.msg(data.meta.message,{icon:11});
					closeWin();
				}
			}

		});
	}
	function closeWin(){
		parent.location.reload();
		parent.layer.close(parent.layer.getFrameIndex(window.name));
	}



</script>
</html>