Examination_system/Examination_system-1/.svn/pristine/9c/9c3f5ca6083d2229d1fd84cf918...

288 lines
9.5 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fns" uri="/WEB-INF/tlds/fns.tld" %>
<!DOCTYPE html>
<html>
<head>
<%@include file="../baseset.jsp" %>
<%@include file="../systemset.jsp" %>
<link rel="stylesheet" href="${bonuspath}/static/plugins/zTree/3.5/zTreeStyle.css" />
<script src="${bonuspath}/static/plugins/zTree/3.5/jquery.ztree.core-3.5.min.js"></script>
<title></title>
<style type="text/css">
.p{
margin:1% 2% 0 1%;
}
.flag{
width:15%;
text-align: right;
}
.flag>span{
padding-right:1em;
}
.con{
width:35%;
text-align: left;
}
.lang{
valign:middle;
width:80%;
text-align: left;
}
.inp{
width:80%;
}
.linp{
width:91.5%;
}
</style>
</head>
<body>
<div class="p">
<form id="registrationForm" method="POST" onsubmit="return false;" >
<table id="baseTable" cellspacing="0" cellpadding="0" border="0" style="margin: 2em 1em;" class="customTable">
<input type="hidden" value="${registration.seatId}" name="seatId" />
<tbody>
<tr class="FormData">
<th class="flag"><span><font color="red">*</font>考生姓名:</span></th>
<td class="con">
<input maxlength="8" class="inp" jyValidate="required" value="${registration.name}" name="name" type="text" />
</td>
<th class="flag"><span><font color="red">*</font>身份证号:</span></th>
<td class="con">
<input class="inp" jyValidate="required" onblur="checkIdcard(this)" value="${registration.idcard}" name="idcard" type="text" />
</td>
</tr>
<tr class="FormData">
<th class="flag"><span><font color="red">*</font>考场:</span></th>
<td class="con">
<select id="roomId" name="roomId" class="inp">
<c:forEach items="${findRoomInfo}" var="post">
<option value="${post.roomId}"
<c:if test="${registration.roomId eq post.roomId}">selected="selected"</c:if> >${post.roomName}</option>
</c:forEach>
</select>
</td>
<th class="flag"><span><font color="red">*</font>座位号:</span></th>
<td class="con">
<input class="inp" jyValidate="required" value="${registration.seat}" name="seatNum" type="text" />
</td>
</tr>
<tr class="FormData">
<th class="flag"><span><font color="red">*</font>考试场次:</span></th>
<td class="con">
<input maxlength="4" class="inp" jyValidate="required" value="${registration.roomSession}" name="roomSession" type="text" />
</td>
<th class="flag"><span><font color="red">*</font>考试专业:</span></th>
<td class="con">
<input class="inp" id="orgName" readonly="readonly" value="${registration.specialtyName}" jyValidate="required" type="text" onclick="showRole(); return false;" />
<input type="hidden" id="orgId" name="specialty" value="${registration.specialty}">
<div id='orgContent' class="menuContent ztreeMC" style="display: none;width:25%; position: absolute;z-index: 999;background-color: #e7e7e7;">
<ul id="orgTree" class="ztree accountOrgTree"></ul>
</div>
</td>
</tr>
</tbody>
</table>
</form>
</div>
<script type="text/javascript">
$(function () {
loadOrgTree();
});
var preisShow=false;//窗口是否显示
function showRole() {
if(preisShow){
hideRole();
}else{
var obj = $("#orgName");
var offpos = $("#orgName").position();
$("#orgContent").css({width:offpos.width+"px",left:offpos.left+"px",top:offpos.top+obj.heigth+"px"}).slideDown("fast");
preisShow=true;
}
}
function hideRole(){
$("#orgContent").fadeOut("fast");
preisShow=false;
}
function loadOrgTree(){
JY.Ajax.doRequest(null,bonuspath +'/backstage/user/orgTree',null,function(data){
$.fn.zTree.init($("#orgTree"),{view:{dblClickExpand:true,selectedMulti:false,nameIsHTML:true},data:{simpleData:{enable: true}},callback:{onClick:clickRole}},data.obj);
});
}
function clickRole(e, treeId, treeNode) {
// var check = (treeNode && !treeNode.isParent);
if(!treeNode.isParent){
var check = (treeNode);
if(check){
var zTree = $.fn.zTree.getZTreeObj("orgTree"),
nodes = zTree.getSelectedNodes(),v ="",n ="",o="",p="";
for (var i=0, l=nodes.length; i<l; i++) {
v += nodes[i].name + ",";//获取name值
n += nodes[i].id + ",";//获取id值
o += nodes[i].other + ",";//获取自定义值
var pathNodes=nodes[i].getPath();
for(var y=0;y<pathNodes.length;y++){
p+=pathNodes[y].name+"/";//获取path/name值
}
}
if (v.length > 0 ) v = v.substring(0, v.length-1);
if (n.length > 0 ) n = n.substring(0, n.length-1);
if (o.length > 0 ) o = o.substring(0, o.length-1);
if (p.length > 0 ) p = p.substring(0, p.length-1);
$("#orgName").val(p);
$("#orgId").val(n);
hideRole();
}
}
}
function addRegistration() {
if(JY.Validate.newForm("registrationForm")){
var data = paramConversionToObjOfForm("registrationForm"); //获取Form表单数据项
var idx = layer.msg('正在提交保存,请稍等...', {
icon: 16
,shade: 0.01
,time:'-1'
});
$.ajax({
type:"POST",
url:bonuspath +'/backstage/seat/addRegistration',
data: JSON.stringify(data),
dataType:"json",
contentType:"application/json",
success:function(data){
layer.close(idx);
if(data.res == 1){
var indexMsg = layer.confirm("<h3 style='color:red'>"+data.resMsg+"</h3>", {btn: ['关闭']},function(){
layer.close(indexMsg);
var i = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
parent.getbaseList();
parent.layer.close(i);
});
}else{
var indexMsg = layer.confirm("<h3 style='color:red'>"+data.resMsg+"</h3>", {btn: ['关闭']},function(){
layer.close(indexMsg);
});
}
},
error:function(data){
layer.msg("数据加载失败!",{icon:2,time:2000})
layer.close(idx);
}
})
}else{
console.log("====ckuw===")
}
}
function updateRegistration(){
if(JY.Validate.newForm("registrationForm")){
var data = paramConversionToObjOfForm("registrationForm");
console.log("data=",data);
var idx = layer.msg('正在提交保存,请稍等...', {
icon: 16
,shade: 0.01
,time:'-1'
});
$.ajax({
type:"POST",
url:bonuspath +'/backstage/registration/updateRegistration',
data: JSON.stringify(data),
dataType:"json",
contentType:"application/json",
success:function(data){
layer.close(idx);
if(data.res == 1){
var indexMsg = layer.confirm("<h3 style='color:red'>"+data.resMsg+"</h3>", {btn: ['关闭']},function(){
layer.close(indexMsg);
var i = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
parent.getbaseList();
parent.layer.close(i);
});
}else{
var indexMsg = layer.confirm("<h3 style='color:red'>"+data.resMsg+"</h3>", {btn: ['关闭']},function(){
layer.close(indexMsg);
});
}
},
error:function(data){
layer.msg("数据加载失败!",{icon:2,time:2000})
layer.close(idx);
}
})
}
}
function checkIdcard(that) {
var idCard = $(that).val();
if(isIdCard(idCard) == false) {
var html = "<h4 style='color:red;'>请输入合法身份证号</h4>";
var idcardMsg = layer.confirm(html, {btn: ['关闭']},function(){
layer.close(idcardMsg);
$(that).val("");
$(that).focus();
});
}
}
//身份证验证
function isIdCard(idCard) {
// 15位和18位身份证号码的正则表达式
var regIdCard = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/;
// 如果通过该验证,说明身份证格式正确,但准确性还需计算
if (regIdCard.test(idCard)) {
if (idCard.length == 18) {
var idCardWi = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2); // 将前17位加权因子保存在数组里
var idCardY = new Array(1, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2); // 这是除以11后可能产生的11位余数、验证码也保存成数组
var idCardWiSum = 0; // 用来保存前17位各自乖以加权因子后的总和
for (var i = 0; i < 17; i++) {
idCardWiSum += idCard.substring(i, i + 1) * idCardWi[i];
}
var idCardMod = idCardWiSum % 11;// 计算出校验码所在数组的位置
var idCardLast = idCard.substring(17);// 得到最后一位身份证号码
// 如果等于2则说明校验码是10身份证号码最后一位应该是X
if (idCardMod == 2) {
if (idCardLast == "X" || idCardLast == "x") {
//alert("恭喜通过验证啦!");
return true;
} else {
//alert("身份证号码错误!");
return false;
}
} else {
// 用计算出的验证码与最后一位身份证号码匹配,如果一致,说明通过,否则是无效的身份证号码
if (idCardLast == idCardY[idCardMod]) {
//alert("恭喜通过验证啦!");
return true;
} else {
//alert("身份证号码错误!");
return false;
}
}
}else{
return true;
}
} else {
//alert("身份证格式不正确!");
return false;
}
}
function formValid(){
return JY.Validate.form("registrationForm");
}
</script>