<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>
	<link th:href="@{/static/js/select/fselect.css}" rel="stylesheet" type="text/css">
<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/select/fSelect.js" th:src="@{/static/js/select/fselect.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;
		}

		.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">
		<ul class="forminfo">
			<li class="clearfix" id="clearfix">
				<label>模板名称：<b>*</b></label>
				<div   onclick="window.open('../bookList/materielTemplateList2.html', 'newwindow', 'height=530, width=1100, top=200, left=250, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no');" style="margin-right: 5px; width: 346px">
					<input type="text"  id="templateName" name="templateName" style="width: 180px; "  disabled="disabled" class="dfinput" >
				</div>
				<input type="hidden" name="templateId" id="templateId"/>
			</li>
			    <li class="clearfix">
				    <label>核销数量：<b>*</b></label>
					<input type="text" name="delNum" class="dfinput" id="delNum"/>
			   </li>
			<li class="clearfix">
				<label>损耗数量：<b>*</b></label>
				<input type="text" name="lostNum" value="0" class="dfinput" id="lostNum"/>
			</li>
			<li class="clearfix">
				<label>是否生成新的物料：<b>*</b></label>
				<div class="vocation" style="margin-right: 5px; width: 300px">
					<select class="select1" name="supplier" id="supplier" name="isNew">
						<option value="0">否</option>
						<option value="1">是</option>
					</select>
				</div>
			</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 : {

			templateId : {
				required : true
			},
			delNum : {
				required : true
			}
		},
		messages: {
			templateId : {
				required : "模板不能为空"
			},
			delNum : {
				required : "核销数量不能为空"
			}
			
		},
		errorPlacement : function(error, element) {
				error.appendTo(element.parent()); 
		},
		submitHandler : function(form) {
			roleFrom();
		}
	});
});
function roleFrom(){
	var url="[[${sysUrl}]]/sys/bookList/saveMaterieDel";
    //取值
	var params = $("#submitFrom").serialize();
	$.post(url,params,function(data){
		if(data != null){
				if(data.code=="999"){
					layer.msg("核销成功",{icon:1});
					closeWin();
				}else{
					layer.msg(data.msg,{icon:11});
					//closeWin();
				}
		}
		
	});
}
function closeWin(){
	window.setTimeout(function(){
		window.location.href ='[[${sysUrl}]]/sys/bookList/materielList.html';
	},3000);

}



</script>
</html>