⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 selectusers.asp

📁 OFFICE办公自动化
💻 ASP
字号:
<%
'功能:批量选择员工
'作者:展亮
'2003-12-1 18:16
%>
<!--#include file="../inc/Secure.asp"-->
<!--#include file="../inc/Conn.asp"-->
<!--#include file="../inc/Const.asp"-->
<%
	Response.Expires=0
	Response.Buffer=true
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../css/main.css">
<title>选择人员</title>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--

function window_onload() {
	window.returnValue = '';
}

//-->
</SCRIPT>
<SCRIPT LANGUAGE=javascript FOR=window EVENT=onload>
<!--
 window_onload()
//-->
</SCRIPT>
</head>
<%
	dim rs
	set rs=server.CreateObject("adodb.recordset")
	dim ary()
	redim ary(3,0)
	dim syxrylb,sbxrylb
	sbxrylb = Request("bxrylb")&""	'不需要在这里选择的人员列表	
	syxrylb=Request.QueryString("yxrylb")
	syxrylb=trim(syxrylb)
	stag=Request.QueryString("tag")
%>
<body class="tdbottom">
<table align="center" width="490">
  <tr>
    <td>
      <table width="100%" border=0 align=center cellpadding=2 cellspacing=1 class="tab">
	<form method=post name=frmxx id=frmxx>
	<tr>
		<td class="tdtop2" colspan="2">
			<img border="0" src="../images/icon_title.gif" align="left">
			选择本部门人员                   
		</td>
	</tr>

	<tr class="tdbottom">
		<td colspan=2>
			<table width=100%>
				<tr align=center class=listtitle>
					<td class=listcelltitle>可选人员</td>
					<td class=listcelltitle>&nbsp;</td>
					<td class=listcelltitle>已选人员</td>
				</tr>
				<tr align=center>
					<td>
						<select id=dxry name=dxry style="display:inline" size=9 rows=9 style="width: 100%" ondblclick="vbscript:dosone">
						<%
							ssql="select * from tbioaUser where department="&Session("DepID")&" order by id asc"							
							rs.Open ssql,oConn,1,1
							dim i
							redim ary(3,rs.RecordCount)
							for i=1 to rs.RecordCount
								ary(0,i)=rs("id")
								ary(1,i)=rs("name")
								ary(2,i)=rs("department")
								ary(3,i)=rs("roleid")
								if sbxrylb<> "" then
									if instr("," & sbxrylb & ",","," & rs("id") & ",")=0 then
									%>
									<option value=<%=rs("id")%>><%=server.HTMLEncode(rs("name") & "")%></option>
									<%
									end if																
								else
									if instr("," & syxrylb & ",","," & rs("id") & ",")=0 then
									%>
									<option value=<%=rs("id")%>><%=server.HTMLEncode(rs("name") & "")%></option>
									<%
									end if																
								end if	
								rs.MoveNext
							next
							rs.Close
						%>
						</select>
					</td>
					<td valign=center width=40>
						<span valign=center>
							<input type="button" value=">>" onclick="vbscript:dosall" name="B0" style="font-weight: bold; width: 32" class="button0" onmouseout=className="button0" onmouseover=className="button1"><hr>
							<input type="button" value=">" onclick="vbscript:dosone" name="B1" style="font-weight: bold; width: 32" class="button0" onmouseout=className="button0" onmouseover=className="button1"><hr>
							<input type="button" value="<" onclick="vbscript:dodsone" name="B2" style="font-weight: bold; width: 32" class="button0" onmouseout=className="button0" onmouseover=className="button1"><hr>
							<input type="button" value="<<" onclick="vbscript:dosnone" name="B3" style="font-weight: bold; width: 32" class="button0" onmouseout=className="button0" onmouseover=className="button1">
						</span>
					</td>
					<td class=row>
						<select id=yxry name=yxry style="display:inline" size=9 rows=9 style="width: 100%" ondblclick="vbscript:dodsone">
						<%
							if syxrylb<>"" then
								ssql="select id,name from tbioauser where id in (" & syxrylb & ")"
								rs.Open ssql,oConn,1,1
								for i=1 to rs.RecordCount
									%>
									<option value=<%=rs("id")%>><%=server.HTMLEncode(rs("name") & "")%></option>
									<%
									rs.MoveNext
								next
								rs.Close
							end if
						%>
						</select>
					</td>
				</tr>
			</table>
		</td>
	</tr>
      </table>
      <table width=100%>
	<tr>
		<td align="middle" colspan="2">
			<input type=button class="button0" onmouseout=className="button0" onmouseover=className="button1" value=确定 name="bQD" id="bQD" onclick="vbscript:doSave">
			<input type=button class="button0" onmouseout=className="button0" onmouseover=className="button1" value=放弃 name="bFQ" id="bFQ" onclick='vbscript:window.close'>
		</td>
	</tr>
      </table>
    </td>
  </tr>
