|
|
@ -44,7 +44,7 @@ export const TableExportBtn = (props) => {
|
|
|
|
}), {}) : {})
|
|
|
|
}), {}) : {})
|
|
|
|
}), {});
|
|
|
|
}), {});
|
|
|
|
const flatCols = props.columns.flatMap((v, k) =>
|
|
|
|
const flatCols = props.columns.flatMap((v, k) =>
|
|
|
|
v.children ? v.children.map((vc, ci) => ({ ...vc, title: `${v?.titleX || v.title}` + (vc?.titleX ? `,${vc.titleX}` : (ci || '')) })) : v
|
|
|
|
v.children ? v.children.map((vc, ci) => ({ ...vc, title: `${v?.titleX || v.title}` + (vc?.titleX ? `,${vc.titleX}` : (ci || '')) })) : {...v, title: `${v?.titleX || v.title}`}
|
|
|
|
);
|
|
|
|
);
|
|
|
|
// .filter((c) => c.dataIndex)
|
|
|
|
// .filter((c) => c.dataIndex)
|
|
|
|
// !['string', 'number'].includes(typeof vc.title) ? `${v?.titleX || v.title}` : `${v?.titleX || v.title}-${vc.title || ''}`
|
|
|
|
// !['string', 'number'].includes(typeof vc.title) ? `${v?.titleX || v.title}` : `${v?.titleX || v.title}-${vc.title || ''}`
|
|
|
@ -74,7 +74,7 @@ export const TableExportBtn = (props) => {
|
|
|
|
}, {});
|
|
|
|
}, {});
|
|
|
|
return itemMapped;
|
|
|
|
return itemMapped;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
const ws = utils.json_to_sheet([summaryRow, ...data], { header: columnsMap.filter((r) => r.dataIndex).map((r) => r.title) });
|
|
|
|
const ws = utils.json_to_sheet([].concat(isEmpty(summaryRow) ? [] : [summaryRow], data), { header: columnsMap.filter((r) => r.dataIndex).map((r) => r.title) });
|
|
|
|
const wb = utils.book_new();
|
|
|
|
const wb = utils.book_new();
|
|
|
|
utils.book_append_sheet(wb, ws, 'sheet');
|
|
|
|
utils.book_append_sheet(wb, ws, 'sheet');
|
|
|
|
writeFile(wb, `${output_name}.xlsx`);
|
|
|
|
writeFile(wb, `${output_name}.xlsx`);
|
|
|
|