📄 addnew_01.asp
字号:
<% option explicit%>
<!-- #include virtual="include/DataEnvi.asp" -->
<!-- #include virtual="include/MyFunc.asp" -->
<!-- #include virtual="include/Roles.asp"-->
<%
Dim ObjDB,vrs
Dim C
Dim IntID,ObjRS,sql
Set ObjDB = Server.CreateObject("ADODB.Connection")
'判断是否有添加的权限
OpenDB ObjDB
dim AddComID
AddComID=AddNewComID(ObjDB)
ObjDB.close
OpenDBH ObjDB
set vrs=server.CreateObject("Adodb.recordset")
vrs.open "select StaID from v_Hrms_Com_Dep_Sta",ObjDB,1,1
if vrs.eof and vrs.bof then
%>
<script language="JavaScript">
alert("请您与管理员联系!先添加公司、部门、岗位等预备信息!!");
location.href="list.asp";
</script>
<%
response.End()
end if
vrs.close
set vrs=nothing
ObjDB.close
If Request.Form.Count > 0 Then
End If
Sub Main
%>
<%
Dim rs
Set ObjDB = Server.CreateObject("ADODB.Connection")
OpenDBH ObjDB
%>
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%
<!--读取分类字段赋给JS数组-->
dim count
set rs=server.createobject("adodb.recordset")
rs.open "select * from v_Hrms_Com_Dep_Sta ",ObjDB,1,1
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("DepName"))%>","<%= rs("ComID")%>","<%= rs("DepID")%>","<%= rs("StaName")%>","<%= rs("StaID")%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
function changelocation(locationid)
{
document.myform.Department.length = 0;
var locationid=locationid;
var i,j,k;
var Subid;
var DepID;
var StaID;
DepID = "";
StaID = "";
document.myform.Station.length = 0
k=0;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
if (DepID.indexOf(subcat[i][2]) == -1)
{
document.myform.Department.options[document.myform.Department.length] = new Option(subcat[i][0], subcat[i][2]);
k=k+1;
if (k == 1)
{
Subid=subcat[i][2];
}
}
DepID = DepID + "," + subcat[i][2];
}
}
for (j=0;j < onecount; j++)
{
if ((subcat[j][1] == locationid) && (Subid == subcat[j][2]))
{
if (StaID.indexOf(subcat[j][4]) == -1)
{
document.myform.Station.options[document.myform.Station.length] = new Option(subcat[j][3], subcat[j][4]);
}
StaID = StaID + "," + subcat[j][4];
}
}
}
</script>
<script language = "JavaScript">
var onecountDep;
onecountDep=0;
subcatDep = new Array();
<%
<!--读取分类字段赋给JS数组-->
dim countDep
<!-- set rs=server.createobject("adodb.recordset") -->
rs.open "select distinct* from v_Hrms_Dep_Job ",ObjDB,1,1
countDep = 0
do while not rs.eof
%>
subcatDep[<%=countDep%>] = new Array("<%= trim(rs("JobName"))%>","<%= rs("ID")%>","<%= rs("Pos")%>");
<%
countDep = countDep + 1
rs.movenext
loop
rs.close
%>
onecountDep=<%=countDep%>;
function changelocationDep(locationid)
{
document.myform.Station.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecountDep; i++)
{
if (subcatDep[i][1] == locationid)
{
document.myform.Station.options[document.myform.Station.length] = new Option(subcatDep[i][0], subcatDep[i][2]);
}
}
}
</script>
<form action="" onSubmit="return checkpro();" method="post" name=myform>
<table width="100%" cellpadding=3 cellspacing=1 class=Ltable>
<tr class=LHtr>
<td height="32" colspan="4" align="left">新增部门需求 </td>
</tr>
<tr class=Ltr>
<td width="15%" height="28">公司</td>
<td width="35%">
<%
rs.open "select * from t_Hrms_Dep where ParentID=0",ObjDB,1,1
if rs.eof and rs.bof then
call MsgBox("请先添加公司!","Back","None")
response.end
else
%>
<select class="SelectWidth" name="Company" size="1" onChange="changelocation(document.myform.Company.options[document.myform.Company.selectedIndex].value)">
<option selected value="<%=rs("ID")%>"><%=trim(rs("DepName"))%></option>
<%
dim selclass
selclass=rs("ID")
rs.movenext
do while not rs.eof
%>
<option value="<%=rs("ID")%>"><%=trim(rs("DepName"))%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select>
</td>
<td width="15%">申请理由</td>
<td width="35%">
<select class="SelectWidth" name="Reason">
<%
rs.open "select * from t_Hrms_Sys_AppReason",ObjDB,1,1
if not(rs.eof and rs.bof) then
%>
<option value="<%=rs("ID")%>" selected><%=rs("Reason")%></option>
<% rs.movenext
do while not rs.eof
%>
<option value="<%=rs("ID")%>"><%=rs("Reason")%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select>
</td>
</tr>
<tr class=Ltr>
<td width="15%" height="31">部门</td>
<td width="35%">
<select class="SelectWidth" name="Department" onChange="changelocationDep(document.myform.Department.options[document.myform.Department.selectedIndex].value)">
<%
rs.open "select * from t_Hrms_Dep where ParentID="&selclass ,ObjDB,1,1
if not(rs.eof and rs.bof) then
%>
<option value="<%=rs("ID")%>" selected><%=rs("DepName")%></option>
<%
dim selDep
selDep=rs("ID")
rs.movenext
do while not rs.eof
%>
<option value="<%=rs("ID")%>"><%=rs("DepName")%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select>
</td>
<td width="15%">人数</td>
<td width="35%"><input name="Number" type="text" class=Input value="" size="5" check=1>
人 </td>
</tr>
<tr class=Ltr>
<td width="15%" height="32">岗位</td>
<td width="35%">
<select class="SelectWidth" name="Station">
<%
rs.open "select distinct StaName,StaID from v_Hrms_Com_Dep_Sta where ComID='"&selClass&"' and DepID='"&selDep&"'",ObjDB,1,1
if not(rs.eof and rs.bof) then
%>
<option value="<%=rs("StaID")%>" selected><%=rs("StaName")%></option>
<%
rs.movenext
do while not rs.eof
%>
<option value="<%=rs("StaID")%>"><%=rs("StaName")%></option>
<%
rs.movenext
loop
end if
rs.close
set rs=nothing
ObjDB.Close
set ObjDB = nothing
%>
</select>
</td>
<td width="15%">希望到岗日期</td>
<td width="35%"><input name="InTime" type="text" class=Input onClick="InputDate(this)" readonly></td>
</tr>
<tr class=Ltr>
<td width="15%">岗位职责</td>
<td colspan="3"><textArea name="Responsibility" cols=80 rows=5 class=Textarea></textarea></td>
</tr>
<tr class=Ltr>
<td width="15%">任职条件</td>
<td colspan="3"><textArea name="Condition" cols=80 rows=5 class=Textarea id="Condition"></textarea></td>
</tr>
<tr class=Ltr>
<td width="15%">备注</td>
<td colspan="3"><textArea cols=80 rows=5 class=Textarea name="Des"></textarea></td>
</tr>
<tr class=Ltr height=100%>
<td colspan=4 align="left" valign="top">
<table border=0 cellpadding=0 cellspacing=0 width='100%'>
<tr>
<td align=left> <input name="submit" type=submit class=button onclick="myform.action='Addnew_03.asp?IsSend=1'" value="立刻发送">
<input type=submit class=button value="保存到草稿箱" onclick="myform.action='Addnew_03.asp?IsSend=0'" id=submit22 name=submit22>
</td>
</tr>
</table></td>
</tr>
<script language="JavaScript">
function checkpro()
{
<!-- '公司限制 -->
if(document.myform.Company.value =="")
{
document.myform.Company.focus();
alert("公司不能为空!");
return false;
}
<!-- '部门限制 -->
if(document.myform.Department.value =="")
{
document.myform.Department.focus();
alert("部门不能为空!");
return false;
}
<!-- 岗位限制 -->
if(document.myform.Station.value =="")
{
document.myform.Station.focus();
alert("岗位不能为空!");
return false;
}
<!-- '申请原因限制 -->
if(document.myform.Reason.value =="")
{
document.myform.Reason.focus();
alert("申请原因不能为空!");
return false;
}
<!-- '申请人数 -->
if(document.myform.Number.value =="")
{
document.myform.Number.focus();
alert("招聘人数不能为空!");
return false;
}
if(isNaN(document.myform.Number.value))
{
document.myform.Number.focus();
alert("招聘人数必须为数字!");
return false;
}
if((document.myform.Number.value > 1999999999)||(document.myform.Number.value < 0))
{
document.myform.Number.focus();
alert("招聘人数必须为1到1999999999的数!");
return false;
}
<!-- '希望到岗日期限制 -->
if(document.myform.InTime.value =="")
{
document.myform.InTime.focus();
alert("希望到岗日期不能为空!");
return false;
}
<!-- '岗位职责限制 -->
if(document.myform.Responsibility.value =="")
{
document.myform.Responsibility.focus();
alert("岗位职责不能为空!");
return false;
}
<!-- '任职条件限制限制 -->
if(document.myform.Condition.value =="")
{
document.myform.Condition.focus();
alert("'任职条件限制不能为空!");
return false;
}
<!-- '备注信息限制限制 -->
if(document.myform.Des.value.length > 500)
{
document.myform.Des.focus();
alert("备注信息的输入最多不能超过500个字!!");
return false;
}
}
</Script>
</table>
</form>
<%
End Sub
%>
<!-- #include file="Templet.asp" -->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -