<%@page import="com.zky.para.Para"%>
<%@include file="/auth.jsp"%>
<%@page language="java" contentType="text/html;charset=utf-8"%>
<jsp:useBean id="getPara" scope="application" class="com.zky.para.SyncPara" />
<%
	Login login = (Login) request.getSession().getAttribute("login");
	String empid = Common.convertNull(request.getParameter("empid"));
	String empstate = request.getParameter("empstate");
	String empname = Common.convertNull(request.getParameter("empname"));

	String certname = Common.convertNull(request.getParameter("certname"));

	String certid = Common.convertNull(request.getParameter("certid"));

	String operate = (String) request.getParameter("operate");
	String sj = Common.convertNull(request.getParameter("sj"));
	String qj = Common.convertNull(request.getParameter("qj"));
	String pcs = Common.convertNull(request.getParameter("pcs"));
	String optrid = login_obj.sanyuan;
	String optrjob = getPara.getDesc("TAB_EMPLOYEE", "EMPID","sanyuan", optrid);
%>
<html>
<title>涉密人员登记</title>
<link rel="stylesheet" type="text/css" href="../../../css/font.css">
<script src="../../../js/check.js"></script>
<link rel="stylesheet" type="text/css" href="../../../js/2k3Grid.css">
<link rel="stylesheet" type="text/css" href="../../../js/2k3Menu.css">
<link rel="stylesheet" type="text/css" href="../../../js/2k3Dialog.css">
<style type="text/css">
html {
	overflow-x: auto;
	overflow-y: auto;
}
select {
	width: 155px;
}
.spanc {
	text-align: center;
}
#myGrid .gridHead{
	height: 50px;
	line-height: 50px;
	background-color: #cce7f5;
	color: #000;
	font-size: 16px;
	box-sizing: border-box;
}
#myGrid .gridHead .gridRow{
	display: flex;
	justify-content: space-between;
}
#myGrid .gridHead span{
	text-align: center;
	display: inline-block;
	width: 148px;
	border-right: 1px solid #000000;
	box-sizing: border-box;
	font-weight: bold;
}
#myGrid .gridBody .gridRow{
	height: 30px;
	/*margin-top: 5px;*/
	display: flex;
	justify-content: space-between;
	align-items: center;
	border-bottom: 1px solid #000;
	color: #000;
}
#myGrid .gridBody .gridRow span{
	width: 148px;
	display: inline-block;
	border-right: 1px solid;
	text-align: center;
	height: 30px;
	line-height: 30px;
	box-sizing: border-box;
}
#myGrid .gridBody .gridRow span a,img,input {
	margin-right: 6px;
}
td .cell1{
	width: 13%;
}
</style>
<script>
	//权限控制
	function textToUpperCase() {
		if (event.keyCode >= 65 && event.keyCode <= 99
				|| event.type == "change") {
			event.srcElement.value = event.srcElement.value.toUpperCase();
		}
	}
	function setValue() {
<%if (!Common.isNull(empstate)) {
				out.println("form1.empstate.value='" + empstate + "';");
			}
			if (!Common.isNull(empname)) {
				out.println("form1.empname.value='" + empname + "';");
			}
			if (!Common.isNull(certname)) {
				out.println("form1.certname.value='" + certname + "';");
			}
			if (!Common.isNull(certid)) {
				out.println("form1.certid.value='" + certid + "';");
			}
			if (!Common.isNull(qj)) {
				out.println("form1.qj.value='" + qj + "';");
			}
			if (!Common.isNull(sj)) {
				out.println("form1.sj.value='" + sj + "';");
			}
			if (!Common.isNull(pcs)) {
				out.println("form1.pcs.value='" + pcs + "';");
			}
			if (!Common.isNull(operate)) {
				out.println("form1.operate.value='" + operate + "';");
			}%>
	}
	function check(operate, empid, nationstate) {
		form1.operate.value = operate;
		if (operate == "addEmp") {
			form1.action = "/zhyw/smry/rydj/EmpEdit.jsp";
		}
		if (operate == "queryEmpByEmpId") {
			form1.action = "/servlet/EmpManage?operate=queryEmpByEmpId&empid="
					+ empid;
		}
		if (operate == "queryEmpBydelete") {
			if (!confirm("您确定要删除此信息吗?"))
				return;
			form1.action = "/servlet/EmpManage?operate=queryEmpBydelete&empid="
					+ empid;
		}
		if (operate == "queryEmpselectEmpId") {
			form1.action = "/servlet/EmpManage?operate=queryEmpselectEmpId&empid="
					+ empid + "&nationstate=" + nationstate;
		}
		if (operate == "modifyEmp") {
			form1.action = "/zhyw/smry/EmpEdit.jsp?empid=" + empid;
		}
		if (operate == "initPwd") {
			if (!confirm("确定要初始化该人员的密码?"))
				return;
			form1.action = "/servlet/EmpManage?operate=initPwd&empid=" + empid;
		}
		if (operate == "cancelEmp") {
			var empids = form1.empids;
			var count = 0;
			if (empids) {
				if (empids.length) {
					for (var i = 0; i < empids.length; i++) {
						if (empids[i].checked == true) {
							count++;
						}
					}
				} else {
					if (empids.checked == true) {
						count++;
					}
				}
			} else {
				alert("没有查到人员!");
				return false;
			}
			if (count == 0) {
				alert("请选择要注销的人员!");
				return false;
			}
			if (!confirm("确定要注销已经选择的人员吗?")) {
				return false;
			}
		}
		return true;
		form1.button1.disabled = true;
		form1.button2.disabled = true;
		form1.button3.disabled = true;
		form1.submit();
	}
	function selectChange(i) {
		form1.action = "/zhyw/smry/rydj/EmpManage.jsp";
		form1.submit();
	}
