<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>成绩校验</title>
<meta name="decorator" content="default" />
<%@include file="/WEB-INF/views/include/head.jsp"%>
<style type="text/css">
.sort {
	color: #0663A2;
	cursor: pointer;
}
</style>
</head>
<body>
	<ul class="nav nav-tabs">
	<c:if test="${fnx:hasPrivilegeCode(role_privilege_codes, 'exam_inspected_info-info')}">
		<li><a href="${ctx}/admin/exam/inspected/info">成绩复核进度</a></li>
		</c:if>
		<c:if test="${fnx:hasPrivilegeCode(role_privilege_codes, 'exam_inspected_info-list')}">
		<li><a href="${ctx}/admin/exam/inspected/list">全卷复核</a></li>
		</c:if>
		<li class="active"><a href="##">成绩校验</a></li>
	</ul>
	<form id="searchForm" action="${ctx}/admin/exam/score/verify/page"
		method="post" class="breadcrumb form-search">
		<input type="hidden" id="pageNumber" name="pageNumber" value="1" /> <input
			type="hidden" id="pageSize" name="pageSize" value="20" />
		<div>

			<label>考生编号</label> <input type="text" name="studentCode"
				id="studentCode" class="input-medium" /> 
			<label>姓名</label> <input
				type="text" name="studentName" id="studentName"
				class="input-mini" /> 
			<label>校验规则</label> <select
				class="input-large" name="rule" id="rule">
				<option value="">请选择</option>
				<option value="RULE1">单科目有分，其它科目0分或无分</option>
				<option value="RULE2">单科目分值小于等于5分，其它科目</option>
				<option value="RULE3">单科目分值小于等于10分，其它科目</option>
			</select> <span id="span-ruleCompare" hidden="true"> <select
				class="input-small" name="ruleCompare" id="ruleCompare">
					<option value="">请选择</option>
					<option value="EQUALS">等于</option>
					<option value="GT">大于</option>
					<option value="LT">小于</option>
			</select> <input name="compareScore" id="compareScore"
				class="input-mini" maxlength="5" type="text" oninput="this.value = this.value.replace(/[^0-9]/g, '')"/>
			</span> <input id="btnQuery" class="btn" type="button" value="查询"
				onclick="query()" />
		</div>
	</form>
	<tags:message content="${message}" />
	<tags:message content="${errmsg}" type="error" />
	<script type="text/javascript">
		function query() {
			if ($('#studentCode').val() == '' && $('#studentName').val() == ''
					&& $('#rule').val() == '') {
				alert("请选择至少一个条件");
				return false;
			}
			var val = $('#rule').val();
			if (val == 'RULE2' || val == 'RULE3') {
				if ($("#ruleCompare").val() == '') {
					alert("请选择分数匹配条件");
					return false;
				}
				if ($("#compareScore").val() == '') {
					alert("请填写匹配分值");
					return false;
				}
				var pattern = /^0|([1-9]\d*)$/; // 正则表达式
				if (!pattern.test($("#compareScore").val())) {
					alert("分值请输入大于等于0的整数");
					return false;
				}
			}
			$("#searchForm").submit();
		}
		$('#rule').change(function() {
			var val = $(this).val();
			if (val == 'RULE2' || val == 'RULE3') {
				$('#span-ruleCompare').show();
			} else {
				$('#span-ruleCompare').hide();
				$("#ruleCompare").val("").trigger('change');
				$('#compareScore').val("");
			}
		});
	</script>
</body>
</html>