<%@ 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="alarmruleid" type="hidden" />
	<div class="form-line clearfix" >
		<div class="fl">
			<span class="text-content"><em class="must">*</em>告警规则名称：</span> 
			<input id="alarmrulename" 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="alarmgrade" class="easyui-numberbox" data-options="required:false,validType:'length[0,10]'" missingMessage="告警等级必填项" > 
		</div> 
	</div>
	<div class="form-line clearfix">
		<div class="fl">
			<span class="text-content"><em class="must">*</em>告警来源：</span> 
			<input id="alarmsource" class="easyui-combobox" data-options="required:false,validType:'length[0,10]'" missingMessage="告警来源必填项" > 
		</div> 
		<div class="fl">
			<span class="text-content"><em class="must">*</em>告警类型：</span> 
			<input id="alarmtype" class="easyui-combobox" data-options="multiple:true"  > 
		</div> 		
	</div>
	
	<div class="form-line clearfix">
		<div class="fl">
			<span class="text-content"><em class="must"></em>告警时触发：</span> 
			<input id="alarmtrigger" class="easyui-combobox" data-options="required:false,validType:'length[0,10]'" missingMessage="告警时触发必填项" > 
		</div> 
		<div class="fl">
			<span class="text-content"><em class="must"></em>消警时触发：</span> 
			<input id="unalarmtrigger" class="easyui-combobox" data-options="required:false,validType:'length[0,10]'" missingMessage="消警时触发必填项" > 
		</div> 
	</div>
	<!-- <div class="form-line clearfix">
		<div class="fl">
			<span class="text-content"><em class="must"></em>自动销警间隔时间：</span> 
			<input id="autounalarmtime" class="easyui-numberbox" data-options="required:false,validType:'length[0,10]'" missingMessage="自动销警间隔时间必填项" > 
		</div> 
		<div class="fl">
			<span class="text-content"><em class="must"></em>最大告警次数：</span> 
			<input id="alarmmaxcount" class="easyui-numberbox" data-options="required:false,validType:'length[0,10]'" missingMessage="最大告警次数必填项" > 
		</div> 
	</div> -->
	<!-- <div class="form-line clearfix">
		<div class="fl">
			<span class="text-content"><em class="must"></em>通知客户端：</span> 
			<input id="noticeclient" class="easyui-numberbox" data-options="required:false,validType:'length[0,10]'" missingMessage="通知客户端必填项" > 
		</div> 
		<div class="fl">
			<span class="text-content"><em class="must"></em>通知短信：</span> 
			<input id="noticesms" class="easyui-numberbox" data-options="required:false,validType:'length[0,10]'" missingMessage="通知短信必填项" > 
		</div> 
	</div>
	<div class="form-line clearfix">
		<div class="fl">
			<span class="text-content"><em class="must"></em>通知邮件：</span> 
			<input id="noticeemail" class="easyui-numberbox" data-options="required:false,validType:'length[0,10]'" missingMessage="通知邮件必填项" > 
		</div> 
		<div class="fl">
			<span class="text-content"><em class="must"></em>通知录像：</span> 
			<input id="noticerecord" class="easyui-numberbox" data-options="required:false,validType:'length[0,10]'" missingMessage="通知录像必填项" > 
		</div> 
	</div>
	<div class="form-line clearfix">
		<div class="fl">
			<span class="text-content"><em class="must"></em>通知上墙：</span> 
			<input id="noticeupwall" class="easyui-numberbox" data-options="required:false,validType:'length[0,10]'" missingMessage="通知上墙必填项" > 
		</div> 
		<div class="fl">
			<span class="text-content"><em class="must"></em>通知抓拍：</span> 
			<input id="noticesnap" class="easyui-numberbox" data-options="required:false,validType:'length[0,10]'" missingMessage="通知抓拍必填项" > 
		</div> 
	</div>
	<div class="form-line clearfix">
		<div class="fl">
			<span class="text-content"><em class="must"></em>通知输出：</span> 
			<input id="noticeputput" class="easyui-numberbox" data-options="required:false,validType:'length[0,10]'" missingMessage="通知输出必填项" > 
		</div> 
		<div class="fl">
			<span class="text-content"><em class="must"></em>通知云台：</span> 
			<input id="noticecloundplat" class="easyui-numberbox" data-options="required:false,validType:'length[0,10]'" missingMessage="通知云台必填项" > 
		</div> 
	</div>
	<div class="form-line clearfix">
		<div class="fl">
			<span class="text-content"><em class="must"></em>语音播报开关：</span> 
			<input id="voiceswitch" class="easyui-numberbox" data-options="required:false,validType:'length[0,10]'" missingMessage="语音播报开关必填项" > 
		</div> 
		<div class="fl">
			<span class="text-content"><em class="must"></em>语音播报内容：</span> 
			<input id="voicecontent" class="easyui-textbox" data-options="required:false,validType:'length[0,128]'" missingMessage="语音播报内容必填项" > 
		</div> 
	</div>
	<div class="form-line clearfix">
		<div class="fl">
			<span class="text-content"><em class="must"></em>手机号码：</span> 
			<input id="phonenum" class="easyui-textbox" data-options="required:false,validType:'length[0,128]'" missingMessage="手机号码必填项" > 
		</div> 
		<div class="fl">
			<span class="text-content"><em class="must"></em>短信内容：</span> 
			<input id="smscontent" class="easyui-textbox" data-options="required:false,validType:'length[0,512]'" missingMessage="短信内容必填项" > 
		</div> 
	</div> -->
	<div class="form-line clearfix">
		<div class="fl">
			<span class="text-content"><em class="must"></em>是否启用：</span> 
			<input id="isenable" class="easyui-combobox" data-options="required:false,validType:'length[0,10]'" missingMessage="是否启用必填项" > 
		</div> 		
	</div>
	
	<div class="form-line clearfix">
		<div class="fl">
			<span class="text-content"><em class="must"></em>备注：</span> 
			<textarea id="remarks" style="width:441px;height:80px"> </textarea> 
		</div> 		
	</div>


	<div class="form-line hidden">
		 
	</div>