</script>
<body onload="setValue();" scroll="no">
	<form name="form1" method="post" action="/servlet/EmpManage" style="height: 98%;">
		<input type="hidden" name="operate" value="" />
		<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="left"
									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;<b>涉密人员登记</b></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%" border="0" align="center" cellpadding="2"
						cellspacing="1" class="table02" height="60px">
						<tr bgcolor="#FFFFFF">
							<td class="cell1">所属地市</td>
							<td class="cell2" width="10%">
							     <select class='aselect' name="sj" setValue="<%=sj%>" onChange="selectChange(1);"><%=Para.getSj(getPara)%></select>
							</td>
							<td class="cell1">所属区县</td>
							<td class="cell2" width="10%">
							    <select class='aselect' name="qj" setValue="<%=qj%>" <%if (sj.equals("0930")) {%> disabled="disabled" <%}%> onChange="selectChange(1);"> <%=Para.getQj(getPara, sj)%> </select>
							</td>
							<td class="cell1">所属单位</td>
							<td class="cell2"><select class='aselect' name="pcs"	setValue="<%=pcs%>">
									<%if (sj.equals("0930")) {%><%=Para.getXx1(getPara, sj)%><%} else {	%><%=Para.getXx(getPara, qj)%><%	}%>
							</select></td>


							<td class="cell1">人员姓名</td>
							<td class="cell2"><input type="text" name="empname"
								setValue="<%=empname%>" /></td>

							<td colspan="2" width="30%"><input name="button1"
								onclick="check('queryEmp');" border="0" type="image"
								src="../../../images1/cx.png" /></td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		<table width="99%" align="center">
			<tr align="left">
				<td>
					<%
						if (login.getSanyuan().equals("0")) {
					%> <input name="button2" onclick="check('addEmp');" border="0"
					type="image" src="../../../images1/tj.png" /> <input
					name="button2" border="0" type="image"
					src="../../../images1/zx.png" onclick="return check('cancelEmp');" <%-- <% if(optrjob.equals("管理员岗位")){ %>class="box_button"  <%}else if(optrjob.equals("核心涉密岗位")){  %> class="box_button" <%}else if(optrjob.equals("重要涉密岗位")){ %> style="display:none;"<% }else{ %> style="display:none;" <% } %> --%> />
					<%
						} else if (login.getSanyuan().equals("1")) {
					%> <input name="button2" border="0" type="image"
					src="../../../images1/zx.png" onclick="return check('cancelEmp');" <%-- <% if(optrjob.equals("管理员岗位")){ %>class="box_button"  <%}else if(optrjob.equals("核心涉密岗位")){  %> class="box_button" <%}else if(optrjob.equals("重要涉密岗位")){ %> style="display:none;"<% }else{ %> style="display:none;" <% } %> --%> />
					<%
						} else if (login.getSanyuan().equals("2")) {
					%> <input name="button2" onclick="check('addEmp');" border="0"
					type="image" src="../../../images1/xj.png" /> <%
 	}
 %>
				</td>
			</tr>
		</table>
		<%
			HashFmlBuf buf = (HashFmlBuf) request.getAttribute("employee_info");
			if (buf != null) {
				int rowcount = buf.getRowCount();
		%>
		<table width="99%" border="0" align="center" cellpadding="0"
			cellspacing="1" class="box" style="height: 84%;">
			<tr>
				<td>
					<div style="width: 100%; height: 96%; overflow: auto;">
						<div id="myGrid" class="2k3Grid" borderWidth="0"
							contextMenu="mnuGridContextMenu" altRowColor="oldLace">
							<div class="gridHead">
								<!--div align="left"><span width="5%">共检索到<%=rowcount%>条记录</span></div-->
								<div class="gridRow">
									<span width="5px" style="text-align: center;width: 100px;">序号 </span> <span
										width="10px">人员编号</span> <span width="10px" style="width: 100px;">人员状态</span> <span
										width="10px">人员姓名</span> <span width="7px" style="width: 100px;">人员性别</span> <span
										width="7px" style="width: 100px;">涉密程度</span> <span width="10px">是否为要害部门</span> <span
										width="10px">联系电话</span> <span width="7px" style="width: 100px;">政治面貌</span>
										<span width="10px">出生年月</span>
									<span style="width: 182px;border-right: none;">管理</span>
								</div>
							</div>
							<div class="gridBody">
								<%
									for (int i = 0; i < rowcount; i++) {
											String tempEmpid = buf.fget("empid", i);
											String tempstate = buf.fget("empstate", i);
											String tempExaminestate = buf.fget("examintstate", i);
											String tenationstate = buf.fget("nationstate", i);
											String disabled = "";
											String employeeid=buf.fget("empid", i);
											String tmpsex = buf.fget("sex", i);
											if (tempstate.equals("1")) {	tempstate = "正常";disabled = "";} else {tempstate = "注销";disabled = "disabled";	}
											if (tmpsex.equals("1")) {tmpsex = "男";	disabled = "";} else if (tmpsex.equals("0")) {	tmpsex = "女";disabled = "disabled";}
											if (tempExaminestate.equals("0")) {tempExaminestate = "已审核";disabled = "";} else {	tempExaminestate = "未审核";	disabled = "";}
								%>
								<div class="gridRow">
									<span width="5px" style="text-align: center;width: 100px;"><%=i + 1%>
										<input type="checkbox" name="empids" value="<%=tempEmpid%>">
									</span>
									<span><%=tempEmpid%></span>
									<span style="width: 100px;">
									    <% if (tempstate.equals("正常")) {%> <img src="../../images1/ok.png" width="16" height="16" alt="正常" style="cursor: pointer;margin-top: 7%;">
									    <% } else {%> <img src="../../images1/nook.png" width="16" height="16" alt="已注销"	style="cursor: pointer;margin-top: 7%;">
									    <% } %>
									</span>
									<span><%=buf.fget("empname", i)%></span>
									<span style="width: 100px;"><%=tmpsex%></span>
									<span style="width: 100px;"><%=buf.fget("empschool", i)%></span>
									<span><%=buf.fget("yaohaidemept", i)%></span>
									<span><%=buf.fget("empcontphone", i)%></span>
									<span style="width: 100px;"><%=buf.fget("emppolitics", i)%></span>
									<span><%=buf.fget("birthday", i)%></span>
									<span style="width: 182px;border-right: none;">
										<% if (login.getSanyuan().equals("0")) {%> 
										<% if(employeeid.equals(login.getEmpid()) || login.getEmpid().equals("ADMIN")  || login.getEmpid().equals("ZHKYADMIN")){ %> 
								    	<a href="	/servlet/EmpManage?operate=queryEmpselectEmpId&empid=<%=tempEmpid%>&nationstate=<%=tenationstate%>"><img
											border="0" src="../../../images1/read_document.png" ALT="查看"  style="cursor: pointer;" /></a>
										<% if (tempstate.equals("正常")) { %> <img border="0" src="../../../images1/unlockTask.png" ALT="已激活"  style="cursor: pointer;" />
										<% } else {  %> 
										<% if (tempExaminestate.equals("已审核")) {  %> 
										<a href="	/servlet/EmpManage?operate=queryEmpstateEmpId&empid=<%=tempEmpid%>"
										onclick="return confirm('确定要激活此人吗?')"><img border="0" 	src="../../../images1/lockTask.png" ALT="激活"
											style="cursor: pointer;" /></a>
									     <% } else { %> <img border="0" src="../../../images1/lockTask.png" ALT="激活" style="cursor: pointer;"
										onclick="return confirm('此用户未进行审核,请先审核,再激活!')" />
										<% }	%> 
										<% } %>
									  <a href="/servlet/EmpManage?operate=initPwd&empid=<%=tempEmpid%>"><img
											border="0" src="../../../images1/password.gif" ALT="初始化密码"/>
									  </a>

									<%--<input border="0" type="image" src="../../../images1/password.gif"
										   ALT="初始化密码" style="cursor: pointer;" name="button2"
										   onclick="check('initPwd','<%=tempEmpid%>');" />--%>



										<input border="0" type="image" src="../../../images1/edit.gif"
										ALT="修改" style="cursor: pointer;" name="button2"
										onclick="check('queryEmpByEmpId','<%=tempEmpid%>');" />
										<input border="0" type="image"
										src="../../../images1/delete.gif" ALT="删除"
										style="cursor: pointer;" name="button2"
										onclick="check('queryEmpBydelete','<%=tempEmpid%>');" />
										<%}else{ %> <%} %>
										<% } else if (login.getSanyuan().equals("1")) { %> 
										<%  if(employeeid.equals(login.getEmpid()) || login.getEmpid().equals("ADMIN")  || login.getEmpid().equals("ZHKYADMIN")){ %>
										 <a href="	/servlet/EmpManage?operate=queryEmpselectEmpId&empid=<%=tempEmpid%>&nationstate=<%=tenationstate%>"><img
											border="0" src="../../../images1/read_document.png" ALT="查看"
											style="cursor: pointer;" /></a><%}else{ %> <%} %> <% } else { %>
										<%
											if(employeeid.equals(login.getEmpid()) || login.getEmpid().equals("ADMIN")  || login.getEmpid().equals("ZHKYADMIN")){
										   %>
									<a href="	/servlet/EmpManage?operate=queryEmpselectEmpId&empid=<%=tempEmpid%>&nationstate=<%=tenationstate%>">
										<img
											border="0" src="../../../images1/read_document.png" ALT="查看"
											style="cursor: pointer;" /></a><input border="0"
										type="image" src="../../../images1/edit.gif" ALT="修改"
										style="cursor: pointer;" name="button2"
										onclick="check('queryEmpByEmpId','<%=tempEmpid%>');" />
										<input border="0" type="image"
										src="../../../images1/delete.gif" ALT="删除"
										style="cursor: pointer;" name="button2"
										onclick="check('queryEmpBydelete','<%=tempEmpid%>');" /> <%}else{ %> 
										<% } %> 
										<% }  %>
									</span>
								</div>
								<%
									}
								%>
							</div>
							<!-- gridBody end -->
						</div>
						<!-- myGrid end -->
					</div> <tag:PageLinkTag operate="queryEmp" scope="request" width="99%"
						align="center" /> <%
 	}
 %>
			<tr>
				<td>
		</table>
	</form>
</body>
</html>