123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362 |
- <!--#include file="Inc/common.asp"-->
- <!--#include file="Inc/MD5.asp"-->
- <!--#include file="Inc/Function.asp"-->
- <!--#include file="Admin_Common.asp"-->
- <!--#include file="CheckComeUrl.asp"-->
- <%
- Dim uid, rsRole, isAdmin, rsgan
- uid = trim(request("uid"))
- if trim(Lcase(AdminName)) = "admin" then
- isAdmin = true
- else
- isAdmin = false
- end if
- %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title><%=systemPageTitle%></title>
- <link href="bs2010.css" rel="stylesheet" type="text/css" />
- <script type="text/javascript" src="js/share.js"></script>
- <script type="text/javascript" src="js/prototype.js"></script>
- <script language="javascript">
- function GetData()
- {
- url="alarm.asp";//调用页面
- var xmlhttp=null;
- if(window.XMLHttpRequest)
- {
- xmlhttp=new XMLHttpRequest();
- }
- if(!xmlhttp&&window.ActiveXObject)
- {
- try
- {
- xmlhttp=new ActiveXObject("Msxml2.XMLHTTP.5.0")
- }
- catch(e)
- {
- try
- {
- xmlhttp=new ActiveXObject("Msxml2.XMLHTTP.4.0")
- }
- catch(e){
- try
- {
- new ActiveXObject("Msxml2.XMLHTTP")
- }
- catch(e)
- {
- try{
- new ActiveXObject("Microsoft.XMLHTTP")
- }catch(e)
- {
- }
- }
- }
- }
- }
- if(!xmlhttp){alert("XMLHTTP不可用,请升级安装。");location="support/msxml.msi"}
-
- xmlhttp.open("GET",url,false);
- xmlhttp.send();
- var str = xmlhttp.responseText;
- document.getElementById("loadcontent").innerHTML=str;
-
- setTimeout("GetData()",<%=refreshRate%>);
- }
- </script>
- <SCRIPT language=javascript>
- function unselectall(){
- if(document.myform.chkAll.checked){
- document.myform.chkAll.checked = document.myform.chkAll.checked&0;
- }
- }
- function CheckAll(form){
- for (var i=0;i<form.elements.length;i++){
- var e = form.elements[i];
- if (e.Name != "chkAll"&&e.disabled!=true)
- e.checked = form.chkAll.checked;
- }
- }
- </script>
- </head>
- <body onLoad="javascript:GetData();">
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
-
- <tr>
- <td class="mainbg"><table width="760" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td valign="top">
- <div id="loadcontent">
- <p></p>
- 数据载入中……</div>
- <br />
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td width="20" height="40"><img src="images/arr1.gif" width="14" height="18" /></td>
- <td class="deviceName">设备管理</td>
- </tr>
- </table>
- <br />
- <%
- Action = request("Action")
- select case Action
- case "Modify"
- call Modify
- case "SaveModify"
- call SaveModify
- case "doMoveToClass"
- call doMoveToClass
- case else
- call main
- end select
-
- sub main()
- %>
- <form name='myform' method='Post' action='Admin_equipment.asp'>
- <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
- <tr>
- <td width="40" class="deviceTdTitle">选中</td>
- <td width="40" class="deviceTdTitle">ID</td>
- <td width="240" class="deviceTdTitle">所属区域 - <a href="admin_equipment.asp" style="font-weight:normal">显示全部</a></td>
- <td class="deviceTdTitle">设备名称</td>
- <td width="100" class="deviceTdTitle">操作</td>
- </tr>
- <%
- dim rse, sqle, t_classid
- t_classid = trim(request("t_classid"))
- if t_classid = "" then
- sqle = "select id, devicename, areaid from t_dev_property order by areaid, devicename"
- else
- sqle = "select id, devicename, areaid from t_dev_property where areaid = " & t_classid & " and uid in (select uid from t_dev_property where isuse = '1') order by devicename"
- end if
- set rse = server.CreateObject("adodb.recordset")
- rse.open sqle, conn, 1, 1
- if rse.bof and rse.eof then
- %>
- <tr class="deviceTd">
- <td colspan="5" align="center">没有设备</td>
- </tr>
- <%
- else
- do while not rse.eof
- %>
- <tr class="deviceTd">
- <td align="center"><input name='eid' type='checkbox' onclick='CheckItem(this)' id='eid' value='<%=rse("id")%>'></td>
- <td align="center"><%=rse("id")%></td>
- <td align="center"><a href="admin_equipment.asp?t_classid=<%=rse("areaid")%>">
- </a>
- <table border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td align="left">
- <a href="admin_equipment.asp?t_classid=<%=rse("areaid")%>">
- <%
- set rsgan = conn.execute("select t_classid, parentpath from t_area where t_classid = " & rse("areaid"))
- response.write GetPath(rsgan(0), rsgan(1))
- %>
- </a> </td>
- </tr>
- </table> </td>
- <td align="center"><%=rse("devicename")%></td>
- <td align="center"><a href="admin_equipment.asp?Action=Modify&id=<%=rse("id")%>">修改</a></td>
- </tr>
- <%
- rse.movenext
- loop
- end if
- rse.close
- set rse = nothing
- %>
- <tr class="deviceTd">
- <td colspan="5" height="40"><table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td><input name='chkAll' type='checkbox' id='chkAll' onclick='CheckAll(this.form)' value='checkbox' />
- 选中本页显示的所有设备</td>
- <td align="right">将选中的设备移动到
- <select name='areaid'>
- <%=GetClass_Option(1, 0)%>
- </select>
- <input type="hidden" id="Action" name="Action" value="doMoveToClass" />
- <input type='submit' name='Submit4' value=' 执行批量移动 '></td>
- </tr>
- </table> </td>
- </tr>
- </table>
- </form>
- <%
- end sub
-
- sub modify()
- dim rsem, id
- id = trim(request("id"))
- set rsem = conn.execute("select * from t_dev_property where id = " & id)
- if rsem.bof and rsem.eof then
- response.write "error"
- else
- %>
- <form name='form1' method='post' action='Admin_equipment.asp' onsubmit='return check()'>
- <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
- <tr class="deviceTd">
- <td width="40" align="center"><%=rsem("id")%></td>
- <td width="200" align="center"><select name='areaid'><%=GetClass_Option(1, rsem("areaid"))%></select></td>
- <td align="center"><%=rsem("devicename")%></td>
- <td width="120" align="center">
- <input name='Action' type='hidden' id='Action' value='SaveModify'>
- <input name="ID" type="hidden" id="ID" value="<%=rsem("id")%>" />
- <input name='Modify' type='submit' value=' 修改' style='cursor:hand;'> </td>
- </tr>
- </table>
- </form>
- <%
- end if
- end sub
-
- sub SaveModify()
- dim id, areaid, devicename, rssm, sqlsm
- id = trim(request("ID"))
- areaid = trim(request("areaid"))
- 'devicename = trim(request("devicename"))
-
- sqlsm = "select * from t_dev_property where id = " & id
- set rssm = server.CreateObject("adodb.recordset")
- rssm.open sqlsm, conn, 1, 3
-
- if rssm.bof and rssm.eof then
- FoundErr = True
- ErrMsg = ErrMsg & "<li>找不到指定的区域!</li>"
- rssm.Close
- Set rssm = Nothing
- Exit Sub
- end if
-
- 'rssm("devicename") = devicename
- rssm("areaid") = areaid
-
- rssm.update
- rssm.close
- set rssm = nothing
- If FoundErr = True Then Exit Sub
- Response.Redirect "Admin_equipment.asp"
- end sub
-
- sub doMoveToClass()
- dim BatchInfoID, areaid, rsar
- BatchInfoID = ReplaceBadChar(Request("Batcheid"))
- If BatchInfoID = "" Then
- BatchInfoID = ReplaceBadChar(Request("eid"))
- End If
- if BatchInfoID = "" then response.write "<script language='javascript'>alert('请至少选择一个设备!');window.history.go(-1);</script>"
- if BatchInfoID = "" then response.end
- areaid = trim(request("areaid"))
- set rsar = conn.execute("select child from t_area where t_classid = " & areaid)
- if rsar(0) <> 0 then response.write "<script language='javascript'>alert('所选区域不能含有子区域!');window.history.go(-1);</script>"
- if rsar(0) <> 0 then response.end
- conn.execute("update t_dev_property set areaid = " & areaid & " where id in (" & BatchInfoID & ")")
- response.redirect "admin_equipment.asp"
- end sub
- %> </td>
- </tr>
- </table></td>
- </tr>
- <tr>
- <td> </td>
- </tr>
- </table>
- </body>
- </html>
- <%
- Function GetClass_Option(iChannelID, CurrentID)
- Dim rsClass, sqlClass, strTemp, tmpDepth, i
- Dim arrShowLine(20)
- For i = 0 To UBound(arrShowLine)
- arrShowLine(i) = False
- Next
- sqlClass = "Select t_classid,ClassName,ClassType,Depth,NextID from t_area where ChannelID=" & iChannelID & " order by RootID,OrderID"
- Set rsClass = Conn.Execute(sqlClass)
- If rsClass.BOF And rsClass.EOF Then
- strTemp = "<option value=''>请先添加区域</option>"
- Else
- strTemp = ""
- Do While Not rsClass.EOF
- tmpDepth = rsClass(3)
- If rsClass(4) > 0 Then
- arrShowLine(tmpDepth) = True
- Else
- arrShowLine(tmpDepth) = False
- End If
- strTemp = strTemp & "<option value='" & rsClass(0) & "'"
- If CurrentID > 0 And rsClass(0) = CurrentID Then
- strTemp = strTemp & " selected"
- End If
- strTemp = strTemp & ">"
-
- If tmpDepth > 0 Then
- For i = 1 To tmpDepth
- strTemp = strTemp & " "
- If i = tmpDepth Then
- If rsClass(4) > 0 Then
- strTemp = strTemp & "├ "
- Else
- strTemp = strTemp & "└ "
- End If
- Else
- If arrShowLine(i) = True Then
- strTemp = strTemp & "│"
- Else
- strTemp = strTemp & " "
- End If
- End If
- Next
- End If
- strTemp = strTemp & rsClass(1)
- If rsClass(2) = 2 Then
- strTemp = strTemp & "(外)"
- End If
- strTemp = strTemp & "</option>"
- rsClass.MoveNext
- Loop
- End If
- rsClass.Close
- Set rsClass = Nothing
- GetClass_Option = strTemp
- End Function
- Function GetPath(ParentID, ParentPath)
- on error resume next
- Dim strPath, i
- If ParentID <= 0 Then
- GetPath = "无(所属区域已被删除)"
- Exit Function
- End If
- ParentPath = ParentPath & "," & ParentID
- Dim rsParent, sqlParent
- sqlParent = "Select * from t_area where t_classid in (" & ParentPath & ") order by Depth"
- Set rsParent = Conn.Execute(sqlParent)
- Do While Not rsParent.EOF
- For i = 1 To rsParent("Depth")
- strPath = strPath & " "
- Next
- If rsParent("Depth") > 0 Then
- strPath = strPath & "└ "
- End If
- strPath = strPath & rsParent("ClassName") & "<br>"
- rsParent.MoveNext
- Loop
- rsParent.Close
- Set rsParent = Nothing
- GetPath = strPath
- End Function
- Call CloseConn
- %>
|