<%@page import="com.zky.para.Para"%>
<%@include file="/auth.jsp"%>
<%@page import="java.util.Date"%>
<%@page language="java" pageEncoding="utf-8" %>
<jsp:useBean id="getPara" scope="application" class="com.zky.para.SyncPara"/>
<%
    String nationstate1="";
    String operate = (String)request.getParameter("operate");
    String empid = "";
    String empname         = "";
    String sj              = Common.convertNull(request.getParameter("sj"));
    String sex             = "";
    String birthday        = "";
    String empcontaddr     = "";
    String empcontphone    = "";
    String empcontmobphone = "";
    String empfaxnum       = "";
    String empidbegindate  = "";
    String empidenddate    = "";
    String empemail        = "";
    String qj              = Common.convertNull(request.getParameter("qj"));
    String school="";
    String readonly        = "";
	String nationstate="";
	String submitbtn="";
	String empage="";
	String emphabby="";
	String empjob="";
	String empeducational="";
	String empfamname="";
	String empfamage="";
	String empfamrelate="";
	String empfamjob="";
	String empschool="";
	String emppolitics="";
	String emphomeAddress="";
	String nationstates="";
	String yaohaidemept="";
	String pary="";
	String samyuan="";
	if (operate.equals("modifyEmp")) {
		HashFmlBuf buf = (HashFmlBuf)request.getAttribute("emp_info_by_empid");
		int pos = 0;
		   yaohaidemept= buf.fget("yaohaidemept",pos);
			empid           = buf.fget("empid",pos);
			empname         = buf.fget("empname",pos);
			sj              = buf.fget("frameworkid    ",pos);
			//birthday        = Common.convertNull(buf.fget("birthday ",pos)).substring(0,10);
//		empcontaddr     = buf.fget("empcontaddr    ",pos);
		    birthday        = buf.fget("birthday    ",pos);
			sex             = buf.fget("sex            ",pos);
			empcontaddr     = buf.fget("empcontaddr    ",pos);
			empcontphone    = buf.fget("empcontphone   ",pos);
			empcontmobphone = buf.fget("empcontmobphone",pos);
			empfaxnum       = buf.fget("empfaxnum      ",pos);
			empidbegindate  = Common.convertNull(buf.fget("empidbegindate ",pos)).substring(0,10);
			empidenddate    = Common.convertNull(buf.fget("empidenddate   ",pos)).substring(0,10);
			empemail        = buf.fget("empemail",pos);
			qj              = buf.fget("areaid    ",pos);
			school          = buf.fget("departid ",pos);
			nationstate=buf.fget("nationstate", pos);
			pary=buf.fget("part", pos);
			samyuan=buf.fget("sanyuan", pos);
			empage=buf.fget("empage", pos);
			emphabby=buf.fget("emphabby", pos);
			empjob=buf.fget("empjob", pos);
			empeducational=buf.fget("empeducational", pos);
			empfamname=buf.fget("empfamname", pos);
			empfamage=buf.fget("empfamage", pos);
			empfamrelate=buf.fget("empfamrelate", pos);
			empfamjob=buf.fget("empfamjob", pos);
			empschool=buf.fget("empschool", pos);
			emppolitics=buf.fget("emppolitics", pos);
			emphomeAddress=buf.fget("emphomeAddress", pos);
		    readonly="readonly";
	} else {
		empidbegindate = DateTime.DateToStr(new Date());
		empidenddate = "2050-12-31";
	}
