<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.HashMap" %>
<%@ 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.system.SzLevelNumber" %>
<%@ page import="net.sz600.organize.*" %>

<html>
<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 src="../share/js/ftiens4_tree.js"></SCRIPT>
</head>

<body>
<table width=100% border="0" cellpadding=0 cellspacing=0>
  <tr>
    <td align="center" width="33">
    <td width="751" colspan="2" align="center"><p align="left">
      <!--名字，连接，定位的页面，图片---->
      <SCRIPT>
        USETEXTLINKS = 1
        level_0 = gFld("<b>组织结构</b>", "","","images/skin1/menu/asset.gif")
<%
    //读取数据
    SzDepart szDepart = new SzDepart();
    SzDepartInfo departInfo = null;
    String sCond = "";
    Iterator iter = szDepart.getArrayList().iterator();
    int i = 0;
    int j = 0;
    SzUserPost szUserPost = new SzUserPost();
    SzUserPostInfo szUserPostInfo = null;
    Iterator iterUserPost = null;

    //获取员工，部门，职务的hashMap
    SzLogin szLogin = new SzLogin();
    HashMap mapLogin = szLogin.getMainHashMap("1=1");
    HashMap mapDepart = szDepart.getMainHashMap("1=1");
    SzPost szPost = new SzPost();
    HashMap mapPost = szPost.getMainHashMap("1=1");
    String sUserInfo = "";
%>
<%
    String sBMBH = "";
    String sBMBH_SJ = "";
    while (iter != null && iter.hasNext()) {
        departInfo = (SzDepartInfo)iter.next();
        sBMBH = departInfo.getBMBH();
        sBMBH_SJ = SzConvert.toZeroStr(SzLevelNumber.getParentNumber(sBMBH));

        i++;
%>
        level_<%=sBMBH%> = insFld(level_<%=sBMBH_SJ%>, gFld("<b><%=departInfo.getBMMC()%></b>", "","","images/skin1/menu/asset.gif"))
<%
        //取得部门下的员工
        iterUserPost = szUserPost.getArrayList("RZBM=" + departInfo.getBMID()).iterator();
        while (iterUserPost != null && iterUserPost.hasNext()) {
            szUserPostInfo = (SzUserPostInfo)iterUserPost.next();
            //获取姓名、职务名称
            sUserInfo = mapLogin.get(new Integer(szUserPostInfo.getRZDL()))
                      + "[" + mapPost.get(new Integer(szUserPostInfo.getRZZW())) + "]";
            j++;
%>
            level_<%=sBMBH%>0<%=j%> = insFld(level_<%=sBMBH%>, gFld("<%=sUserInfo%>", "","","images/skin1/menu/asset.gif"))
<%
        }
    }
%>
      </SCRIPT>
<SCRIPT>
    initializeDocument();
</SCRIPT>
    </td>
  </tr>
</table>
</body>

