<%@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 deptid = Common.convertNull(request.getParameter("departid")); String frameworkid = Common.convertNull(request.getParameter("frameworkid")); %> <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> <style type="text/css"> select { width:155px; } </style> <script> function setValue() { <%-- if (!Common.isNull(frameworkid)) { out.println("form1.frameworkid.value='" + frameworkid + "';"); } --%> } </script> </head> <body onload="setValue();"> <br> <table width="90%" 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"> 人员与单位关系管理</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> <form name="form1" method="post" action="/servlet/EmpDeptRelation"> <input type="hidden" name="operate" value=""/> <input type="hidden" name="departid" value="<%=deptid%>"/> <input type="hidden" name="frameworkid" value="<%=frameworkid%>"/> <table width="90%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="d8e9fe" class="table02"> <tr bgcolor="#FFFFFF"> <td class="cell1">所属地市</td> <td class="cell2"> <input type="text" readonly value="<%=Para.getSjName(getPara, frameworkid)%>"/> </td> <td class="cell1">单位名称</td> <td class="cell2"> <input type="text" readonly value="<%=Para.getSchoolName(getPara, deptid)%>" size="25" onkeyup="value=value.replace(/[^\u4E00-\u9FA5]/g,'')"/> </td> </tr> </table> <%-- 员工岗位列表 --%> <br> <table width="90%" align="center" bgcolor="#999999" cellpadding="1" cellspacing="1"> <tr align="center" bgcolor="#ffffff" height="20"> <td>可选人员列表</td> <td>选择岗位</td> <td>本单位人员列表</td> </tr> <tr align="center" bgcolor="#ffffff"> <td width="35%" valign="top" nowrap> <span id="otherEmp" style="width:100%;height:250px;overflow:auto;vertical-align:top;"> <table width='100%' border='0' align='center' cellpadding='0' cellspacing='1' bgcolor='#999999'> <tr height='20'> <td class='cell4'>选择</td> <td class='cell4'>人员工号</td> <td class='cell4'>人员姓名</td> </tr> <% HashFmlBuf otherBuf = (HashFmlBuf) request.getAttribute("otherEmpBuf"); if (otherBuf != null) { for (int i=0; i<otherBuf.getRowCount(); i++) { String empid = otherBuf.fget("empid",i); %> <tr bgcolor='ebebeb' align='center'> <td><input type="checkbox" name="otherEmpid" value="<%=empid%>"></td> <td><%=empid%></td> <td><%=otherBuf.fget("empname",i)%></td> </tr> <% } } %> </table> </span> </td> <td valign="top"> <select name="jobcode"> <option value="">--请选择岗位--</option> <%=Para.getSelectJob(frameworkid)%> </select> <br><br> <input type="button" name="addButton" class="box_button" value=" -> " onclick="add();"/><br><br> <input type="button" name="delButton" class="box_button" value=" <- " onclick="remove();"/> </td> <td width="50%" valign="top" nowrap> <span id="existEmp" style="width:100%;height:250px;overflow:auto;vertical-align:top;"> <table width='100%' border='0' align='center' cellpadding='0' cellspacing='1' bgcolor='#999999'> <tr height="20"> <td class='cell4'>选择</td> <td class='cell4'>工作人员工号</td> <td class='cell4'>工作人员姓名</td> <td class='cell4'>岗位</td> </tr> <% HashFmlBuf existBuf = (HashFmlBuf) request.getAttribute("existEmpBuf"); if (existBuf != null) { for (int i=0; i<existBuf.getRowCount(); i++) { String empid = existBuf.fget("empid",i); %> <tr bgcolor='ebebeb' align='center'> <td><input type='checkbox' name='existEmpid' value='<%=empid%>'></td> <td><%=empid%></td> <td><%=existBuf.fget("empname",i)%></td> <td><%=existBuf.fget("jobname",i)%></td> </tr> <% } } %> </table> </span> </td> </tr> </table> <tag:PageLinkTag operate="query" scope="request" width="90%" align="center"/> <br> <table width="90%" align="center"> <tr align="center"> <td> <a href="javascript:history.go(-1)"><img src="../../images1/fh.png" alt="返回" border="0" /></a> </td> </tr> </table> </form> </td> </tr> </table> <%@include file="/foot.jsp"%> </body> </html> <%-- <script> function add() { var jobcode = form1.jobcode.value; if (jobcode == "") { alert("请选择一个岗位!"); form1.jobcode.focus(); return false; } var count = 0; if (form1.otherEmpid) { if (form1.otherEmpid.length) { for (var i=0; i<form1.otherEmpid.length; i++) { if (form1.otherEmpid[i].checked==true) { count++; } } } else { if (form1.otherEmpid.checked==true) { count++; } } } else { alert("没有可以添加的员工!"); return false; } if (count==0) { alert("请选择要添加的员工!"); return false; } form1.operate.value="add"; form1.submit(); } function remove() { var count = 0; if (form1.existEmpid) { if (form1.existEmpid.length) { for (var i=0; i<form1.existEmpid.length; i++) { if (form1.existEmpid[i].checked==true) { count++; } } } else { if (form1.existEmpid.checked==true) { count++; } } } else { alert("没有可以删除的员工!"); return false; } if (count==0) { alert("请选择要删除的员工!"); return false; } form1.operate.value="remove"; form1.submit(); } function historyBack() { form1.action = "/servlet/DeptManage"; form1.operate.value="queryDept"; form1.submit(); } </script> --%> <script> function add() { var jobcode = form1.jobcode.value; if (jobcode == "") { alert("请选择一个岗位!"); form1.jobcode.focus(); return false; } var count = 0; var temp = ""; if (form1.otherEmpid) { if (form1.otherEmpid.length) { for (var i=0; i<form1.otherEmpid.length; i++) { if (form1.otherEmpid[i].checked==true) { temp += "&otherEmpid=" + form1.otherEmpid[i].value; count++; } } } else { if (form1.otherEmpid.checked==true) { temp += "&otherEmpid=" + form1.otherEmpid.value; count++; } } } else { alert("没有可以添加的员工!"); return false; } if (count==0) { alert("请选择要添加的员工!"); return false; } var url = "/servlet/EmpDeptRelation?operate=add&frameworkid=<%=frameworkid%>&departid=<%=deptid%>&jobcode=" + jobcode + temp; var callback = reloadTable; executeXhr(callback,url); } function remove() { var count = 0; var temp = ""; if (form1.existEmpid) { if (form1.existEmpid.length) { for (var i=0; i<form1.existEmpid.length; i++) { if (form1.existEmpid[i].checked==true) { temp += "&existEmpid=" + form1.existEmpid[i].value; count++; } } } else { if (form1.existEmpid.checked==true) { temp += "&existEmpid=" + form1.existEmpid.value; count++; } } } else { alert("没有可以删除的员工!"); return false; } if (count==0) { alert("请选择要删除的员工!"); return false; } var url = "/servlet/EmpDeptRelation?operate=remove&frameworkid=<%=frameworkid%>&departid=<%=deptid%>" + temp; var callback = reloadTable; executeXhr(callback,url); } function column(name,id,type) { this.name = name; this.id = id; if (type) { this.type = type; } else { this.type = ""; } } function reloadTable() { // only if req shows "loaded" if (req.readyState == 4) { // only if "OK" if (req.status == 200) { var xmlobj = req.responseXML; var table = xmlobj.getElementsByTagName("table"); document.all.otherEmp.innerHTML = ""; document.all.existEmp.innerHTML = ""; document.all.otherEmp.appendChild(makeTable(table[1],new Array(new column("选择","otherEmpid","checkbox"),new column("员工工号","empid"),new column("员工姓名","empname")))); document.all.existEmp.appendChild(makeTable(table[0],new Array(new column("选择","existEmpid","checkbox"),new column("员工工号","empid"),new column("员工姓名","empname"),new column("岗位","jobname")))); } else { alert("There was a problem retrieving the XML data:" + req.statusText); } } } function makeTable(tableEl,columns) { var table = document.createElement("table"); table.setAttribute("border","0",0); table.setAttribute("width","100%",0); table.setAttribute("align","center",0); table.setAttribute("cellpadding","0",0); table.setAttribute("cellspacing","1",0); table.setAttribute("bgcolor","#999999",0); document.body.appendChild(table); var header = table.createTHead(); var headerrow = header.insertRow(0); headerrow.setAttribute("height","20"); for (var i=0; i<columns.length; i++) { var cell = headerrow.insertCell(i); cell.setAttribute("bgcolor","#98C5EC",0); cell.setAttribute("align","center"); cell.appendChild(document.createTextNode(columns[i].name)); } var rowsEl = tableEl.getElementsByTagName("row"); for(var i=0;i<rowsEl.length;i++) { var row = table.insertRow(i+1); row.setAttribute("bgcolor","#ebebeb",0); row.setAttribute("align","center"); for (var j=0; j<columns.length; j++) { var data = rowsEl[i].getElementsByTagName(columns[j].id)[0].firstChild.data; if (columns[j].type == "") { row.insertCell(j).appendChild(document.createTextNode(data)); } else { var el = document.createElement("<input NAME=\"" + columns[j].id + "\">"); el.setAttribute("type",columns[j].type); el.setAttribute("value",data); row.insertCell(j).appendChild(el); } } } return table; } function historyBack() { history.back(); } </script> <script src="/js/ajaxUtils.js"></script>