%>
<%
HashFmlBuf buf = (HashFmlBuf)request.getAttribute("emp_info_by_empid");
int pos = 0;
String empj="";
if(buf.fget("empjob", pos).equals("核心涉密岗位")){
	empj="0";
}else if(buf.fget("empjob", pos).equals("重要涉密岗位")){
	empj="1";
}else{
	empj="2";
}
String empsc="";
if(buf.fget("empschool", pos).equals("核心")){
	empj="0";
}else if(buf.fget("empschool", pos).equals("重要")){
	empj="1";
}else{
	empj="2";
}
%>
<html>
<head>
<title>涉密人员管理</title>
<link href="../../../css/font.css" rel="stylesheet" type="text/css">
<script src="../../../js/date.js"></script>
<script src="../../../js/check.js"></script>
<script>
//在填写时间的时候完成时在调用此方法与 让 出生年月与age同步
function agesync(){
	//首先获取到出生年月 (正则规定的格式是 0年-0月-0日)
	var birthday= document.getElementById("birthday").value; 
	//得到年份
	var year=birthday.substring(0,birthday.indexOf("-"));
	//获取今年的年份
	var	myDate=new Date();
	// 得到年龄 今年的年份-出生年份
	var agevalue=(parseInt(myDate.getFullYear())-parseInt(year));
	//想age输入框写值
	document.getElementById("empage").value=agevalue;
}
function textToUpperCase(){
  if(event.keyCode>=65 && event.keyCode<=99 || event.type=="change"){
    event.srcElement.value = event.srcElement.value.toUpperCase();
  }
}
function setValue() {
<%
	if (!Common.isNull(qj)) {
		out.println("form1.qj.value='" + qj + "';");
	}
   if (!Common.isNull(sj)) {
		out.println("form1.sj.value='" + sj + "';");
	}
   if(!Common.isNull(school))
   {
	   out.println("form1.school.value='" + school + "';");
   }
		if (!Common.isNull(operate)) {
		out.println("form1.operate.value='" + operate + "';");
	}
%>	
}

function check(operate) {
	form1.operate.value = operate;
	if (form1.sex.value == "") {
		alert("请选择性别!");
		form1.sex.focus();
		return false;
	}
	if (form1.empid.value == "") {
		alert("请输入人员编号!");
		
		form1.empid.focus();
		return false;
	}
	if (form1.empname.value == "") {
		alert("请输入人员姓名!");
		form1.empname.focus();
		return false;
	}			

	if (form1.birthday.value == "") {
		alert("请选择人员出生年月!");
		form1.birthday.focus();
		return false;
	}
	if (form1.empjob.value == "") {
		alert("请选择人员岗位");
		form1.empjob.focus();
		return false;
	}
	if (form1.empschool.value == "") {
		alert("请选择涉密程度");
		form1.empschool.focus();
		return false;
	}
	return true;
	form1.button1.disabled=true;
	form1.button2.disabled=true;
	form1.submit();
}
function onClick1(){
	var empid=document.getElementById("empcontphone").value.trim();
	var reg=/^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/;
	if(!reg.test(empid)){
		alert("电话格式错误或长度错误!");
	}
}
function onClick2(){
	var empid=document.getElementById("empcontmobphone").value.trim();
	var reg=/^1[3|4|5|8][0-9]\d{4,8}$/;
	if(!reg.test(empid)){
		alert("手机号码格式或长度错误!");
	}
}
function onClick3(){
	var empid=document.getElementById("empfaxnum").value.trim();
	var reg=/^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/;
	if(!reg.test(empid)){
		alert("传真号码格式或长度错误!");
	}
}
function onClick4(){  
	var empid=document.getElementById("empemail").value.trim();
	var reg=' w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*';
	if(!reg.test(empid)){
		alert("邮件格式错误!");
	}
}
function selectChange(i)
{
	form1.action = "/zhyw/smry/rydj/EmpEdit.jsp";
	form1.submit();
}
</script>

