物联网平台 +Web 组态
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

150 lines
3.7 KiB

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="com.lp.cfg.ProConfig"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<html>
<head>
<title><%=ProConfig.PROJECT_NAME %></title>
<%@ include file="/WEB-INF/wechat/iot/common/resource_lib.jsp"%>
<style type="text/css">
.sub-container{
margin-left: 10px;
padding: 10px 10px 10px 0;
border-top: 1px solid #d9d9d9;
}
.sub-container:FIRST-CHILD{
border-top: 0;
}
.body-container{
background: #fff ;
}
.sub-container p{
font-size: 14px;
}
</style>
</head>
<body>
<div class="container">
<div class="t-c title-info">
<span>设备列表</span>
<div class="back" onclick="forward('/wiot/mscene')" style=" position: fixed;top: 0px;" >返回</div>
<c:if test="${user.type == 10 || user.type == 8 }">
<div class="add" onclick="addDevice()" style=" position: fixed;top: 0px;right: 10px;" >绑定设备</div>
</c:if>
</div>
<div style="height: 50px;"></div>
<div class="body-container">
</div>
<%@ include file="/WEB-INF/wechat/iot/common/pager.jsp"%>
<div id="template" class="hide">
<div class="sub-container clear"
<c:if test="${user.type == 10 || user.type == 8 }">
onclick="deviceInit({id})"
</c:if>
>
<div class="float-left width50">
<p class="title" style="color: #333;">
<span class="state" style="margin-left: 0;">{name}</span>
</p>
<p style="color: #666;padding-top: 10px;">{atimestr}</p>
</div>
<div class="float-left width50 " style="text-align: left;">
<p style="color: #666;">
状态: {data.iot_node_status}
</p>
<p style="color: #666;padding-top: 10px;">SN: {device_code}</p>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
function addDevice(){
forward('/wiot/edevice?id=' + GetQueryString("id") );
}
function deviceInit(did){
$.actions({
actions: [
// {
// text: "编辑",
// className: "color-success",
// onClick: function() {
// forward("/wiot/edevice?id="+GetQueryString("id") +"&did=" +did );
// }
// },
{
text: "删除",
className: "color-danger",
onClick: function() {
$.confirm("是否确认删除", function() {
commonAjax("DELETE",localUrl+"/node?id="+ did , "",function(){
tip("删除成功");
setTimeout(function(){
window.location.reload();
},200)
})
}, function() {
});
}
}]
});
}
$(function(){
//查询条件
var data = {scene_id:GetQueryString("id")} ;
var paged = 1;
getData(paged++);
var loading = false; //状态标记
$(document.body).infinite().on("infinite", function() {
if (loading)
return;
loading = true;
setTimeout(function() {
// 获取商品信息
getData(paged++);
}, 500);
});
function getData(paged){
var sid = GetQueryString("id") ;
postAjax(localUrl+"/page/node/sensor/lists.json?pageSize=6&paged="+paged , data ,function(data){
if(isOK(data)){
var dataObj = data.data.data ;
for(var i=0; i <dataObj.length;i++){
dataObj[i].atimestr = time2Str(dataObj[i].atime,'yyyy/MM/dd hh:mm');
dataObj[i].device_code = disvalue(dataObj[i].device_code,13);
$(".body-container").append($("#template").html().format( dataObj[i]));
}
if(data.data.totalPage > data.data.paged){
loading = false;
}else{
loading =true ;
}
}else{
loading =true ;
}
// 传data就可以,分页的
pagerinit(data,".body-container");
});
}
})
</script>
</html>