<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
		<%@include file="../../../frame/assets/header-all.jsp"%>
		<!--
			.form-line .text-content {65px;}
			easyui-textbox
			easyui-combobox
			easyui-datetimebox
		-->
	</head>
	<!-- 设置高度,n表示几行    44px + 36px *( n - 1) -->
	<body class="easyui-layout" >
 		<div data-options="region:'north'" id='north' style="height: 80px;border-bottom: none">
			<div class="form-line clearfix">
	            <div class='fl'>
	                <span class="text-content">行政目录：</span>
	                <input id="LIKExzbh" class="easyui-combotree" >
	            </div>      
	            <div class='fl'>
	                <span class="text-content">设备编号：</span>
	                <input class="easyui-textbox" id="LIKEsbbh" >
	            </div>
	            <div class='fl'>
	                <span class="text-content">摄像头筛选：</span>
	                <input class="easyui-textbox" id="LIKEtdmc" >
	            </div>
	            
        	</div>
        	<div class="form-line clearfix">
        		<div class='fl'>
	                <span class="text-content">已设定经纬度：</span>
	                <input class="easyui-combobox" id="isSetLngLat" >
	            </div>
        	</div>
		</div>
		<div data-options="region:'center',split:false" class="easyui-layout">
			<table id='monitor-tab-grid'></table>
		 </div>
	<script>
	$(function(){
	    initDefault();
	});
	function initDefault(){
		$('#isSetLngLat').combobox({
			 url:'xtclAction!query_Xtcl.do?csdl=enable',
			 textField:"csmc",  
			 valueField:"csdm",
			 panelWidth:148,
			 value:"" 
		})
		initXzNameTree();
		initGrid();
	}
	//查询
	function doSearch(){    
	    $('#monitor-tab-grid').datagrid('load', getQueryParams());     
	}
	//查询条件
	function getQueryParams(){
	    var sParam = {};
	    sParam.LIKExzbh = $('#LIKExzbh').combotree('getValue');
	    sParam.LIKEsbbh = $('#LIKEsbbh').textbox('getValue');
	    sParam.LIKEtdmc = $('#LIKEtdmc').textbox('getValue');
	    var isSetLngLat = $('#isSetLngLat').combobox('getValue');
	    switch (isSetLngLat) {
	    case "0" : 
	    	sParam.tableparam = "AND (jd is null OR jd = '' OR wd is null OR wd = '')";
	    	break;
	    case "1" :
			sParam.tableparam = "AND (jd is not NULL AND jd != '' AND wd is not NULL AND wd != '')";
			break;
		default : break;
	    }
	    return sParam;
	}
	//加载列表
	function initGrid(){   
		var toolbar = [{
			text:'查询',
			iconCls:'icon-search',
			handler:function(){doSearch();}
		}];
		datagrid = $('#monitor-tab-grid').datagrid({
			toolbar : toolbar,
	        url : 'sbtdspsrAction!listSbtdspsrByPage.do',
	        queryParams:getQueryParams(),
	        rownumbers:true,
	        columns : [[
	            {field:'sbbh',title:'摄像头编号',width:150,
	                formatter:function showClick(value,record,index){ 
	                return "<span title="+value+" >"+value+"</span>";
	               }
	            },
	            {field:'tdmc',title:'摄像头名称',width:150,
	                formatter:function showClick(value,record,index){ 
	                return "<span title="+value+" >"+value+"</span>";
	               }
	            },
	            {field:'jd',title:'经度',width:150,
	                formatter:function showClick(value,record,index){ 
	                return "<span title="+value+" >"+value+"</span>";
	               }
	            },
	            {field:'wd',title:'纬度',width:150,
	                formatter:function showClick(value,record,index){ 
	                return "<span title="+value+" >"+value+"</span>";
	               }
	            },
	            {field:'xzmc',title:'行政目录',width:150,
	                formatter:function showClick(value,record,index){ 
	                return "<span title="+value+" >"+(value||'')+"</span>";
	               }
	            }
	        ]]
	    });
	}
	//行政树
	function initXzNameTree(){
		$.ajax({
			type:'post',
			dataType : 'json',
			url:'ptxzsAction!query_Ptxzs.do',
			data:{
				order : " order by jdpx asc "
			},
			success:function(data){
				data.unshift({xzbh: "", xzmc: "全部目录"});
			    selectTree = $('#LIKExzbh').combotree({
	            	checkbox:false,
	             	border:false,
	             	parentField:"sjxzbh",
	             	textFiled:"xzmc",
	             	idFiled:"xzbh",
	             	data:data,
	             	value: "",
	             	panelWidth:200,
	             	onLoadSuccess:function(node,data){
	                	if(data){
	                        $('#LIKExzbh').combotree("setValue",data[0].xzbh).combotree("setText", data[0].xzmc);
	                    }
	             	},	
	             	onClick: function(node){
	                	$('#LIKExzbh').combotree("setValue",node.xzbh).combotree("setText", node.xzmc);
	             	}
	        	});
			}
		});	
	}
	</script>   
	</body>
</html>	