<style type="text/css">
html { overflow-x:hidden; overflow-y:hidden; } 
.aselect{
	width: 155px;
}
</style>
</head>
<body onload="setValue();">
<form name="form1" method="post" action="/servlet/EmpManage">
<input type="hidden" name="operate" value=""/>
<input type="hidden" name="submitbtn" value=""/>
<input type="hidden" name="empid" value="<%=empid%>">
<table width="99%"  border="0" align="center" cellpadding="0" cellspacing="1" class="box">
  <tr>
    <td valign="top"><table width="100%" height="23"  border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="25%" background="/images/tab_search_01.jpg"><table width="80%" height="23" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td width="3%"><img src="/images/little_red.jpg" width="12" height="12"></td>
                <td width="97%" class="font12b">&nbsp;人员管理</td>
              </tr>
          </table></td>
          <td width="82%" background="/images/tab_search_03.jpg"><img src="/images/tab_search_02.jpg" width="12" height="23"></td>
        </tr>
      </table>                 

	<table width="99%" style="height: 35" border="0" align="center" cellpadding="0" cellspacing="0">
	  <tr>
		<td width="3%"><img src="/images/little.gif" width="12" height="12"></td>
		<td width="97%" class="font12">基本信息填写(<font color="red">必填</font>)</td>
	  </tr>
	</table>	
	<table width="99%"  border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="d8e9fe" class="table02">
	  <tr bgcolor="#FFFFFF">
		<td class="cell1" style="line-height: 30px;">所属地市</td>
		<td class="cell2">
			<select class='aselect' name="sj" setValue="<%=sj%>" disabled="disabled"   onChange="selectChange(1);" >
		   		<%=Para.getSj(getPara)%>            					
			</select><font color="#ff0000">*</font>
		</td>	
		<td class="cell1">所属区县</td>
		<td class="cell2">
			<select class='aselect' name="qj" setValue="<%=qj%>" disabled="disabled"  onChange="selectChange(1);">
		   		<%=Para.getQj(getPara,sj)%>            					
			</select><font color="#ff0000">*</font>
		</td>
		<td class="cell1">所属单位</td>
		<td class="cell2">
		<select class='aselect' name="school" setValue="<%=school%>" disabled="disabled" >
			   <%if(sj.equals("0930")){ %>
		    	<%=Para.getXx1(getPara, sj)%>      
		    <%}else { %>
		     	<%=Para.getXx(getPara, qj)%>      
		      		<%} %>	        					
			</select><font color="#ff0000">*</font>		 
		</td>	
		</tr>
		<tr bgcolor="#FFFFFF">
		<td class="cell1">下属部门</td>
		<td class="cell2">
		<input type="text"  name="part"  value="<%=pary%>"> 
		</td>
		<td class="cell1" style="line-height: 30px;">人员姓名</td>
		<td class="cell2">
			<input type="text" name="empname" value="<%=empname%>" onblur="checkLength(this,40);" maxlength="8"  onkeyup="value=value.replace(/[^\u4E00-\u9FA5]/g,'')">
		</td>
		<td class="cell1">人员编码</td>
		<td class="cell2">
			<input type="text" name="empid"  disabled="disabled" value="<%=empid%>" <%=readonly%> maxlength="8"  onChange="textToUpperCase()" >
		</td>
		
		</tr>
		<tr bgcolor="#FFFFFF">
		<td class="cell1" style="line-height: 30px;">性别</td>
		<td class="cell2">
			<select class='aselect' name="sex" value="<%=sex%>">         					
		   	<%
			if (sex.equals("")){
			out.println(Para.getStatic(getPara,"SEX"));
			if (!sex.equals("")){
			%>
			<script>
			form1.sex.value='<%=sex%>';
			</script>
			<%	
			}
			}else{
			out.println(getPara.getSParaFilter("td_s_static","data_code","dataname","type_code","SEX","data_code",sex));
			}
			%>          					
			</select>
		</td>
		<td class="cell1">出生年月</td>
		<td class="cell2">
			<input id="birthday" name='birthday' type='text' readonly=true value='<%=birthday%>'onclick=" fPopCalendar(birthday,birthday); return true;" onblur="agesync()" >
		</td>
		<td class="cell1">拟任岗位</td>
		<td class="cell2">
			<select class='aselect' name="empjob" id="empjob"  value="<%=empjob%>">         					
		   	<%
			if (empjob.equals("")){
			out.println(Para.getStatic(getPara,"WORKJOB"));
			if (!empjob.equals("")){
			%>
			<script>
			form1.empjob.value='<%=empjob%>';
			</script>
			<%	
			}
			}else{
			out.println(getPara.getSParaFilter("td_s_static","data_code","dataname","type_code","WORKJOB","data_code",empj));
			}
			%>          					
			</select>
		</td>
		</tr>
		<tr bgcolor="#FFFFFF">
		<td class="cell1" style="line-height: 30px;">涉密程度</td>
		<td class="cell2">
			<select class='aselect' name="empschool" id="empschool"  value="<%=empschool%>">         					
		   	<%
			if (empschool.equals("")){
			out.println(Para.getStatic(getPara,"SMCD"));
			if (!empschool.equals("")){
			%>
			<script>
			form1.empschool.value='<%=empschool%>';
			</script>
			<%	
			}
			}else{
			out.println(getPara.getSParaFilter("td_s_static","data_code","dataname","type_code","SMCD","dataname",empsc));
			}
			%>          					
			</select>
		</td>
		<td class="cell1">三员分类</td>
		<td class="cell2">
		   <select class='aselect' name="sanyuan" >      
		                   <option >--请选择--</option>
		                   <%if(samyuan.equals("0")){ %>
		                    <option value="0"  selected="selected">管理员</option>
		  					<option value="1">审计员</option>
		  					<option value="2">操作员</option>
		                   <%}else if(samyuan.equals("1")) {%>
		                   <option value="0" >管理员</option>
		  					<option value="1" selected="selected">审计员</option>
		  					<option value="2">操作员</option>
		                   <%}else{ %>
		                   	<option value="0" >管理员</option>
		  					<option value="1">审计员</option>
		  					<option value="2" selected="selected">操作员</option>
		                   <%} %>
			</select>
		</td>	
		<td class="cell1">是否为要害部门</td>
	    <td class="cell2">
	    <%
	    if(yaohaidemept.equals("是")){  %>  	
	        <input type="radio" checked="checked" name="yaohaidemept" value="是" >是&nbsp;&nbsp;&nbsp;<input type="radio" name="yaohaidemept" value="否"  >否
	      <%  } else{ %>
	      	    <input type="radio"  name="yaohaidemept" value="是" >是&nbsp;&nbsp;&nbsp;<input type="radio" name="yaohaidemept" value="否" checked="checked" >否</td>
	      <%} %>

		</tr>
	</table>
	<table width="99%" style="height: 35" border="0" align="center" cellpadding="0" cellspacing="0">
	  <tr>
		<td width="3%"><img src="/images/little.gif" width="12" height="12"></td>
		<td width="97%" class="font12">详细信息填写(<font color="red">选填</font>)</td>
	  </tr>
	</table>	

   <table width="99%"  border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="d8e9fe" class="table02">
	  <tr bgcolor="#FFFFFF">
		<td class="cell1" style="line-height: 30px;">联系地址</td>
		<td class="cell2">
			<input type="text" name="empcontaddr" value="<%=empcontaddr%>" onblur="checkLength(this,128);" maxlength="20" onkeyup="value=value.replace(/[^\u4E00-\u9FA5]/g,'')">
		</td>	
		<td class="cell1">联系电话</td>
		<td class="cell2">
			<input type="text" name="empcontphone"  onblur="onClick1()" value="<%=empcontphone%>" class="PhoneNoFormat"   maxlength="12"  >
		</td>	
		<td class="cell1">手机号码</td>
		<td class="cell2">
			<input type="text" name="empcontmobphone"   onblur="onClick2()" value="<%=empcontmobphone%>" class="MobileNoFormat"   maxlength="11" onKeyUp="value=value.replace(/[^\d|]/g,'')">
		</td>	
		</tr>
		<tr bgcolor="#FFFFFF">
		<td class="cell1" style="line-height: 30px;">传真号码</td>
		<td class="cell2">
			<input type="text" name="empfaxnum"  onblur="onClick3()" value="<%=empfaxnum%>"  maxlength="12" >
		</td>	
		<td class="cell1">邮箱</td>
		<td class="cell2">
			<input type="text" name="empemail"   onblur="onClick4()" value="<%=empemail%>" class="EmailFormat" >
		</td>
	    <td class="cell1">籍贯</td>
		<td class="cell2">
			<input type="text" name="emphomeAddress" value="<%=emphomeAddress%>" class="emphomeAddress" maxlength="20" onkeyup="value=value.replace(/[^\u4E00-\u9FA5]/g,'')">
		</td>	
		</tr>
		<tr bgcolor="#FFFFFF">
		<td class="cell1" style="line-height: 30px;">学历</td>
		<td class="cell2">
			<input type="text" name="empeducational" value="<%=empeducational%>" class="empeducational"  maxlength="4">
		</td>		
	 	<td class="cell1">健康状况</td>
		<td class="cell2">
			<input type="text" name="emphabby" value="<%=emphabby%>" class="emphabby"  maxlength="12" onkeyup="value=value.replace(/[^\u4E00-\u9FA5]/g,'')">
		</td>
		<td class="cell1">家人姓名</td>
		<td class="cell2">
			<input type="text" name="empfamname" value="<%=empfamname%>" class="empfamname"  maxlength="5" onkeyup="value=value.replace(/[^\u4E00-\u9FA5]/g,'')">
		</td>
		</tr>
		<tr bgcolor="#FFFFFF">
		<td class="cell1" style="line-height: 30px;">家人职位</td>
		<td class="cell2">
			<input type="text" name="empfamjob" value="<%=empfamjob%>" class="empfamjob"  maxlength="6" onkeyup="value=value.replace(/[^\u4E00-\u9FA5]/g,'')" maxlength="4">
		</td>		
		<td class="cell1">家人关系</td>
		<td class="cell2">
			<input type="text" name="empfamrelate" value="<%=empfamrelate%>" class="empfamrelate" onkeyup="value=value.replace(/[^\u4E00-\u9FA5]/g,'')" maxlength="4">
		</td>
			<td class="cell1">生效日期</td>
		<td class="cell2">
			<input name='empidbegindate' type='text' readonly="readonly"  value='<%=empidbegindate%>' onclick="fPopCalendar(empidbegindate,empidbegindate);return true;" >
		</td>	
		</tr>
	<tr bgcolor="#FFFFFF">
		<td class="cell1" style="line-height: 30px;">失效日期</td>
		<td class="cell2">
			<input name='empidenddate' type='text' readonly="readonly"  value='<%=empidenddate%>' >
		</td>
	<td class="cell1">政治面貌</td>
		<td class="cell2" >
		   <select class='aselect' name="emppolitics" id="emppolitics"  value="<%=emppolitics%>">         					
		   	<%
			if (emppolitics.equals("")){
			out.println(Para.getStatic(getPara,"EMPPOLIT"));
			if (!emppolitics.equals("")){
			%>
			<script>
			form1.emppolitics.value='<%=emppolitics%>';
			</script>
			<%	
			}
			}else{
			out.println(getPara.getSParaFilter("td_s_static","data_code","dataname","type_code","EMPPOLIT","data_code",emppolitics));
			}
			%>          					
			</select>
		</td>	
		<td class="cell1">民族</td>
		<td class="cell2">
			<select class='aselect' name="nationstate" value="<%=nationstate%>">         					
		   	<%
			if (nationstate.equals("")){
			out.println(Para.getStaticNationstate(getPara,"NATIONSTATE"));
			if (!nationstate.equals("")){
			%>
			<script>
			form1.nationstate.value='<%=nationstate%>';
			</script>
			<%	
			}
			}else{
			out.println(getPara.getSParaFilter("td_s_static","data_code","dataname","type_code","NATIONSTATE","data_code",nationstate));
			}
			%>          					
			</select>
		</td>
	  </tr>	
</table>
	<br>   
	<table width="99%" align="center">
		<tr align="center">
		<td><input border="0"  type="image"  src="../../../images1/bc1.png" alt="保存" onclick="return check('<%=operate%>');"/>&nbsp;&nbsp;
	  <a href="javascript:history.go(-1)"><img src="../../../images1/fh.png" alt="返回" border="0" /></a>
	<!--<input border="0"  type="image"  src="../../images1/fh.png" alt="返回" onclick="javascript:history.go(-1)"/> -->
		</td>
		</tr>
	</table>	
	 </td>
  </tr>
</table>
</form>
</body>
</html>