📄 dept_tree.jsp
字号:
<%@ page language="java" contentType="text/html;charset=GB2312" %>
<%@ page import="hrm.dept.*,java.util.* " %>
<html>
<head>
<%String path=request.getContextPath(); %>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title> </title>
<link href="<%=path %>/css/tree.css" rel="stylesheet" type="text/css">
<script src="<%=path %>/js/tree.js" type="text/javascript"></script>
<script language="JavaScript">
var judge=0;
function expandall(o)
{
if (judge==0)
{
closeAll();
judge=1;
o.src='../images/tree/icon-closeall.gif';
o.alt='全部折叠';
}
else
{
openAll();
judge=0;
o.src='../images/tree/icon-expandall.gif';
o.alt='全部展开';
}
}
</SCRIPT>
<%
//System.out.println("xxxx");
DeptService depts=new DeptService();
//DeptForm deptInfo=new DeptForm();
//ArrayList list=(ArrayList)depts.deptList();
ArrayList list=new ArrayList();
HashMap map=new HashMap();
list=(ArrayList)session.getAttribute("dept_tree");//获取部门信息
map=(HashMap)session.getAttribute("dept_map_tree");//获取部门编号
request.setCharacterEncoding("GBK");
%>
</head >
<body bgcolor="#FFFFFF" text="#000000" >
<table id=control width="196" border="0" cellspacing="0" cellpadding="0" class="borderon" >
<tr>
<td height="20" style="padding-top:3px"> 部门树</td>
<td width="20" align="center" valign="top"><img src="<%=path %>/images/tree/icon-expandall.gif" width="16" height="15" class="button" onClick="expandall(this)" vspace="2" ></td>
</tr>
</table >
<table border=0>
<tr>
<td>
<script language="javascript" type="text/javascript">
// treemenu 的参数意义依次为:资源目录,如"treemenu/image/";树名称;树图标;连接(可不填);目标窗口(可不填,如果连接为空,此项无效)
objTree = new treemenu("","部门信息","<%=path %>/images/tree/parenticon.gif","","");
<%
for(int i=0;i<list.size();i++){
String dept_code=new String(); //部门编号
String dept_name=new String(); //部门名
String f_dept_code=new String(); //父节点的部门编号
int father_code=2; //父节点号
DeptForm dptinfo=(DeptForm)list.get(i);
dept_code=dptinfo.getDeptCode();
f_dept_code=dept_code.substring(0,dept_code.length()-3);
if(dept_code.length()==3){
father_code=1; //根节点下的节点 父节点为1
}else{
father_code=Integer.valueOf(String.valueOf(map.get(f_dept_code))).intValue();//通过父节点的部门编号获取 父节点号
}
dept_name=dptinfo.getDeptName();
%>
add_item(<%=i+2%>,<%=father_code%>,"<%=dept_name%>","<%=path %>/images/tree/folder.gif",
"<%=path %>/images/tree/folder-expanded.gif","<%=path %>/deptGet.do?deptCode=<%=dptinfo.getDeptCode() %>","right");
<%
System.out.println("deptCode is "+dptinfo.getDeptCode()); }
%>
document.write(menu(1));
</script>
</td>
</tr>
</table>
</body>
</html>
<%
session.removeAttribute("dept_tree");
session.removeAttribute("dept_map_tree");
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -