<!--------------
功能：把部门、用户任职、登陆帐号放在三个数组里。
    //部门数组
    departArray_JS = new Array();
    departCount_JS = 0;

    //职务数组
    postArray_JS = new Array();
    postCount_JS = 0;

    //用户任职
    userPostArray_JS = new Array();
    userPostCount_JS = 0;

    //这个数组单独显示登陆的用户
    loginArray_JS = new Array();
    loginCount_JS = 0;

  //当选择DepartSelecting的时候，改变LoginSelecting的用户
  function SelectDepart() {
  }

  //将全体员工放进LoginSelecting
  function ShowAllLogin() {
  }
-------------------------------------->
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.Collection" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Map" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.system.SzLevelNumber" %>
<%@ page import="net.sz600.organize.*" %>
<%
    //2010-04-02修改，获取本人所管理的所有部门ID
    String strManageDepartID = "";    
    if (isBarManager_SESSION) {
	type = "";
    }
    if (type.equals("manage")) {
        SzUserHelp szUserHelp = new SzUserHelp(); 
	strManageDepartID = "," + szUserHelp.getManageDepartID(iDLID_SESSION) + ",";
    }
    String type_JS = "";
    //读取部门，需要按照编号排序，用arrayList
    SzUserHelp szUserHelp_JS = new SzUserHelp();
  
    Collection collDepart_JS = szUserHelp_JS.getDepartStaticList(szCOMPANY_SESSION);
    Iterator iterDepart_JS = null;
    if (collDepart_JS != null) {
        iterDepart_JS = collDepart_JS.iterator();
    }
    SzDepartInfo szDepartInfo_JS = new SzDepartInfo();

    //读取职务，按序号排序，用arrayList
    Collection collPost_JS = szUserHelp_JS.getPostStaticList();
    Iterator iterPost_JS = null;
    if (collPost_JS != null) {
        iterPost_JS = collPost_JS.iterator();
    }
    SzPostInfo szPostInfo_JS = new SzPostInfo();


    //取得员工，需要根据部门ID获取部门下的员工，所以用HashMap
    Map mapUser_JS = SzUserHelp.getUserStaticMap();  //以部门为主健

    ArrayList arrayList_JS = null;
    Iterator iterUser_JS = null;
    SzUserHelpInfo szUserHelpInfo_JS = null;

    /////判断是否需要限制
    String str_DLID_limit_JS = "0";
    if (type_JS.equals("same")) {
        str_DLID_limit_JS = szUserHelp_JS.getJuniorLoginInSameDepart(szLoginInfo_SESSION.getDLID());
    } else if (type_JS.equals("tree")) {
        str_DLID_limit_JS = szUserHelp_JS.getJuniorLoginInTreeDepart(szLoginInfo_SESSION.getDLID());
    }

    String sUserInfo_JS = "";
    boolean flag_JS = true;

    int iBMID_JS = 0;
    String sBMMC_JS = "";
    String sBMMC_TEMP_JS = "";

%>
<!----------将数据读进JS数组中----------->
<script language="JavaScript">
    //部门数组
    var departCount_JS;
    departArray_JS = new Array();
    departCount_JS = 0;
    //职务数组
    var postCount_JS;
    postArray_JS = new Array();
    postCount_JS = 0;

    var  userPostCount_JS;
    userPostArray_JS = new Array();
    userPostCount_JS = 0;
<%
    while (flag_JS) {
        if (iterDepart_JS != null && iterDepart_JS.hasNext()) {
            szDepartInfo_JS = (SzDepartInfo)iterDepart_JS.next();
            iBMID_JS = szDepartInfo_JS.getBMID();

            if (type.equals("manage")) {
		if (strManageDepartID.indexOf("," + iBMID_JS + ",") == -1) {
		    continue;
		}
	    }	


            sBMMC_TEMP_JS = szDepartInfo_JS.getBMMC();
            sBMMC_JS = SzLevelNumber.getLevelSpace(szDepartInfo_JS.getBMBH()) + szDepartInfo_JS.getBMMC();
%>
            //部门数组
            departArray_JS[departCount_JS] = new Array("<%=iBMID_JS%>","<%=sBMMC_TEMP_JS%>", "<%=szDepartInfo_JS.getBMBH()%>");
            departCount_JS ++;
<%
        } else {
            flag_JS = false;
            iBMID_JS = 0;
            sBMMC_TEMP_JS = "";
        }
        //读取部门下的用户
        //根据部门ID读取下面的员工
//        arrayList_JS = (ArrayList)mapUser_JS.get(new Integer(iBMID_JS));
	arrayList_JS = (ArrayList)mapUser_JS.get(new String(szCOMPANY_SESSION + "-" + iBMID_JS));
        if (arrayList_JS == null) {
           continue;
        }
        iterUser_JS = arrayList_JS.iterator();
        while (iterUser_JS != null && iterUser_JS.hasNext()) {
            szUserHelpInfo_JS = (SzUserHelpInfo)iterUser_JS.next();
            sUserInfo_JS = szUserHelpInfo_JS.getUserInfo();
%>
            userPostArray_JS[userPostCount_JS] = new Array("<%=iBMID_JS%>","<%=szUserHelpInfo_JS.getDLID()%>","<%=sUserInfo_JS%>", "<%=sBMMC_TEMP_JS%>","<%=szUserHelpInfo_JS.getDLXM()%>","<%=szUserHelpInfo_JS.getYGSJ()%>");
            userPostCount_JS++;
<%
        }
    }

    if (collPost_JS != null) {
        iterPost_JS = collPost_JS.iterator();
    }

    while (iterPost_JS != null && iterPost_JS.hasNext()) {
        szPostInfo_JS = (SzPostInfo)iterPost_JS.next();
%>
        //职务数组
        postArray_JS[postCount_JS] = new Array("<%=szPostInfo_JS.getZWID()%>","<%=szPostInfo_JS.getZWMC()%>");
        postCount_JS ++;
<%        
    }

%>
  //选择部门
  function SelectDepart() {
    //获取选择的部门
    var vBMID = 0;
    vBMID = formSelect.DepartSelecting.value;
    //将部门下的员工放进LoginSelecting
    formSelect.LoginSelecting.length = 0;
    //========显示部门的全体人员========
    if (vBMID > "0") {
      //如果选择了部门，或者选择了没有部门的
      for (var i=0; i<userPostCount_JS; i++) {
        //如果是同一个部门的，就放进去
        //因为员工是按照部门排序的，所以这里可以加一个变量，如果已经加完同一部门的，就跳出循环。
        if (userPostArray_JS[i][0] == vBMID) {
          formSelect.LoginSelecting.options[formSelect.LoginSelecting.length]
          = new Option(userPostArray_JS[i][2], userPostArray_JS[i][1]);
        }
      } //for
    } //if else
  }

  //将全体员工放进LoginSelecting
  function ShowAllLogin() {
    formSelect.LoginSelecting.length = 0;
    for (var i=0; i<userPostCount_JS; i++) {
      formSelect.LoginSelecting.options[formSelect.LoginSelecting.length]
      = new Option(userPostArray_JS[i][2], userPostArray_JS[i][1]);
    }
  }
</script>

<!--------------选择部门、用户公用页面，把信息读进js数组-------->