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

📄 change_role.asp

📁 OFFICE办公自动化
💻 ASP
字号:
<%@ Language=VBScript.Encode %>
<%
	Response.Expires=0
	Response.Buffer=true
%>
<!--#include file="../inc/Secure.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/Const.asp"-->
<%'call checkqx("0602,3401")%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../css/main.css">
<title>人员调动和分配</title>
<SCRIPT LANGUAGE=javascript>
<!--

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

//-->
</SCRIPT>
<SCRIPT LANGUAGE=javascript FOR=window EVENT=onload>
<!--
 window_onload()
//-->
</SCRIPT>
<script Language="JavaScript">

function InsertItem(ObjID, Location)
{
  len=document.form1.elements[ObjID].length;
  for (counter=len; counter>Location; counter--)
  {
    Value = document.form1.elements[ObjID].options[counter-1].value;
    Text2Insert  = document.form1.elements[ObjID].options[counter-1].text;
    document.form1.elements[ObjID].options[counter] = new Option(Text2Insert, Value);
  }
}
function GetLocation(ObjID, Value)
{
  total=document.form1.elements[ObjID].length;
  for (pp=0; pp<total; pp++)
    if (document.form1.elements[ObjID].options[pp].text == "---"+Value+"---")
    { return (pp);
      break;
    }
  return (-1);
}

function GetObjID(ObjName)
{
  for (var ObjID=0; ObjID < window.form1.elements.length; ObjID++)
    if ( window.form1.elements[ObjID].name == ObjName )
    {  return(ObjID);
      break;
    }
  return(-1);
}

function AddItem(ObjName, DesName, CatName)
{
  //GET OBJECT ID AND DESTINATION OBJECT
  ObjID    = GetObjID(ObjName);
  DesObjID = GetObjID(DesName);
//  window.alert(document.form1.elements[DesObjID].length);
  k=0;
  i = document.form1.elements[ObjID].options.length;
  if (i==0)
    return;
  maxselected=0
  for (h=0; h<i; h++)
    if (document.form1.elements[ObjID].options[h].selected ) {
        k=k+1;
        maxselected=h+1;
        }
  if (maxselected>=i)
    maxselected=0;
  if (CatName != "")
    CatObjID = GetObjID(CatName);
  else
    CatObjID = 0;
  if ( ObjID != -1 && DesObjID != -1 && CatObjID != -1 )
  { jj = document.form1.elements[CatObjID].selectedIndex;
    if ( CatName != "")
    { CatValue = document.form1.elements[CatObjID].options[jj].text;
      CatCode  = document.form1.elements[CatObjID].options[jj].value;
    }
    else
      CatValue = "";
    i = document.form1.elements[ObjID].options.length;
    j = document.form1.elements[DesObjID].options.length;
    for (h=0; h<i; h++)
    { if (document.form1.elements[ObjID].options[h].selected )
      {  Code = document.form1.elements[ObjID].options[h].value;
        Text = document.form1.elements[ObjID].options[h].text;
        j = document.form1.elements[DesObjID].options.length;
        if (Text.indexOf('--')!=-1) {
            for (k=j-1; k>=0; k-- ) {
              document.form1.elements[DesObjID].options[k]=null;
            }
            j=0;
        }
        if (Text.substring(0,1)=='-' && Text.substring(1,2)!='-') {
            for (k=j-1; k>=0; k-- ) {
              if (((document.form1.elements[DesObjID].options[k].value).substring(0,2))==(Code.substring(0,2)))
                document.form1.elements[DesObjID].options[k]=null;
            }
            j= document.form1.elements[DesObjID].options.length;
        }
        HasSelected = false;
        for (k=0; k<j; k++ ) {
          if ((document.form1.elements[DesObjID].options[k].text).indexOf('--')!=-1){
              HasSelected = true;
              window.alert('已经包括本选项:'+Text);
              break;
          }else if ((document.form1.elements[DesObjID].options[k].text).indexOf('-')!=-1 && ((document.form1.elements[DesObjID].options[k].value).substring(0,2)==Code.substring(0,2))){
              HasSelected = true;
              window.alert('已经包括本选项:'+Text);
              break;
          }
          if (document.form1.elements[DesObjID].options[k].value == Code)
          {  HasSelected = true;
              break;
          }
        }
        if ( HasSelected == false)
        { if (CatValue !="")
          { Location = GetLocation(DesObjID, CatValue);
            if ( Location == -1 )
            { document.form1.elements[DesObjID].options[j] =  new Option("---"+CatValue+"---",CatCode);
              document.form1.elements[DesObjID].options[j+1] = new Option(Text, Code);
            }//if
            else
            { InsertItem(DesObjID, Location+1);
              document.form1.elements[DesObjID].options[Location+1] = new Option(Text, Code);
            }//else
          }
          else
            document.form1.elements[DesObjID].options[j] = new Option(Text, Code);
        }//if
        document.form1.elements[ObjID].options[h].selected =false;
      }//if
    }//for
    document.form1.elements[ObjID].options[maxselected].selected =true;
  }//if
}//end of function

