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

📄 download_selectuser.asp

📁 OFFICE办公自动化
💻 ASP
字号:
<%
'功能:批量选择员工
%>
<!--#include file="../inc/Secure.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/Const.asp"-->
<%
response.expires=false
'response.buffer=false
'------------------------------------------------设置参数
LoginID=trim(session("LoginID")) : if LoginID="" then LoginID=0 '当前用户ID
'------------------------------------------------
'------------------------------------------------取记录
'取用户信息 (返回rs_user对象)
'
set rs_user=Server.CreateObject("ADODB.RecordSet")
sql="select * from vioaUser where ID="&LoginID
rs_user.open sql,oConn,1,1
'------------------------------------------------
'取最高部门信息 (返回rs_center对象)
'
set rs_center=Server.CreateObject("ADODB.RecordSet")
sql="select * from tbioaDepartment where ParentID=0"
rs_center.open sql,oConn,1,1
'------------------------------------------------
%>

<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../css/main.css" type=text/css>
<title>选择访问者</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
window.returnValue = ""
function move(fbox,tbox,movemod) {
	for(var i=0; i<fbox.options.length; i++) {
		if((fbox.options[i].selected || movemod) && fbox.options[i].value != "") {
			var no = new Option();
			no.value = fbox.options[i].value;
			no.text = fbox.options[i].text;
			tbox.options[tbox.options.length] = no;
			fbox.options[i].value = "";
			fbox.options[i].text = "";
		}
	}
	BumpUp(fbox);
}
function BumpUp(box)  {
	for(var i=0; i<box.options.length; i++) {
		if(box.options[i].value == "")  {
			for(var j=i; j<box.options.length-1; j++)  {
				box.options[j].value = box.options[j+1].value;
				box.options[j].text = box.options[j+1].text;
			}
			var ln = i;
			break;
		}
	}
	if(ln < box.options.length)  {
		box.options.length -= 1;
		BumpUp(box);
	}
}
function restr(rbox,tbox,str)  {
	if(tbox.options.length){
		rbox.value = tbox.options[0].value;
		for(var i=1; i<tbox.options.length; i++) {
			rbox.value = rbox.value+str+tbox.options[i].value;
		}
	}else rbox.value = ""
}
// End -->
</script>
</HEAD>

<body topmargin="0" leftmargin="0">
<center>

<form name="eventfrm" method="POST" action="">
<table width="100%" height="100%" border="0" bgcolor=menu>
<tr>
<td colspan="3">
选择部门:
<select name="department" size=1 onChange="redirect(this.options.selectedIndex)" class="input" style="WIDTH:150">
<%
dim departments
departments=rs_center("id")
response.write "<option value='"&rs_center("id")&"'>"& Heads & rs_center("Name")&"</option>"
Function ListDepartment(ParentID,Heads)
set rs_department=Server.CreateObject("ADODB.RecordSet")
sql="select * from tbioaDepartment where ParentID="& ParentID &" order by ID"
rs_department.open sql,oConn,1,1
while not rs_department.EOF '循环
	departments=departments&","&rs_department("ID")
	response.write "<option value='"&rs_department("ID")&"'>"& Heads & Server.HTMLEncode(rs_department("Name"))&"</option>"
	Call ListDepartment(rs_department("ID"),Heads&"·")
rs_department.MoveNext: wend
rs_department.close
End Function
Call ListDepartment(rs_center("id"),"·")
%>
</select>  
<input type="hidden" name="rst" value="" size="41">
<input type="button" value="确定" onclick="restr(this.form.rst,this.form.list2,','); window.returnValue = this.form.rst.value; window.close();" name="B4" class="button0" onmouseout=className="button0" onmouseover=className="button1"> 
<input type="reset" value="取消" onclick="window.close()" class="button0" onmouseout=className="button0" onmouseover=className="button1">
</td>
</tr>
<tr>
<td>可选员工:<br>
<select multiple size="9" name="list1" style="width: 150">
<%
set rs_member=Server.CreateObject("ADODB.RECORDSET")
rs_member.Open "select * from tbioaUser where Department='"& rs_center("id") &"'",oconn
while not rs_member.EOF
	response.write("<option value='"&rs_member("ID")&"'> "&Server.HTMLEncode(rs_member("Name"))&" </option>")
	rs_member.MoveNext
wend
rs_member.close
%>
</select>
</td>
<td><br>
<input type="button" value=">>" onclick="move(this.form.list1,this.form.list2,1)" name="B0" style="font-weight: bold; width: 32" class="button0" onmouseout=className="button0" onmouseover=className="button1"><hr>
<input type="button" value=">" onclick="move(this.form.list1,this.form.list2,0)" name="B1" style="font-weight: bold; width: 32" class="button0" onmouseout=className="button0" onmouseover=className="button1"><hr>
<input type="button" value="<" onclick="move(this.form.list2,this.form.list1,0)" name="B2" style="font-weight: bold; width: 32" class="button0" onmouseout=className="button0" onmouseover=className="button1"><hr>
<input type="button" value="<<" onclick="move(this.form.list2,this.form.list1,1)" name="B3" style="font-weight: bold; width: 32" class="button0" onmouseout=className="button0" onmouseover=className="button1">
</td>
<td>已选员工:<br><select multiple size="9" name="list2" style="width: 150"></select></td>
</tr>
</table>
</form>

<script language="JavaScript">
<!--
var groups=document.eventfrm.department.options.length
var group=new Array(groups)
for (i=0; i<groups; i++) group[i]=new Array()
<%
departmentlist=Split(departments,",")
for i=0 to ubound(departmentlist)
	call GetMember(i,departmentlist(i),"")
next
%>

var temp=document.eventfrm.list1
function redirect(x)
{
	for (m=temp.options.length-1;m>=0;m--)
	temp.options[m]=null
	for (i=0;i<group[x].length;i++)
	{
		temp.options[i]=new Option(group[x][i].text,group[x][i].value)
	}
}

//-->
</script>

</center>
</body>
</html>

<%
rs_center.close
rs_user.close
%> 

⌨️ 快捷键说明

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