📄 emp_oa.inc
字号:
<%
Function FirstForm()
FirstForm = _
"<form method=post name=""frmAddEmp"" action=""emp_oa.asp"" onsubmit=""return(CheckInput());"">" & vbLF & _
"<input type=""hidden"" name=""co_id"" value=""" & co_id & """>" & vbLF & _
"<input type=""hidden"" name=""isdummy"" value=""" & isdummy & """>" & vbLF & _
"<input type=""hidden"" name=""dismissed"" value=""" & dismissed & """>" & vbLF & _
"<input type=""hidden"" name=""step"" value=""2"">" & vbLF & _
"<table width=600 cellspacing=2 cellpadding=2 align=center background=""images/bgdots.gif"">" & vbLF & _
" <tr bgcolor=""#0040a0"" height=15 align=center style=""font-weight:600;color:white"">" & vbLF & _
" <td>第一步:请输入员工姓名和用户名</td></tr>" & vbLF & _
" <tr bgcolor=white height=200 align=center>" & vbLF & _
" <td><span id=""tip"" style=""color:red"">" & sTip & "</span><br>" & vbLF & _
" <br>姓 名: <input type=""text"" name=""name"" value=""" & sName & """ size=20 maxlength=20>" & _
" <br> " & vbLF & _
" <br>用户名: <input type=""text"" name=""account_id"" value=""" & sAccountId & """ size=20 maxlength=20>" & vbLF & _
" <br> " & vbLF & _
" <br>角 色: <select name=""role"" style=""width:130px"">" & vbLF & _
selectOptions(dbLocal, "t_role", "role_id", "role_desp", role , "") & _
"</select></td></tr>" & vbLF & _
" <tr bgcolor=white align=center>" & vbLF & _
" <td><input type=""image"" src=""images/button_2.gif"" style=""border-width:0""></td></tr>" & vbLF & _
" <tr bgcolor=white height=2><td></td></tr>" & vbLF & _
"</table>" & vbLF & _
"</form>" & vbLF
End Function
Function SecondForm()
dim sName, sAccountId, co_id, isdummy, dismissed
sName = GetParam("name")
sAccountId = GetParam("account_id")
co_id = GetParam("co_id")
isdummy = GetParam("isdummy")
dismissed = GetParam("dismissed")
dim FormParams
FormParams = ToURL("name=" & sName & "&account_id=" & sAccountId & "&")
SecondForm = _
"<form method=post name=""frmAddEmp"" action=""emp_oa.asp"" onsubmit=""return(CheckInput());"">" & vbLF & _
"<input type=""hidden"" name=""co_id"" value=""" & co_id & """>" & vbLF & _
"<input type=""hidden"" name=""isdummy"" value=""" & isdummy & """>" & vbLF & _
"<input type=""hidden"" name=""dismissed"" value=""" & dismissed & """>" & vbLF & _
"<input type=""hidden"" name=""step"" value=""3"">" & vbLF & _
"<input type=""hidden"" name=""role"" value=""" & role & """>" & vbLF & _
"<table width=600 cellspacing=2 cellpadding=2 align=center background=""images/bgdots.gif"">" & vbLF & _
" <tr bgcolor=""#0040a0"" height=15 align=center style=""font-weight:600;color:white"">" & vbLF & _
" <td><span id=""title"">第二步:确认用户姓名和用户名</span></td></tr>" & vbLF & _
" <tr bgcolor=white height=200 align=center>" & vbLF & _
" <td><span id=""tip"" style=""color:red"">" & sTip & "</span><br>" & vbLF & _
" <br>姓 名: <input type=""text"" name=""name"" value=""" & sName & """ size=20 maxlength=20 style=""border-color:white;"" readonly>" & _
" <br> " & vbLF & _
" <br>用户名: <input type=""text"" name=""account_id"" value=""" & sAccountId & """ size=20 maxlength=20 style=""border-color:white"" readonly>" & vbLF & _
" <br> " & vbLF & _
" <br>角 色: <select style=""width:130px;"" disabled>" & vbLF & _
selectOptions(dbLocal, "t_role", "role_id", "role_desp", role, "") & _
"</select></td></tr>" & vbLF & _
" <tr bgcolor=white align=center>" & vbLF & _
" <td>" & _
"<img id=""btnLastStep"" border=0 src=""images/button_1.gif"" onclick=""frmAddEmp.step.value='1';frmAddEmp.submit();"" style=""cursor:hand"">" & vbLF & _
" " & vbLF & _
"<input type=""image"" src=""images/button_2.gif"" style=""border-width:0""></td></tr>" & vbLF & _
" <tr bgcolor=white height=2><td></td></tr>" & vbLF & _
"</table>" & vbLF & _
"</form>" & vbLF
End Function
Function TableLink()
'' 这是管理页面,因此每个链接都没有限制
TableLink = _
"<table width=600 cellspacing=0 cellpadding=0 border=0 align=center>" & vbLF & _
"<tr height=10>" & vbLF & _
" <td width=600><img src=""../images/bg/line.gif"" width=600 height=3></td>" & vbLF & _
"</tr>" & vbLF & _
"<tr>" & vbLF & _
" <td width=600> " & vbLF & _
" <img src=""../images/goto.gif""> <a href=""../role/list_user.asp"">用户管理</a>" & vbLF & _
" " & vbLF & _
" <img src=""../images/goto.gif""> <a href=""../role/list_role.asp"">角色管理</a></td>" & vbLF & _
"</tr>" & _
"</table>"
End Function
Sub AddEmp()
dim sSQL, iEmpSerial
sSQL = "proc_AddAccount " & ToSQL(sName, "Text") & ", " & ToSQL(sAccountId, "Text") & ", " &ToSQL(role, "Number") & ", " & ToSQL(co_id, "Number") & ", " & ToSQL(isdummy, "Number") & ", " & ToSQL(dismissed, "Number")
'Response.write sSQL & "<br>" : response.end
iEmpSerial = ExecuteSP(dbLocal, sSQL)
'' 通过ExecuteSP返回的iEmpSerial常常是-1,但数据却已经成功提交到数据库,不知道为什么,后来发现是在本机上运行是好的,远程运行则不成功
'' 因此这里直接通过account_id来选取emp_serial
'' iEmpSerial = DLookUp(dbLocal, "t_account", "emp_serial", "account_id = " & ToSQL(sAccountId, "Text"))
'' 再后来知道了原因,原因是提交按钮用了input type=image,在javascript里又用了form.submit函数,因此造成了两次提交,
'' 第一次提交成功了,数据写进了数据库,第二次提交存在相同用户名,当然就不成功了
if CInt(iEmpSerial) <= 0 then
Response.Write "<script language=""javascript"">alert(""出错啦!"");</script>"
else
Response.Clear
''Response.Redirect("emp_oe.asp?emp_serial=" & iEmpSerial)
Response.Redirect("../role/list_user.asp?accountid=" & sAccountId & "&")
Response.end
end if
End Sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -