<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<!DOCTYPE html>
<html>
<head lang="en">
	<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
 	<%@include file="../../../../frame/assets/header-all.jsp"%>
	<style>
	.form-line .text-content{
		width:120px;
	}
	</style>
</head>
<body class="easyui-layout">
<form id="childform" class="easyui-form" data-options="novalidate:true">
	<input id="ruleid" type="hidden" />
	<input id="taskid" type="hidden" />
	<!-- <div class="form-line clearfix" >
		<div class="fl">
			<span class="text-content">*<em class="must"></em>规则名称：</span> 
			<input id="taskid" class="easyui-textbox" data-options="required:true,validType:'length[0,40]'" missingMessage="规则名称必填项" > 
		</div> 
		<div class="fl">
			<span class="text-content"><em class="must"></em>时间段：</span> 
			<input id="ruleruntime" class="easyui-textbox" data-options="required:false,validType:'length[0,20]'" missingMessage="时间段必填项" > 
		</div> 
		<div class="fl">
			<span class="text-content"><em class="must"></em>无信号开关：</span> 
			<input id="nosignalswitch" class="easyui-combobox" data-options="required:false,validType:'length[0,5]'" missingMessage="无信号检测开关必填项" > 
		</div> 
	</div> -->
	<div class="form-line clearfix">
		
		<div class="fl">
			<span class="text-content">
				<input id="imgclearswitch" class="checkStyle"  type="checkbox" checked="checked" >
				<em class="must"></em>清晰度峰值：
			</span> 
			<input id="imgclearupperlevel" class="easyui-textbox" data-options="required:false,validType:'length[0,20]'" missingMessage="图像清晰度检测下水位阀值必填项" > 
		</div> 
		<div class="fl">
			<span class="text-content"><em class="must"></em>清晰度谷值：</span> 
			<input id="imgclearunderlevel" class="easyui-textbox" data-options="required:false,validType:'length[0,20]'" missingMessage="图像清晰度检测上水位阀值必填项" > 
		</div>
	</div>
	<div class="form-line clearfix">
		<div class="fl">
			<span class="text-content">
				<input id="imgcontrastswitch" class="checkStyle"  type="checkbox" checked="checked" >
				<em class="must"></em>对比度峰值：
			</span> 
			<input id="imgcontrastupperlevel" class="easyui-textbox" data-options="required:false,validType:'length[0,20]'" missingMessage="图像对比度检测上水位阀值必填项" > 
		</div> 
		<div class="fl">
			<span class="text-content"><em class="must"></em>对比度谷值：</span> 
			<input id="imgcontrastunderlevel" class="easyui-textbox" data-options="required:false,validType:'length[0,20]'" missingMessage="图像对比度检测下水位阀值必填项" > 
		</div> 
	</div>
	<div class="form-line clearfix">
		<div class="fl">
			<span class="text-content">
				<input id="imglightswitch" class="checkStyle"  type="checkbox" checked="checked" >
				<em class="must"></em>亮度检峰值：
			</span> 
			<input id="imglightupperlevel" class="easyui-textbox" data-options="required:false,validType:'length[0,20]'" missingMessage="亮度检测高水位必填项" > 
		</div> 
		<div class="fl">
			<span class="text-content"><em class="must"></em>亮度检谷值：</span> 
			<input id="imglightunderlevel" class="easyui-textbox" data-options="required:false,validType:'length[0,20]'" missingMessage="亮度检测低水位必填项" > 
		</div>
	</div>
	<div class="form-line clearfix">
		<div class="fl">
			<span class="text-content"><em class="must"></em>偏色检测开关：</span> 
			<input id="imgcolorswitch" class="easyui-combobox" data-options="valueField:'id', textField:'text',panelHeight:'auto'" missingMessage="偏色检测开关必填项" > 
		</div> 
		<div class="fl">
			<span class="text-content"><em class="must"></em>颜色色偏：</span> 
			<input id="imgcolordeviation" class="easyui-textbox" data-options="required:false,validType:'length[0,20]'" missingMessage="颜色色偏必填项" > 
		</div> 
	</div>
	
	<div class="form-line clearfix">
		<div class="fl">
			<span class="text-content"><em class="must"></em>视频冻结检测开关：</span> 
			<input id="videofreezeswitch" class="easyui-combobox" data-options="valueField:'id', textField:'text',panelHeight:'auto'" missingMessage="视频冻结检测开关必填项" > 
		</div> 
		<div class="fl">
			<span class="text-content"><em class="must"></em>视频冻结程度：</span> 
			<input id="videofreezedegree" class="easyui-textbox" data-options="required:false,validType:'length[0,20]'" missingMessage="spdjcd必填项" > 
		</div> 
	</div>
	<div class="form-line clearfix">
		<div class="fl">
			<span class="text-content"><em class="must"></em>镜头抖动检测开关：</span> 
			<input id="videojitterswitch" class="easyui-combobox" data-options="valueField:'id', textField:'text',panelHeight:'auto'" missingMessage="镜头抖动检测开关必填项" > 
		</div> 
		<div class="fl">
			<span class="text-content"><em class="must"></em>镜头抖动程度：</span> 
			<input id="videojitterdegree" class="easyui-textbox" data-options="required:false,validType:'length[0,20]'" missingMessage="镜头抖动程度必填项" > 
		</div> 
	</div>
	<div class="form-line clearfix">
		<div class="fl">
			<span class="text-content"><em class="must"></em>视频剧变检测开关：</span> 
			<input id="videoupheavalswitch" class="easyui-combobox" data-options="valueField:'id', textField:'text',panelHeight:'auto'" missingMessage="视频剧变检测开关必填项" > 
		</div> 
		<div class="fl">
			<span class="text-content"><em class="must"></em>视频剧变程度：</span> 
			<input id="videoupheavaldegree" class="easyui-textbox" data-options="required:false,validType:'length[0,20]'" missingMessage="视频剧变程度必填项" > 
		</div> 
	</div>
	<div class="form-line clearfix">
		<div class="fl">
			<span class="text-content"><em class="must"></em>编码异常检测开关：</span> 
			<input id="videocodeerrorswitch" class="easyui-combobox" data-options="valueField:'id', textField:'text',panelHeight:'auto'" missingMessage="编码异常检测开关必填项" > 
		</div> 
		<div class="fl">
			<span class="text-content"><em class="must"></em>编码异常程度：</span> 
			<input id="videocodeerrordegree" class="easyui-textbox" data-options="required:false,validType:'length[0,20]'" missingMessage="编码异常程度必填项" > 
		</div> 
	</div>
	<div class="form-line clearfix">
		<div class="fl">
			<span class="text-content"><em class="must"></em>噪声检测开关：</span> 
			<input id="videonoiseswitch" class="easyui-combobox" data-options="valueField:'id', textField:'text',panelHeight:'auto'" missingMessage="噪声检测开关必填项" > 
		</div> 
		<div class="fl">
			<span class="text-content"><em class="must"></em>噪声雪花异常程度：</span> 
			<input id="videonoisedegree" class="easyui-textbox" data-options="required:false,validType:'length[0,20]'" missingMessage="噪声雪花异常程度必填项" > 
		</div> 
	</div>
	<div class="form-line clearfix">
		<div class="fl">
			<span class="text-content"><em class="must"></em>滚动条纹检测开关：</span> 
			<input id="videorollstripeswitch" class="easyui-combobox" data-options="valueField:'id', textField:'text',panelHeight:'auto'" missingMessage="稳定滚动条纹检测开关必填项" > 
		</div> 
		<div class="fl">
			<span class="text-content"><em class="must"></em>滚动条纹异常程度：</span> 
			<input id="videorollstropedegree" class="easyui-textbox" data-options="required:false,validType:'length[0,20]'" missingMessage="稳定滚动条纹异常程度必填项" > 
		</div> 
	</div>
	<div class="form-line clearfix">
		<div class="fl">
			<span class="text-content"><em class="must"></em>无信号开关：</span> 
			<input id="nosignalswitch" class="easyui-combobox" data-options="valueField:'id', textField:'text',panelHeight:'auto'" missingMessage="无信号检测开关必填项" > 
		</div> 
		<div class="fl">
			<span class="text-content"><em class="must"></em>备注：</span> 
			<input id="remarks" class="easyui-textbox" data-options="required:false,validType:'length[0,128]'" missingMessage="备注必填项" > 
		</div> 
	</div>

	<div class="form-line hidden">
		 
	</div>
</form>
</body>
</html>
<script type="text/javascript">
var winId	= $.getUrlParam("winId");
var taskid	= $.getUrlParam("taskid");
$("#taskid").val(taskid);
var records = top.$("#"+winId).panel("options").data;
var record = {};
if(records && records.length>0){
	record = records[0];
}
$(function(){
	//加载下拉选项
	initSelect();
	//初始化数据
	setTimeout(loadValue,500);
});
function loadValue(){
	console.log(record)
	if(JSON.stringify(record)!="{}"){
		$("#ruleid").val(record.ruleid);
//		$("#ruleruntime").textbox("setValue",record.ruleruntime);
		$("#nosignalswitch").combobox("setValue",record.nosignalswitch);
		if(record.imgclearswitch==1){
			$('#imgclearswitch').attr("checked",true); 
		}else{
			$('#imgclearswitch').attr("checked",false); 
			
		}
		if(record.imgcontrastswitch==1){
			$('#imgcontrastswitch').attr("checked",true); 
		}else{
			$('#imgcontrastswitch').attr("checked",false); 
			
		}
		if(record.imglightswitch==1){
			$('#imglightswitch').attr("checked",true); 
		}else{
			$('#imglightswitch').attr("checked",false); 
			
		}
		//$("#imgclearswitch").numberbox("setValue",record.imgclearswitch);
		$("#imgclearunderlevel").textbox("setValue",record.imgclearunderlevel);
		$("#imgclearupperlevel").textbox("setValue",record.imgclearupperlevel);
		//$("#imgcontrastswitch").numberbox("setValue",record.imgcontrastswitch);
		$("#imgcontrastunderlevel").textbox("setValue",record.imgcontrastunderlevel);
		$("#imgcontrastupperlevel").textbox("setValue",record.imgcontrastupperlevel);
		//$("#imglightswitch").numberbox("setValue",record.imglightswitch);
		$("#imglightunderlevel").textbox("setValue",record.imglightunderlevel);
		$("#imglightupperlevel").textbox("setValue",record.imglightupperlevel);
		$("#imgcolorswitch").combobox("setValue",record.imgcolorswitch);
		$("#imgcolordeviation").textbox("setValue",record.imgcolordeviation);
		$("#videofreezeswitch").combobox("setValue",record.videofreezeswitch);
		$("#videofreezedegree").textbox("setValue",record.videofreezedegree);
		$("#videojitterswitch").combobox("setValue",record.videojitterswitch);
		$("#videojitterdegree").textbox("setValue",record.videojitterdegree);
		$("#videoupheavalswitch").combobox("setValue",record.videoupheavalswitch);
		$("#videoupheavaldegree").textbox("setValue",record.videoupheavaldegree);
		$("#videocodeerrorswitch").combobox("setValue",record.videocodeerrorswitch);
		$("#videocodeerrordegree").textbox("setValue",record.videocodeerrordegree);
		$("#videonoiseswitch").combobox("setValue",record.videonoiseswitch);
		$("#videonoisedegree").textbox("setValue",record.videonoisedegree);
		$("#videorollstripeswitch").combobox("setValue",record.videorollstripeswitch);
		$("#videorollstropedegree").textbox("setValue",record.videorollstropedegree);
		$("#remarks").textbox("setValue",record.remarks);
		/* $("#createaccount").textbox("setValue",record.createaccount);
		$("#createtime").textbox("setValue",record.createtime);
		$("#modifyaccount").textbox("setValue",record.modifyaccount);
		$("#modifytime").textbox("setValue",record.modifytime);
		$("#extend1").textbox("setValue",record.extend1);
		$("#extend2").textbox("setValue",record.extend2);
		$("#extend3").textbox("setValue",record.extend3);
		$("#extend4").textbox("setValue",record.extend4);
 */
	}else{
		
	}
}
function initSelect(){
	var switchArr = [{"id":"0","text":"关闭" ,"selected":true},{"id":"1","text":"打开"}];
	$("#nosignalswitch").combobox( "loadData", switchArr);
	$("#imgcolorswitch").combobox( "loadData", switchArr);
	$("#videorollstripeswitch").combobox("loadData", switchArr);
	$("#videonoiseswitch").combobox("loadData", switchArr);
	$("#videocodeerrorswitch").combobox("loadData",switchArr);
	$("#videoupheavalswitch").combobox("loadData",switchArr);
	$("#videojitterswitch").combobox("loadData",switchArr);
	$("#videofreezeswitch").combobox("loadData",switchArr);
	$("#imgcolorswitch").combobox("loadData",switchArr); 
}
/*
var xx1 = $("#xx1").textbox("getValue");//文本
var xx2 = $("#xx2").combobox("getValue");//下拉
var xx3 = $("#xx3").datetimebox("getValue");//日期
var xx4 = $("#xx4").numberbox("getValue");//数字
$('#xx5').combobox({  
	url:'xtclAction!select_Xtcl.do?csdl=xx5&page=1&rows=1000', 
	textField:"csmc",  
	valueField:"csdm",
	panelWidth:148,
	loadFilter:function(data){
		//data.unshift({"csmc":"选择","csdm":""});
		return data;
	}
});
$("#xx6").textbox("setValue",records.xx6);
$("#xx7").combobox("setValue",records.xx7);
$("#xx8").combobox("setValue",records.xx8);
$("#xx9").datetimebox("setValue",$.getNowTime());
$("#xx10").datetimebox("setValue",$.getTodayStart('00:00:00',-3));//往前推3天  +'00:00:00'
$("#xx11").datetimebox("setValue",$.getTodayEnd());//当天 +'23:59:59'	
$("#xx12").datetimebox("setValue",$.getDateNumToStr(records.xx12));
$("#xx13").numberbox("setValue",records.xx13);
*/
//插入规则
parent.parent.$(".l-btn-text").on("click",function(){ 
	if($(this).text()=="关闭"){
		return;
	}
	var insertParam = {};
	insertParam.remarks = $("#remarks").val();
	insertParam.ruleid = $("#ruleid").val();
	insertParam.taskid = $("#taskid").val();
	
	insertParam.nosignalswitch = $("#nosignalswitch").val();
	
	insertParam.videorollstripeswitch = $("#videorollstripeswitch").val();
	insertParam.videorollstropedegree = $("#videorollstropedegree").val();
	
	insertParam.videonoiseswitch = $("#videonoiseswitch").val();
	insertParam.videonoisedegree = $("#videonoisedegree").val();
	
	insertParam.videocodeerrorswitch = $("#videocodeerrorswitch").val();
	insertParam.videocodeerrordegree = $("#videocodeerrordegree").val();
	
	insertParam.videoupheavalswitch = $("#videoupheavalswitch").val();
	insertParam.videoupheavaldegree = $("#videoupheavaldegree").val();
	//镜头抖动
	insertParam.videojitterswitch = $("#videojitterswitch").val();
	insertParam.videojitterdegree = $("#videojitterdegree").val();
	//视频冻结
	insertParam.videofreezeswitch = $("#videofreezeswitch").val();
	insertParam.videofreezedegree = $("#videofreezedegree").val();
	//偏色检测
	insertParam.imgcolorswitch = $("#imgcolorswitch").val();
	insertParam.imgcolordeviation = $("#imgcolordeviation").val();
	
	//亮度
	if($("#imglightswitch").prop("checked",this.checked)){
		insertParam.imgcolorswitch = 1;
	}else{
		insertParam.imgcolorswitch = 0;
	}
	insertParam.imglightupperlevel = $("#imglightupperlevel").val();
	insertParam.imglightunderlevel = $("#imglightunderlevel").val();
	//对比度
	if($("#imgcontrastswitch").prop("checked",this.checked)){
		insertParam.imgcontrastswitch = 1;
	}else{
		insertParam.imgcontrastswitch = 0;
	}
	insertParam.imgcontrastupperlevel = $("#imgcontrastupperlevel").val();
	insertParam.imgcontrastunderlevel = $("#imgcontrastunderlevel").val();
	//清晰度
	if($("#imgclearswitch").prop("checked",this.checked)){
		insertParam.imgclearswitch = 1;
	}else{
		insertParam.imgclearswitch = 0;
	}
	insertParam.imgclearupperlevel = $("#imgclearupperlevel").val();
	insertParam.imgclearunderlevel = $("#imgclearunderlevel").val();
	
	
	$.ajax({
		type:'post',
		dataType : 'json',
		url:'ywvideotaskruleAction!insert_Ywvideotaskrule.do',
		data:insertParam,
		success:function(value){
			if(value=="success"){
				$.showMsg("操作成功！");
				top.$("#"+winId).dialog('close');
			}else if(value=="same"){
				$.showMsg("已存在！");
			}else{
				$.showMsg("操作失败！");
			}
		}
	});
	
});
</script>
