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

📄 deptmt_back.asp

📁 武汉软件园人力资源管理系统完整源代码,希望大家能够多多交流.
💻 ASP
字号:
<%@ Language=VBScript Transaction="Required"%>
<!--#include file="../Include/conn.asp"-->
<!--#include file="../Include/Syscheck.asp"-->
<%
call checkin_sys(session("UsersId"),session("PerId"),1)
Response.CharSet="GB2312"
dim op,dept_hi,r_name,rtxt,cid,post_hi
op=Request.QueryString("op")
dim res
set res = server.CreateObject("adodb.recordset")

if op="1" then
    r_name=Request.QueryString("hi")
    on error resume next
    res.Open "select dept_name from dept where dept_name='"&r_name&"' and dept_state='启用'",conn,3,3
    if err.number<>0 then
        Response.Write "输入非法字符!"
    else
        if res.BOF<>true or res.EOF<>true then
            Response.Write "此部门名已存在!"
        end if
    end if
elseif op="1_1" then
    r_name=Request.QueryString("hi")
    dept_id=Request.QueryString("id")
    'Response.Write r_name&dept_id
    'Response.End
    on error resume next
    res.Open "select dept_name from dept where dept_name='"&r_name&"' and dept_state='启用' and dept_meanid!='"&dept_id&"'",conn,3,3
    if err.number<>0 then
        Response.Write "输入非法字符!"
    else
		if res.BOF<>true or res.EOF<>true then
		    Response.Write "此部门名已存在!"
		end if
    end if
elseif op="2" then                         '部门创建时
	dept_hi=Request.QueryString("hi")
	
	'Response.Write dept_hi
	'Response.End
	if dept_hi="" then
	    Response.Write "请选择部门等级!"
	else
	
	res.open "select dept_meanid,dept_name from dept where dept_level="&(dept_hi-1)&" and dept_state='启用'",conn,3,3
	
	if res.EOF=true and res.BOF=true then
	    Response.Write "无相匹配的上级部门可选!"
	else
	%>
	<select name="high">
	<%
	    while not res.eof
            response.Write"<option value="&res.fields(0).value&">"&res.fields(1).value
	        res.movenext
	    wend
	end if
	
	%>
	</select>
	<%
	end if
elseif op="3" then
    dept_hi=Request.QueryString("hi")
    rtxt=Request.QueryString("rt")
    res.Open "select dept_id from personnel where dept_id="&dept_hi,conn,3,3          '查询是否有员工绑定
    if res.BOF=true and res.EOF=true then
        on error resume next
        conn.execute "update dept set dept_state='撤消',dept_delereason='"&rtxt&"' where dept_id="&dept_hi        '更改状态
        conn.execute "delete deptpost where dept_id="&dept_hi                          '删除与部门的绑定
        if err.number<>0 then
            ObjectContext.setAbort             '事务回滚
            Response.Write "撤消失败!"
        else
            ObjectContext.setComplete          '事务提交
            Response.Write "已撤消!"
        end if
    else
        Response.Write "该部门有员工绑定,撤消前请先更新员工表!"
    end if    

elseif op="4" then                           '部门调整时
	dept_hi=Request.QueryString("hi")
	cid=Request.QueryString("cid")
	'Response.Write cid
	'Response.End
	if dept_hi="" then
	    Response.Write "请选择部门等级!"
	else
	
	res.open "select dept_meanid,dept_name from dept where dept_level="&(dept_hi-1)&" and dept_state='启用' and dept_id<>"&cid,conn,3,3
	
	if res.EOF=true and res.BOF=true then
	    Response.Write "无相匹配的上级部门可选!"
	else
	%>
	<select name="high">
	<%
	    while not res.eof
            response.Write"<option value="&res.fields(0).value&">"&res.fields(1).value
	        res.movenext
	    wend
	%>
	</select>
	<%
	end if
	
	end if
	
elseif op="5" then
    post_id=Request.QueryString("hi")
    dept_hi=Request.QueryString("dept")
    'Response.Write post_id&","&dept_hi
    'Response.End
    res.Open "select personnel_id from personnel where dept_id="&dept_hi&" and post_id="&post_id&" and personnel_state!='离职'",conn,1,1
    if res.BOF=true and res.EOF=true then
        Response.Write ""
    else
        Response.Write "已有人员分配!"
    end if
end if

if res.State=1 then
    res.close
end if
conn.close
set res = nothing
set conn=nothing
%>

⌨️ 快捷键说明

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