<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.basicdata.*" %>
<%@ page import="net.sz600.database.SzPageInfo" %>
<%@ page import="net.sz600.system.SzProperties" %>
<%@ page import="net.sz600.system.SzPageHelp" %>
<%@ page import="net.sz600.organize.*" %>
<%@ 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">
<script language="javascript" src="../../share/js/commonTool.js"></script>
</head>
<%
    //获取提交的参数
    String sPage = SzConvert.toZeroStr(request.getParameter("page"));
    String sSearch = SzConvert.strWriteData(request.getParameter("txtSearch"));
    String selectBM = SzConvert.toZeroStr(request.getParameter("selectBM"));
    String selectZW = SzConvert.toZeroStr(request.getParameter("selectZW"));
    
    //读取数据
    SzLogin login = new SzLogin();
    SzLoginInfo loginInfo = null;
    String sCond = "DLGSID=" + szCOMPANY_SESSION;
    if (!selectBM.equals("") && !selectBM.equals("0")) {
        sCond += " AND DLBM =" + selectBM + "";
    }
    if (!selectZW.equals("") && !selectZW.equals("0")) {
        sCond += " AND DLZW =" + selectZW + "";
    }    

    String sSortField = SzConvert.toSpaceStr(request.getParameter("txtSortField")); 
    int iSortOrder    = Integer.parseInt(SzConvert.toZeroStr(request.getParameter("txtSortOrder"))); 
    if (sSortField.equals("")) { 
    	sSortField = "YGBH";
    	iSortOrder = SzProperties.I_SortOrder_DESC;
    } 
    
    int iCurrentPage = 1;
    try {
        iCurrentPage =  Integer.parseInt(sPage);
    }catch(Exception e) {
    }
    Iterator iter = login.getArrayList_2(sCond, sSortField, iSortOrder, iCurrentPage, sSearch).iterator();

    SzPageInfo pageInfo = login.getPageInfo();
    int iPageCount = pageInfo.getPageCount();
    int iRecordCount = pageInfo.getRecordCount();
    iCurrentPage = pageInfo.getCurrentPage();
    int i = 0;
%>
<!-----上面的工具栏------>
<%@ include file="/share/title.jsp" %>
<table width="100%">
  <form name="formBar" method="post">
  <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="sCond" value="<%=sCond%>">  
  <tr>
    <td>
    <% if (isSystemManager_SESSION) { %>
      <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:FormSubmitConfirm(formList, 'control.jsp?OPERATOR=delete','确定要删除？');">
      <input type="button" class="btnClass" value="导入用户" OnClick="javascript:ExcelImportWin('LoginInfoImport');">
			<input type="button" class="btnClassLong" value="导出EXCEL" OnClick="javascript:FormSubmit(formBar, 'control.jsp?OPERATOR=export&table=SZXT_DL');">      
    <% } %>
		 选择部门：<%=SzPageHelp.idSelectTreeSubmit("SZXT_BM","BMID","BMMC","BMBH","selectBM",Integer.parseInt(selectBM), "txtClass200", "BMGSID=" + szCOMPANY_SESSION)%>      
      选择职务：<%=SzPageHelp.idSelectSubmit("SZXT_ZW","ZWID","ZWMC","selectZW",Integer.parseInt(selectZW), "txtClass200", "ZWGSID=" + szCOMPANY_SESSION)%>      
    </td>
  </tr>
  </form>
</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%>">
  <input type="hidden" name="txtSortField" value="<%=sSortField%>"> 
  <input type="hidden" name="txtSortOrder" value="<%=iSortOrder%>">  
  <input type="hidden" name="sCond" value="<%=sCond%>">   
  <tr class="trClassTitle">
    <td width="5"><input type="checkbox" name="chkCheckAll" OnClick="javascript:CheckAll(formList, chkCheckAll, 'chkId');"></td>
    <td><%=SzPageHelp.sortTitle("登陆帐号", "DLZH", sSortField, iSortOrder)%></td>
    <td><%=SzPageHelp.sortTitle("用户名称", "DLXM", sSortField, iSortOrder)%></td>
    <td><%=SzPageHelp.sortTitle("部门名称", "DLBM", sSortField, iSortOrder)%></td>
    <td><%=SzPageHelp.sortTitle("职务名称", "DLZW", sSortField, iSortOrder)%></td>
    <td><%=SzPageHelp.sortTitle("员工编号", "YGBH", sSortField, iSortOrder)%></td>
    <td><%=SzPageHelp.sortTitle("手机号码", "YGSJ", sSortField, iSortOrder)%></td>
    <td><%=SzPageHelp.sortTitle("电子邮箱", "YGYX", sSortField, iSortOrder)%></td>
    <td><%=SzPageHelp.sortTitle("状态", "DLBZ", sSortField, iSortOrder)%></td>
    <% if (ReadOaConfig.getAlert_button().indexOf("weixin") >=0) { %>
    <td width="40"><%=SzPageHelp.sortTitle("微信", "DLOPENID", sSortField, iSortOrder)%></td>
    <% } %>
    <td><%=SzPageHelp.sortTitle("默认权限", "DLQX", sSortField, iSortOrder)%></td>
    <td width="40">操作</td>
  </tr>
