物联网平台 +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.
 
 
 
 

322 lines
12 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>
<%@ include file="/WEB-INF/oss/iot/common/variable.jsp"%>
<%@ include file="/WEB-INF/oss/iot/common/variable_js.jsp"%>
<%@ include file="/WEB-INF/oss/iot/common/resource_lib.jsp"%>
<link rel="stylesheet" type="text/css" href="<%=basePath%>/lib/radioLib/jquery-labelauty.css"/>
<script type="text/javascript" src="<%=basePath%>/lib/radioLib/jquery-labelauty.js"></script>
<style type="text/css">
#map {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}
.mapContainer{
height: 550px;width:100%;
}
.dashboard-menu{
border-top:1px solid #ecf0f5;
}
.app-container{
background: #f2f2f2;width: 100%;border-top:1px solid #ecf0f5;
}
.box-white {
width: 97%;
min-width: 897px;
padding-bottom: 0;
margin: 0 auto;
}
.box {
padding: 10px;
padding-top:1px;
border-left: 1px solid #d2d6de;
border-right: 1px solid #d2d6de;
border-bottom: 1px solid #d2d6de;
}
.box {
border: 0!important;
box-shadow: 0 0 2px 1px rgba(13,5,9,.08)!important;
}
.box {
position: relative;
border-radius: 3px;
background: #fff;
border-top: 3px solid #d2d6de;
margin-bottom: 20px;
/* width: 100%; */
width:800px;
margin: 0 auto;
box-shadow: 0 1px 1px rgba(0,0,0,.1);
}
.sceneList-info{
padding-top: 10px;
padding-left: 10px;
}
.p-title{
padding: 20px 0;
font-size: 20px;
margin-left: -50px;
}
ul.dowebok { list-style-type: none ;}
.dowebok li { display: inline-block; margin-right: 10px;}
input.labelauty + label { font: 12px "Microsoft Yahei";}
</style>
</head>
<body>
<div>
<div style="background: #ecf0f5;">
<div class="mapContainer" >
<div class="app-container">
<div class="container-layout sceneList-info">
<div class="box join-device-box">
<div class="clearfix" style="width: 600px;margin: 0 auto;">
<div>
<p class="p-title">添加触发器信息</p>
</div>
<div id="add-trigger" config-option=" url:'/deviceTemplateTiggerInfo',
submit:'.save-Btn',success:'sunccessReturn'">
<div id="modify-trigger"
config-option="url:'/deviceTemplateTiggerInfo',method:'put',submit:'.save-Btn',success:'sunccessReturn'">
<div id="detail_get" config-option=" 'url':'/deviceTemplateTiggerInfo?id=$#init-id$' ,'success':'initTrigger' ">
<input type="hidden" type-name="id" id="init-id" >
<input type="hidden" type-name="device_template_id" class="device_template_id">
<div class="form-line">
<span class="red">*</span>&nbsp;<span>触发器名称:</span>
<div class="pb-10 pt-10">
<input placeholder="触发器名称" validate="empty:请输入名称" type-name="name" class="input input-big " >
</div>
</div>
<div class="form-line">
<span class="red">*</span>&nbsp;<span>关联传感器:</span>
<div class="pb-10 pt-10">
<select type-name="from_sensor_id" validate="empty:选择关联传感器"
config-option=" 'url':'/page/deviceTemplateSensorInfo?paged=1&pageSize=100','key':'id',
'value':'name','init_value':'请选择传感器',data:{ device_template_id:'$.device_template_id$' } " class="input input-select input-big jui-selecter" ></select>
</div>
</div>
<div class="form-line">
<span class="red">*</span>&nbsp;<span>条件类型:</span>
<div class="pb-10 pt-10">
<select type-name="iot_trigger_condition_type" onchange="conditionChange(this);" validate="empty:条件类型"
config-option="'method':'GET','url':'/dictionary/28','key':'code','value':'name',
'init_value':'请选择传感器类型','type':'list' " class="input input-big input-select jui-selecter" ></select>
</div>
</div>
<input type="hidden" type-name="condition_params" >
<div class="form-line x-type hide ">
<span>X:</span>
<div class="pb-10 pt-10">
<input placeholder="X" class="input input-big condition_params" >
</div>
</div>
<div class="form-line y-type hide">
<span>Y:</span>
<div class="pb-10 pt-10">
<input placeholder="Y" class="input input-big condition_params" >
</div>
</div>
<div class="form-line m-type hide ">
<span>M:</span>
<div class="pb-10 pt-10">
<input placeholder="M" class="input input-big condition_params" >
</div>
</div>
<input type="hidden" type-name="iot_trigger_action_type" >
<div class="form-line">
<span>动作类型:</span>
<div class="pb-10 pt-10">
<div class="clearfloat multi-checkbox" >
<ul class="dowebok">
</ul>
</div>
</div>
</div>
<input type="hidden" type-name="action_params" >
<div class="form-line contactuserInfo-type hide">
<span>联系人信息:</span>
<div class="pb-10 pt-10">
<select type-option="selecter"
config-option=" 'url':'/page/contact/user/info?paged=1&pageSize=100','key':'id',
'value':'name','init_value':'请选择联系人' " class="input input-big input-select action_params" ></select>
</div>
</div>
<div class="form-line device_type hide">
<span class="red">*</span>&nbsp;<span>联控设备:</span>
<div class="pb-10 pt-10">
<select config-option=" url:'/page/deviceTemplateSensorInfo?paged=1&pageSize=100',key:'id',
value:'name',init_value:'请选择联控设备',data:{ device_template_id:'$.device_template_id$' ,iot_sensor_type:27 } " class="input input-select input-big action_params control_device jui-selecter" ></select>
</div>
</div>
<div class="form-line device_type hide">
<span class="red">*</span>&nbsp;<span>联控设备动作:</span>
<div class="pb-10 pt-10">
<select type-option="selecter"
config-option="'method':'GET','url':'/dictionary/35',
'key':'code','value':'name','type':'list' " class="input input-big action_params input-select" ></select>
</div>
</div>
<div class="form-line">
<span class="red">*</span>&nbsp;<span>发送报警信息:</span>
<div class="pb-10 pt-10">
<select type-name="iot_trigger_alarm_flag" onchange="sendAlarmInfo(this);" validate="empty:报警信息" type-option="selecter"
config-option="'method':'GET','url':'/dictionary/35','key':'code','value':'name',
'type':'list' ,'default_value':'37' " class="input input-big input-select" ></select>
</div>
</div>
<div class="form-line alarm-level hide">
<span>报警级别:</span>
<div class="pb-10 pt-10">
<select type-name="iot_trigger_alarm_level" type-option="selecter"
config-option="'method':'GET','url':'/dictionary/38','key':'code','value':'name','type':'list' " class="input input-big input-select" ></select>
</div>
</div>
<div class="form-line">
<span>间隔检测时间:</span>
<div class="pb-10 pt-10">
<input placeholder="间隔时间" validate="num:请输入数字" value="30" type-name="trigger_inteval_time" class="input input-big">
</div>
</div>
<div class="form-line clearfix" style="padding-bottom: 20px;">
<button onclick="returnBack()" class="cancel-btn button ml-20 border-gray button-big float-right">取消</button>
<button class="save-Btn button bg-iot ml-10 button-big float-right">保存</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="height: 40px;"></div>
</div>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
function sunccessReturn(){
forwardUrl("/iot/template_trigger_list?id="+GetQueryString("id"),1000,"保存成功");
}
function returnBack(){
forwardUrl('/iot/template_trigger_list?id='+GetQueryString("id"));
}
$(function(){
// 初始化url参数
var id = GetQueryString("id");
$(".device_template_id").val(id);
var tid = GetQueryString("tid");
if(validater.empty(tid)){
manual_form_submit($("#add-trigger"))
}else{
$(".p-title").html("编辑触发器信息");
writeVal("init-id",tid);
manual_form_submit($("#modify-trigger"));
setTimeout(function(){
manual_init_detail_get($("#detail_get"));
}, 150);
}
domAjaxInit({
'url':'/dictionary/49',
'method':'GET',
'selector' :'.dowebok',
'getContent':function(obj){
return '<li><input type="checkbox" class="actionTypeCheckBox" tag="'+ obj.code +'" name="checkbox" data-labelauty="'+ obj.name +'"></li>';
},
'success':function(){
$('.multi-checkbox input').labelauty();
}
});
})
$(document).delegate(".actionTypeCheckBox","click",function(){
var tmp = selArrayVal("#add-trigger input.actionTypeCheckBox");
gic("iot_trigger_action_type","#add-trigger").val( tmp );
if(tmp.indexOf('50') >-1 ){
$("#add-trigger .device_type").show();
}else{
$("#add-trigger .device_type").hide();
}
if(tmp.indexOf('51')>-1 || tmp.indexOf('52')>-1 || tmp.indexOf('53')>-1 ){
$("#add-trigger .contactuserInfo-type").show();
}else{
$("#add-trigger .contactuserInfo-type").hide();
}
});
function initTrigger(obj){
var val = obj.data.iot_trigger_condition_type ;
condition_code(val);
// 值初始化
wrtArrayVal(obj.data.condition_params,"#modify-trigger .form-line input.condition_params");
var trigger_types = obj.data.iot_trigger_action_type.split(",");
for(var i=0;i<trigger_types.length;i++){
$("input[tag='"+ trigger_types[i] +"']").attr("checked",true);
}
var tmp = gic("iot_trigger_action_type","#modify-trigger").val();
if(tmp.indexOf('50') >-1 ){
$("#modify-trigger .device_type").show();
}else{
$("#modify-trigger .device_type").hide();
}
if(tmp.indexOf('51')>-1 || tmp.indexOf('52')>-1 || tmp.indexOf('53')>-1 ){
$("#modify-trigger .contactuserInfo-type").show();
}else{
$("#modify-trigger .contactuserInfo-type").hide();
}
wrtArrayVal(obj.data.action_params,"#modify-trigger .action_params");
if(obj.data.iot_trigger_alarm_flag == 36){
$(".alarm-level").show();
gsc("iot_trigger_alarm_level").val(obj.data.iot_trigger_alarm_level);
}
}
function conditionChange(obj){
$(".x-type,.y-type,.m-type").hide();
var val = $(obj).val() ;
condition_code(val);
}
function condition_code(val){
if(val == 29){
$(".x-type").show();
}else if(val == 30){
$(".y-type").show();
}else if(val == 31){
$(".x-type,.y-type").show();
}else if(val == 32){
$(".x-type").show();
}else if(val == 33){
$(".x-type,.m-type").show();
}else if(val == 34){
$(".x-type,.m-type").show();
}
}
// 执行参数变化的时候,将执行参数记录下来
$(document).delegate("#add-trigger .action_params","change",function(){
var tmp = selArrayVal("#add-trigger .form-line select.action_params",'sel');
gic("action_params","#add-trigger").val( tmp );
});
// condition_paran 有变化时候,记录到隐藏域中
$(document).delegate("#add-trigger .condition_params","change",function(){
var tmp = selArrayVal("#add-trigger .form-line input.condition_params",'sel');
gic("condition_params","#add-trigger").val( tmp );
});
function sendAlarmInfo(obj){
$(".alarm-level").hide();
if($(obj).val()==36){
$(".alarm-level").show();
}
}
</script>
</html>