var windowId,proName = window.location.pathname.split("/")[1],sysUrl = "http://"+window.location.host+"/"+proName,toEdit;
var winId	= $.getUrlParam("winId");
var obj = top.$("#"+winId).panel("options").data;
$(function(){
	initDefault();	
});
//默认
function initDefault(){
	initGrid();
}
//查询条件
function getQueryParams(){
	var sParam = {};
	if(obj.type=="1"){//在线
			sParam.tableparam = " and state=1 ";
	}else {
			sParam.tableparam ='and （state=0 or state is null ）';
	}
	sParam.LIKEldmc = $("#LIKEldmc").textbox("getValue");
	return sParam;
}
//加载列表
function initGrid(){	
	var toolbar = [{
    	text	:	'查询',
        iconCls	:	'icon-search',
        handler	:	doSearch
    }];
	
	$('#tableGrid').datagrid({
		toolbar : toolbar,
		singleSelect:true,
		rownumbers:true,
		queryParams:getQueryParams(),
		url : "zxldAction!listZxldcurrentstateByPage.do",
		columns : [[
		    {
				field: 'A',
				checkbox:'true',
				width:30
			},
			{field: 'ldbh', title: '雷达编号', hidden: false, width: 120},
			{field: 'ldmc', title: '雷达名称', hidden: false, width: 120},
		{field: 'gxdwbh', title: '管辖单位编号', hidden: false, width: 120},
		{field: 'gxdwmc', title: '管辖单位名称', hidden: false, width: 120},
		]]
	});
}
//查询
function doSearch(){
	$('#tableGrid').datagrid('load',getQueryParams());
}

function transEmpty(str){
	if(!str || str==null ||str=="null"){
		return "-";
	}
	return str;
}