function DeleteItem(ObjName)
{
  ObjID = GetObjID(ObjName);
  minselected=0;
  if ( ObjID != -1 )
  {
    for (i=window.form1.elements[ObjID].length-1; i>=0; i--)
    {  if (window.form1.elements[ObjID].options[i].selected)
      { // window.alert(i);
          if (minselected==0 || i<minselected)
            minselected=i;
          window.form1.elements[ObjID].options[i] = null;
      }
    }
    i=window.form1.elements[ObjID].length;

    if (i>0)  {
        if (minselected>=i)
          minselected=i-1;
        window.form1.elements[ObjID].options[minselected].selected=true;
        }
  }
}
function DeleteAllItem(ObjName)
{
 	ObjID = GetObjID(ObjName);
	for (m=window.form1.elements[ObjID].length-1;m>=0;m--){
		window.form1.elements[ObjID].options[m]=null;
		}
}
function AddAllItem(ObjName, DesName, CatName)
{
  ObjID    = GetObjID(ObjName);
  DesObjID = GetObjID(DesName);
  for (m=window.form1.elements[DesObjID].length-1;m>=0;m--){
	window.form1.elements[DesObjID].options[m]=null;
	}
  for (m=window.form1.elements[ObjName].length-1;m>=0;m--)
  	{
  	window.form1.elements[DesObjID].options[m]=new Option(window.form1.elements[ObjID].options[m].text,window.form1.elements[ObjID].options[m].value)
  	}
}
		
</script>





</head>
<%
	dim rs,userid,department,sqlstr,roleid,username,LoginName
	userid=request("userid")
	if userid = "" then 
		oconn.close
		set oconn = nothing
%>
	<script language="vbscript">
		msgbox "参数错误,请返回",vbCritical,"错误"
		history.back(0)
	</script>
<%		
	end if	
%>

<%
	set rs=server.CreateObject("adodb.recordset")
	sqlstr="select * from vioauser where id="&userid
	rs.open sqlstr,oconn,1,1
	if not rs.EOF then
		LoginName=rs("LoginName")
		UserName=rs("Name")
		Department=rs("Department")
		DepartmentName=rs("Departmentname")
		Roleid=rs("Roleid")
	end if
	rs.Close 						
%>

<div class="TitleBar"> </div>

