使用ajax導出會出現導出按鈕失效的問題,建議使用如下的導出方式: 使用隱藏iframe實現無刷新下載文件 前臺 download function downloadFile(){ var dom=document.getElementById('ifile'); dom.class="lazy" src="//p2.ttnews.xyz/loading.gif" data-original="//p2.ttnews.xyz/5fd576a73204792926983baa.jpg"; 後臺 @RequestMapping(value = "exportData") public void exportData(PurchaseMaterial purchaseMaterial,String materialProducer,String materialSupplier,HttpServletResponse response) { purchaseMaterial.setMaterialStatus(1); purchaseMaterial.setMaterialProducer(materialProducer); purchaseMaterial.setMaterialSupplier(materialSupplier); List list = purchaseMaterialService.findList(purchaseMaterial); if(list.size()>0){ String fileName = "採購物料詳細表-"+materialProducer+ DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx"; try(ExcelExport ee = new ExcelExport(materialProducer, PurchaseMaterial.class)){ ee.setDataList(list).write(response, fileName); } } }
關鍵字: 使用 materialSupplier list