<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="net.sz600.basicdata.*" %>
<%@ page import="net.sz600.tool.*" %>
<%@ page import="net.sz600.database.SzPageInfo" %>
<%@ page import="net.sz600.system.SzProperties" %>
<%@ page import="net.sz600.system.SzLevelNumber" %>
<%@ page import="net.sz600.system.SzPageHelp" %>
<%@ page import="net.sz600.system.*" %>

<%@ include file="/sessionInfo.jsp"%>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="<%=strSkin_SESSION%>/css2007.css" rel="stylesheet" type="text/css">
</head>
<%
    //获取提交的参数
    String sType = SzConvert.toZeroStr(request.getParameter("type"));
    String sPKEY = SzConvert.toZeroStr(request.getParameter("PKEY"));
    String sPage = SzConvert.toZeroStr(request.getParameter("page"));
    String sSearch = SzConvert.strWriteData(request.getParameter("txtSearch"));
    String sSearchName = SzConvert.strWriteData(request.getParameter("txtSearchName"));
		String sSearchTitle = SzConvert.strWriteData(request.getParameter("txtSearchTitle"));    

    //获取提交的时间字段
    String sBG =SzConvert.strWriteData(request.getParameter("RZBG"));
    String sED =SzConvert.strWriteData(request.getParameter("RZED"));
   
    
    String sTable_type = "";
    //读取数据
    SzLogControl logControl= new SzLogControl();
    SzLogControlInfo  logControlInfo = null;
    String sCond = "1=1";
    if (!sPKEY.equals("0")) {
        sCond += "";
    }
		if (!sBG.equals("")){
    	sCond += " and RZCZSJ >= '" + sBG + "'";
    }
		if (!sED.equals("")) {
    	sCond += " and RZCZSJ <='" + sED + "'";
    }
	  if (!sSearchName.equals("")) {
	    	sCond += " AND RZCZRY ='" + sSearchName + "'";
	    }   
	  if (!sSearchTitle.equals("")) {
	    	sCond += " AND RZNR LIKE '%" + sSearchTitle + "%'";
	  }       
    
    String sSortField = SzConvert.toSpaceStr(request.getParameter("txtSortField")); 
    int iSortOrder    = Integer.parseInt(SzConvert.toZeroStr(request.getParameter("txtSortOrder"))); 
    if (sSortField.equals("")) { 
      //sSortField = "RZCZSJ";
      sSortField = "RZID";
      iSortOrder = SzProperties.I_SortOrder_DESC;
    } 
    int iCurrentPage = 1;
    try {
        iCurrentPage =  Integer.parseInt(sPage);
    }catch(Exception e) {
    }
	/* //2012-01-05
		if (isBarManager_SESSION) {
			
		} else {
			//只能看到自己部门的
			sCond = " LYBMID=" + iBMID_SESSION;
		}  */
    
	//分页
    Iterator iter = logControl.getArrayList(sCond, sSortField, iSortOrder, iCurrentPage, 50, sSearch).iterator();

    SzPageInfo pageInfo = logControl.getPageInfo();
    int iPageCount = pageInfo.getPageCount();
    int iRecordCount = pageInfo.getRecordCount();
    iCurrentPage = pageInfo.getCurrentPage();
    int i = 0;

    //-----------------2013-06-07
    //获得天数
    int iLogDeleteDays = SzProperties.logDeleteDays();
    
    String strLogDeleteDays = SzDateHelp.dateToString(SzDateHelp.dayBefore(SzDateHelp.getDate(),iLogDeleteDays));
    
%>
<!-----上面的工具栏------>
<%@ include file="/share/title.jsp"%>
<table width="100%">
  <form name="formBar" method="post">
  <input type="hidden" name="page" value="<%=sPage%>">
  <input type="hidden" name="type" value="<%=sType%>">
  <input type="hidden" name="txtSearch" value="<%=sSearch%>">
  <input type="hidden" name="txtSortField" value="<%=sSortField%>"> 
  <input type="hidden" name="txtSortOrder" value="<%=iSortOrder%>"> 
  <input type="hidden" name="sCond" value="<%=sCond%>">   
  <tr>
    <td>
      <%//=SzPageHelp.addButtonSubmit()%>
      <%
        if (isSystemManager_SESSION) {
          out.println(SzPageHelp.deleteButton());			         
        }
      %>
        		<input type="button" class="btnClassLong" value="导出EXCEL" OnClick="javascript:FormSubmit(formBar, 'control.jsp?OPERATOR=export&table=SZXT_XTRZ');">
     	 操作时间<input type="text" name="RZBG"  value="<%=sBG%>" class="txtClassSearch2" ><%=SzPageHelp.calendarSelect2("formBar.RZBG")%>
     	 -<input type="text" name="RZED"  value="<%=sED%>" class="txtClassSearch2" ><%=SzPageHelp.calendarSelect2("formBar.RZED")%>
       操作人员<input type="text" name="txtSearchName" class="txtClassSearch" value="<%=sSearchName%>" OnDblClick="javascript:OpenWin32('../../','','formBar.txtSearchName');">
		  操作内容<input type="text" name="txtSearchTitle" class="txtClassSearch" value="<%=sSearchTitle%>">      
     	 
     	<!-- <input type=""/> -->
     	<input type="button"  class="btnClass" value="查询"  OnClick="javascript:FormSubmit(formBar,'index.jsp');">
    </td>
  </tr>
  </form>
