<%@ page language="java" pageEncoding="UTF-8"%> <%@include file="/taglibs.jsp"%> <div style="margin-top:25px; "> <div id="justGage"> <label style="font-size:12px;">距离刷新时间还剩:<span id="countdown"></span></label> <div id="flowJustGage" style="width:160px; height:160px; float:left"></div> <div id="pressJustGage" style="width:160px; height:160px; float:left"></div> <div id="noiseJustGage" style="width:160px; height:160px;"></div> </div> </div> <script src="${ctx}/s/jquery-easyui-1.3.2/jquery-1.8.0.min.js" type="text/javascript"></script> <script type="text/javascript" src="${ctx}/s/justgage/raphael.2.1.0.min.js"></script> <script type="text/javascript" src="${ctx}/s/justgage/justgage.1.0.1.min.js"></script> <script type="text/javascript"> var devCode = null; var flowDeviceGage, pressDeviceGage, noiseDeviceGage; $(function() { devCode = window.top.document.getElementById("viewDevCode").value; if(devCode == null || devCode == "") { alert("数据错误:devCode不能为空"); return; } flowDeviceGage = new JustGage({ id : "flowJustGage", value : 0, min : 0, max : 1000, title : "流量传感器", label : "", startAnimationTime : 2000, startAnimationType : ">", refreshAnimationTime : 1000, refreshAnimationType : "bounce" }); pressDeviceGage = new JustGage({ id : "pressJustGage", value : 0, min : 0, max : 1000, title : "压力监测仪", label : "", startAnimationTime : 2000, startAnimationType : ">", refreshAnimationTime : 1000, refreshAnimationType : "bounce" }); noiseDeviceGage = new JustGage({ id : "noiseJustGage", value : 0, min : 0, max : 1000, title : "噪音传感器", label : "", startAnimationTime : 2000, startAnimationType : ">", refreshAnimationTime : 1000, refreshAnimationType : "bounce" }); intervalId = setInterval(loadData, 1000); }); var second = 5; function loadData() { if (second != 0) { $("#countdown").html(second + "秒"); second--; return; } else { $("#countdown").html(second + "秒"); second = 5; $ .ajax({ url : "/alarm/alarm/device-realtime-data!getDeviceData.do", type : "POST", data : { 'model.devCode' : devCode, 'model.dataType' : 'realtime' }, success : function(data) { var data = eval('(' + data + ')'); var dataContent = data.data; var insData = parseFloat(dataContent.insData); var pressData = parseFloat(dataContent.pressData); var denseData = parseFloat(dataContent.denseData); if (typeof (insData) != 'undefined' && insData != null) { flowDeviceGage.refresh(insData); } if (typeof (pressData) != 'undefined' && pressData != null) { pressDeviceGage.refresh(pressData); } if (typeof (denseData) != 'undefined' && denseData != null) { noiseDeviceGage.refresh(denseData); } } }); } } </script>