  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14247
- 金币
- 2414
- 威望
- 1647
- 贡献
- 1362
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
; y8 f/ ~# w: ^* G6 t c pageencoding="gb2312"
9 R# K) p7 V- g( i5 B% Z' D6 S I%>
! A( D3 \. t3 T/ s- y1 w<style>1 ]+ {1 A' ?6 r3 Y2 P
.f9{ font-size:9pt; }
4 W6 Z7 `3 B8 F$ K" A: X.bgc{ background-color:#aecaf9; color: #0033ff }# v( i% E% I: v0 d
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
( s; ^0 u- y, |( T+ j7 E border-bottom: solid 1px #4e7dc1;+ e! e/ C9 x+ ^! b
border-left: solid 1px #aecaf9;
$ S7 e$ F! K+ [ border-right: solid 1px #5679bd;7 c: W( z K( Z+ b: A# t
padding:1px;& S7 c* K8 l( Y( V
margin:0px;}
! {" D0 }4 ]6 i# Y% F</style>
$ Q/ v7 Q* I! ?$ L% f<script language="javascript">. d; [, c- r5 j# l4 z# x
<!--3 G9 q, A! d5 S7 B; j! @1 }
function rv()9 T2 |. M# n- v% R
{
) k+ i7 u8 c# x var val="";5 S5 N8 a: r' q+ J6 L
for(i=0;i<combo_box.list2.length;i++){
0 c, w4 x# v$ ] val+=","+combo_box.list2.value;
7 E7 c, Q7 B; n. {3 d }- C/ I& ]! R8 k6 t t
if(val.charat(0)==","){
, Y- R+ P, Z9 A# B: \8 I* q" O val=val.substr(1,val.length);
: b$ i0 {- [8 Q/ @: a, w# O4 ^ }
* F- T& P) N! e* I! S opener.form1.frecname.value=val;
& F5 ~1 O2 {4 w6 {5 G self.close();0 B6 N# a) H% R& `3 ?% P
}+ @/ y1 q; Y& N# I
//-->
# | k: t( l5 C! m- m- @# X</script>
5 h% R0 i: D) J7 _<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">6 I& ?% h( F. E% J; j7 y
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
( t& H$ |9 o4 @% W<%
p( W5 O$ \; s. q4 s cdatasource ds=new cdatasource(); //数据联结bean实例6 }' ]; T) o" B2 u1 p, E/ L
java.sql.connection conn=ds.getconnection();+ ]" k; j2 ]% g& F
java.sql.statement stmt=null;; O: D$ b2 q+ u5 d# [# l7 ~* \
java.sql.resultset rs=null;
- k4 L8 C0 L6 B3 _8 B* W cdatacheck dc=new cdatacheck();
1 Z4 j. \+ |! G0 q% m8 e%>
+ l. {+ J% u3 K/ l4 i0 F<% c: c: I7 O5 [3 `: L) ?: p r
string sqlu="select t1.fno, t1.fname, t2.fname as fdept from tuser t1 left outer join tdept t2 on t1.fdept = t2.fno order by t2.fname";
5 S; w9 I7 K/ r% a& Bstmt=conn.createstatement();. L! T W$ I* M# F
rs=stmt.executequery(sqlu);
! N3 j4 ~: `8 [) d9 v5 K%>
1 R) X9 M, b. T6 ^<script language='javascript'>/ L9 _- h6 e& q
arr = new array();
9 Q; C( C/ C8 ~) n* o<% int temp=0;
1 q) H8 K" D! W2 y8 {. cwhile(rs.next())2 k5 p9 w/ P) u( u$ J F, W# i y
{
$ I1 h: v* g* }% Z# A5 F* f%>, J' _+ U- s9 i! @9 ^
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");3 `2 T1 _) a6 ]7 d1 e3 v6 y
<%+ @# D" }4 a* Z
temp = temp + 1;3 r5 d$ M% X: j2 y! t* p1 @* Q: R
}
( t+ M% S0 I9 z2 v%>
! O2 C. a+ h. Atemp=<%=temp%>;
8 W i& I* |& F/ Qfunction changelocation(id){
" _% w% u: p) V+ Y+ Mdocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
& ?# j8 \( m/ b T! u& A% Svar i = 0;
N' d6 K# w& X) `7 G9 c% _document.combo_box.city.options[0]=new option('-------',''); " G+ B8 e1 l5 o8 G
for(i=0;i<temp;i++){
. }2 n8 _) I& K" s6 r. F) Qif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
, R/ U2 E, Q/ j( g6 c5 idocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); $ A/ U; R( y& Y) \4 `, a
} $ S/ {$ F. K, u* W2 w( r+ e" K+ ]
}
% t2 X4 w& k% \5 d( K}
# q9 h6 a/ P' S) \- m/ e& t</script>
* {' ]6 L7 w' ^, w5 I- a& [$ u# @% H7 `- F
<form name="combo_box">
6 r7 R y1 j8 Z8 b7 g<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">) b, _8 L! l/ T: j
<tr height="24">- @. Q7 q, j6 m$ c" `
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
; {# c8 ^4 C! ]3 Y( H8 {2 q <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
1 D5 G$ U/ i+ S5 F8 n9 | <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>4 q1 ^& V$ e' t5 [1 {+ C" q; E. m
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
# K% @2 P2 ~5 @, o: p4 [. r( _ </tr>& R8 F% i- P% R; u
<tr>
' C2 s) U3 M0 M3 y9 k <td>
! [. o2 p q$ i <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
- ?& {4 l: ^; K/ K7 i9 G* b. E <option value="0">请选择部门 ---></option>1 W, d& L K* z5 _+ n4 R% m
<%
& a7 F! v" f3 g- I* l: o string sqld="select * from tdept";
! d+ p. o$ M# }' H3 Pstmt=conn.createstatement();
3 m s6 W' y' }% k) z G- Crs=stmt.executequery(sqld);
9 m0 n# r4 F" h: D$ t+ b8 g2 Rwhile(rs.next())
$ M# P2 t* f8 @: I( t7 S{ V9 o- g i0 v6 L
%>
% G# x6 }2 F% q* G7 X' C5 ] <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>5 o8 Y3 V6 w' L( o
<%
6 ~" ^. g3 c; |6 J5 c}
( i6 w ?" M% |( i; u' S3 j%>
7 M4 e) l) A1 X# E </select>
3 n7 n( q& l* C F0 x" g</td>7 t! v! s' |) J2 j
<td>
7 C% f" F- j: z# f <select multiple id=city style="width:150;height:200" class="bgc">
/ m- K8 Q' o z9 I: W </select>
. o4 V1 U, F6 F; [6 [6 r9 o</td>
7 e) x$ V! |. Y! \ <td nowrap align="center" class="bgc">) W# \1 m+ A& W* b# l
<input type="button" value="<<" class="buttons">
" _: I$ i1 ]- D3 m& S" [ <input type="button" value=">>" class="buttons">
$ \( _$ U- m) D6 P8 f9 I</td>1 ?; L7 n: I9 s
<td> h# J* C# f: p) G& n8 f* ~
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">8 \/ \, I; ]6 y+ q
</select>. ], w0 t. }( h! `
</td>
$ X j. P0 q0 O </tr>
$ U3 a4 [3 D! e5 D0 [/ m' o8 n <tr class="bgc">
. ~4 Q2 g2 E" O0 U" z, {6 f6 | <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
( w5 t y; c1 m. [ </tr>
: J+ b" r- t8 y7 ^* r</table>
' c. `- N" S( S/ l: f' X</form>7 |- G6 v M3 M% E+ f% @
<script language="javascript">' d4 }' L" ~0 w! k
//人名移动
" W7 A3 f- o1 q _function move(fbox, tbox) {! L* U; H( y9 q5 J0 x8 U
var arrfbox = new array();
% }: w( Z2 z+ p0 z& d j0 Lvar arrtbox = new array();' o" a( |# e, a" ~! F
var arrlookup = new array();
# I* E* Y& S+ }& [6 b" o( L0 T3 `var i;
% d) _, A! U5 H+ m" D5 c: V }for (i = 0; i < tbox.options.length; i++) {4 U6 q8 f1 S# \) Q, L& P6 o
arrlookup[tbox.options.text] = tbox.options.value;" K8 @6 v2 M% ~* L+ R( J1 S6 q# _& p
arrtbox = tbox.options.text;
/ z- _+ c5 Z& @}$ K- b- v7 y! r0 r3 X" K2 w
var flength = 0;
$ H7 x) G# V( v) k7 S, ovar tlength = arrtbox.length;
# _- G# A& f9 h, b9 N4 b. ]for(i = 0; i < fbox.options.length; i++) {2 ?+ I- W/ R l% }& j# P+ I
arrlookup[fbox.options.text] = fbox.options.value;7 b' D- `* S5 q
if (fbox.options.selected && fbox.options.value != "") {
+ v; G: w8 X$ C% x: D9 `5 z* ~$ u, Zarrtbox[tlength] = fbox.options.text;4 W6 I4 k; h7 @; W, n
tlength++;+ a" k; y0 e' u
}3 q4 {7 ?) b3 x0 A2 x. t0 C6 C' L8 |
else {
" U% _1 q/ i( f5 m2 o( Sarrfbox[flength] = fbox.options.text;& U8 [4 a7 w g) U2 c
flength++;
2 [/ ?0 o/ ]6 N$ T }, I* r/ n s. n7 Q
}
2 D U t, j( e) e0 }arrfbox.sort();1 N. t& o8 m, y, ?' b4 p& M
arrtbox.sort();2 _% r+ t7 O. y' g
& @9 a! l' G, v& } T" tfbox.length = 0;
) M' y" a+ [; L0 G6 {6 Z6 q/ Htbox.length = 0;1 g7 N$ `6 q/ N4 P, P
var c;
1 N8 r0 R- F7 F3 w, T& B/ Yfor(c = 0; c < arrfbox.length; c++) {
& E5 R0 J7 i$ ~6 l k$ L+ p& Jvar no = new option();, Z) B+ Z k/ u/ j' }
no.value = arrlookup[arrfbox[c]];* K; b- ]( g2 Y; K' M5 I% C8 x( B' D
no.text = arrfbox[c];' [+ P0 a, i$ M' @% V. N3 W
fbox[c] = no;
1 W0 e# }) S& D- B' }: u}
( G J$ w8 Z4 x- Mfor(c = 0; c < arrtbox.length; c++) {: n, X7 F2 ]& [2 ?
var no = new option();& d: ?/ X( i! O
no.value = arrlookup[arrtbox[c]];
! ^" `* x8 u9 v- h7 t7 H w9 g- f2 x: hno.text = arrtbox[c];; z* w U! N, q( t$ H- B. U' k
tbox[c] = no;' I9 u7 p3 l" M- J5 v; S" M
}
; \% o* i) L7 f1 I}
. `" m. ] s2 m; \/ K3 g</script>
1 H' X- i4 G$ D& d8 V</body>6 ~: d4 J- i; [. H5 M. S" h4 C. P
|
|