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.
195 lines
5.0 KiB
195 lines
5.0 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">
|
|
.title-container{
|
|
height: 50px;
|
|
line-height: 48px;
|
|
text-align: center;
|
|
background: #fff;
|
|
}
|
|
|
|
.title-container .width20{
|
|
font-weight: 540;
|
|
}
|
|
|
|
.title-container .width33.active{
|
|
border-bottom: 2px solid #46addb;
|
|
color:#46addb;
|
|
}
|
|
|
|
.weui-panel.weui-panel_access{
|
|
border-radius: 5px;
|
|
}
|
|
.weui-cells{
|
|
color: #333;
|
|
}
|
|
.weui-cells label{
|
|
font-size: 15px;
|
|
}
|
|
.weui-cells span{
|
|
font-size: 14px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<div class="t-c title-info" onclick="backup()">
|
|
<span>传感信息</span>
|
|
<div class="back" style=" position: fixed;top: 0px;" >
|
|
返回</div>
|
|
</div>
|
|
<div style="height: 50px;"></div>
|
|
<div class="clear title-container">
|
|
<div class="float-left width33 pointer" url="/wiot/sensor?id=">
|
|
<span>基本信息</span>
|
|
</div>
|
|
<div class="float-left width33 pointer" url="/wiot/history?id=">
|
|
<span>数据曲线</span>
|
|
</div>
|
|
<div class="float-left width33 pointer active" url="/wiot/trigger?id=">
|
|
<span>触发器信息</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="body-container">
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div id="template0" class="hide">
|
|
<div class="weui-cells weui-cells_form" >
|
|
<div class="weui-cell">
|
|
<div class="weui-cell__hd">
|
|
<label for="" class="weui-label">名称</label>
|
|
</div>
|
|
<div class="weui-cell__bd">
|
|
<span style="color: cornflowerblue;">{0}</span>
|
|
</div>
|
|
</div>
|
|
<div class="weui-cell">
|
|
<div class="weui-cell__hd">
|
|
<label for="" class="weui-label">关联传感器</label>
|
|
</div>
|
|
<div class="weui-cell__bd">
|
|
<span>{1}</span>
|
|
</div>
|
|
</div>
|
|
<div class="weui-cell">
|
|
<div class="weui-cell__hd">
|
|
<label for="" class="weui-label">触发条件</label>
|
|
</div>
|
|
<div class="weui-cell__bd">
|
|
<span style="font-weight: 700">{2}</span>
|
|
</div>
|
|
</div>
|
|
<div class="weui-cell">
|
|
<div class="weui-cell__hd">
|
|
<label for="" class="weui-label">触发方式</label>
|
|
</div>
|
|
<div class="weui-cell__bd">
|
|
<span style="color:darkolivegreen;">{3}</span>
|
|
</div>
|
|
</div>
|
|
<div class="weui-cell">
|
|
<div class="weui-cell__hd">
|
|
<label for="" class="weui-label">报警提醒</label>
|
|
</div>
|
|
<div class="weui-cell__bd">
|
|
<span>{4}</span>
|
|
</div>
|
|
</div>
|
|
<div class="weui-cell">
|
|
<div class="weui-cell__hd">
|
|
<label for="" class="weui-label">触发器状态</label>
|
|
</div>
|
|
<div class="weui-cell__bd">
|
|
<span style="font-weight: 700" >{5}</span>
|
|
</div>
|
|
<div class="weui-cell__ft">
|
|
<input class="weui-switch" onchange="changeMode({7},this)" {6} type="checkbox">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
<script type="text/javascript">
|
|
|
|
function backup(){
|
|
forward('/wiot/device?id='+ GetQueryString("did"));
|
|
}
|
|
|
|
function changeMode(id,obj){
|
|
var data ;
|
|
if( $(obj).attr("checked") == 'checked' ){
|
|
data ={ id:id,iot_trigger_status:44};
|
|
}else{
|
|
data ={ id:id,iot_trigger_status:43};
|
|
}
|
|
|
|
commonAjax("PUT",localUrl+"/trigger?id="+id, data,function(data){
|
|
if(data.status == status_code.OK){
|
|
$.toptip('操作成功', 'success');
|
|
setTimeout(function() {
|
|
window.location.reload();
|
|
}, 500);
|
|
}else{
|
|
$.toptip('操作失败'+ data.statusMsg , 'error');
|
|
}
|
|
});
|
|
}
|
|
|
|
$(function(){
|
|
$("#sensorId").val( GetQueryString("id") );
|
|
|
|
$(".title-container .width33").click(function(){
|
|
forward( $(this).attr("url") + GetQueryString("id") +"&did="+ GetQueryString("did") );
|
|
})
|
|
|
|
postAjax(localUrl+"/page/trigger.json?paged=1&pageSize=300", {from_sensor_id: GetQueryString("id") },function(data){
|
|
if(isOK(data)){
|
|
var dataT = data.data.data ;
|
|
for(var i=0;i<dataT.length;i++){
|
|
$(".body-container").append( $("#template0").html().format(
|
|
dataT[i].name,
|
|
dataT[i].from_sensor_name ,
|
|
replaceValue( dataT[i].condition_params,dataT[i].data.iot_trigger_condition_type)
|
|
,dataT[i].data.iot_trigger_action_type,
|
|
dataT[i].data.iot_trigger_alarm_flag,
|
|
dataT[i].data.iot_trigger_status,
|
|
tom( dataT[i].iot_trigger_status== 43,'checked="checked"' , ""),
|
|
dataT[i].id
|
|
));
|
|
}
|
|
}else{
|
|
$(".body-container").append('<div style="margin-top:20px;" class="no-data"><p>暂无更多数据</p></div>');
|
|
}
|
|
});
|
|
|
|
function replaceValue(x,y){
|
|
var array = x.split(",");
|
|
if(y.indexOf("{X}")>0 ){
|
|
y = y.replace(/{X}/,array[0]);
|
|
}
|
|
if(y.indexOf("{Y}")>0){
|
|
y = y.replace(/{Y}/,array[1]);
|
|
}
|
|
if(y.indexOf("{M}")>0){
|
|
y = y.replace(/{M}/,array[1]);
|
|
}
|
|
return y;
|
|
}
|
|
|
|
})
|
|
|
|
|
|
</script>
|
|
</html>
|