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

📄 selusers.asp

📁 功能齐全的oa系统
💻 ASP
字号:
<%option explicit%>
<%
Response.Expires = -1
Response.AddHeader "Pragma","no-cache"
Response.AddHeader "Cache-Control","no-cache,must-revalidate"
%>
<!-- #include virtual="DataEnvi.asp" -->
<!-- #include virtual="Page.asp" -->

<%
	Dim StrDept,StrName,StrOptions
	Dim StrIDs,IsBinded,ClassID,GroupID
	Dim StartID,EndID,StrWhere,IsSearch
	IsBinded=Trim(Request.QueryString("IsBinded"))'If 1 show the binded users else show unbinded ones
	If IsBinded="" Then
	Response.Write("<script language=javascript>alert('请重新点击选择按钮!');window.Close();</script>")
	Response.End()
	End If
	ClassID=Trim(Request.QueryString("ClassID"))
	If ClassID="" Then
	Response.Write("<script language=javascript>alert('请重新点击选择按钮!');window.Close();</script>")
	Response.End()
	End If
	GroupID=Trim(Request.QueryString("GroupID"))
	If GroupID="" Then
	Response.Write("<script language=javascript>alert('请重新点击选择按钮!');window.Close();</script>")
	Response.End()
	End If
	StrIDs =Trim(Request.QueryString("IDs"))
	' get the search info
If Trim(Request.QueryString("IsSearch"))="" Then%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>用户选择</title>
<style>
<!--
td       { font-size: 12px;}
select       { font-size: 12px; width: 200 }
input        { font-size: 12px; border-style: ridge; border-width: 1 }
-->
</style>
<script language=javascript>
function dosearch(IsBinded,ClassID,GroupID,StrIDs,StartID,EndID,IsSearch){
	var r =window.showModalDialog("<%=Application("RootPath")%>Include/SelUsers.asp?IDs=" + StrIDs +"&IsBinded="+IsBinded+"&ClassID="+ClassID+"&GroupID="+GroupID+"&StartID="+StartID+"&EndID="+EndID+"&IsSearch="+IsSearch+"&R=" + Math.random(),"AccountWin","dialogHeight=300px;dialogWidth=500px;resizable=No;status=0;scrollbars=1");
	if(r!=null){
		window.returnValue=r;
		window.close();
		}
	
}
</script>
</head>
<body topmargin="0" leftmargin="10"   bgcolor="#dedfde">
  <table border="0" cellpadding="0" cellspacing="0" width=98% align=right>
  <Tr><td>&nbsp;</td>
    <td valign="bottom" height="50" align="left"><strong>查询用户:</strong></td>
  </Tr>
    <tr><td>&nbsp;</td><td align="left" >
	<form action="" method="post" name="sch" id="sch">
	用户证号 从<input class=Input name="StartID" id="StartID" style="HEIGHT: 20px; WIDTH: 80px">至<input class="Input" name="EndID" style="HEIGHT: 20px; WIDTH: 80px" >
			<input name="IsBinded" type="hidden" id="v1" value="<%=IsBinded%>"> 
			<input name="ClassID" type="hidden" id="v2"  value="<%=ClassID%>"> 
			<input name="GroupID" type="hidden" id="v3"  value="<%=GroupID%>"> 
			<input name="StrIDs" type="hidden" id="v4"  value="<%=StrIDs%>">
			<input type="button" name="Submit" value="搜索" onClick="if(StartID.value==''){alert('请输入要查询的用户ID号!');StartID.focus();}else dosearch(v1.value,v2.value,v3.value,v4.value,StartID.value,EndID.value,true);" style="color: #000000;height=20;width=50; background-color: #f3f3f3; border-style: solid; border-width: 1" onMouseOver ="this.style.backgroundColor='#FFC864'" onMouseOut ="this.style.backgroundColor='#f3f3f3'">
			<input type="button" name="all" value="全部" onClick="dosearch(v1.value,v2.value,v3.value,v4.value,StartID.value,EndID.value,false);" style="color: #000000;height=20;width=50; background-color: #f3f3f3; border-style: solid; border-width: 1" onMouseOver ="this.style.backgroundColor='#FFC864'" onMouseOut ="this.style.backgroundColor='#f3f3f3'">
	</form></td>
	</tr>
</table>
<%Else
	Dim ObjDB,StrSQL,ObjRS
	IsSearch=Trim(Request.QueryString("IsSearch"))
	StartID=Trim(Request.QueryString("StartID"))
	EndID=Trim(Request.QueryString("EndID"))
		If EndID<>"" Then
		StrWhere=" BETWEEN "&StartID&" AND "&EndID
		Else
		StrWhere=" ="&StartID
		End If
	Set ObjDB = Server.CreateObject("Adodb.Connection")
	OpenDB ObjDB
	If IsBinded=1 Then'select the binded users
		If GroupID="" Then
		Response.Write("<script language=javascript>alert('请重新点击选择按钮!');window.Close();</script>")
		Response.End()
		End If
	StrSQL="Select IndividualID AS ID,IndividualName AS UserName From v_MIS_Client_Binding_Individual Where ClassID="&ClassID&" AND GroupID="&GroupID
		If IsSearch="true" Then
		StrSQL=StrSQL&" And IndividualID "&StrWhere
		End If%>
	<!--Response.Write("<script language=javascript>alert('delete str="&StrSQL&"');</script>")-->
	<%End If
	If IsBinded=0 Then'select the unbinded users
	StrSQL="Select ID,UserName From t_MIS_Client_Individual Where ID Not In (Select IndividualID From v_MIS_Client_Binding_Individual Where ClassID="&ClassID&")"
		If IsSearch="true" Then
		StrSQL=StrSQL&" And ID "&StrWhere
		End If
	End If
	If StrSQL="" Then
	Response.Write("<script language=javascript>alert('数据库操作失败!请重试!');window.Close();</script>")
	End If
	Set ObjRS = ObjDB.Execute(StrSQL)
	While Not ObjRS.Eof
		StrName = StrName & ObjRS("ID") & "," & Chr(34) & ObjRS("UserName") & Chr(34) & ","
		StrOptions=StrOptions&"<option value= "&ObjRS("ID")&">"&ObjRS("UserName")&"</option>"
		ObjRS.MoveNext
	Wend
	If StrName<>"" Then 
	StrName = Left(StrName,Len(StrName)-1) 
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>用户选择</title>
<style>
<!--
td       { font-size: 12px;}
select       { font-size: 12px; width: 200 }
input        { font-size: 12px; border-style: ridge; border-width: 1 }
-->
</style>
<script language=javascript>
var arrAllID = new Array(<%=StrName%>)
var arrSelID = new Array(<%=StrIDs%>)
function AddToSel(ID){
 	for(var i=0;i<arrSelID.length;i++){
		if(arrSelID[i]==ID){
			return;
		}
	}
	arrSelID[arrSelID.length]=ID;
	
}

function DelFromSel(ID){
	for(var i=0;i<arrSelID.length;i++){
		if(arrSelID[i]==ID)delete arrSelID[i];
	}
}
function GetOption(IDs){
	var s=""
	for(var i=0;i<IDs.length;i++){
		if(GetName(IDs[i])!="")
		s += "<option value=" + IDs[i] + ">" + GetName(IDs[i]) + "</option>";
	}
	return s;
}

function GetName(ID){
	for(var i=0;i<arrAllID.length;i+=2){
		if(arrAllID[i]==ID)return arrAllID[i+1]
	}
	return "";
}
function doReWriteSel(){
	var f = document.forms[0];
	var s = "<select name=Sel2 size=16 multiple>";
	s+= GetOption(arrSelID);
	s+= "</select>";
	tdSel2.innerHTML = s ;
}
function doAdd(){
	var f = document.forms[0]
	for(var i=0;i<f.Sel1.length;i++){
		if(f.Sel1[i].selected)AddToSel(f.Sel1[i].value)
	}
	doReWriteSel();
}

function doDel(){
	var f = document.forms[0]
	for(var i=0;i<f.Sel2.length;i++){
		if(f.Sel2[i].selected)DelFromSel(f.Sel2[i].value)
	}
	doReWriteSel();
}

function doEnd(){
	var k1=k2=""
	var f = document.forms[0];
	for(var i=0;i<f.Sel2.length-1;i++){
		k1 += f.Sel2[i].value + ",";
		k2 += f.Sel2[i].text + ",";
	}
	if(f.Sel2.length>0){
		k1 += f.Sel2[i].value;
		k2 += f.Sel2[i].text;
	}
	var k = new Array()
	k[0]=k1;
	k[1]=k2;
	window.returnValue=k;
	window.close();
}
function showlayer(layer){
	layer.style.visibility = 'visible';
	}
function hidelayer(layer){
	layer.style.visibility = 'hidden';
	}
	function dosearch(IsBinded,GroupID,StrIDs,StartID,EndID,IsSearch){
		var r =window.showModalDialog("<%=Application("RootPath")%>Include/SelUsers.asp?IDs=" + StrIDs +"&IsBinded="+IsBinded+"&GroupID="+GroupID+"&StartID="+StartID+"&EndID="+EndID+"&IsSearch="+IsSearch+"&R=" + Math.random(),"AccountWin","dialogHeight=300px;dialogWidth=500px;resizable=No;status=0;scrollbars=1");
		if(r!=null){
			window.returnValue=r;
			window.close();
			}
	
	}
</script>
</head>
<body topmargin="0" leftmargin="10"  onload="doReWriteSel()" bgcolor="#dedfde">
<form method="POST" action="SelUsers.asp" webbot-action="--WEBBOT-SELF--">

  <table border="0" cellpadding="0" cellspacing="0" width=98% align=right>
    <tr>
      <td id=tdSel0>选择<font color="#FF0000"><%If IsBinded<>"1" Then%>未<%End If%>绑定</font>用户 </td>
      <td>&nbsp;</td>
      <td rowspan="2"  id=tdSel2><select size="16" name="Sel2">
  </select></td>
    </tr>
    <tr>
      <td id=tdSel1><select size="15" name="Sel1" multiple><%=StrOptions%>
  </select> </td>
      <td width="80">
        <p align="center">
        <input type="button" value="添加-->" name="B1" onclick="doAdd()">
        <br><br>
        <input type="button" value="<--移除" name="B1" onclick="doDel()">
        </td>
    </tr>
    <tr>
      <td><按ctrl+可以多选></td>
      <td></td>
      <td align=right><input type="button" value="确定" onclick="doEnd()" name="B2"> </td>
    </tr>
  </table>
  <p><br>
  &nbsp; </p>
  <p> </p>
</form>
<%else%>
<html>
<body>
<table width="100%" height="80%">
	<tr >
		<td  valign="middle" align="center">库中没有您要的纪录!
		</td> 
	</tr>
</table>
<table  width="100%">
	<tr >
		<td align="center">
		<input type=button onclick="window.close()" value="关闭窗口" id=button1 name=button1>
		</td>
	</tr>

</table></body></html>
<%End If
End If%>
</body>

</html>

⌨️ 快捷键说明

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