var expExcelForm = "expExcelForm"; //初始化导出excelform,searchAreaId: list页面的查询条件区域对象的id,非list也必须定义改对象id,用来初始化form function initExportForm(searchAreaId){ var searchArea = $("#"+searchAreaId); if($("#"+expExcelForm).size()==0){ var form = "
"; searchArea.html(''); searchArea.append(form); } } //导出excel调用 function exportExcel(fromUrl){ $("#"+expExcelForm).attr("action",fromUrl); var mch= Math.round(Math.random() * 10000); var data=$("#"+expExcelForm).serialize()+"&mch="+mch; $.ajax({ type: "POST", url: fromUrl, data: data, dataType:'json', async:true, success: function(jsonObj){ if(jsonObj.isExport=='1'){ window.location.href="download.action?fileName="+jsonObj.fileName+"&allFilePath="+jsonObj.filePath+"&isDelete=1"; }else{ //alert("没有要导出的数据"); ModelWindow.msgbox('没有要导出的数据!', '温馨提示',null, null); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { ret=false; //alert("网络错误,请重试"); ModelWindow.msgbox('网络错误,请重试!', '温馨提示',null, null); } }); }