|
|
@@ -289,6 +289,35 @@ const Manage = () => { |
|
|
|
}, |
|
|
|
]; |
|
|
|
|
|
|
|
//下载Excel |
|
|
|
const onDownloadExcel = async () => { |
|
|
|
const response = await api.GetFlowExport(Selectparams) |
|
|
|
if (response.isSuccess) { |
|
|
|
let option = {}; //option代表的就是excel文件 |
|
|
|
const date = new Date(); |
|
|
|
const excelName = "订单流水" + date.toLocaleString().replaceAll('\/', '-'); |
|
|
|
option.fileName = excelName; //excel文件名称 |
|
|
|
const sheetHeader = ['storeTypeName','storeName','order_Number','order_OriginalMoney','order_RealMoney','refundOriginalMoney','refundRealMoney','order_Count','order_CreateTime'];; |
|
|
|
// Object.keys(response.data[0]).forEach(item => { |
|
|
|
// sheetHeader.push(item); |
|
|
|
// }); |
|
|
|
option.datas = [ |
|
|
|
{ |
|
|
|
sheetData: response.data, //excel文件中的数据源 |
|
|
|
sheetName: excelName, //excel文件中sheet页名称 |
|
|
|
sheetFilter: sheetHeader, //excel文件中需显示的列数据 |
|
|
|
sheetHeader: ['店铺分类', '店铺名称', '交易单号', '应付金额', '实付金额', |
|
|
|
'应付金额(退)', '实付金额(退)', '子订单数量', '创建时间', |
|
|
|
] //excel文件中每列的表头名称 |
|
|
|
} |
|
|
|
] |
|
|
|
let toExcel = new ExportJsonExcel(option); //生成excel文件 |
|
|
|
toExcel.saveExcel(); |
|
|
|
} else { |
|
|
|
message.error(response.errors || '导出失败'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return ( |
|
|
|
<PageContainer> |
|
|
|
<ProTable |
|
|
@@ -299,7 +328,7 @@ const Manage = () => { |
|
|
|
labelWidth: 120, |
|
|
|
}} |
|
|
|
toolBarRender={() => [ |
|
|
|
<Button type="primary" key="create" onClick={() => handleExport()}> |
|
|
|
<Button type="primary" key="create" onClick={onDownloadExcel}> |
|
|
|
<DownloadOutlined /> 导出 |
|
|
|
</Button>, |
|
|
|
]} |
|
|
|