</table>
<%
	set rrs = nothing
	oConn.Close
	set oConn = nothing
%>
</BODY>
</html>

<script language=vbscript>
<!--
	dim ary()
	redim ary(3,0)
	<%
		Response.Write "redim ary(3," & ubound(ary,2) & ")" & vbcrlf
		for i= 0 to ubound(ary,2)
			Response.Write "ary(0," & i & ")=""" & ary(0,i) & """" & vbcrlf
			Response.Write "ary(1," & i & ")=""" & ary(1,i) & """" & vbcrlf
			Response.Write "ary(2," & i & ")=""" & ary(2,i) & """" & vbcrlf
			Response.Write "ary(3," & i & ")=""" & ary(3,i) & """" & vbcrlf
		next
	%>

	sub dosall
		dim i,j,ba
		for i= 0 to frmxx.dxry.options.length-1
			ba=0
			for j=0 to frmxx.yxry.length-1
				if frmxx.dxry.item(i).value=frmxx.yxry.item(j).value then
					ba=1
					exit for
				end if
			next
			if ba=0 then
				Set e = Document.createElement("OPTION")
				e.value=frmxx.dxry.item(i).value
				e.text=frmxx.dxry.item(i).text
				frmxx.yxry.options.add e
			end if
		next
		for i= 0 to frmxx.dxry.options.length-1
			frmxx.dxry.options.remove 0
		next
	end sub

	sub dosnone
		dim i,j,ba
		for i= 0 to frmxx.yxry.options.length-1
			ba=0
			for j=0 to frmxx.dxry.length-1
				if frmxx.yxry.item(i).value=frmxx.dxry.item(j).value then
					ba=1
					exit for
				end if
			next
			if ba=0 then
				Set e = Document.createElement("OPTION")
				e.value=frmxx.yxry.item(i).value
				e.text=frmxx.yxry.item(i).text
				frmxx.dxry.options.add e
			end if
		next
		for i= 0 to frmxx.yxry.options.length-1
			frmxx.yxry.options.remove 0
		next
	end sub

	sub dodsone
		dim i,j,ba		
		if frmxx.yxry.options.length=0 then exit sub
		if frmxx.yxry.selectedIndex<0 then	exit sub
		ba=0		
		for j=0 to frmxx.dxry.length-1
			if frmxx.yxry.item(frmxx.yxry.selectedIndex).value=frmxx.dxry.item(j).value then
				ba=1
				exit for
			end if
		next
		if ba=0 then
			Set e = Document.createElement("OPTION")
			e.value=frmxx.yxry.item(frmxx.yxry.selectedIndex).value
			e.text=frmxx.yxry.item(frmxx.yxry.selectedIndex).text
			frmxx.dxry.options.add e
		end if
		frmxx.yxry.options.remove frmxx.yxry.selectedIndex
	end sub

	sub dosone
		dim i,j,ba		
		if frmxx.dxry.options.length=0 then exit sub
		if frmxx.dxry.selectedIndex<0 then exit sub
		ba=0
		for j=0 to frmxx.yxry.length-1
			if frmxx.dxry.item(frmxx.dxry.selectedIndex).value=frmxx.yxry.item(j).value then
				ba=1
				exit for
			end if
		next
		if ba=0 then
			Set e = Document.createElement("OPTION")
			e.value=frmxx.dxry.item(frmxx.dxry.selectedIndex).value
			e.text=frmxx.dxry.item(frmxx.dxry.selectedIndex).text
			frmxx.yxry.options.add e
		end if
		frmxx.dxry.options.remove frmxx.dxry.selectedIndex
	end sub

	sub doSave
		dim i
		dim s1,s2
		s1=""
		s2=""
		for i=0 to frmxx.yxry.length-1
			s1=s1 & "," & frmxx.yxry.item(i).value
			s2=s2 & " " & frmxx.yxry.item(i).text
		next
		if s1<>"" then
			s1=mid(s1,2)
			s2=mid(s2,2)
		end if
		window.returnValue = s1 & "_" & s2
		window.close
	end sub
//-->
</script>
 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -