var windowId,proName = window.location.pathname.split("/")[1],sysUrl = "http://"+window.location.host+"/"+proName,toEdit;

var sbbh = $.getUrlParam("sbbh");
var tdbh = $.getUrlParam("tdbh");
$(function(){
	$("#jobreporttimeStart").datebox("setValue",$.getTodayStart(0,"00:00:00"));
	$("#jobreporttimeEnd").datebox("setValue",$.getTodayEnd("23:59:59"));
	initGrid();
});
//加载列表
var toolbar = [{
	text	:	'查询',
	iconCls	:	'icon-search',
	handler	:	doSearch
}];
function initGrid(){
	$("#videoRepairTable").datagrid(  {
		toolbar : toolbar,
		singleSelect:true,
		rownumbers:true,
		queryParams:getQueryParams(),
		url : 'ywrepairjobinfoAction!listYwrepairDevicejobinfoByPage.do',
		columns : [[
			{
				field: 'A',
				checkbox:'true',
				width:30
			},
			{field:'jobnum',title:'工单编号',hidden:false,width:130},
			{field:'jobacceptstate',title:'工单受理状态',hidden:true,width:120},
			{field:'jobprocessstatename',title:'工单状态',hidden:false,width:90},
			{field:'faultgradename',title:'告警等级',hidden:false,width:90},
			{field:'faultdevicetypename',title:'故障设备类型',hidden:false,width:90},
			{field:'faultdevicename',title:'故障设备名称',hidden:false,width:120},
			{field:'faultdeviceid',title:'故障设备编号',hidden:false,width:120},
			{field:'channelnum',title:'通道编号',hidden:false,width:60},
			{field:'faulttypename',title:'故障类型',hidden:false,width:120},
			{field:'faultdescription',title:'故障描述',hidden:false,width:220},
			{field:'jobreportcompanyname',title:'上报单位',hidden:false,width:120},
			{field:'jobreporttime',title:'上报时间',hidden:false,width:130},
			{field:'requirefinishtime',title:'要求完成时间',hidden:false,width:130},
			{field:'delaytime',title:'延期时间',hidden:false,width:130}
		]]
	});
	
}
//查询条件
function getQueryParams(){
	var sParam = {};
	var tableparam = "";
	sParam.faultdeviceid = sbbh;
	sParam.channelnum = tdbh;
	var LIKEtime1 = $('#jobreporttimeStart').datetimebox("getValue");
	var LIKEtime2 = $('#jobreporttimeEnd').datetimebox("getValue");
	if(!(LIKEtime1==null||LIKEtime1==""||LIKEtime1==undefined)){
		tableparam += " AND jobreporttime >= '" +LIKEtime1 + "'";
	}
	if(!(LIKEtime2==null||LIKEtime2==""||LIKEtime2==undefined)){
		tableparam += " AND jobreporttime <= '" +LIKEtime2 + "'";
	}
	sParam.tableparam = tableparam;
	sParam.order = "order by jobreporttime desc ";
	return sParam;
}
function doSearch()
{
	$('#videoRepairTable').datagrid('load',getQueryParams());
}

