From bda849855c1036b352b4ea29bf1c1d7460d340be Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 04 四月 2023 17:14:15 +0800 Subject: [PATCH] 2023-04-04 --- src/menu/components/share/actioncomponent/index.jsx | 56 ++++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 42 insertions(+), 14 deletions(-) diff --git a/src/menu/components/share/actioncomponent/index.jsx b/src/menu/components/share/actioncomponent/index.jsx index ca8fa7f..731e10c 100644 --- a/src/menu/components/share/actioncomponent/index.jsx +++ b/src/menu/components/share/actioncomponent/index.jsx @@ -266,6 +266,12 @@ if ((btn.OpenType === 'excelIn' || btn.OpenType === 'excelOut') && (!btn.verify || !btn.verify.columns) && (config.subtype === 'basetable' || config.subtype === 'normaltable')) { let columns = [] let maps = [] + let labels = {} + if (config.subtype === 'normaltable') { + config.columns.forEach(col => { + labels[col.field] = col.label + }) + } if (btn.OpenType === 'excelOut') { let pushcol = (item) => { @@ -289,16 +295,27 @@ } config.cols.forEach(item => { - if (item.type === 'colspan' && config.subtype === 'normaltable') { - item.subcols.forEach(cell => { - if (!cell.field || cell.Hide === 'true' || maps.includes(cell.field)) return - maps.push(cell.field) + if (item.Hide === 'true') return - pushcol(cell) - }) + if (config.subtype === 'normaltable') { + if (item.type === 'colspan') { + item.subcols.forEach(cell => { + if (!cell.field || cell.Hide === 'true' || maps.includes(cell.field)) return + maps.push(cell.field) + + pushcol(cell) + }) + } else if (item.type === 'custom') { + item.elements.forEach(cell => { + if (!cell.field || maps.includes(cell.field)) return + maps.push(cell.field) + + pushcol({...cell, label: labels[cell.field]}) + }) + } } - if (!item.field || item.Hide === 'true' || maps.includes(item.field)) return + if (!item.field || maps.includes(item.field)) return maps.push(item.field) pushcol(item) @@ -337,16 +354,27 @@ } config.cols.forEach(item => { - if (item.type === 'colspan' && config.subtype === 'normaltable') { - item.subcols.forEach(cell => { - if (!cell.field || cell.Hide === 'true' || maps.includes(cell.field)) return - maps.push(cell.field) + if (item.Hide === 'true') return - pushcol(cell) - }) + if (config.subtype === 'normaltable') { + if (item.type === 'colspan') { + item.subcols.forEach(cell => { + if (!cell.field || cell.Hide === 'true' || maps.includes(cell.field)) return + maps.push(cell.field) + + pushcol(cell) + }) + } else if (item.type === 'custom') { + item.elements.forEach(cell => { + if (!cell.field || maps.includes(cell.field)) return + maps.push(cell.field) + + pushcol({...cell, label: labels[cell.field]}) + }) + } } - if (!item.field || item.Hide === 'true' || maps.includes(item.field)) return + if (!item.field || maps.includes(item.field)) return maps.push(item.field) pushcol(item) -- Gitblit v1.8.0