</table>

<!-----信息列表----->
<table width="99%" 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%>">
  <input type="hidden" name="type" value="<%=sType%>">
  <input type="hidden" name="txtSortField" value="<%=sSortField%>"> 
  <input type="hidden" name="txtSortOrder" value="<%=iSortOrder%>"> 

	<input type="hidden" name="RZBG" value="<%=sBG%>">
	<input type="hidden" name="RZED" value="<%=sED%>">
  <input type="hidden" name="txtSearchName" value="<%=sSearchName%>">
  <input type="hidden" name="txtSearchTitle" value="<%=sSearchTitle%>"> 
  <tr class="trClassTitle">
    <td width="5"><input type="checkbox" name="chkCheckAll" OnClick="javascript:CheckAll(formList, chkCheckAll, 'chkId');"></td>
    <td><%=SzPageHelp.sortTitle("操作人员", "RZCZRY", sSortField, iSortOrder)%></td>
    <td><%=SzPageHelp.sortTitle("操作时间", "RZCZSJ", sSortField, iSortOrder)%></td>
    <td><%=SzPageHelp.sortTitle("操作内容", "RZNR", sSortField, iSortOrder)%></td>
    <td><%=SzPageHelp.sortTitle("操作类型", "RZLX", sSortField, iSortOrder)%></td>
    <td><%=SzPageHelp.sortTitle("IP地址", "RZIP", sSortField, iSortOrder)%></td>
    <td width="40">操作</td>
  </tr>
<%
    String disabled = "";
		String sContent = "";
    while (iter != null && iter.hasNext()) {
    	logControlInfo  = (SzLogControlInfo )iter.next();
      i++;
      disabled = "";
			if (iLogDeleteDays >0 && strLogDeleteDays.compareTo(logControlInfo.getRZCZSJ()) <0 ) {
          disabled = "disabled";
			}
	    sContent = SzConvert.toPageString(logControlInfo.getRZNR());
	    //sContent = sContent.replaceAll("<br>","\n");	    	
%>
  <tr>
    <td width="10" title="<%=i%>"><input type="checkbox" name="chkId" id="chkId" value="<%=logControlInfo.getRZID()%>" <%=disabled%> ></td>
    <td width="100"><%=logControlInfo.getRZCZRY()%>&nbsp;</td>
    <td width="130"><%=logControlInfo.getRZCZSJ()%>&nbsp;</td>
    <td><%=sContent%>&nbsp;</td>
    <td width="80"><%=logControlInfo.getRZLX()%>&nbsp;</td>
     <td width="100"><%=logControlInfo.getRZIP()%>&nbsp;</td>
    <td width="40">
      <a href="javascript:FormSubmit(formPage,'update.jsp?OPERATOR=detail&type=<%=sType%>&KEY=<%=logControlInfo.getRZID()%>');">&nbsp;详情&nbsp;</a>
     <!--
      <a href="javascript:FormSubmit(formPage,'update.jsp?OPERATOR=update&type=<%=sType%>&KEY=<%=logControlInfo.getRZID()%>');">修改</a>
     --> 
    </td>
  </tr>
<%
    }
    out.println(SzPageHelp.outIndexTableTr(i, SzProperties.I_PageSize, 7));
%>

  </form>
</table>

<!-----下面的工具栏------>
<table width="100%">
  <form name="formPage" method="post">
  <input type="hidden" name="type" value="<%=sType%>">
  <input type="hidden" name="txtSearchName" value="<%=sSearchName%>">
  <input type="hidden" name="txtSortField" value="<%=sSortField%>"> 
  <input type="hidden" name="txtSortOrder" value="<%=iSortOrder%>">
	<input type="hidden" name="RZBG" value="<%=sBG%>">
	<input type="hidden" name="RZED" value="<%=sED%>">  
  <input type="hidden" name="txtSearchName" value="<%=sSearchName%>">
  <input type="hidden" name="txtSearchTitle" value="<%=sSearchTitle%>">    
  <tr>
    <td align="right">
      <%@ include file="/share/page/page_include.jsp"%>
    </td>
  </tr>
  </form>
</table>

<!-----这里包含要提交的内容--->
<form name="formHidden" method="post">
  <input type="hidden" name="type" value="<%=sType%>">
  <input type="hidden" name="page" value="<%=iCurrentPage%>">
  <input type="hidden" name="txtSearch" value="<%=sSearch%>">
  <input type="hidden" name="txtSortField" value="<%=sSortField%>"> 
  <input type="hidden" name="txtSortOrder" value="<%=iSortOrder%>">
	<input type="hidden" name="RZBG" value="<%=sBG%>">
	<input type="hidden" name="RZED" value="<%=sED%>">  
  <input type="hidden" name="txtSearchName" value="<%=sSearchName%>">
  <input type="hidden" name="txtSearchTitle" value="<%=sSearchTitle%>">    
</form>
<script language="javascript" src="../../share/js/commonTool.js"></script>
<%
    out.println(SzPageHelp.calendarFrame2());
%>