</form>
</body>
</html>
<script type="text/javascript">
var winId	= $.getUrlParam("winId");
var records = top.$("#"+winId).panel("options").data;
$(function(){
	var type = "";
	//加载下拉选项
	$('#isenable').combobox({
		 url:'xtclAction!query_Xtcl.do?csdl=ywTaskEnable',
		 textField:"csmc",  
		 valueField:"csdm",
		 panelWidth:148,
		 value:"1" 
	});
	$('#alarmsource').combobox({
		 url:'xtclAction!query_Xtcl.do?csdl=ywAlarmRuleSource',
		 textField:"csmc",  
		 valueField:"csdm",
		 panelWidth:148,
		 value:"1" 
	});
	
	/* $('#alarmtype').combobox({
		 url:'xtclAction!query_Xtcl.do?csdl=ywAlarmVideoType',
		 textField:"csmc",  
		 valueField:"csdm",
		 panelWidth:148,
		 value:"1" 
	}); */
	$('#alarmtype').combobox({
		 data : $.obj2ary(CommonData.jkgj),
		 textField:1,  
		 valueField:0,
		 panelWidth:148,
		 value:"2" 
	});
	
	$("#alarmsource").combobox({		
		onChange: function (n,o) {			
			if(n==1){   		//监控告警
				type = 'ywAlarmVideoType';
			}else if(n==2){		//服务器告警
				type = 'ywAlarmMachineType';
			}else if(n==3){		//应用系统告警
				type = 'ywAlarmSoftWareType';
			}else if(n==4){		//存储告警
				type = 'ywAlarmStorageType';
			}
//console.log("下拉改变：",n,o);	

			if(n==1){
				$('#alarmtype').combobox({
					 data : $.obj2ary(CommonData.jkgj),
					 textField:1,  
					 valueField:0,
					 panelWidth:148,
					 value:"2" 
				});
			}else if(n==2){
				$('#alarmtype').combobox({  
					 data : $.obj2ary(CommonData.fwqgj),  
					 textField:1,  
					 valueField:0,
					 panelWidth:148,
					 value:"2" 
				});
			}else if(n==3){
				$('#alarmtype').combobox({  
					 data : $.obj2ary(CommonData.yyxtgj),  
					 textField:1,  
					 valueField:0,
					 panelWidth:148,
					 value:"1" 
				});
			}else if(n==4){
				$('#alarmtype').combobox({  
					 data : $.obj2ary(CommonData.ccgj),  
					 textField:1,  
					 valueField:0,
					 panelWidth:148,
					 value:"1" 
				});
			}
			
			/* $('#alarmtype').combobox({
				 url:'xtclAction!query_Xtcl.do?csdl='+type+'',
				 textField:"csmc",  
				 valueField:"csdm",
				 panelWidth:148,
				 value:"1" 
			}); */
		}
	});
	
	
	$('#alarmtrigger').combobox({
		 url:'xtclAction!query_Xtcl.do?csdl=enable',
		 textField:"csmc",  
		 valueField:"csdm",
		 panelWidth:148,
		 value:"1" 
	});
	
	$('#unalarmtrigger').combobox({
		 url:'xtclAction!query_Xtcl.do?csdl=enable',
		 textField:"csmc",  
		 valueField:"csdm",
		 panelWidth:148,
		 value:"1" 
	});
	
	$('#alarmgrade').combobox({
		 url:'xtclAction!query_Xtcl.do?csdl=ywAlarmRuleLevel',
		 textField:"csmc",  
		 valueField:"csdm",
		 panelWidth:148,
		 value:"1" 
	});
	
	
	setTimeout(loadValue,500);
});
function loadValue(){
	if(records){
		$("#alarmruleid").val(records.alarmruleid);
		$("#alarmrulename").textbox("setValue",records.alarmrulename);
		$("#alarmsource").combobox("setValue",records.alarmsource);
	//	$("#alarmtype").combobox("setValue",records.alarmtype);
		$("#alarmtype").combobox("setValue",records.alarmtype.split(","));
		$("#alarmdeviceid").numberbox("setValue",records.alarmdeviceid);
		$("#alarmgrade").combobox("setValue",records.alarmgrade);
		$("#isenable").combobox("setValue",records.isenable);
		$("#alarmtrigger").combobox("setValue",records.alarmtrigger);
		$("#unalarmtrigger").combobox("setValue",records.unalarmtrigger);
		$("#autounalarmtime").numberbox("setValue",records.autounalarmtime);
		$("#alarmmaxcount").numberbox("setValue",records.alarmmaxcount);
		$("#noticeclient").numberbox("setValue",records.noticeclient);
		$("#noticesms").numberbox("setValue",records.noticesms);
		$("#noticeemail").numberbox("setValue",records.noticeemail);
		$("#noticerecord").numberbox("setValue",records.noticerecord);
		$("#noticeupwall").numberbox("setValue",records.noticeupwall);
		$("#noticesnap").numberbox("setValue",records.noticesnap);
		$("#noticeputput").numberbox("setValue",records.noticeputput);
		$("#noticecloundplat").numberbox("setValue",records.noticecloundplat);
		$("#voiceswitch").numberbox("setValue",records.voiceswitch);
		$("#voicecontent").textbox("setValue",records.voicecontent);
		$("#phonenum").textbox("setValue",records.phonenum);
		$("#smscontent").textbox("setValue",records.smscontent);
		$("#createaccount").textbox("setValue",records.createaccount);
		$("#createtime").textbox("setValue",records.createtime);
		$("#modifyaccount").textbox("setValue",records.modifyaccount);
		$("#modifytime").textbox("setValue",records.modifytime);
//		$("#remarks").textbox("setValue",records.remarks);
		$("#extend1").textbox("setValue",records.extend1);
		$("#extend2").textbox("setValue",records.extend2);
		$("#extend3").textbox("setValue",records.extend3);
		$("#extend4").textbox("setValue",records.extend4);
		$("#remarks").val(records.remarks);
	}else{
		
	}
}

</script>
