📄 deptmt.asp
字号:
<b id="r_name"></b>
</td>
</tr>
<tr align="center">
<td class="td1"><span class="STYLE1">部门功能描述:</span></td>
<td colspan="5"><div align="left">
<input type="text" size="86" name="function" dataType="CEN" msg="功能描述输入无效字符!" onblur="testlen(this,50)">
</div></td>
</tr>
<tr align="center">
<td class="td1"><span class="STYLE1">部门等级:</span></td>
<td colspan="2"><div align="left">
<select name="level" onchange="ajaxfuct(document.new_dept.level.value,'2')" dataType="Require" msg="未选择部门等级">
<option selected="selected" value="">请选择</option>
<%
res.open "select * from deptlevel",conn,3,3 '下拉框
while not res.eof=true
if res.Fields(0).Value<>"1" then
response.Write"<option value="&res.fields(0).value&">"&res.fields(1).value
end if
res.movenext
wend
%>
</select>
</div></td>
<td class="td1"><span class="STYLE1">上级部门:</span></td>
<td colspan="2" id="dept_l"> </td>
</tr>
<tr align="center">
<td class="td1"><span class="STYLE1">部门备注:</span></td>
<td colspan="3">
<div align="left">
<input type="text" size="50" name="ps" dataType="CEN" msg="部门备注输入无效字符" onblur="testlen(this,50)">
</div>
</td>
<td class="td1"><span class="STYLE1">办公地点:</span></td>
<td><div align="left">
<input type="text" size="15" name="station" dataType="CEN" msg="办公地点无效字符" onblur="testlen(this,10)">
</div></td>
</tr>
</table>
<br>
<table width="87%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="5"><div align="center">
<%
if e_id="" then
%>
<input name="提交" type="submit" value="创建" class="button">
<%
end if
%>
<input name="" type="reset" value="重填" class="button">
</div></td>
</tr>
<tr>
<td width="70%" height="58"><a href="deptmt.asp"><div align="right"><br>
</div>
</a></td>
<td width="30%"><div align="center">
<a href="deptmt.asp">返回</a>
<%
if e_id<>"" then
%>
<script language="Javascript">
function co_dept()
{
var num;
num=confirm("确认要创建的信息的吗?");
//alert("aaa")
if (num==true)
{
if(Validator.Validate(document.new_dept,2)==true)
{
document.new_dept.submit();
}
}
}
</script>
<input type="hidden" value="<%=e_id%>" name="id">
<a href="#" onClick="co_dept();">下一步</a>
<%
end if
%>
</div></td>
</tr>
</table>
</form>
<%
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''' 创建新部门及部门合并处理 ''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
elseif op="6" then '接收新创建的部门信息,并写入到数据库中
dname = request.form("name")
dfunction = request.form("function")
dhigh = request.form("high")
dlevel = request.form("level")
dps = request.form("ps")
dstation = request.form("station")
ddate1 = cstr(year(date))&"-"&cstr(month(date))&"-"&cstr(day(date))
e_id=request.form("id") '部门合并时用到
on error resume next
conn.execute "insert into dept(Dept_name,Dept_fctdescription,High_dept,Dept_state,Dept_level,Dept_remark,Dept_station,Dept_createdate) values ('"&dname&"','"&dfunction&"','"&dhigh&"','启用','"&dlevel&"','"&dps&"','"&dstation&"','"&ddate1&"')"
if e_id="" then '''''''''创建部门处理
if err.number = 0 then
Response.Write "<center>部门创建成功!</center>"
else
response.Write "<center>部门创建失败!</center>"
end if
Response.AddHeader "refresh","2;url=deptmt.asp"
else ''''''''''部门合并处理
dim array_id,t_id,sqlstr
array_id=split(e_id,",")
res.Open "select dept_id from dept where dept_name='"&dname&"' and dept_state='启用'",conn,1,1
t_id=res.Fields(0).Value
res.close
for each i in array_id
conn.execute "update dept set dept_state='撤销' where dept_id="&trim(i) '将原部门设撤消
conn.execute "delete deptpost where dept_id="&trim(i) '解除与岗位的绑定
conn.execute "update personnel set dept_id="&t_id&" where dept_id="&trim(i) '修改原部门中员工的所属部门
next
if err.number=0 then
dim new_id
res.Open "select top 1 dept_id from dept order by dept_id desc",conn,1,1 '查询新部门的id
new_id=res("dept_id")
Response.Write new_id&"<br>"
res.close
sqlstr="select post_id,count(post_id) as '人数' from personnel where dept_id="&new_id&" and personnel_state!='离职' group by post_id" '在员工表中统计新部门中各岗位人数
res.Open sqlstr,conn,1,1
do while not res.EOF=true
conn.execute "insert deptpost(dept_id,post_id,post_mannumber) values("&new_id&","&res("post_id")&","&res("人数")&")" '根据统计的各岗位人数在新部门岗位分配表中分配
res.MoveNext
loop
res.Close
end if
if err.number = 0 then
ObjectContext.setComplete '事务提交
Response.Write "<li>部门已合并!岗位已依据原有人员分配!</li>"
else
ObjectContext.setAbort '事务回滚
response.Write "<center>部门合并失败!</center>"
end if
Response.AddHeader "refresh","2;url=deptmt.asp"
end if
%>
<%
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''编辑/修改部门信息操作
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
elseif op="2" then '编辑/修改部门信息
e_id = request.QueryString("id")
res.open "select a.Dept_meanid,a.Dept_name,a.Dept_man,a.Dept_fctdescription,a.High_dept,a.Dept_state,b.dlevel_name,a.Dept_remark,a.Dept_station,a.Dept_createdate,a.Dept_deledate,a.Dept_adjustdate,a.Dept_adjustreason from dept as a inner join deptlevel as b on a.dept_level = b.dept_level where a.dept_id='"&e_id&"'",conn,3,3
%>
<script type="text/javascript" src="../Include/ajaxrequest.js"></script>
<script type="text/javascript">
function ajaxfuct(num,theid,op)
{
// 创建AJAX对象
var ajaxobj=new AJAXRequest();
ajaxobj.method="post";
// 设置回调函数,输出响应内容
ajaxobj.callback=function(xmlobj)
{
if (op=="1_1")
{
document.getElementById("r_name").innerHTML=xmlobj.responseText;
if (xmlobj.responseText=="此部门名已存在!")
{
alert("请重新输入!")
document.re_dept.name.focus();
}
}
}
// 发送请求
ajaxobj.send("deptmt_back.asp?hi="+num+"&id="+theid+"&op="+op);
}
//-->
</SCRIPT>
<img src="..\images\sub01_05.jpg" align="absmiddle" ><font color="#183978" size="3" face="华文仿宋">当前部门ID:<%=res(0)%></font>
<a href="deptmt.asp">返回</a>
<form action="deptmt.asp?op=7&id=<%=e_id%>" method="post" name="re_dept" onSubmit="return Validator.Validate(this,2)">
<table width="87%" border="1" align="center" cellpadding="10" cellspacing="0" class="table1">
<tr align="center">
<td class="td1"><span class="STYLE1">部门名称:</span></td>
<td align="left" colspan="3">
<input name="name" type="text" value="<%=res(1)%>" size="16" dataType="CEN" msg="部门名称输入非法字符" onkeyup="testlen(this,10,0)" onblur="ajaxfuct(this.value,'<%=res(0)%>','1_1')">
<b id="r_name"></b>
</td>
<td class="td1"><span class="STYLE1">部门负责人:</span></td>
<td><div align="left">
<%
dim res3
set res3=server.CreateObject("ADODB.recordset")
res3.open "select personnel_name from personnel where Personnel_deptman=1 and personnel_state!='离职' and dept_id="&e_id,conn,3,3
if res3.EOF=true and res3.BOF=true then
Response.Write "请在员工档案中设置!"
else
while not res3.eof=true
Response.Write res3.Fields(0).Value&";"
res3.movenext
wend
end if
res3.Close
set res3=nothing
%>
</div></td>
</tr>
<tr align="center">
<td class="td1"><span class="STYLE1">部门功能描述:</span></td>
<td colspan="5"><div align="left"><input name="function" type="text" value="<%=res(3)%>" size="86" dataType="CEN" msg="功能描述输入非法字符" onblur="testlen(this,50)">
</div></td>
</tr>
<tr align="center">
<td width="13.3%" class="td1"><span class="STYLE1">上级部门:</span></td>
<td width="20%">
<div align="center"><%=res(4)%>
</div></td>
<td width="13.3%" class="td1"><span class="STYLE1">部门状态:</span></td>
<td width="20%"><span class="STYLE1"><%=res(5)%></span></td>
<td width="13.3%" class="td1"><span class="STYLE1">部门等级:</span></td>
<td width="20%"><%=res(6)%></td>
</tr>
<tr>
<td align="center" class="td1"><a href="deptmt.asp?op=8&id=<%=e_id%>">岗位配置</a></td>
<td colspan="5">
<%
dim res1
set res1=server.CreateObject("ADODB.recordset")
res1.open "select b.post_name,a.post_mannumber from deptpost as a inner join post as b on a.post_id=b.post_id where a.dept_id="&e_id,conn,3,3
if res1.EOF=true and res1.BOF=true then
Response.Write "未设置"
else
do while not res1.EOF
Response.Write res1.Fields(0).Value&":"&res1.Fields(1).Value&"人;"
res1.MoveNext
loop
end if
res1.Close
set res1=nothing
%>
</td>
</tr>
<tr align="center">
<td class="td1"><span class="STYLE1">部门备注:</span></td>
<td colspan="3"><div align="left">
<input name="ps" type="text" value="<%=res(7)%>" size="50" dataType="CEN" msg="部门备注输入无效字符" onblur="testlen(this,50)">
</div></td>
<td class="td1"><span class="STYLE1">办公地点:</span></td>
<td><div align="left">
<input name="station" type="text" value="<%=res(8)%>" size="15" dataType="CEN" msg="办公地点输入无效字符" onblur="testlen(this,10)">
</div></td>
</tr>
<tr align="center">
<td class="td1"><span class="STYLE1">创建日期:</span></td>
<td><div align="left"><%=res(9)%></div></td>
<td class="td1"><span class="STYLE1">撤销日期:</span></td>
<td><div align="left"> <%=res(10)%></div></td>
<td class="td1"><span class="STYLE1">调整时间:</span></td>
<td><div align="left"> <%=res(11)%></div></td>
</tr>
<tr align="center">
<td class="td1"><span class="STYLE1">调整理由:</span></td>
<td colspan="5"><div align="left"> <%=res(12)%></div></td>
</tr>
</table>
<br>
<table width="87%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="5"><div align="center">
<input name="提交" type="submit" value="确定" class="button">
<input name="" type="reset" value="重填" class="button">
</div></td>
</tr>
</table>
</form>
<%
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''' 部门信息修改处理
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
elseif op="7" then '接收修改后的部门信息,更新到数据库中
dname = request.form("name")
'dman = request.form("man")
dfunction = request.form("function")
'dstate = request.form("state")
dps = request.form("ps")
dstation=Request.Form("station")
e_id = request.QueryString("id")
'Response.Write dname&dman&dfunction&dlevel&dps&dstation&e_id
'Response.End
sqlstr="update dept set Dept_name='"&dname&"',Dept_fctdescription='"&dfunction&"',Dept_remark='"&dps&"',Dept_station='"&dstation&"' where dept_id ='"&e_id&"'"
'response.Write sqlstr
'response.End()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -