⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 equi_list.asp

📁 物业管理和办公自动化系统
💻 ASP
字号:
<%
''*******************************************************************************
' 文件名: equi_list.asp
' Copyright(c) 2001-2002 上海阿尔卡特网络支援系统有限公司
'
' 创建人 : 周秋舫
' 日 期 : 2002-11-15
' 
' 修改历史 :
'   ****年**月**日 ****** 修改内容:**************************************************
' 功能描述 : 设备查询,即对表T_equipment进行查询
'				本.asp文件(包括相应的.inc文件)为实现了两个功能,
'				第一个功能:设备查询,根据关键字进行查询
'				第二个功能:查询某个设备的所有子设备,需要parent_equi_id参数
'  版 本 :
'-------------------------------------------------------------------------------------------------------------------------------
option explicit
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
%>
<!-- #include file="../include/common.inc" -->
<!-- #include file="../include/commonpage.inc" -->
<!-- #include file="../include/recordlist.inc" -->
<!-- #include file="equi_list.inc" -->
<%
call CheckSecurity()

'' 如果不是设备管理员,则无权进入本页
if hasright(ID_EQUIPMENT) < RIGHT_READ  then
	Response.Clear
	Response.Redirect "../include/error.asp?error=对不起,您没有设备查询权限!"
	Response.end
end if

''*******************************************************************************
' 服务器端代码

''*******************************************************************************
' 建立数据库连接
dim conn	: Set conn = DBConnection

'-------------------------------------------------------------------------------------------------------------------------------
' 分页相关的变量定义
'-------------------------------------------------------------------------------------------------------------------------------
Dim sSQL, sWhere, sOrderby
Dim sFileName				: sFileName = "equi_list.asp"
Dim iTotalRecords			: iTotalRecords = 0			' 分页
Dim iRecordsPerPage	: iRecordsPerPage = 12
Dim iTotalPages			: iTotalPages = 0
Dim iCols						: iCols = 8
Dim iCurrentPage			: iCurrentPage = GetParam("Page")
Dim sSorting					: sSorting = GetParam("Sorting")
Dim sSorted					: sSorted = GetParam("Sorted")
Dim sSortParams			: sSortParams = ""
Dim sFormParams		: sFormParams = ""
Dim sDirection				: sDirection = ""

''*******************************************************************************
'' 构造分页的SQL语句
''*******************************************************************************
sSQL = "select t1.equi_id, t1.name, t1.number, t2.type_desc, t1.model, t1.room_no" & _
			", t1.sys_id, t1.parent_equi_id, t1.discarded" & _
			" from t_equipment t1" & _
			" left join t_equipment_type t2 on t2.type_id = t1.type"
sOrderby = " order by t1.name asc"
''*******************************************************************************
'' 构造Where子句
'-------------------------------------------------------------------------------------------------------------------------------
' 定义全局变量 ---- 查询参数

'' 以下参数用于按关键字(/关键信息)查询设备
''-----------------------------------------------------
'' 设备名称
''-----------------------------------------------------
dim pName	: pName	= GetParam("name")
sWhere = " where name like " & ToSQL("%" & pName & "%", "Text")
if not IsEmpty(pName) then
	sFormParams = sFormParams & "name=" & pName & "&"
end if

''-----------------------------------------------------
'' 设备标识
''-----------------------------------------------------
dim pEquiId	: pEquiId	= GetParam("equi_id")	
if Not IsEmpty(pEquiId) then
	sWhere = sWhere & " and t1.equi_id = " & ToSQL(pEquiId, "Number")
	sFormParams = sFormParams & "equi_id=" & pEquiId & "&"
end if

''-----------------------------------------------------
'' 设备类型
''-----------------------------------------------------
dim pTypeId : pTypeId = GetParam("type_id")
if IsEmpty(pTypeId) then
	pTypeId = -1
else
	sWhere = sWhere & " and t1.type = " & ToSQL(pTypeId, "Number")
	sFormParams = sFormParams & "equi_id=" & pEquiId & "&"
end if

''-----------------------------------------------------
'' 负责部门
''-----------------------------------------------------
dim pDeptId	 : pDeptId = GetParam("dept_id")
if IsEmpty(pDeptId) then
	pDeptId = -1
else
	sWhere = sWhere & " and t1.department = " & ToSQL(pDeptId, "Number")
	sFormParams = sFormParams & "dept_id=" & pDeptId & "&" 
end if

''-----------------------------------------------------
'' 设备状态:报废/在用
''-----------------------------------------------------
dim pDiscarded	: pDiscarded = GetParam("discarded")
if IsEmpty(pDiscarded) then pDiscarded = -1
if CStr(pDiscarded) <> "-1" then
	sWhere = sWhere & " and t1.discarded = " & ToSQL(pDiscarded, "Number")
	sFormParams = sFormParams & "discarded=" & pDiscarded & "&"
end if


'' 以下参数用于查询某个设备的子设备
'' 这里假定查询子设备时也借用关键字查询时的参数name,因此这里sWhere中直接用and
dim pParentEquiId	: pParentEquiId = GetParam("parent_equi_id")	'' 父设备代码
if not IsEmpty(pParentEquiId) then
	sWhere = sWhere & " and parent_equi_id = " & ToSQL(pParentEquiId, "Number")
	sFormParams = sFormParams & "parent_equi_id=" & pParentEquiId & "&"
	iRecordsPerPage = 16
end if

'response.write sSQL & sWhere & sOrderby & "<br>"
'response.end
'response.write "**" & pDiscarded & "**<br>"
''*******************************************************************************
' 分页SQL语句构造完毕,调用PrepareListData进行分页前的准备
'-------------------------------------------------------------------------------------------------------------------------------
dim arrayFields(6), sDelimiter
sDelimiter = "*"
arrayFields(0) = "equi_id"
arrayFields(1) = "name"
arrayFields(2) = "number"
arrayFields(3) = "type_desc"
arrayFields(4) = "model"
arrayFields(5) = "room_no"
arrayFields(6) = "discarded"
call PrepareListData(conn, sSQL&sWhere, Join(arrayFields, sDelimiter), sDelimiter)
''*******************************************************************************

%>

<html>
<head>
<title>上海信息大楼	Shanghai Information Tower</title>
<meta http-equiv="Content-Type"	content="text/html;charset=gb2312">
<link rel="stylesheet" href="../include/common.css" type="text/css">
<script language="javascript">
function OnEquipSearch()
{
	// 检查设备代码是否合法,设备代码只能是数字
	if ( FormSearchEquip.equi_id.value != "" )
	{
		var re = new RegExp("^[0-9][0-9]*$","ig");
		var digit = FormSearchEquip.equi_id.value;
		if (digit.match(re) == null)
		{
			alert("对不起,设备代码必须是数字!");
			FormSearchEquip.equi_id.focus();
			FormSearchEquip.equi_id.style.color = "red";
			return;
		}
	}
	FormSearchEquip.submit();
}
</script>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="../images/bg/bg0.jpg">
<br>

<%
Response.Write OuterTableHeader
Response.Write HeaderWithMenu
Response.Write InnerTableHeader
''*******************************************************************************
' 主体从这里开始
'-------------------------------------------------------------------------------------------------------------------------------
if IsEmpty(pParentEquiId) then
	Response.Write FormSearchEquip
end if

Response.Write ListTableHeader
Response.Write ListTableRecords(sSQL&sWhere&sOrderby, iCols, iRecordsPerPage, iTotalRecords, iCurrentPage, iTotalPages, sFileName, sFormParams, sSortParams )
Response.Write  ListTableTailer()
'-------------------------------------------------------------------------------------------------------------------------------
' 主体到这里结束
''*******************************************************************************
Response.Write InnerTableTailer
Response.Write Footer
Response.Write OuterTableTailer
Disconnect(conn)

%>

<script language="javascript">
	FormSearchEquip.discarded.value="<%=pDiscarded%>";
</script>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -