employee_role_setting.jsp
上传用户:guhaomin
上传日期:2007-06-10
资源大小:23203k
文件大小:13k
源码类别:

电子政务应用

开发平台:

Java

  1. <%
  2. /**
  3.  * $RCSfile: employee_role_setting.jsp,v $
  4.  * $Revision: 1.0 $
  5.  * $Date: 2001/05/17 20:57:46 $
  6.  * /mainctrl/intranet/hr/role_set
  7.  */
  8. %>
  9. <%@ page errorPage="/vnex/ErrorPage.jsp" %>
  10. <%@ page import="com.vnex.intranet.hr.employer_info.value.*"%>
  11. <%@ page import="com.vnex.intranet.hr.employer_info.process.*"%>
  12. <%@ page import="com.vnex.intranet.hr.util.*"%>
  13. <%@ page import="java.util.*" %>
  14. <%@ taglib uri="/vnex.tld" prefix="vnex" %>
  15. <%@ taglib uri="/vnex_organization.tld" prefix="org" %>
  16. <%@ taglib uri="/vnex_hr.tld" prefix="hr" %>
  17. <jsp:useBean id="hrProxyBean" class="com.vnex.intranet.hr.employer_info.proxy.MemberInfoProxyBean" scope="application" />
  18. <jsp:useBean id="dutyInfoBean" class="com.vnex.intranet.hr.employer_info.value.MemberDutyInfo" scope="page" />
  19. <jsp:useBean id="businessSession" class="com.vnex.intranet.pub.BusinessSession" scope="session" />
  20. <jsp:setProperty name="dutyInfoBean" property="*" />
  21. <%
  22.     Collection pageColl = new ArrayList();
  23.     int emp_id = -1;
  24.     int chgMainDivisionId = -1;
  25.     int chgMainDutyId = -1;
  26.     String name = "";
  27.     String str = request.getParameter("emp_id");
  28.     if ( str != null )
  29.     {
  30.         emp_id = Integer.parseInt( str );
  31.         dutyInfoBean.setEmpId( emp_id );
  32.     }
  33.     str = request.getParameter("name");
  34.     if ( str != null )
  35.     {
  36.         name = new String(str);
  37.     }
  38.     String start = request.getParameter("start");
  39.     //MemberDutyDAO mi = new MemberDutyDAO();
  40.     if ( request.getParameter("doAdd") != null && dutyInfoBean.getEmpId() > 0 )
  41.     {
  42.         dutyInfoBean.setAssignId( businessSession.getEmpId() );
  43.         hrProxyBean.dutyCreate( dutyInfoBean );
  44.     }
  45.     if ( request.getParameter("doDel") != null && dutyInfoBean.getEmpId() > 0 && request.getParameter("delId") != null)
  46.     {
  47.         String[] delId = request.getParameterValues("delId");
  48.         for ( int i=0; i<delId.length; i++ )
  49.         {
  50.             hrProxyBean.dutyRemove( dutyInfoBean.getEmpId(), Integer.parseInt( delId[i].substring(1) ) );
  51.         }
  52.     }
  53.     int deIdTemp = -1;
  54.     if ( request.getParameter("doChange") != null && dutyInfoBean.getEmpId() > 0 )
  55.     {
  56.         if ( request.getParameter("divisionId") != null )
  57.             deIdTemp = Integer.parseInt( request.getParameter("divisionId") );
  58.     }
  59.     if( request.getParameter("doModifyMainDuty") != null)
  60.     {
  61.      System.out.println("nn**********************Processing the if condition()");
  62.      System.out.println("nn**********************request.getParameter("divisionId")"+request.getParameter("divisionId"));
  63.      System.out.println("nn**********************request.getParameter("dutyId") "+request.getParameter("dutyId") );
  64.      if( request.getParameter("divisionId") != null )
  65.      chgMainDivisionId = Integer.parseInt(request.getParameter("divisionId") );
  66.      if( request.getParameter("dutyId") != null )
  67.      chgMainDutyId = Integer.parseInt( request.getParameter("dutyId") );
  68.         if(chgMainDivisionId > 0 && chgMainDutyId > 0 && emp_id > 0)    
  69.         {
  70.          try
  71.          {
  72.          System.out.println("nnProcessing the method:hrProxyBean.modifyIsMainDuty()");
  73.          hrProxyBean.modifyIsMainDuty( chgMainDutyId, chgMainDivisionId , emp_id); 
  74.          }
  75.          catch(Exception e)
  76.          {
  77.          System.out.println("Exception  :"+e.getMessage());
  78.          }
  79.         }
  80.     }
  81.     
  82.     System.out.println("Jsp find the emp_id"+emp_id);
  83.     pageColl = hrProxyBean.dutyFind( emp_id );
  84. %>
  85. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  86. <HTML>
  87. <jsp:include page="/vnex/page/FORM_HEAD.jsp" />
  88. <script language="JavaScript" src="/vnex/validate.js"></script>
  89. <script language="javascript" src="/vnex/util/strUtil.js"></script>
  90. <script language=JavaScript>
  91. function submitAdd()
  92. {
  93.     if (form1.divisionId.selectedIndex < 0)
  94.     {
  95.         alert("你必须选择部门!");
  96.         form1.divisionId.focus();
  97.         return false;
  98.     }
  99.     if (form1.dutyId.selectedIndex < 0)
  100.     {
  101.         alert("你必须选择职位!");
  102.         form1.dutyId.focus();
  103.         return false;
  104.     }
  105.     form1.action= "/mainctrl/intranet/hr/role_set?doAdd=1";
  106.     form1.submit();
  107. }
  108. function change(select)
  109. {
  110.     form1.action="/mainctrl/intranet/hr/role_set?doChange=1";
  111.     form1.submit();
  112. }
  113. function checkIfValidForDel(ob,division,dutyName)
  114. {
  115. if( ob.value.charAt(0)=="N" && ob.checked == true )
  116. {
  117. alert("<%=name%>"+"在"+division+"担任了两个或两个以上职位,您当前选中想要删除的"+dutyName+"职位是"+"<%=name%>"+"在"+division+"担任的主要职位,您必须给" +"<%=name%>"+ "在"+division+"部门另指定一个主要职位然后再选择删除.");
  118. return false;
  119. }
  120. else
  121. {
  122. return false;
  123. }
  124. }
  125. function submitDel()
  126. {
  127.     if(form1.delId == null)
  128.     {
  129.        alert("目前没有数据可供删除!");
  130.        return false;
  131.     }
  132.     if(!isChecked(form1.delId))
  133.     {
  134.        alert("您没有选择要删除的项!");
  135.        return false;
  136.     }
  137.     for(var i=0;i<document.form1.delId.length;i++)
  138.     {
  139.    if (document.form1.delId[i].checked)
  140.   {
  141. if( document.form1.delId[i].value.charAt(0)=="N" )
  142. {
  143. alert("根据职位设定的原则,您必须保证每一个员工在其任职的每一个部门有而且仅有一个主要职位,n如果"+"<%=name%>"+"在一个部门担任了两个或两个以上的职位(其中会有一个而且仅有一个为主要职位),当您试图去删除其在某部门担任的主要职务时,n请您先将"+"<%=name%>"+"在该部门担任的主要职务标记更换到他在该部门担任的另一个职务上以后再选中删除.");
  144. return false;
  145. }
  146. }    
  147.     }
  148.     if ( confirm("你确认要删除您选中的项吗?") )
  149.     {
  150.         form1.action= "/mainctrl/intranet/hr/role_set?doDel=1";
  151.         form1.submit();
  152.     }
  153.     else return false;
  154. }
  155. function domodifyMainDuty( ob, dutyId,divisionId,empId)
  156. {
  157. if(ob.value == "Y")
  158. {
  159. //alert("Y"+dutyId);
  160. return false;
  161. }
  162. if(ob.value == "N")
  163. {
  164. ob.checked = false;
  165. form1.action = "/mainctrl/intranet/hr/role_set?doModifyMainDuty=1&dutyId="+dutyId+"&empId="+empId+"&divisionId="+divisionId;
  166. form1.submit();
  167. }
  168. return false;
  169. }
  170. </script>
  171. <BODY text=#000000 vLink=#000000 aLink=#000000 link=#000000 bgColor=#ffffff topMargin=20 leftmargin="0" marginwidth="0" marginheight="0">
  172. <script language="JavaScript1.2" src="/vnex/menu/dockmenu_hr.js"></script>
  173. <script language="JavaScript" src="/vnex/menu/dockmenu.js"></script>
  174. <DIV align=center>
  175. <form name="form1" method="post" action="/mainctrl/intranet/hr/role_set?emp_id=<%= emp_id %>">
  176.   <TABLE class=outter cellSpacing=0 cellPadding=0 width=600 border=0>
  177.     <TBODY>
  178.     <jsp:include page="/vnex/page/TTOA_TABLE_TOP.jsp" />
  179.     <TR> 
  180.         <TD colSpan=3 align="center"> 
  181.           <br>
  182.           <table width="600" border="1" cellspacing="1" bordercolor="#666666">
  183.             <tr>
  184.               <td bgcolor="#fafafa">  
  185.                 <table class=title cellspacing=1 width="600" border=0>
  186.                   <tr> 
  187.                     <td colspan="6" bgcolor="#666666"><font class="strongw"><a href="/mainctrl/home/index"><font color="#FFFFFF">首页</font></a>&gt;&gt;<a href="/mainctrl/hr/main"><font color="#FFFFFF">人力资源</font></a>&gt;&gt;<a href="/mainctrl/intranet/hr/search_result"><font color="#FFFFFF">员工信息库</font></a>&gt;&gt;个人职务设定</font></td>
  188.             </tr>
  189.                   <tr bgcolor="#fafafa"> 
  190.                     <td colspan="6" height="30">&nbsp; 
  191.     <%
  192.         if ( pageColl.size() > 0 )
  193.         {
  194.     %>
  195.                       <input type="button" value="删除" name="B22" onClick="submitDel()"  class=text>
  196.     <%
  197.         }
  198.     %>
  199.                     </td>
  200.             </tr>
  201.                   <tr> 
  202.                     <td width="40" align="center"><font class=strong>选择</font></td>
  203.                     <td width="140" align="center"><font class=strong>设定时间</font></td>
  204.                     <td width="140" align="center"><font class=strong>部门</font></td>
  205.                     <td width="140" align="center"><font class=strong>主管</font></td>
  206.                     <td width="140" align="center"> <font class=strong>职务</font></td>
  207.                     <td width="10" align="center"> <font class=strong>主</font></td>
  208.             </tr>
  209.     <%
  210.         String bgcolor = null;
  211.         int color_i = 0;
  212.         Iterator iter = pageColl.iterator();
  213.         while ( iter.hasNext() )
  214.         {
  215.             MemberDutyInfo mdi = (MemberDutyInfo)iter.next();
  216.             color_i++;
  217.             if( color_i%2==0 )
  218.             {
  219.                 bgcolor = "#e0e0e0";
  220.             }
  221.             else
  222.             {
  223.                 bgcolor = "#fafafa";
  224.             }
  225.     %>
  226.                   <tr bgcolor="<%= bgcolor %>"> 
  227.                     <td width="40" align="center"><font class=strongw> 
  228.                       <input type="checkbox" name="delId" value="<%= hrProxyBean.isValidForDel(mdi.getDutyId(),emp_id)?"Y":"N"%><%= mdi.getDutyId() %>" onclick = "checkIfValidForDel(this,'<%= mdi.getDivisionName() %>','<%= mdi.getDutyName() %>')">
  229.                 </font></td>
  230.                     <td width="140" align="center"><%= MyDateFormat.myDate(mdi.getAssignDate()) %></td>
  231.                     <td align="center" width="140"><%= mdi.getDivisionName() %></td>
  232.                     <td width="140" align="center"><%= mdi.getManagerName() %></td>
  233.                     <td width="140" align="center"><%= mdi.getDutyName() %></td>
  234.                     <td width="10" align="center"><input type="radio"  name="radio<%=mdi.getDutyId()%>" value="<%=mdi.getIsMainDuty()?"Y":"N"%>" <% if( mdi.getIsMainDuty() == true ) out.print("checked");%> onclick = "domodifyMainDuty(this,'<%= mdi.getDutyId() %>','<%=mdi.getDivisionId()%>','<%=emp_id%>')" ></td>
  235.             </tr>
  236.     <%
  237.         }
  238.     %>
  239.           </table>
  240.                 <hr size="1" color="#ffffff">
  241.                 <table class=title cellspacing=1 width="600" border=0>
  242.                   <tr> 
  243.                     <td bgcolor="#e0e0e0" width="21%"><font class=strong>&nbsp;姓名:</font></td>
  244.                     <td bgcolor="#e0e0e0" width="79%"><%= name %></td>
  245.                   </tr>
  246.                   <tr> 
  247.                     <td bgcolor="#fafafa" width="21%"><font class=strong>&nbsp;部门:</font></td>
  248.                     <td bgcolor="#fafafa" width="79%"> 
  249.                     <!--部门列表开始-->
  250.                     <select name="divisionId" class=choice onChange=change(this)>
  251.                     <option value="-1">------------请选择部门------------</option>
  252.                     <org:DivisionList>
  253.                     <vnex:items select='<%= deIdTemp+"" %>' >
  254.                     <option value=<org:DivisionAttribute attribute="id"/> <org:DivisionAttribute attribute="isSelected"/> >
  255.                     <org:DivisionAttribute attribute="levelStr"/>+<org:DivisionAttribute attribute="name"/></option>
  256.                     </vnex:items>
  257.                     </org:DivisionList>
  258.                     </select>
  259.                     <!--部门列表结束-->
  260.                     </td>
  261.                   </tr>
  262.                   <tr bgcolor="#e0e0e0"> 
  263.                     <td width="21%"><font class=strong>&nbsp;职位:</font></td>
  264.                     <td width="79%"> 
  265.                     <select name="dutyId">
  266.                     <%
  267.                     try
  268.                     {
  269.                      System.out.println("deIdTemp:"+deIdTemp);
  270.                     %>
  271.                     <hr:DutyList divisionId='<%= deIdTemp %>'>                          
  272.             <vnex:items >
  273.             <option value="<hr:DutyAttribute attribute="id" />"  >
  274.             <hr:DutyAttribute attribute='<%= null %>' /></option>
  275.             </vnex:items>            
  276.      </hr:DutyList> 
  277.      <%
  278.      }
  279.      catch(Exception e)
  280.      {
  281.       System.out.println("Error at Employee_role_setting.jsp at the DutyList tag:"+e.getMessage());
  282.      }
  283.      %>            
  284.             </select>
  285.                     </td>
  286.                   </tr>
  287.                   <tr bgcolor="#fafafa"> 
  288.                     <td width="21%"><font class=strong>&nbsp;主要职务:</font></td>
  289.                     <td width="79%"> 
  290.                       <input type="checkbox" name="isMainDuty" value=true >
  291.                     </td>
  292.                   </tr>
  293.                   <tr bgcolor="#fafafa" align="center"> 
  294.                     <td colspan="2" height="30"> 
  295.                       <input type=button value=新增 name=B3 class=text onclick="submitAdd()">&nbsp;&nbsp;
  296.                       <input type="reset" value="重置" name="B2" class=text>&nbsp;&nbsp;
  297.                       <input type="button" value="返回" name="B23" onClick="location='/mainctrl/intranet/hr/search_result?start=<%= start %>'"  class=text>
  298.                     </td>
  299.                   </tr>
  300.                 </table>
  301.            </td>
  302.             </tr>
  303.           </table> 
  304.           <br><br>
  305.           <jsp:include page="/vnex/page/TTOA_HELP.jsp" />
  306.         </TD>
  307.     </TR>
  308.      <jsp:include page="/vnex/page/TTOA_TABLE_BOTTOM.jsp" />
  309.     </TBODY> 
  310.     </TABLE>
  311.   <BR>
  312.   <jsp:include page="/vnex/page/TTOA_PRODUCER_LOGO.jsp" />
  313.     <input type=hidden name=emp_id value=<%= emp_id %> >
  314.     <input type=hidden name=name value=<%= name %> >
  315.     <input type=hidden name=start value=<%= start %> >
  316.   </form></DIV>
  317. </BODY></HTML>