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

📄 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>
<SCRIPT LANGUAGE="javascript">
<!--
function searchuser(userlist,key){
	if (!key) return false
	eval('re=/'+key+'/')
	for (i=userlist.options.selectedIndex+1; i<userlist.options.length; i++){
		if(re.test(userlist.options[i].text)){
		  userlist.options[i].selected=true
		  return false
		}
	}
	for (i=0; i<userlist.options.selectedIndex+1; i++){
		if(re.test(userlist.options[i].text)){
		  userlist.options[i].selected=true
		  return false
		}
	}
}
//-->
</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 onsubmit="return false">
	<tr>
		<td class="tdtop2" colspan="2">
			<img border="0" src="../images/icon_title.gif" align="left">
			选择人员                   
			<span onclick="vbscript:usebm"><input type="radio" value="V1" name="R1" Checked hidefocus=true>按部门选择</span>&nbsp;<span onclick="vbscript:usezw"><input type="radio" value="V1" name="R1" hidefocus=true>按职位选择</span>
		</td>
	</tr>
	<tr class="td2">
		<td align=right nowrap>部门/职位:</td>
		<td width=400>
			<select id=bm name=bm style="display:inline" onchange="vbscript:chgbm" style="width:100%">
				<option value="X" selected>所有部门</option>
		<%
			ssql="select * from tbioaDepartment where ParentID='0' order by id"
			rs.Open ssql,oConn,1,1
			do while not rs.EOF
				Call pOptions("tbioaDepartment","Name",0,Department,"")
				rs.MoveNext
			loop
			rs.Close
		%>
			</select>
			<select id=zw name=zw style="display:none" onchange="vbscript:chgzw"  style="width:100%">
				<option value="X" selected>所有职位</option>
		<%
			ssql="SELECT tbioaRole.*, tbioaDepartment.Name AS departmentname FROM tbioaRole INNER JOIN tbioaDepartment ON tbioaRole.department = tbioaDepartment.ID"
			rs.Open ssql,oConn,1,1
			do while not rs.EOF
				%>
				<option value="<%=rs("id")%>"><%=server.HTMLEncode(rs("departmentname") & "/" & rs("rolename") & "")%></option>
				<%
				rs.MoveNext
			loop
			rs.Close
		%>
			</select>
		</td>
	</tr>
	<tr class="tdbottom">
		<td colspan=2>
			<table width=100%>
				<tr align=center class=listtitle>
					<td class=listcelltitle>可选人员
			<input type="text" name="searchnamedxry" style="width:40%">
			<a href="#" onclick="return searchuser(frmxx.dxry,frmxx.searchnamedxry.value)">
			  <img src="../images/search.gif" border="0" align="absmiddle">查找
			</a>
					</td>
					<td class=listcelltitle>&nbsp;</td>
					<td class=listcelltitle>已选人员
			<input type="text" name="searchnameyxry" style="width:40%">
			<a href="#" onclick="return searchuser(frmxx.yxry,frmxx.searchnameyxry.value)">
			  <img src="../images/search.gif" border="0" align="absmiddle">查找
			</a>
					</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<>0 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
	%>
	<%if stag="zw" then%>
		usezw
	<%else%>
		usebm
	<%end if%>

	sub usebm
		frmxx.R1(0).checked=true
		frmxx.bm.value="X"
		chgbm
		frmxx.bm.style.display="inline"
		frmxx.zw.style.display="none"
	end sub
	sub usezw
		frmxx.R1(1).checked=true
		frmxx.zw.value="X"
		chgzw
		frmxx.zw.style.display="inline"
		frmxx.bm.style.display="none"
	end sub
	sub chgbm
		dim i,e,j,ba
		for i= 0 to frmxx.dxry.options.length-1
			frmxx.dxry.options.remove 0
		next
		for i=1 to ubound(ary,2)
			if frmxx.bm.value=ary(2,i) or frmxx.bm.value="X"	then
				ba=0
				for j=0 to frmxx.yxry.length-1
					if ary(0,i)=frmxx.yxry.item(j).value then
						ba=1
						exit for
					end if
				next
				if ba=0 then
					Set e = Document.createElement("OPTION")
					e.value=ary(0,i)
					e.text=ary(1,i)
					frmxx.dxry.options.add e
				end if
			end if
		next
	end sub
	sub chgzw
		dim i,e,j,ba
		for i= 0 to frmxx.dxry.options.length-1
			frmxx.dxry.options.remove 0
		next
		for i=1 to ubound(ary,2)
			if instr("," & ary(3,i) & ",", "," & frmxx.zw.value & ",")>0 or frmxx.zw.value="X"	then
				ba=0
				for j=0 to frmxx.yxry.length-1
					if ary(0,i)=frmxx.yxry.item(j).value then
						ba=1
						exit for
					end if
				next
				if ba=0 then
					Set e = Document.createElement("OPTION")
					e.value=ary(0,i)
					e.text=ary(1,i)
					frmxx.dxry.options.add e
				end if
			end if
		next
	end sub

	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 + -