<%@ page contentType="text/html;charset=gbk" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.database.SzPageInfo" %>
<%@ page import="net.sz600.system.SzProperties" %>
<%@ page import="net.sz600.system.SzPageHelp" %>
<%@ page import="net.sz600.organize.SzUser" %>
<%@ page import="net.sz600.organize.SzUserInfo" %>
<%@ include file="/sessionInfo.jsp"%>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<link href="<%=strSkin_SESSION%>/css2007.css" rel="stylesheet" type="text/css">
</head>
<%
    //获取提交的参数
    String sPage = SzConvert.toZeroStr(request.getParameter("page"));
    String sSearch = SzConvert.strWriteData(request.getParameter("txtSearch"));

    //读取数据
    SzUser szUser = new SzUser();
    SzUserInfo szUserInfo = null;
    String sCond = "1=1";
    String sSortField = "YGID";
    int iSortOrder = SzProperties.I_SortOrder_DESC;
    int iCurrentPage = 1;
    try {
        iCurrentPage =  Integer.parseInt(sPage);
    }catch(Exception e) {
    }
    Iterator iter = szUser.getArrayList(sCond, sSortField, iSortOrder, iCurrentPage, sSearch).iterator();
    SzPageInfo pageInfo = szUser.getPageInfo();
    int iPageCount = pageInfo.getPageCount();
    int iRecordCount = pageInfo.getRecordCount();
    iCurrentPage = pageInfo.getCurrentPage();
    int i = 0;
%>
<!-----上面的工具栏------>
<table width="100%">
  <tr>
    <td class="titleClass">员工管理</td>
    <td>
      <input type="button" name="btnAdd" class="btnClass" value="添加" OnClick="javascript:GoUrl('update.jsp?OPERATOR=add&KEY=0');">
      <input type="button" name="btnDel" class="btnClass" value="删除" OnClick="javascript:FormSubmit(formList, 'control.jsp?OPERATOR=delete');">
    </td>
  </tr>
</table>

<!-----信息列表----->
<table width="100%" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" class="tableClass" cellpadding="1" cellspacing="0">
  <form name="formList" method="post">
  <input type="hidden" name="page" value="<%=iCurrentPage%>">
  <input type="hidden" name="txtSearch" value="<%=sSearch%>">
  <tr class="trClassTitle">
    <td width="5"><input type="checkbox" name="chkCheckAll" OnClick="javascript:CheckAll(formList, chkCheckAll, 'chkId');"></td>
    <td>员工编号</td>
    <td>手机号码</td>
    <td>电子邮箱</td>
    <td>工作职责</td>
    <td width="40">操作</td>
  </tr>
<%
    while (iter != null && iter.hasNext()) {
        szUserInfo = (SzUserInfo)iter.next();
        i++;
%>
  <tr>
    <td width="5"><input type="checkbox" name="chkId" id="chkId" value="<%=szUserInfo.getYGID()%>"></td>
    <td><%=szUserInfo.getYGBH()%>&nbsp;</td>
    <td><%=szUserInfo.getYGSJ()%>&nbsp;</td>
    <td><%=szUserInfo.getYGYX()%>&nbsp;</td>
    <td><%=szUserInfo.getYGZW()%>&nbsp;</td>
    <td><a href="javascript:FormSubmit(formPage,'update.jsp?OPERATOR=update&KEY=<%=szUserInfo.getYGID()%>');">修改</a></td>
  </tr>
<%
    }
    out.println(SzPageHelp.outIndexTableTr(i, SzProperties.I_PageSize, 6));
%>

  </form>
</table>

<!-----下面的工具栏------>
<table width="100%">
  <form name="formPage" method="post">
  <tr>
    <td align="right">
      <%@ include file="/share/page/page_include.jsp"%>
    </td>
  </tr>
  </form>
</table>

<!-----这里包含要提交的内容--->
<form name="formHidden" method="post">
</form>
<script language="javascript">
  //第一个表示对象，form，第二个表示字符串
  function FormSubmit(oFormName, vUrl) {
    oFormName.action = vUrl;
    oFormName.submit();
  }

  function GoUrl(vUrl) {
    document.location.href = vUrl;
  }

  //javascript参数的调用：
  //checkAll(formList,chkCheckAll,'chkId')
  //第一个表示对象，第二个表示对象，第三个表示字符串
  function CheckAll(oFormList, oChkCheckAll, vChkId) {
    var e;
    for (var i=0; i<oFormList.elements.length; i++) {
      e = oFormList.elements[i];
      if (e.name == vChkId) {
        e.checked = oChkCheckAll.checked;
      }
    }
  }
</script>