📄 newrole.inc
字号:
<%'************************************************************************************************' 函数名 : FormRoleTable(iRoleid)' 输 入 : iRoleid:角色id,如果是新增角色,那么iRoleid=0,表示一张空的表' 输 出 : 一张角色信息表(新的或者是旧的供修改的),可以提交' 功能描述: 根据角色id,将相应的角色信息显示出来' 调用模块: newrole.inc' 作 者 : weilin' 日 期 : 2002-11-08' 版 本 : '************************************************************************************************Function FormRoleTable(iRoleid) '------------------------------------ ' 根据iRoleid,显示相应的角色信息,供修改 '------------------------------------ dim sSQL, sRoledesp,iRcustomer,iRstock,iRpurchase,iRhr,iRworksheet,iRequipment dim sTemp, sTempButtons dim rs, sError dim i sSQL = "select * from t_role where role_id = "& iRoleid set rs = openRS(conn,sSQL) if not rs.eof then '存在该角色,显示该角色信息 iRcustomer=GetValue(rs,"customer_right") iRstock=GetValue(rs,"stock_right") iRpurchase=GetValue(rs,"purchase_right") iRhr=GetValue(rs,"hr_right") iRworksheet=GetValue(rs,"worksheet_right") iRequipment=GetValue(rs,"equipment_right") sTempButtons=_ " <img border=0 src=""../images/button/update.gif"" style=""cursor:hand"" onclick=""btnUpdate_Onclick()"">" & _ " <img border=0 src=""../images/button/delete.gif"" style=""cursor:hand"" name=btnDelete>" & _ " <img border=0 src=""../images/button/reset.gif"" style=""cursor:hand"" name=btnReset>" FormRoletable=_ TableTitle("角色信息维护", 600, "", "#0040a0") & _ "<table cellspacing=0 cellpadding=0 width=600 align=center border=0 >" & _ "<form name=""frmnewrole"" method=post action=""newrole.asp"">" FormRoleTable = FormRoleTable & _ "<tr height=30>" & _ " <td width=115 align=right>角色名称:</td>" FormRoleTable = FormRoleTable & _ " <td width=485 > " & GetValue(rs,"role_desp") & "</td>" FormRoleTable = FormRoleTable & _ "<tr height=30>" & _ " <td colspan=2 align=center>角 色 权 限</td>"&_ "</tr>" & _ "<tr>" & _ " <td colspan=2 >"&_ " <table cellspacing=0 cellpadding=0 width=600 align=center border=0 >" & _ " <tr>"&_ " <td> </td>"&_ " <td>客户意见管理</td>"&_ " <td>库存管理</td>"&_ " <td>采购管理</td>"&_ " <td>人事管理</td>"&_ " <td>工作单管理</td>"&_ " <td>设备管理</td>"&_ " <tr>"&_ " <tr>"&_ " <td>无权</td>"&_ " <td><input name=customer type = ""radio"" value=0 "&radiocheck(0,iRcustomer)&" style=""border-width:0"" ></td>"&_ " <td><input name=stock type = ""radio"" value=0 "&radiocheck(0,iRstock)&" style=""border-width:0"" ></td>"&_ " <td><input name=purchase type = ""radio"" value=0 "&radiocheck(0,iRpurchase)&" style=""border-width:0"" ></td>"&_ " <td><input name=hr type = ""radio"" value=0 "&radiocheck(0,iRhr)&" style=""border-width:0"" ></td>"&_ " <td><input name=worksheet type = ""radio"" value=0 "&radiocheck(0,iRworksheet)&" style=""border-width:0"" ></td>"&_ " <td><input name=equipment type = ""radio"" value=0 "&radiocheck(0,iRequipment)&" style=""border-width:0"" ></td>"&_ " <tr>"&_ " <tr>"&_ " <td>查询</td>"&_ " <td><input name=customer type = ""radio"" value=1 "&radiocheck(1,iRcustomer)&" style=""border-width:0"" ></td>"&_ " <td><input name=stock type = ""radio"" value=1 "&radiocheck(1,iRstock)&" style=""border-width:0"" ></td>"&_ " <td><input name=purchase type = ""radio"" value=1 "&radiocheck(1,iRpurchase)&" style=""border-width:0"" ></td>"&_ " <td><input name=hr type = ""radio"" value=1 "&radiocheck(1,iRhr)&" style=""border-width:0"" ></td>"&_ " <td><input name=worksheet type = ""radio"" value=1 "&radiocheck(1,iRworksheet)&" style=""border-width:0"" ></td>"&_ " <td><input name=equipment type = ""radio"" value=1 "&radiocheck(1,iRequipment)&" style=""border-width:0"" ></td>"&_ " <tr>"&_ " <tr>"&_ " <td>更新</td>"&_ " <td><input name=customer type = ""radio"" value=2 "&radiocheck(2,iRcustomer)&" style=""border-width:0"" ></td>"&_ " <td><input name=stock type = ""radio"" value=2 "&radiocheck(2,iRstock)&" style=""border-width:0"" ></td>"&_ " <td><input name=purchase type = ""radio"" value=2 "&radiocheck(2,iRpurchase)&" style=""border-width:0"" ></td>"&_ " <td><input name=hr type = ""radio"" value=2 "&radiocheck(2,iRhr)&" style=""border-width:0"" ></td>"&_ " <td><input name=worksheet type = ""radio"" value=2 "&radiocheck(2,iRworksheet)&" style=""border-width:0"" ></td>"&_ " <td><input name=equipment type = ""radio"" value=2 "&radiocheck(2,iRequipment)&" style=""border-width:0"" ></td>"&_ " <tr>"&_ " </table>"&_ " </td>"&_ "</tr>" FormRoleTable = FormRoleTable & _ "<tr height=50>" & _ " <td colspan=2 align=center>" & sTempButtons & _ " </td>" & _ "</tr>" & _ "<tr height=30>" & _ " <input type=hidden name=formaction>" & _ " <input type=hidden name=roleid value="""&iRoleid&""">" & _ "</tr>" & _ "</form>" & _ "</table>" else '不存在该角色,显示空的角色信息 sTempButtons=_ " <img border=0 src=""../images/button/submit.gif"" style=""cursor:hand"" name=btnSubmit>" & _ " <img border=0 src=""../images/button/clear.gif"" style=""cursor:hand"" name=btnCancel>" FormRoletable=_ TableTitle("新增角色", 600, "", "#0040a0") & _ "<table cellspacing=0 cellpadding=0 width=600 align=center border=0 >" & _ "<form name=""frmnewrole"" method=post action=""newrole.asp"">" FormRoleTable = FormRoleTable & _ "<tr height=30>" & _ " <td width=115 align=right>角色名称:</td>"&_ " <td width=485 ><input name=""roledesp"" size=64 type=""text"" maxlength=100></td>"& _ "<tr height=30>" & _ " <td colspan=2 align=center>角 色 权 限</td>"&_ "</tr>" & _ "<tr>" & _ " <td colspan=2 >"&_ " <table cellspacing=0 cellpadding=0 width=600 align=center border=0 >" & _ " <tr>"&_ " <td> </td>"&_ " <td>客户意见管理</td>"&_ " <td>库存管理</td>"&_ " <td>采购管理</td>"&_ " <td>人事管理</td>"&_ " <td>工作单管理</td>"&_ " <td>设备管理</td>"&_ " <tr>"&_ " <tr>"&_ " <td>无权</td>"&_ " <td><input name=customer type = ""radio"" value=0 checked style=""border-width:0"" ></td>"&_ " <td><input name=stock type = ""radio"" value=0 checked style=""border-width:0"" ></td>"&_ " <td><input name=purchase type = ""radio"" value=0 checked style=""border-width:0"" ></td>"&_ " <td><input name=hr type = ""radio"" value=0 checked style=""border-width:0"" ></td>"&_ " <td><input name=worksheet type = ""radio"" value=0 checked style=""border-width:0"" ></td>"&_ " <td><input name=equipment type = ""radio"" value=0 checked style=""border-width:0"" ></td>"&_ " <tr>"&_ " <tr>"&_ " <td>查询</td>"&_ " <td><input name=customer type = ""radio"" value=1 style=""border-width:0"" ></td>"&_ " <td><input name=stock type = ""radio"" value=1 style=""border-width:0"" ></td>"&_ " <td><input name=purchase type = ""radio"" value=1 style=""border-width:0"" ></td>"&_ " <td><input name=hr type = ""radio"" value=1 style=""border-width:0"" ></td>"&_ " <td><input name=worksheet type = ""radio"" value=1 style=""border-width:0"" ></td>"&_ " <td><input name=equipment type = ""radio"" value=1 style=""border-width:0"" ></td>"&_ " <tr>"&_ " <tr>"&_ " <td>更新</td>"&_ " <td><input name=customer type = ""radio"" value=2 style=""border-width:0"" ></td>"&_ " <td><input name=stock type = ""radio"" value=2 style=""border-width:0"" ></td>"&_ " <td><input name=purchase type = ""radio"" value=2 style=""border-width:0"" ></td>"&_ " <td><input name=hr type = ""radio"" value=2 style=""border-width:0"" ></td>"&_ " <td><input name=worksheet type = ""radio"" value=2 style=""border-width:0"" ></td>"&_ " <td><input name=equipment type = ""radio"" value=2 style=""border-width:0"" ></td>"&_ " <tr>"&_ " </table>"&_ " </td>"&_ "</tr>" FormRoleTable = FormRoleTable & _ "<tr height=50>" & _ " <td colspan=2 align=center>" & sTempButtons & _ " </td>" & _ "</tr>" & _ "<tr height=30>" & _ " <input type=hidden name=formaction>" & _ " <input type=hidden name=roleid value="""&iRoleid&""">" & _ "</tr>" & _ "</form>" & _ "</table>" end if CloseRS(rs) End Function'************************************************************************************************' 函数名 : UpdateRole()' 输 入 : ' 输 出 : ' 功能描述: 新增、更新、删除' 调用模块: newrole.asp' 作 者 : 蔡晓燕' 日 期 : 2002-08-01' 版 本 : '************************************************************************************************Sub UpdateRole()' 定义变量 dim sSQL, sError, sFormaction, rs, sRoledesp,iRcustomer,iRstock,iRpurchase,iRhr,iRworksheet,iRequipment dim newid, temp' 获取表单的数据 sFormaction = GetParam("formaction") sRoledesp = GetParam("roledesp") iRcustomer=GetParam("customer") iRstock=GetParam("stock") iRpurchase=GetParam("purchase") iRhr=GetParam("hr") iRworksheet=GetParam("worksheet") iRequipment=GetParam("equipment") select case sFormaction case "add"'新增角色 '检查有没有相同的角色名称,如果有的话,给出消息,不允许相同 sSQL = "select * from t_role where role_desp = "&Tosql(sRoledesp,"text") set rs = openRS(conn,sSQL) if not rs.eof then response.write "<script language=javascript >window.alert('对不起,该角色已经存在,请另选角色名称!')</script>" response.write "<script language=javascript >history.back()</script>" response.end end if CloseRS(rs) sSQL = "insert into T_Role values("&_ ToSQL(sRoledesp,"text")&","&_ ToSQL(iRcustomer,"number")&","&_ ToSQL(iRstock,"number")&","&_ ToSQL(iRpurchase,"number")&","&_ ToSQL(iRhr,"number")&","&_ ToSQL(iRworksheet,"number")&","&_ ToSQL(iRequipment,"number")&")" '执行新增角色到t_role表中 conn.Execute(sSQL) sError=ProcessError(conn) if sError <> "" then response.write "<script language=""javascript"">alert('对不起,新增角色失败!')</script>" else response.write "<script language=""javascript"">alert('新增角色成功!')</script>" end if response.write "<script language=vbscript>window.navigate(""newrole.asp"")</script>" case "upd"'更新角色 sSQL = "select * from t_role where role_id = "&ToSQL(iRoleid,"number") set rs = openRS(conn,sSQL) if rs.eof then response.write "<script language=""javascript"">alert('对不起,不存在该角色!')</script>" response.write "<script language = vbscript>window.navigate(""list_role.asp"")</script>" response.end end if CloseRS(rs) sSQL = "update T_Role set customer_right="&ToSQL(iRcustomer,"number")&_ ",stock_right="&ToSQL(iRstock,"number")&_ ",purchase_right="&ToSQL(iRpurchase,"number")&_ ",hr_right="&ToSQL(iRhr,"number")&_ ",worksheet_right="&ToSQL(iRworksheet,"number")&_ ",equipment_right="&ToSQL(iRequipment,"number")&_ " where role_id="&iRoleid '执行新增角色到t_role表中 'response.write sSQL &"----"&sRoledesp 'response.end conn.Execute(sSQL) sError=ProcessError(conn) if sError <> "" then response.write "<script language=""javascript"">alert('对不起,新增角色失败!')</script>" response.write "<script language=vbscript>window.navigate(""newrole.asp?roleid="&iRoleid&""")</script>" response.end else response.write "<script language=""javascript"">alert('更新角色成功!')</script>" response.write "<script language=vbscript>window.navigate(""list_role.asp"")</script>" response.end end if case "del"'删除角色 sSQL = "select * from t_role where role_id = "&ToSQL(iRoleid,"number") set rs = openRS(conn,sSQL) if rs.eof then response.write "<script language=""javascript"">alert('对不起,不存在该角色!')</script>" response.write "<script language = vbscript>window.navigate(""list_role.asp"")</script>" response.end end if CloseRS(rs) '判断在T_account表中是否有用户的Role_id=要删除的role_id,如果有,则不能删除该role sSQL = "select * from T_Account where role_id ="&ToSQL(iRoleid,"number") set rs = openRS(conn,sSQL) if not rs.eof then response.write "<script language=""javascript"">alert('该角色目前有用户,不能删除,如果要删除该角色,请先删除所有对应该角色的用户!')</script>" response.write "<script language=vbscript>window.navigate(""newrole.asp?roleid="&iRoleid&""")</script>" response.end end if closeRS(rs) '先删除t_role表中的角色信息 sSQL = "delete from T_Role where role_id = "&ToSQL(iRoleid,"number") conn.Execute(sSQL) sError=ProcessError(conn) if sError <> "" then response.write "<script language=""javascript"">alert('对不起,角色删除失败!')</script>" response.write "<script language=vbscript>window.navigate(""newrole.asp?roleid="&iRoleid&""")</script>" response.end else response.write "<script language=""javascript"">alert('角色删除成功!')</script>" response.write "<script language=vbscript>window.navigate(""list_role.asp"")</script>" response.end end if end selectEnd Sub'************************************************************************************************' 函数名 : TableLink()' 输 入 : ' 输 出 : ' 功能描述: 角色管理相关连接' 调用模块: list_role.asp' 作 者 : 蔡晓燕' 日 期 : 2002-08-01' 版 本 : '************************************************************************************************Function TableLink() TableLink = _ "<table width=600 cellspacing=0 cellpadding=0 border=0 align=center>" & _ "<tr height=30>" & _ " <td width=600><img src=""../images/bg/line.gif"" width=600 height=3></td>" & _ "</tr>" & _ "<tr height=30>" & _ " <td width=600> " & _ " <img src=""../images/goto.gif"" width=11 height=11> <a href=""list_role.asp"">角色列表</a>" & _ " " & _ " <img src=""../images/goto.gif"" width=11 height=11> <a href=""list_user.asp"">用户列表</a></td>" & _ "</tr>" & _ "</table>"End FunctionFunction radiocheck(i,iR) if CStr(i)=CStr(iR) then radiocheck=" checked " else radiocheck="" end ifend Function%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -