<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;
             }
              .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;
    	}
    </style>
</head>

<body>
<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    	<li><a href="#">答案管理</a></li>
    </ul>
</div>
<div class="formbody">
	<div class="formtitle"><span>答案信息</span></div>
	<form id="roleFrom"   method="post" class="form-horizontal form-validate">
		<input  type="hidden" id="id" th:if="${articeMatterSolution.id}" th:value="${articeMatterSolution.id}" name="id">
		<input  type="hidden" id="matterId" th:if="${articeMatterSolution.matterId}" th:value="${articeMatterSolution.matterId}" name="matterId">
		<ul class="forminfo">
			<li class="clearfix">
				<label class="fl">答案<b>*</b></label>
				  <input  type="text" id="solution"  th:value="${articeMatterSolution.solution}" class="dfinput fl"  name="solution">
			</li>
			<li class="clearfix">
				<label class="fl">GR值<b>*</b></label>
				  <input  type="text" id="grWorth"  th:value="${articeMatterSolution.grWorth}" class="dfinput fl"  name="grWorth">
			</li>
			<li class="clearfix">
			    <label>是否正确答案：<b>*</b></label>
				<div class="vocation" style="margin-right: 5px; width: 179px">
					<select class="select1" name="type">
					         <option  value="2"  th:selected="${articeMatterSolution.type==2}" >否</option>
					   		 <option  value="1"  th:selected="${articeMatterSolution.type==1}" >是</option>
					</select>
				</div>
		   </li>
			<li class="clearfix">
				<label class="fl">排序<b>*</b></label>
				  <input  type="text" id="sequence"  th:value="${articeMatterSolution.sequence}" class="dfinput fl"  name="sequence">
			</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 : {
			solution : {
				required : true
			},
			grWorth : {
		        required : true
	       }
		},
		messages: {
			solution : {
				required : "请输入答案" 
			 },
			 grWorth : {
			   required : "请输入GR值" 
		   }
			
		},
		errorPlacement : function(error, element) {
				error.appendTo(element.parent()); 
		},
		submitHandler : function(form) {
			roleFrom();
		}
	});
	
});

function roleFrom(){
	var url="[[${sysUrl}]]/sys/ydz/saveArticeMatterSolution";
	var params = $("#roleFrom").serialize();
	$.post(url,params,function(data){
		if(data != null){
			if(data.code=="999"){
					layer.msg("操作成功!",{icon:1});
			    	setTimeout(function(){
			    		window.location.href ='[[${sysUrl}]]/sys/ydz/articeMatterSolutionlist.html?matter_id='+'[[${articeMatterSolution.matterId}]]&artice_id='+'[[${artice_id}]]';
					},1000);
				}else{
					layer.msg(data.meta.message,{icon:11});
				}
		}
		
	});
}


</script>
</html>