
// 详情按钮
function historyRecordViewOperate(id,subjectId){
	window.open('/creditreporting/history/view?viewUnderlyingAssets=1&reportingHistoryId='+id+'&subjectId='+subjectId);
};

$(function(){
	
	function operateHistoryUpRecord(cellValue,options,rowObject){
		var btnstr = '';
		if( $("#viewHistoricCreditReportingRecord").length>0 ){
			btnstr += '<p><span>详情</span><i class="operateIconfont operateIcon-xiangqing" onclick="historyRecordViewOperate('+rowObject.id+','+rowObject.subjectId+')"></i></p>';
		};
		return '<div class="operateIcon noHover">'+btnstr+'</div>';
	};
	
	sxUtil.jqGrid('#creditReportingHistoryList',{
		colNames:['ID','序号','保理类型','上报主体','主体名称','上报日期','上报人','操作'],
		colModel:[
			{name: 'id', label: 'ID', hidedlg:true, hidden:true,sortable:false,title:false},
			{name: 'orderNumber', label: '序号',sortable:false,width:50,align:'center',title:false},
			{name: 'positiveReverseFactoring', label: '保理类型',sortable:false,width:180,align:'center',title:false},
            {name: 'buyerSeller', label: '上报主体',sortable:false,align:'left',width:150,title:false},
            {name: 'subjectName', label: '主体名称',sortable:false,align:'center',width:150,title:false},
            {name: 'gmtCreate', label: '上报日期',sortable:false,align:'center',width:150,title:false},
            {name: 'reporterName', label: '上报人',sortable:false,align:'center',width:150,title:false},
            {name: 'remark', label: '操作',sortable:false,align:'left',width:100,title:false,formatter:operateHistoryUpRecord}
		], 
		height:'auto',
		mtype:'GET',
		url : '/creditreporting/history/doList',
		pager : "#creditReportingHistoryListPage",
		multiselect: false,
		rownumbers:false,
		postData : {
			'creditReportingId':creditReportQuery.creditReportingId
		},
		page:1,
		loadError:function(){
			new $.zui.Messager('历史上报记录列表加载失败', {
			    type: 'warning'
			}).show();
		}
	},true);
	
	//刷新
	$('#refresh').click(function(){
		$('#creditReportingHistoryList').setGridParam({
			mtype:'GET',
			url : '/creditreporting/history/doList',
			datatype : 'json',
			postData: {'creditReportingId':creditReportQuery.creditReportingId},
			page : 1
		});
		$('#creditReportingHistoryList').trigger('reloadGrid');
	});
	
	// 返回
	$('.newBackBtn').click(function(){
		$('.yk_rightcontent').load('/creditreporting/list')
	})
})