<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>
<script src="sys/js/My97DatePicker/WdatePicker.js" th:src="@{/static/sys/js/My97DatePicker/WdatePicker.js}"></script>
<script src="sys/js/My97DatePicker/WdatePicker.js" th:src="@{/static/js/city/city.json.js}"></script>
<script src="sys/js/My97DatePicker/WdatePicker.js" th:src="@{/static/js/city/citySetMe.js}"></script>
<script src="sys/js/My97DatePicker/WdatePicker.js" th:src="@{/static/js/city/Popt.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;
             }
          .lispan {line-height: 34px;}   
          
          .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;
    	}
.wrap{width:464px;height:34px;margin:0px 20px 20px 110px;border:0;position:relative;}   	
.input{position:absolute;top:0;left:0;width:457px;margin:0;padding-left:5px;height:30px;line-height:30px;font-size:12px;border:1px solid #c9cacb;}
._citys {     background-color: whitesmoke;width: 450px; display: inline-block; border: 2px solid #eee; padding: 5px; position: relative; }
._citys span { color: #05920a; height: 15px; width: 15px; line-height: 15px; text-align: center; border-radius: 3px; position: absolute; right: 10px; top: 10px; border: 1px solid #05920a; cursor: pointer; }
._citys0 { width: 95%; height: 34px; line-height: 34px; display: inline-block; border-bottom: 2px solid #05920a; padding: 0px 5px; font-size:14px; font-weight:bold; margin-left:6px; }
._citys0 li { display: inline-block; line-height: 34px; font-size: 15px; color: #888; width: 80px; text-align: center; cursor: pointer; }
._citys1 { width: 100%; display: inline-block; padding: 10px 0; }
._citys1 a { width: 83px; height: 35px; display: inline-block; background-color: #f5f5f5; color: #666; margin-left: 6px; margin-top: 3px; line-height: 35px; text-align: center; cursor: pointer; font-size: 12px; border-radius: 5px; overflow: hidden; }
._citys1 a:hover { color: #fff; background-color: #05920a; }
.AreaS { background-color: #05920a !important; color: #fff !important; }
    </style>
</head>

<body>
<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    	<li><a href="#">图书馆</a></li>
    	<li><a href="#">KMT表头信息管理</a></li>
    </ul>
</div>
<div class="formbody">
	<div class="formtitle"><span>KMT表头信息管理</span></div>
	<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  id="year" class="dfinput fl" name="year"  th:value="${ws.year}" onfocus="WdatePicker({dateFmt:'yyyy'})" />
			</li>
			<li class="clearfix" >
				<label>城市:<b>*</b></label> 
				<div class="wrap"><input type="text" id="city" name="city"  class="dfinput fl input" th:value="${ws.city}" placeholder="请选择" autocomplete="off" readonly="true"></div>
			</li>
			<li class="clearfix" >
				<label>区:<b>*</b></label> 
				<input type="text" id="area" name="area"  class="dfinput fl" th:value="${ws.area}" readonly="true">
			</li>
			<li class="clearfix">
				<label>学校:<b>*</b></label>
				<input type="text" id="school" class="dfinput fl" name="school"  th:value="${ws.school}"/>
			</li>
			<li class="clearfix">
				<label>学期:</label>
				<div class="vocation" style="margin-right: 5px; width: 346px">
					<select name="semester" id="semester" class="select1"> 
						<option th:selected="${ ws.semester eq 1 }" value="1" >上学期</option>
						<option th:selected="${ ws.semester eq 2 }" value="2" >下学期</option>
					</select>
				</div>
			</li>
			<li class="clearfix">
				<label>类型:<b>*</b></label>
				<div class="vocation" style="margin-right: 5px; width: 346px">
					<select name="type" id="type" class="select1"> 
						<option th:selected="${ ws.type eq 1 }" value="1" >单元</option>
						<option th:selected="${ ws.type eq 2 }" value="2" >期末</option>
					</select>
				</div>
			</li>
			<li class="clearfix">
				<label>科目:</label>
				<div class="vocation" style="margin-right: 5px; width: 346px">
					<select name="subject" id="subject" class="select1"> 
						<option th:selected="${ ws.subject eq '语文' }" value="语文" >语文</option>
						<option th:selected="${ ws.subject eq '数学' }" value="数学" >数学</option>
						<option th:selected="${ ws.subject eq '英语'}" value="英语" >英语</option>
					</select>
				</div>
			</li>
			<li class="clearfix">
				<label>年级:</label>
				<div class="vocation" style="margin-right: 5px; width: 346px">
				<select name="grade" id="grade" class="select1">
					<option th:selected="${ws.grade eq list.name}" th:value="${list.name}" th:each="list:${grade}" th:text="${list.name}">学前</option>
				</select>
				</div>
			</li>
			<li class="clearfix">
				<label>自定义值:<b>*</b></label>
				<input type="text" id="addStr" class="dfinput fl" name="addStr"  th:value="${ws.addStr}"/>
			</li>
			<li>
				<label>&nbsp;</label>
				<button type="button" class="btn" onclick="roleFrom()" >保存</button>
				<button type="button" class="btn" onClick="javascript :history.back(-1);" >返回</button>
			</li>
		</ul>
	</form>
</div>
</body>
<script type="text/javascript">
$("#city").click(function (e) {
	SelCity(this,e);
});
function roleFrom(){
	var year = $("#year").val();
	if(year == ""){
		layer.msg("年份不能为空",{icon:11});
		return ;
	}
	var city = $("#city").val();
	if(city == ""){
		layer.msg("城市不能为空",{icon:11});
		return ;
	}
	var area = $("#area").val();
	if(area == ""){
		layer.msg("城市区域不能为空",{icon:11});
		return ;
	}
	var semester = $("#semester").val();
	if(semester == ""){
		layer.msg("学期不能为空",{icon:11});
		return ;
	}
	var type = $("#type").val();
	if(type == ""){
		layer.msg("类型不能为空",{icon:11});
		return ;
	}
	var subject = $("#subject").val();
	if(subject == ""){
		layer.msg("科目不能为空",{icon:11});
		return ;
	}
	var grade = $("#grade").val();
	if(grade == ""){
		layer.msg("年级不能为空",{icon:11});
		return ;
	}
	var url="[[${sysUrl}]]/sys/kmtExampaper/exampaperSave";
	var params = $("#submitFrom").serialize();
	$.post(url,params,function(data){
		if(data != null){
				if(data.meta.success){
					layer.msg("操作成功!",{icon:1});
			    	setTimeout(function(){
			    		window.location.href ='[[${sysUrl}]]/sys/kmtExampaper/exampaperList.html';
					},1000);
				}else{
					layer.msg(data.meta.message,{icon:11});
				}
		}
		
	});
}
</script>
</html>