场景1:导出表单信息;(拼接一个虚拟form表单然后提交)
function exportExcel()
{
var rows = $('#invoiceDetail_dg').datagrid('getData').rows;
if(!rows || rows.length == 0)
{
msgShow("提示", "无情信息需要导出", "waring");
return;
}
$.messager.progress({
title: '提示',
msg:'正在导出EXCEL,请稍候......'
});
var form = $("<form>"); //定义一个form表单
form.attr('style', 'display:none'); //在form表单中添加查询参数
form.attr('target', '');
form.attr('method', 'post');
form.attr('action', ${pageContext.request.contextPath}/invoicewo/。。。。/。。。");
$('body').append(form); //将表单放置在web中
var input1 = $('<input>');
input1.attr('type', 'hidden');
input1.attr('name', 'invoiceid');
input1.attr('value', JSON.stringify(Exportinvoiceid));
form.append(input1); //将查询参数控件提交到表单上
form.submit();
$.messager.progress('close');
}
场景二:动态表格加载获取数据
function loaddata(invoiceid,dgid){
$('#'+dgid).datagrid({ //表格id
width: '99%',
height: 'auto',
loadMsg:"数据加载中,请稍后...",
nowrap: true,
striped: true,
border: true,
collapsible:false,//是否可折叠的
url:'${pageContext.request.contextPath}/invoicewo/f。。。。/。。。',
remoteSort:false,
idField:'id',
singleSelect:true,//是否单选
pagination:true,//分页控件
rownumbers:true,//行号
queryParams:
{ //请求参数
invoiceid : invoiceid,
},
columns:[[
{field:'serviceName',title:'服务种类',width:'12%',align:'center'},
{field:'skuCode',title:'延保SKU',width:'12%',align:'center'},
{field:'woNo',title:'工单号',width:'12%',align:'center'},
{field:'cost',title:'工单费用',width:'14%',align:'center'},
{field:'woType',title:'工单类型',width:'14%',align:'center',
formatter:function(value, row, index){return getWoType(value);}},
{field:'createUser',title:'费用核算通过人员',width:'15%',align:'center'},
{field:'createTime',title:'费用核算通过时间',width:'15%',align:'center',
formatter:function(value, row, index){return timeStampToString(value);}},
]],
onLoadSuccess: function (data){
}
});
}