<table width="500" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td class="tdBottom"><table width=98% border=0 align=center cellpadding=2 cellspacing=1 class="tab" style="Margin:5px 5px 5px 5px">
        <form method=post name=form1 id=form1 action="">
          <tr class=InputFrameLine> 
            <td colspan="2" class='tdTop2'><img border="0" src="../images/icon_title.gif" align="left">人事调动/职位分配-<%=server.HTMLEncode(UserName)%> 
              [ 
              <%
	if DepartmentName = "" then
		Response.Write "未分配"
	else
		Response.Write DepartmentName
	end if%>
              ]
              <input type=hidden name=infoid value="<%=request("userid")%>"> </td>
          </tr>
          <tr class=InputFrameLine> 
            <td width=92 align=center class='td2'><nobr>希望调动的新部门:</nobr> </td>
            <td width=92 class='td2'> 
              <select id=Sdep name=Sdep style="width:260">
                <option value="0" selected>不分配</option>
                <%Call pOptions("tbioaDepartment","Name",0,Department,"")%>
              </select></td>
          </tr>
          <tr class=InputFrameLine> 
            <td colspan="2" class=tdBottom><table width=100% class=tableframe>
                <tr align=center class=listtitle> 
                  <td class=listcelltitle width="240"> <select id=bm name=bm  style="width:100%" onchange="redirect(this.options.value)">
                      <option value='all' selected>所有职务</option>
                      <%Call pOptions("tbioaDepartment","Name",0,0,"")%>
                    </select> </td>
                  <td class=listcelltitle width="40">&nbsp;</td>
                  <td class=listcelltitle width="240"><nobr>已选职位</nobr></td>
                </tr>
                <tr align=center> 
                  <td> <select name=RoleID size=9 rows=9 style="width: 100%" ondblclick="JavaScript:AddItem('RoleID','SRoleID', '')">
                      <%
						set rs_role=Server.CreateObject("ADODB.RecordSet")
						sql="select tbioaRole.id,tbioaRole.rolename,tbioarole.department,tbioadepartment.name from tbioaRole,tbioadepartment where tbioarole.department=tbioadepartment.id"
						rs_role.open sql,oConn,1,1
						while not rs_role.eof
						%>
                      <option value='<%=rs_role("id")%>'><%=rs_role("name")%>/<%=rs_role("rolename")%></option>
                      <%
						rs_role.MoveNext
						wend
						%>
                    </select> </td>
                  <td valign=center width=40> <span valign=center> 
                    <input  name=insert1 type=button id="insert1" onClick="JavaScript:AddItem('RoleID','SRoleID', '')" value="&gt;" style="font-weight: bold; width: 32" class="button0" onmouseout=className="button0" onmouseover=className="button1">
                    <hr>
                    <input  name=insert type=button  id="insert" onClick="JavaScript:AddAllItem('RoleID','SRoleID', '')" value="&gt;&gt;" style="font-weight: bold; width: 32" class="button0" onmouseout=className="button0" onmouseover=className="button1">
                    <hr>
                    <input name=delall type=button class="button0" id=bsall2 style="font-weight: bold; width: 32" onMouseOver=className="button1" onMouseOut=className="button0" value="&lt;"  onClick="JavaScript:DeleteItem('SRoleID')">
                    <hr>
                    <input type=button value="&lt;&lt;"  name=del onClick="JavaScript:DeleteAllItem('SRoleID')" style="font-weight: bold; width: 32" class="button0" onMouseOut=className="button0" onMouseOver=className="button1">
                    </span> </td>
                  <td class=row> <select id=SRoleID name=SRoleID  size=9 rows=9 style="width: 100%" ondblclick="JavaScript:DeleteItem('SRoleID')">
                      <%
                      if trim(Roleid)<>"" then
			sql="select tbioaRole.id,tbioaRole.rolename,tbioarole.department,tbioadepartment.name from tbioaRole,tbioadepartment where tbioarole.id in (" & Roleid & ") and tbioarole.department=tbioadepartment.id"							
			rs.Open sql,Oconn,1,1
			do while not rs.eof %>
                      		<option value='<%=rs("id")%>'> <%=rs("name")%>/<%=rs("RoleName")%></option>
                      <%
				rs.MoveNext
			loop
			rs.Close
			end if			%>
                    </select> </td>
                </tr>
              </table></td>
          </tr>
          <tr class=InputFrameButtonLine> 
            <td colspan="2" align="center" class="tdBottom"> <input type=hidden name=rolelist value=""> 
			<input type=button class="button0" onmouseout=className="button0" onmouseover=className="button1" value=确定 name="bQD" id="bQD" onclick="re_role()"> 
              <input type=button class="button0" onmouseout=className="button0" onmouseover=className="button1" value=放弃 name="bFQ" id="bFQ" onclick="JavaScript:window.close()"> 
          </tr>
        </form>
      </table></td>
  </tr>
</table>
<script language="JavaScript">
<!--
<%set rs_role=Server.CreateObject("ADODB.RecordSet")
sql="select tbioaRole.id,tbioaRole.rolename,tbioarole.department,tbioadepartment.name from tbioaRole,tbioadepartment where tbioarole.department=tbioadepartment.id"
rs_role.open sql,oconn,1,1
i=0%>
var groups=<%=rs_role.recordcount%>;
var group=new Array(groups);	
<%do while not rs_role.eof%>
	group[<%=i%>]= new Array(3);	
	group[<%=i%>][0]='<%=rs_role("Department")%>';
	group[<%=i%>][1]='<%=rs_role("ID")%>';
	group[<%=i%>][2]='<%=rs_role("Name")%>/<%=rs_role("RoleName")%>';
	<%rs_role.movenext
	i=i+1
loop
rs_role.close
set rs_role=nothing%>

var temp=document.form1.RoleID;
var temp1=document.form1.SRoleID;
function redirect(x)
{
	for (m=temp.options.length-1;m>=0;m--){
		temp.options[m]=null;
		}
	if (x=='all'){
		for (i=0;i<groups;i++)
			temp.options[temp.options.length]=new Option(group[i][2],group[i][1]);
	}
	else
		for (i=0;i<groups;i++)
		{
			if (group[i][0]==x){
				temp.options[temp.options.length]=new Option(group[i][2],group[i][1]);
				}
		}
}
function re_role()
{	
	var str;
	str=form1.Sdep.value+'|';
	str+=form1.infoid.value+'|';
	for (i=0;i<temp1.options.length;i++)
		str+=temp1.options[i].value+',';
	window.returnValue=str;
	window.close();
		
}
//-->
</script>

<%
	set rs = nothing
	oConn.Close
	set oconn = nothing
%>
</BODY>
</html>
 

⌨️ 快捷键说明

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