|
|
|
@ -38,13 +38,13 @@ export const TableExportBtn = (props) => {
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const r1 = props.columns.reduce((r, v) => ({
|
|
|
|
|
...r,
|
|
|
|
|
...(v.children ? v.children.reduce((rc, vc) => ({
|
|
|
|
|
...(v.children ? v.children.reduce((rc, vc, ci) => ({
|
|
|
|
|
...rc,
|
|
|
|
|
...(vc?.titleX ? {[`${v?.titleX || v.title},${vc.titleX}`]: vc.titleX } : {[v?.titleX || v.title]: `${vc?.titleX || vc?.title || ''}`}),
|
|
|
|
|
...(vc?.titleX ? {[`${v?.titleX || v.title},${vc.titleX}`]: vc.titleX } : {[(v?.titleX || v.title) + (ci || '')]: `${vc?.titleX || vc?.title || ''}`}),
|
|
|
|
|
}), {}) : {})
|
|
|
|
|
}), {});
|
|
|
|
|
const flatCols = props.columns.flatMap((v, k) =>
|
|
|
|
|
v.children ? v.children.map((vc) => ({ ...vc, title: `${v?.titleX || v.title}` + (vc?.titleX ? `,${vc.titleX}` : '') })) : v
|
|
|
|
|
v.children ? v.children.map((vc, ci) => ({ ...vc, title: `${v?.titleX || v.title}` + (vc?.titleX ? `,${vc.titleX}` : (ci || '')) })) : v
|
|
|
|
|
);
|
|
|
|
|
// .filter((c) => c.dataIndex)
|
|
|
|
|
// !['string', 'number'].includes(typeof vc.title) ? `${v?.titleX || v.title}` : `${v?.titleX || v.title}-${vc.title || ''}`
|
|
|
|
|