對應文件有
: machmap.jsp,dtree,js,op.js,dtree.css
等
.
?
數據庫設計
sys04_Machine
表
?
machmap.jsp
代碼如下
<%@
page
contentType
=
"text/html; charset=gb2312"
language
=
"java"
%>
<%@
page
import
=
"java.sql.*"
%>
<%@
page
import
=
"pub.*"
%>
<
html
>
<
head
>
<
title
>
#.Admin
</
title
>
<
meta
http-equiv
=
"Content-Type"
content
=
"text/html; charset=gb2312"
>
<
link
href
=
"../css/putong.css"
type
=
"text/css"
rel
=
"stylesheet"
>
<
link
rel
=
"StyleSheet"
href
=
"../css/dtree.css"
type
=
"text/css"
>
<
script
type
=
"text/javascript"
src
=
"../js/dtree.js"
></
script
>
<
script
type
=
"text/javascript"
src
=
"../js/op.js"
></
script
>
</
head
>
?
<
body
bgcolor
=
"ffffff"
text
=
"#000000"
>
<
table
cellSpacing
=
"0"
cellPadding
=
"0"
width
=
"100%"
bgColor
=
"#bfcae6"
border
=
"0"
background
=
"../images/subtitle.gif"
>
???
<
tr
>
??????
<
td
width
=
"100%"
height
=
"26"
><
FONT
face
=
"
宋體
"
>
?????????
<
DIV
align
=
"left"
><
FONT
face
=
"
宋體
"
color
=
"#ffffff"
>
當前位置:基礎信息
>>
組織機構圖
????????
</
FONT
>
??????????
</
DIV
>
??????????
</
FONT
>
??????
</
td
>
???
</
tr
>
?
</
table
>
?
<
br
>
<
a
href
=
"javascript: d.openAll();"
>
展開
</
a
>
|
<
a
href
=
"javascript: d.closeAll();"
>
折疊
</
a
>
<
script
type
=
"text/javascript"
>
<!--
???
d =
new
dTree(
'd'
);
??? d.config.folderLinks=
true
;
???
//id, pid, name, url, title, target, icon, iconOpen, open?????
???
d.add(0,-1,
'PICC
組織機構圖
'
,
''
,
'easydone'
,
'_blank'
);
<%
??? //String Sql = "select * from tree";
??? String Sql =
"select * from sys04_Machine"
;
??? String strID=
""
;
??? String strPid=
""
;
??? String strName=
""
;
??? String strCropID=
""
;
??? String strUrl=
""
;
??? String strTarget=
""
;
???
Conn conn=
new
Conn
();
??? DataTable dt =
new
DataTable();
??? //Connection conn = null;
??? try
{
?????? conn.execSql(Sql);
?????? if
(conn.querySql(Sql,dt)){
?????????? if
(dt.getRowCount()>0){
????????????? for
(
int
i=0;i<dt.getRowCount();i++){??
????????????????? //strID = dt.getItemForName(i,"id");
????????????????? strID = dt.getItemForName(i,
"MachID"
);
????????????????? System.out.println(
"strID:"
+strID);
????????????????? //strPid = dt.getItemForName(i,"pid");
????????????????? strPid = dt.getItemForName(i,
"ParentID"
);
????????????????? System.out.println(
"strPid:"
+strPid);
????????????????? strCropID = dt.getItemForName(i,
"Cropid"
);
????????????????? System.out.println(
"strCropID:"
+strCropID);
??????????
?????? //strName = dt.getItemForName(i,"name");
????????????????? strName = dt.getItemForName(i,
"MachName"
);
????????????????? System.out.println(
"strName:"
+strName);
????????????????? strUrl = dt.getItemForName(i,
"url"
);
????????????????? System.out.println(
"strUrl:"
+strUrl);
????????????????? strTarget = dt.getItemForName(i,
"target"
);
????????????????? System.out.println(
"strTarget:"
+strTarget);
????????????????? if
(strCropID.equals(
"0"
)==
false
&& strPid.equals(
"0"
)==
true
){
%>
?
??????????????
?????????????
??? d.add(
<%=
strID
%>
,
<%=
strCropID
%>
,
'
<%=
strName
%>
'
,
'
<%=
strUrl
%>
'
,
'
<%=
strName
%>
'
,
'
<%=
strTarget
%>
'
);??
????????????????????
<%
????????????????? }
????????????????? else
{
%>
?????????????
?? d.add(
<%=
strID
%>
,
<%=
strPid
%>
,
'
<%=
strName
%>
'
,
'
<%=
strUrl
%>
'
,
'
<%=
strName
%>
'
,
'
<%=
strTarget
%>
'
);??????????
<%
????????????????? }??
????????????? }
?????????? }
?????? }
??? }
??? catch
(Exception ex){
?????? out.println(ex.toString());
??? }
%>
??? document.write(d);
//-->
</
script
>
</
body
>
</
html
>