📄 product_root.asp
字号:
<%@ Language=VBScript %>
<%
Response.Buffer=true
Response.Expires=0
if Session("userqx")>="1" and Session("userqx")<="9" then
else
Response.Redirect "warn.asp"
end if
%>
<!-- #include file="../dsn.asp" -->
<%
dept=Request.QueryString("dept")
flag=Request.QueryString("flag")
myflag=Request.QueryString("myflag")
classcode=Request.QueryString("classcode")
delclass=Request.QueryString("delclass")
if myflag="" then myflag="0"
if classcode="" then classcode="0"
if flag="" then flag="0"
tablename="product_class"
set cn=server.CreateObject("ADODB.Connection")
cn.Open mycnstr
set rs=server.CreateObject("ADODB.Recordset")
set rs2=server.CreateObject("ADODB.Recordset")
if delclass<>"" then
sqltext="select top 1 classcode from "+tablename+" where parentcode='"+delclass+"'"
rs.Open sqltext,cn,0,1,1
if rs.EOF then
sqltext="delete from "+tablename+" where classcode='"+delclass+"'"
cn.Execute sqltext
else
Response.Write "<font color=red>警告:该类别下已有线路小类,不能删除!</font>"
end if
rs.Close
end if
htmltitle="产品大类管理"
htmlname="product_root.asp?agent="+agent+"&dept="+dept
enflag="0"
if Request.ServerVariables("REQUEST_METHOD")="POST" then
sortnum=Request.Form("sortnum")
if classcode="0" then
sqltext="select top 1 classcode from "+tablename+" where parentcode='0' order by classcode desc"
rs.Open sqltext,cn,1,1
if rs.EOF then
classcode="101"
else
classcode=rs(0)+1
end if
rs.Close
if sortnum="" or not isnumeric(sortnum) then
sqltext="select top 1 sortnum from "+tablename+" where parentcode='0' and flag='"+flag+"' order by sortnum desc"
rs.Open sqltext,cn,1,1
if rs.EOF then
sortnum=1
else
sortnum=rs(0)+1
end if
rs.Close
end if
rs.Open tablename,cn,3,3
rs.AddNew
rs("classcode")=classcode
rs("parentcode")="0"
rs("flag")=flag
rs("basclass")=dept
else
sqltext="select * from "+tablename+" where classcode='"+classcode+"'"
rs.Open sqltext,cn,3,3
end if
if isnumeric(sortnum) then rs("sortnum")=sortnum
rs("classname")=trim(Request.Form("classname"))
if enflag="1" then
rs("classname2")=trim(Request.Form("classname2"))
end if
rs.Update
rs.Close
myflag="0"
end if
%>
<HTML>
<HEAD>
<meta HTTP-EQUIV="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {font-size: 12px; color: #000000; font-family: 宋体}
td {font-size: 12px; color: #000000; font-family: 宋体;}
.t1 {font:12px 宋体;color=000000}
.t2 {font:12px 宋体;color:ffffff}
.bt1 {font:14px 宋体;color=000000}
.bt2 {font:14px 宋体;color:ffffff}
A:link {color: #000066}
A:visited {color: #000066}
A:hover {color: #ff0000}
A.r1:link {font-size:12px;text-decoration:underline;color:#000000;}
A.r1:visited {font-size:12px;text-decoration:underline;color:#000000;}
A.r1:hover {font-size:12px;text-decoration:underline;color:#ff6600;}
A.r2:link {font-size:12px;text-decoration:underline;color:#ffffff;}
A.r2:visited {font-size:12px;text-decoration:underline;color:#ffffff;}
A.r2:hover {font-size:12px;text-decoration:underline;color:#ff6600;}
-->
</style>
</HEAD>
<body topmargin=5 leftmargin=5 bgcolor=#ffffff>
<table width="100%" align=center border="0" cellspacing="0" cellpadding="2">
<tr><td align="left">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height=24>
<tr valign=bottom>
<td style="font-size:12px;">
<font color=DarkSlateGray style="font-size:14px"><b><%=htmltitle%></b></font>
<font color=#003300 style="font-size:12px"></font>
<a href="<%=htmlname%>">[刷新列表]</a>
<%if Session("userqx")="9" then%>
<a href="<%=htmlname%>&myflag=1">[增加]</a>
<%end if%>
</td>
</tr>
</table>
</td></tr>
<%
sqltext="select classcode,sortnum,classname,classname2 from product_class where parentcode='0' and flag='"+flag+"' and basclass='"+dept+"' order by sortnum"
rs.Open sqltext,cn,1,1
listcount=30
rs.PageSize=listcount
if pageno="" then pageno=1 else pageno=cint(pageno)
if rs.PageCount>0 then rs.AbsolutePage=pageno
%>
<tr><td height=200 valign=top>
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr bgcolor="527c72" style="color:#ffffff" align="center">
<%if Session("userqx")="9" then%>
<td height=20 width="35" class=t2></td>
<%end if%>
<td class=t2>序号</td>
<td class=t2>编号</td>
<td class=t2 align=center>类别名称</td>
<%if enflag="1" then%>
<td class=t2 align=center>英文名称</td>
<%end if%>
<td class=t2 align=center>小类维护</td>
<td class=t2></td>
</tr>
<%
i=1
do while not rs.EOF and i<=listcount
if (i mod 2)=0 then
Response.Write("<tr bgcolor=fefefe>")
else
Response.Write("<tr bgcolor=efefef>")
end if
%>
<%if Session("userqx")="9" then%>
<td width="35" align=right>
<div align=center><img onclick="delrec('<%=trim(rs("classcode"))%>')" src="images/delete.gif" style="cursor:hand"></div>
</td>
<%end if%>
<td width=40 align="center" height=20><%=rs("sortnum")%></td>
<td width=40 align="center" height=20><%=rs("classcode")%></td>
<td align="left" height=20>
<%if trim(rs(0))=Session("classcode") or Session("userqx")="9" then%>
<a href="<%=htmlname%>&myflag=1&classcode=<%=trim(rs("classcode"))%>">
<%end if%>
<%=trim(rs("classname"))%></td>
<%if enflag="1" then%>
<td align="left" height=20><%=trim(rs("classname2"))%></td>
<%end if%>
<td width=60 align="center" height=20>
<%if trim(rs(0))=Session("classcode") or Session("userqx")="9" then%>
<a href="product_class.asp?parentcode=<%=trim(rs("classcode"))%>&dept=<%=dept%>">小类维护
<%end if%>
</td>
<td></td>
</tr>
<%
i=i+1
rs.MoveNext
loop
rs.Close
%>
</table>
</td></tr>
</table>
<%if myflag="1" then%>
<form action="<%=htmlname%>&classcode=<%=classcode%>" method=post name=form1 onsubmit="return checkform(form1)" autocomplete = "off">
<table width="100%" border="0" cellspacing="1" cellpadding="1" align="center">
<%
if classcode="0" then
else
sqltext="select classcode,sortnum,classname,classname2 from "+tablename+" where classcode='"+classcode+"'"
rs.Open sqltext,cn,1,1
if not rs.EOF then
sortnum=rs("sortnum")
classname=trim(rs("classname"))
classname2=trim(rs("classname2"))
end if
rs.Close
end if
%>
<tr bgcolor=#898989><td colspan=2 height=20><font class=t2>具体内容</font></td></tr>
<tr><td width=600>
<table width="100%" border="0" cellspacing="1" cellpadding="1" align="center">
<tr><td width=70 class=td1 align=right height=5></td>
<td class=td2></td></tr>
<tr><td width=70 class=td1 align=right>序号</td>
<td class=td2><INPUT type="text" value="<%=sortnum%>" name=sortnum maxlength=10 size=10></td></tr>
<tr><td class=td1 align=right>大类名称</td>
<td class=td2>
<input type="text" value="<%=classname%>" name=classname maxlength=30 size=30> <font color=red>*</font>
</td></tr>
<%if enflag="1" then%>
<tr><td class=td1 align=right>英文名称</td>
<td class=td2>
<input type="text" value="<%=classname2%>" name=classname2 maxlength=50 size=50> <font color=red>*</font>
</td></tr>
<%end if%>
<tr><td class=td2 bgcolor=ffffff ></td><td class=td2 bgcolor=ffffff align=left><br>
<input type="submit" name="submit" value="确认提交">
</td></tr>
</table>
</td>
<td> </td>
</tr>
</table>
</form>
<%end if%>
</body>
</html>
<script language="Javascript">
function delrec(code)
{
if (confirm("您确认要删除("+code+")吗?")==true)
{
window.location.href="<%=htmlname%>&pageno=<%=pageno%>&delclass="+code
}
}
function checkform(form)
{
var flag=true;
if(form("classname").value==""){alert("请输入大类名称!");form("classname").focus();return false;}
return flag;
}
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -