<!DOCTYPE html>
|
<html>
|
<head>
|
<meta charset="utf-8">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="renderer" content="webkit">
|
<meta http-equiv="Cache-Control" content="no-siteapp"/>
|
<title>智能机房管理平台-开关量状态</title>
|
|
<link rel="shortcut icon" href="favicon.ico">
|
<link rel="stylesheet" type="text/css" href="./plugins/layui/css/layui.css"/>
|
<link rel="stylesheet" type="text/css" href="css/page/state-device.css"/>
|
</head>
|
|
<body>
|
<div class="i-container">
|
<div class="jmkt-main">
|
<div class="layui-fluid">
|
<div class="pdgxq-m1 layui-row layui-col-space20">
|
<div class="layui-col-lg7 layui-col-md7">
|
<div class="pdgxq-m1-right pdgxq-m1-box">
|
<div class="pdgxq-table jmkt-table-wrap">
|
<i class="i"></i>
|
<div style="height: 640px">
|
<div class="table-thead">
|
<table class="layui-table pdgxq-table1" lay-skin="nob">
|
<colgroup>
|
<col width="50%">
|
<col width="50%">
|
</colgroup>
|
<thead>
|
<tr>
|
<th>名称</th>
|
<th>状态</th>
|
</tr>
|
</thead>
|
</table>
|
</div>
|
<div class="table-tbody">
|
<table class="layui-table pdgxq-table1" lay-skin="nob">
|
<colgroup>
|
<col width="50%">
|
<col width="50%">
|
</colgroup>
|
<tbody id="deviceList">
|
|
</tbody>
|
</table>
|
</div>
|
|
</div>
|
<div style="height: 15px;border-top: 1px solid #444d58;"></div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
|
<script type="text/javascript" src="./js/jquery.min.js"></script>
|
<script src="js/constant.js"></script>
|
<script type="text/javascript">
|
|
function main(){
|
//设备列表
|
var deviceList = window.parent.parent.LIST_DEVICE;
|
var device = null;
|
$.each(deviceList, function (index, data) {
|
if (CATEGORY.D2090.code == data.type || CATEGORY.D2091.code == data.type){
|
device = data;
|
}
|
});
|
|
var did=256;
|
|
if (!did) {
|
window.parent.parent.notify("没有获取到设备ID,无法查看监控信息");
|
return false;
|
}
|
|
//根据设备ID从接口中获取实时监控
|
queryData(did,device);
|
//定时器,每5秒查询一次;查询设备信息并渲染
|
setInterval(function () {
|
queryData(did,device);
|
},5000);
|
}
|
|
function queryData(deviceId,device){
|
var data = {id: deviceId};
|
$.post("./cgi-bin/detail/query-data", JSON.stringify(data), function (data, status) {
|
if ("success" == status) {
|
console.log('---------获取到的设备实时数据-----' + data);
|
renderInfo(data,device);
|
} else {
|
window.parent.parent.notify("数据查询出错,请重新操作!");
|
}
|
}, "json");
|
}
|
|
//开始渲染
|
function renderInfo(deviceData, device) {
|
|
//监控属性渲染
|
var list = deviceData.value;
|
var html='';
|
|
if(list !=null && list.length>0){
|
$.each(list,function(index,item){
|
|
if(item.passcode == 1){
|
|
}else if(item.passcode == 2){
|
|
}else {
|
html += '<tr><td>' + item.name + '</td>';
|
html += '<td>' + item.value + '</td></tr>';
|
}
|
});
|
}else {
|
html += "<tr><td colspan='2'>暂无数据</td></tr>";
|
}
|
$("#deviceList").html(html);
|
}
|
|
main();
|
</script>
|
|
</body>
|
</html>
|