dept_user.jsp
上传用户:jhtang88
上传日期:2014-01-27
资源大小:28528k
文件大小:6k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
  2. <%@ page import="com.redmoon.oa.pvg.*" %>
  3. <%@ page import="com.redmoon.oa.dept.*" %>
  4. <%@ page import="com.redmoon.oa.basic.*" %>
  5. <%@ page import="com.redmoon.oa.person.*" %>
  6. <%@ page import="cn.js.fan.web.*" %>
  7. <%@ page import="cn.js.fan.util.*" %>
  8. <%@ page import="java.util.*" %>
  9. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  10. <html>
  11. <head>
  12. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  13. <title>部门员工</title>
  14. <LINK href="default.css" type=text/css rel=stylesheet>
  15. <script>
  16. function setPerson(user, userRealName)
  17. {
  18. form1.userName.value = user;
  19. form1.userRealName.value = userRealName;
  20. }
  21. function openWin(url,width,height)
  22. {
  23.   var newwin=window.open(url,"_blank","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,top=50,left=120,width="+width+",height="+height);
  24. }
  25. </script>
  26. </head>
  27. <body>
  28. <%
  29. String deptCode = ParamUtil.get(request, "deptCode");
  30. if (deptCode.equals(DeptDb.ROOTCODE)) {
  31. out.print(SkinUtil.makeErrMsg(request, "请选择某个部门!"));
  32. return;
  33. }
  34. DeptDb dd = new DeptDb();
  35. dd = dd.getDeptDb(deptCode);
  36. if (dd==null) {
  37. out.print(SkinUtil.makeErrMsg(request, "部门 " + deptCode + " 不存在!"));
  38. return;
  39. }
  40. String op = ParamUtil.get(request, "op");
  41. if (op.equals("add")) {
  42. try {
  43. DeptUserMgr pum = new DeptUserMgr();
  44. if (pum.add(request))
  45. out.print(StrUtil.Alert("添加成功!"));
  46. }
  47. catch (ErrMsgException e) {
  48. out.print(StrUtil.Alert(e.getMessage()));
  49. }
  50. }
  51. if (op.equals("move")) {
  52. try {
  53. DeptUserMgr jm = new DeptUserMgr();
  54. jm.move(request);
  55. }
  56. catch (ErrMsgException e) {
  57. out.print(StrUtil.Alert(e.getMessage()));
  58. }
  59. }
  60. if (op.equals("del")) {
  61. try {
  62. DeptUserMgr pum = new DeptUserMgr();
  63. if (pum.del(request))
  64. out.print(StrUtil.Alert("删除成功!"));
  65. }
  66. catch (ErrMsgException e) {
  67. out.print(StrUtil.Alert(e.getMessage()));
  68. }
  69. }
  70. if (op.equals("modify")) {
  71. try {
  72. DeptUserMgr jm = new DeptUserMgr();
  73. if (jm.modify(request))
  74. out.print(StrUtil.Alert("修改成功!"));
  75. }
  76. catch (ErrMsgException e) {
  77. out.print(StrUtil.Alert(e.getMessage()));
  78. }
  79. }
  80. %>
  81. <table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" class="frame_gray" style="height:100%">
  82.   <tr>
  83.     <td width="100%" align="center" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  84.       <tr>
  85.         <td height="24" align="center" bgcolor="#88B5FF">
  86.   <%=dd.getName()%>&nbsp;的员工</td>
  87.       </tr>
  88.     </table>
  89.       <table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  90.       <tr>
  91.         <td align="center" bgcolor="#C4DAFF">职级</td>
  92.         <td height="24" align="center" bgcolor="#C4DAFF">用户</td>
  93.         <td align="center" bgcolor="#C4DAFF">角色</td>
  94.         <td width="21%" height="24" align="center" bgcolor="#C4DAFF">操作</td>
  95.         </tr>
  96.     <%
  97. RankDb rd = new RankDb();
  98. DeptUserDb jd = new DeptUserDb();
  99. Vector v = jd.list(deptCode);
  100. Iterator ir = v.iterator();
  101. while (ir.hasNext()) {
  102. DeptUserDb pu = (DeptUserDb)ir.next();
  103. UserDb ud = new UserDb();
  104. if (!pu.getUserName().equals(""))
  105. ud = ud.getUserDb(pu.getUserName());
  106. %>
  107.       <tr>
  108.         <td width="11%">
  109. <%
  110. String userRealName = "";
  111. if (ud.isLoaded()) {
  112. out.print(StrUtil.getNullString(rd.getRankDb(ud.getRankCode()).getName()));
  113. userRealName = ud.getRealName();
  114. }
  115. %></td>
  116.         <td width="23%" height="22"><a href="user_edit.jsp?name=<%=StrUtil.UrlEncode(pu.getUserName())%>"><%=userRealName%></a></td>
  117.         <td width="45%">
  118. <%
  119. RoleDb[] roleary = ud.getRoles();
  120. if (roleary!=null) {
  121. int len = roleary.length;
  122. for (int i=0; i<len; i++) {
  123. if (i==0)
  124. out.print(roleary[i].getDesc());
  125. else
  126. out.print("," + roleary[i].getDesc());
  127. }
  128. }
  129. %>
  130. </td>
  131.         <td height="22"><a href="dept_user_edit.jsp?deptCode=<%=StrUtil.UrlEncode(pu.getDeptCode())%>&id=<%=pu.getId()%>">修改</a>&nbsp;&nbsp;<a href="?op=move&direction=up&deptCode=<%=StrUtil.UrlEncode(pu.getDeptCode())%>&deptCode=<%=StrUtil.UrlEncode(pu.getDeptCode())%>&id=<%=pu.getId()%>">上移</a>&nbsp;&nbsp;<a href="?op=move&direction=down&deptCode=<%=StrUtil.UrlEncode(pu.getDeptCode())%>&deptCode=<%=StrUtil.UrlEncode(pu.getDeptCode())%>&id=<%=pu.getId()%>">下移</a>&nbsp;&nbsp;<a href="?op=del&id=<%=pu.getId()%>&deptCode=<%=StrUtil.UrlEncode(deptCode)%>">删除</a></td>
  132.         </tr>
  133.     <%}%>
  134.     </table>
  135.       <br>
  136.       <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  137.         <form name="form1" method="post" action="?">
  138.           <tr>
  139.             <td height="24" colspan="2" align="center" bgcolor="#C4DAFF">添加部门中的用户</td>
  140.           </tr>
  141.           <tr>
  142.             <td width="32%" height="22" align="center"> 部&nbsp;&nbsp;&nbsp;&nbsp;门 </td>
  143.             <td width="68%" align="left"><%=dd.getName()%>
  144.               <input type=hidden name="deptCode" value="<%=deptCode%>">
  145.               <input name="op" value="add" type=hidden></td>
  146.           </tr>
  147.           <tr>
  148.             <td height="22" align="center">用户名</td>
  149.             <td height="22" align="left"><input name="userName" class="singleboarder" value="" size="16" type="hidden">
  150.               <input name="rank" class="singleboarder" value="" size="16" type="hidden">
  151.               <input name="userRealName" class="singleboarder" id="userRealName" value="" size="18" readonly>
  152. <a href="#" onClick="openWin('user_sel.jsp', 480, 320)">选择</a>&nbsp;<a href="#" onClick="form1.name.value=''; form1.userRealName.value=''">清除</a></td>
  153.           </tr>
  154.           
  155.           <tr>
  156.             <td height="22" colspan="2" align="center"><input name="Submit" type="submit" class="singleboarder" value="添加">
  157. &nbsp;&nbsp;&nbsp;
  158.         <input name="Submit" type="reset" class="singleboarder" value="重置">            </td>
  159.           </tr>
  160.         </form>
  161.     </table></td>
  162.   </tr>
  163. </table>
  164. </body>
  165. </html>