<%@ 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: 130px;
		}
		.formTitle{
			margin:20px 10px 10px 10px;
		}
		.input-addimg {
	    	margin-left: 255px;
		}
		
	</style>
	
	<script type="text/javascript">
		var winId	= $.getUrlParam("winId") ,ptxzTree;
		var records = top.$("#"+winId).panel("options").data;
		var sbbh	= $.getUrlParam("sbbh");
		$(function(){
			initdefault();
			loadValue();
		});		
		function  initdefault(){
			$.ajax({
				 type:"post",
				 dataType : "json",
				 async:"true",
				 url:"ptxzsAction!query_Ptxzs.do",
				 success:function(data){
					ptxzTree = $("#xzbh").combotree({
						 checkbox:false,
					     border:false,
					     parentField:"sjxzbh",
					   	 textFiled:"xzmc",
					   	 idFiled:"xzbh",
					   	 data:data,
					   	 panelWidth:148,
					     onLoadSuccess:function(node,data){
							if(records && records.xzbh){
								$("#xzbh").combotree("setValue",records.xzbh || "").combotree("setText",records.xztreename || "");
								return ;
							}
					    	if(data){
								$("#xzbh").combotree("setValue",  data[0].xzbh).combotree("setText", data[0].xzmc);
							}
					     },
						 onClick: function(node){
							//$("#xzbh").combotree("setValue",node.xzbh).combotree("setText", node.xzmc);
						 }
					}); 
				 }
			 });			
			$("#sbzt").combobox({//设备状态
				 url:"xtclAction!query_Xtcl.do?csdl=vdState", 
				 textField:"csmc",  
				 valueField:"csdm",
				 panelWidth:148,
				 onLoadSuccess:function(){
					 !!records || $("#sbzt").combobox("setValue",0);
				 }
			});			
			$("#tdlx").combobox({ //通道类型
				 url:"xtclAction!query_Xtcl.do?csdl=channelSmallType",
				 textField:"csmc",  
				 valueField:"csdm",
				 panelWidth:148,
				 onLoadSuccess:function(){
					 !!records || $("#tdlx").combobox("setValue",1);
				 }				 
			});			
			$("#spbmgs").combobox({//视频编码格式
				 url:"xtclAction!query_Xtcl.do?csdl=encodeFormat",
				 textField:"csmc",  
				 valueField:"csdm",
				 panelWidth:148,
				 onLoadSuccess:function(){
					 !!records || $("#spbmgs").combobox("setValue",1);
				 } 
			});				 
			$("#lxfs").combobox({//录像方式
				 url:"xtclAction!query_Xtcl.do?csdl=recordMethod",
				 textField:"csmc",  
				 valueField:"csdm",
				 panelWidth:148,
				 onLoadSuccess:function(){
					 !!records || $("#lxfs").combobox("setValue",0);
				 } 
			});			
			$("#tdzt").combobox({//通道状态
				 url:"xtclAction!query_Xtcl.do?csdl=channelState",
				 textField:"csmc",  
				 valueField:"csdm",
				 panelWidth:148,
				 onLoadSuccess:function(){
					 !!records || $("#tdzt").combobox("setValue",0);
				 } 
			});			
			$("#sfzcptzkz").combobox({//支持ptz控制
				 url:"xtclAction!query_Xtcl.do?csdl=supportControl",
				 textField:"csmc",  
				 valueField:"csdm",
				 panelWidth:148,
				 onLoadSuccess:function(){
					 !!records || $("#sfzcptzkz").combobox("setValue",0);
				 } 
			});			
			$("#zxcczbh").combobox({
				 url:'ptlxccqzAction!query_Ptlxccqz.do',
				 textField:"zms",  
				 valueField:"zbh",
				 panelWidth:148
			})	
			$("#sqms").combobox({
				 url:"xtclAction!query_Xtcl.do?csdl=mediaWallMode",
				 textField:"csmc",  
				 valueField:"csdm",
				 panelWidth:148,
				 onLoadSuccess:function(){
					
				 } 
			})	
			$("#lxmlxz").combobox({
				 url:"xtclAction!query_Xtcl.do?csdl=recordMdeiaType",
				 textField:"csmc",  
				 valueField:"csdm",
				 panelWidth:148,
				 onLoadSuccess:function(){
					 !!records || $("#lxmlxz").combobox("setValue",0);
				 } 
			})	
			$("#lxlrcyfs").combobox({
				 url:"xtclAction!query_Xtcl.do?csdl=recordStoreType",
				 textField:"csmc",  
				 valueField:"csdm",
				 panelWidth:148,
				 onLoadSuccess:function(){
					 !!records || $("#lxlrcyfs").combobox("setValue",0);
				 } 
			})
		}		
	function loadValue(){
			if(records){
				$("#sfzcptzkz").combobox("setValue",records.sfzcptzkz).combobox("setText",records.sfzcptzkz == 0  ?"是" : "否");
				if(records.tdzt === ""){
					records.tdztname = "请选择";
				}else if( records.tdzt == 0){
					records.tdztname = "启用";	
				}else {
						records.tdztname = "停用";
				}				
				$("#tdzt").combobox("setValue",records.tdzt).combobox("setText",records.tdztname || "");
			    $("#ssspsfzzf").combobox("setValue",records.ssspsfzzf || "").combobox("setText",records.tdtypename || "");
			    $("#tdlx").combobox("setValue",records.tdlx ||"").combobox("setText", records.tdlx == 0 ? "是 " : "否");
			    $("#spbmgs").combobox("setValue",records.spbmgs).combobox("setText",records.encodeformat);
				$("#lxfs").combobox("setValue",records.lxfs).combobox("setText",records.recordmethod);			    
				$("#sbbh").textbox("setValue",records.sbbh);
				$("#tdbh").textbox("setValue",records.tdbh);
				$("#wbbh").textbox("setValue",records.wbbh);
				$("#tdmc").textbox("setValue",records.tdmc);
				$("#tdazwz").textbox("setValue",records.tdazwz);
				$("#jd").textbox("setValue",records.jd);
				$("#wd").textbox("setValue",records.wd);
				$("#tpwzx").textbox("setValue",records.tpwzx);
				$("#tpwzy").textbox("setValue",records.tpwzy);				
				$("#spxsgs").textbox("setValue",records.spxsgs);
				$("#lxzt").textbox("setValue",records.lxzt);			
				$("#lxsfzzf").textbox("setValue",records.lxsfzzf);
				$("#spzl").textbox("setValue",records.spzl);
				$("#gjzjg").textbox("setValue",records.gjzjg);
				$("#ml").textbox("setValue",records.ml);
				$("#spmlyxgs").textbox("setValue",records.spmlyxgs);
				$("#zxccxe").textbox("setValue",records.zxccxe);
				$("#zxccyyrl").textbox("setValue",records.zxccyyrl);
				$("#zxccsyrl").textbox("setValue",records.zxccsyrl);
				$("#lxblts").textbox("setValue",records.lxblts);
				$("#sfqy").textbox("setValue",records.sfqy);
				//$("#jlbh").textbox("setValue",records.jlbh);
				$("#fxms").textbox("setValue",records.fxms);
				$("#jbms").textbox("setValue",records.jbms);
				$("#ggbh").textbox("setValue",records.ggbh);
				$("#znbh").textbox("setValue",records.znbh);				
				$("#jpkzdh").textbox("setValue",records.jpkzdh);
				$("#jdpx").textbox("setValue",records.jdpx);
				$("#sfznfxjd").textbox("setValue",records.sfznfxjd);
				$("#znfxlx").textbox("setValue",records.znfxlx);
				$("#sqms").textbox("setValue",records.sqms);
				$("#squrllj").textbox("setValue",records.squrllj);
				$("#ssmlxz").textbox("setValue",records.ssmlxz);
				$("#lxmlxz").textbox("setValue",records.lxmlxz);
				$("#zburllj").textbox("setValue",records.zburllj);
				$("#zbdk").textbox("setValue",records.zbdk); 
				$("#sfzlx").textbox("setValue",records.sfzlx);
				$("#sfzx").textbox("setValue",records.sfzx);
				$("#hb").textbox("setValue",records.hb);
				$("#jmcj").textbox("setValue",records.jmcj);
				$("#sj").textbox("setValue",records.sj);
				$("#khdosdxsnr").textbox("setValue",records.khdosdxsnr);
				$("#khdosdxswz").textbox("setValue",records.khdosdxswz);
				$("#zxcczbh").combobox("setValue",records.zxcczbh).combobox("setText",records.zxcczmc);		
				$("#lxlrcyfs").combobox("setValue",records.lxlrcyfs);			   
			}else{
				$("#sbbh").textbox("setValue",sbbh);
				$.ajax({
					 type:"post",
					 dataType : "json",
					 url:"sbtdspsrAction!getMaxtVideoInNumbysbbh.do",
					 data:{sbbh:sbbh},
					 success:function(value){
						 if(!!value){
							 $("#tdbh").textbox("setValue",value);
						 }
					 }
				 });
			}
		}	
		var mapWin;
		//选择地图位置
		function selectMapLocation(){
			var url = "";
			if(top.sysUrl){
				url = top.sysUrl+"/map/emap/ExtMap.jsp";
			}
			var tmpRecord = {};
			tmpRecord.jd = $('#jd').textbox('getValue');
			tmpRecord.wd = $('#wd').textbox('getValue');
			mapWin =  top.$.createWin({
				title : "地图标注",
		      	width : 800,
		       	height:500,
		       	draggable:true,
		       	constrain:true,//将拖动范围限制在容器内
		       	autoDestroy:false,
		       	closeAction:'hide',
		        records	: tmpRecord,
		       	modal : true,
				url:url,
				buttons: [{
					 text:$.fn.textbox.defaults.ok,
					 handler: doUpdateMapValue
		    	}]
			});     
		}
		function doUpdateMapValue() {
			var frame 	= 	top.$("#"+mapWin).children("iframe")[0];
			var win		=	frame.contentWindow||frame.window;
			var jq		=	win.$;
			$('#jd').textbox('setValue',win.$("#extLongitude").val());
			$('#wd').textbox('setValue',win.$("#extLatitude").val());
			top.$("#"+mapWin).dialog('close');
		}; 
		
		</script>
</head>
<body class="easyui-layout" >
	<form id="childform" class="easyui-form" data-options="novalidate:true">
		<div class="formTitle">
			<p>通道基本信息</p>
		</div>
		<div class="form-line clearfix">
			<div class="fl">
				<span class="text-content">设备编号：</span> 
				<input id="sbbh" class="easyui-textbox" data-options="required:false,disabled:true" missingMessage="设备编号必填项" > 
			</div> 
			<div class="fl">
				<span class="text-content">通道编号：</span> 
				<input id="tdbh" class="easyui-textbox" data-options="required:false,disabled:true" missingMessage="通道编号必填项" > 
			</div>
		</div>
		<div class="form-line clearfix">
			<div class="fl">
				<span class="text-content"><em class="must">*</em>通道名称：</span> 
				<input id="tdmc" class="easyui-textbox" data-options="required:false" missingMessage="通道名称必填项" > 
			</div> 
			<div class="fl">
				<span class="text-content"><em class="must">*</em>通道状态：</span> 
				<input id="tdzt" class="easyui-combobox" data-options="required:false" missingMessage="通道状态必填项" > 
			</div> 
		</div>
		<div class="form-line clearfix">
			<div class="fl">
				<span class="text-content">通道类型：</span> 
				<input id="tdlx" class="easyui-combobox" data-options="required:false" missingMessage="通道类型必填项" > 
			</div> 
			<div class="fl">
				<span class="text-content">支持ptz控制：</span> 
				<input id="sfzcptzkz" class="easyui-combobox" data-options="required:false" missingMessage="是否支持ptz控制必填项" > 
			</div> 
		</div>
		<div class="form-line clearfix">
			<div class="fl">
				<span class="text-content">行政编号：</span> 
				<input id="xzbh" class="easyui-combotree" data-options="required:false" missingMessage="行政编号必填项" > 
			</div>
			<div class="fl">
				<span class="text-content">外部编号：</span> 
				<input id="wbbh" class="easyui-textbox" data-options="required:false" missingMessage="级联编号必填项" > 
			</div> 
		</div>
		<div class="form-line clearfix">
			<div class="fl">
				<span class="text-content">经度：</span> 
				<input id="jd" class="easyui-textbox" data-options="required:false" missingMessage="经度必填项" > 
				<!-- 
				<div class="input-addimg">
					<a href="javascript:selectMapLocation();" class="icon-add img-btn1"></a>
				</div>
				 -->
			</div> 
			<div class="fl">
				<span class="text-content">纬度：</span> 
				<input id="wd" class="easyui-textbox" data-options="required:false" missingMessage="纬度必填项" > 
			</div> 
		</div>
		<div class="form-line clearfix">
			<div class="fl">
				<span class="text-content">安装位置：</span> 
				<input id="tdazwz" class="easyui-textbox" data-options="required:false" missingMessage="通道安装位置必填项" > 
			</div>
			<div class="fl">
				<span class="text-content">基本描述：</span> 
				<input id="jbms" class="easyui-textbox" data-options="required:false" missingMessage="基本描述必填项" > 
			</div>
		</div>
		
		<div class="formTitle">
			<p>通道录像信息</p>
		</div>
		<div class="form-line clearfix">
			<div class="fl">
				<span class="text-content">视频编码格式：</span> 
				<input id="spbmgs" class="easyui-combobox" data-options="required:false" missingMessage="视频编码格式必填项" > 
			</div> 
			<div class="fl">
				<span class="text-content">录像方式：</span> 
				<input id="lxfs" class="easyui-combobox" data-options="required:false" missingMessage="录像录入方式必填项" > 
			</div>
		</div>
		<div class="form-line clearfix">
			<div class="fl">
				<span class="text-content">中心存储组：</span> 
				<input id="zxcczbh" class="easyui-combobox" data-options="required:false" missingMessage="中心存储组编号必填项" > 
			</div> 
			<div class="fl">
				<span class="text-content">录像保留天数：</span> 
				<input id="lxblts" class="easyui-textbox" data-options="required:false" missingMessage="录像保留天数必填项" > 
			</div>
		</div>
		<div class="form-line clearfix">
			<div class="fl">
				<span class="text-content">上墙模式：</span> 
				<input id="sqms" class="easyui-combobox" data-options="required:false" missingMessage="上墙模式必填项" > 
			</div> 
			<div class="fl">
				<span class="text-content">上墙地址：</span> 
				<input id="squrllj" class="easyui-textbox" data-options="required:false" missingMessage="上墙url路径必填项" > 
			</div> 
		</div>
		<div class="form-line clearfix">
			<div class="fl">
				<span class="text-content">组播地址：</span> 
				<input id="zburllj" class="easyui-textbox" data-options="required:false" missingMessage="组播url路径必填项" > 
			</div> 
			<div class="fl">
				<span class="text-content">组播端口：</span> 
				<input id="zbdk" class="easyui-textbox" data-options="required:false" missingMessage="组播端口必填项" > 
			</div> 
		</div>	
		<div class="form-line clearfix">
			<div class="fl">
				<span class="text-content">录像码流：</span> 
				<input id="lxmlxz" class="easyui-combobox" data-options="required:false" missingMessage="录像码流选择必填项" > 
			</div> 
			<div class="fl">
				<span class="text-content">录像存储类型：</span> 
				<input id="lxlrcyfs" class="easyui-combobox" data-options="required:false" missingMessage="录像码流选择必填项" > 
			</div> 
		</div>
		<div class="form-line clearfix">
			<div class="fl">
				<span class="text-content">键盘控制短号：</span> 
				<input id="jpkzdh" class="easyui-textbox" data-options="required:false" missingMessage="键盘控制短号必填项" > 
			</div> 
			<div class="fl">
				<span class="text-content">是否在录像：</span> 
				<input id="sfzlxmc" class="easyui-textbox" data-options="required:false" missingMessage="键盘控制短号必填项" > 
			</div> 
		</div>
		<div class="form-line clearfix">
			<div class="fl">
				<span class="text-content">OSD位置：</span> 
				<input id="khdosdxswz" class="easyui-textbox" data-options="required:false" missingMessage="OSD位置必填项" > 
			</div> 
			<div class="fl">
				<span class="text-content">OSD内容：</span> 
				<input id="khdosdxsnr" class="easyui-textbox" data-options="required:false" missingMessage="OSD内容必填项" > 
			</div> 
		</div>
	</form>
</body>