<%
    boolean flag = false;
    while (iter != null && iter.hasNext()) {
        loginInfo = (SzLoginInfo)iter.next();
        i++;
        flag = false;
        if (loginInfo.getDLZH().toUpperCase().indexOf("ADMIN") >=0) {
        	flag = true;
        }
        
%>
  <tr  onMouseOver="javascript:this.className='trMouseOver'" onMouseOut="javascript:this.className='trMouseOut'">
    <td width="5">
    <% if (flag) { %>
      <input type="checkbox" disabled>
    <% } else { %>
      <input type="checkbox" name="chkId" id="chkId" value="<%=loginInfo.getDLID()%>">
    <% } %>
    </td>
    <td><%=loginInfo.getDLZH()%>&nbsp;</td>
    <td><%=loginInfo.getDLXM()%>&nbsp;</td>
    <td><%=SzUserHelp.getDepartName(loginInfo.getDLBM())%>&nbsp;</td>
    <td><%=SzUserHelp.getPostName(loginInfo.getDLZW())%>&nbsp;</td>
    <td><%=loginInfo.getYGBH()%>&nbsp;</td>
    <td><%=loginInfo.getYGSJ()%>&nbsp;</td>
    <td><%=loginInfo.getYGYX()%>&nbsp;</td>
    <td align="center"><%=login.getDLBZ_name(loginInfo.getDLBZ())%>&nbsp;</td>
    <% if (ReadOaConfig.getAlert_button().indexOf("weixin") >=0) { %>
    <td width="30" align="center">
    <%
    	if (!loginInfo.getDLOPENID().equals("")) {
    		out.print("<img src='../../images/share2/weixin20.gif' border='0'>");
    	} else {
    		out.print("&nbsp;");
    	}
    %>    
    </td>
    <% } %>
    <td align="center"><%=login.getDLQX_name(loginInfo.getDLQX())%>&nbsp;</td>
    <td><% if (isSystemManager_SESSION) { %><a href="javascript:FormSubmit(formPage,'update.jsp?OPERATOR=update&KEY=<%=loginInfo.getDLID()%>');">修改</a><% } %></td>
  </tr>
<%
    }
    if (ReadOaConfig.getAlert_button().indexOf("weixin") >=0) {
    	out.println(SzPageHelp.outIndexTableTr(i, SzProperties.I_PageSize, 12));
    } else {
    	out.println(SzPageHelp.outIndexTableTr(i, SzProperties.I_PageSize, 11));
    }
%>

  </form>
</table>

<!-----下面的工具栏------>
<table width="100%">
  <form name="formPage" method="post">
  <input type="hidden" name="txtSortField" value="<%=sSortField%>"> 
  <input type="hidden" name="txtSortOrder" value="<%=iSortOrder%>">   
  <input type="hidden" name="selectBM" value="<%=selectBM%>">   
  <input type="hidden" name="selectZW" value="<%=selectZW%>">   
  <tr>
    <td align="right">
      <%@ include file="/share/page/page_include.jsp"%>
    </td>
  </tr>
  </form>
</table>

<!-----这里包含要提交的内容--->
<form name="formHidden" method="post">
  <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%>"> 
</form>
<script language="javascript">
	/*
  //第一个表示对象，form，第二个表示字符串
  function FormSubmit(oFormName, vUrl) {
  	if (confirm("确定要删除?")) {
    	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;
      }
    }
  }
  */
  function ExcelImportWin(vModule) {
		var url ="../../share/page/excel_import_win.jsp?module=" + vModule;
		//2014-12
		//window.showModalDialog(url,window,"status=no;dialogWidth=580px;dialogHeight=350px");
		window.open(url,"","left=100,top=100,scrollbars=yes,resizable=yes,status=yes,width=580,height=350");		
  }  
</script>
