mirror of
https://github.com/dataease/dataease.git
synced 2026-05-17 15:00:59 +08:00
fix(图表): 修复透视表带格式导出无响应 #15051
This commit is contained in:
@@ -2030,9 +2030,12 @@ Scatter chart (bubble) chart: {a} (series name), {b} (data name), {c} (value arr
|
||||
circle_packing_padding: 'Circle padding',
|
||||
increase: 'Increase',
|
||||
decrease: 'Decrease',
|
||||
total: 'Total',
|
||||
accumulate: 'Accumulate',
|
||||
table_cross_bg_tip: 'After merging cells,the zebra pattern is not supported'
|
||||
table_cross_bg_tip: 'After merging cells,the zebra pattern is not supported',
|
||||
pivot_export_invalid_field:
|
||||
'The row dimension or indicator dimension is empty and can not be exported !',
|
||||
pivot_export_invalid_col_exceed:
|
||||
'Table can not be exported cause the number of columns exceeds the maximum limit!'
|
||||
},
|
||||
dataset: {
|
||||
field_value: 'Field Value',
|
||||
|
||||
@@ -1976,9 +1976,10 @@ export default {
|
||||
circle_packing_padding: '圓形間距',
|
||||
increase: '增加',
|
||||
decrease: '減少',
|
||||
total: '合計',
|
||||
accumulate: '累加',
|
||||
table_cross_bg_tip: '合併儲存格後,不支持斑馬紋'
|
||||
table_cross_bg_tip: '合併儲存格後,不支持斑馬紋',
|
||||
pivot_export_invalid_field: '行維度或指標維度為空不可導出!',
|
||||
pivot_export_invalid_col_exceed: '表格列數超過最大限制不可導出!'
|
||||
},
|
||||
dataset: {
|
||||
field_value: '欄位值',
|
||||
|
||||
@@ -1983,7 +1983,9 @@ export default {
|
||||
decrease: '减少',
|
||||
waterfall_total: '合计',
|
||||
accumulate: '累加',
|
||||
table_cross_bg_tip: '合并单元格后,不支持班马纹'
|
||||
table_cross_bg_tip: '合并单元格后,不支持班马纹',
|
||||
pivot_export_invalid_field: '行维度或指标维度为空不可导出!',
|
||||
pivot_export_invalid_col_exceed: '表格列数超过最大限制不可导出!'
|
||||
},
|
||||
dataset: {
|
||||
field_value: '字段值',
|
||||
|
||||
@@ -1181,9 +1181,15 @@ function getTooltipPosition(event) {
|
||||
}
|
||||
|
||||
export async function exportGridPivot(instance: PivotSheet, chart: ChartObj) {
|
||||
const { layoutResult } = instance.facet
|
||||
const { meta, fields } = instance.dataCfg
|
||||
const rowLength = fields?.rows?.length || 0
|
||||
const colLength = fields?.columns?.length || 0
|
||||
const colNums = layoutResult.colLeafNodes.length + rowLength + 1
|
||||
if (colNums > 16384) {
|
||||
ElMessage.warning(i18nt('chart.pivot_export_invalid_col_exceed'))
|
||||
return
|
||||
}
|
||||
const workbook = new Exceljs.Workbook()
|
||||
const worksheet = workbook.addWorksheet(i18nt('chart.chart_data'))
|
||||
const metaMap: Record<string, Meta> = meta?.reduce((p, n) => {
|
||||
@@ -1215,7 +1221,6 @@ export async function exportGridPivot(instance: PivotSheet, chart: ChartObj) {
|
||||
cell.border.right = { style: 'thick', color: { argb: '00000000' } }
|
||||
}
|
||||
})
|
||||
const { layoutResult } = instance.facet
|
||||
// 行头
|
||||
const { rowLeafNodes, rowsHierarchy, rowNodes } = layoutResult
|
||||
const maxColIndex = rowsHierarchy.maxLevel + 1
|
||||
@@ -1351,18 +1356,21 @@ export async function exportGridPivot(instance: PivotSheet, chart: ChartObj) {
|
||||
}
|
||||
|
||||
export async function exportTreePivot(instance: PivotSheet, chart: ChartObj) {
|
||||
const layoutResult = instance.facet.layoutResult
|
||||
if (layoutResult.colLeafNodes.length + 2 > 16384) {
|
||||
ElMessage.warning(i18nt('chart.pivot_export_invalid_col_exceed'))
|
||||
return
|
||||
}
|
||||
const { meta, fields } = instance.dataCfg
|
||||
const colLength = fields?.columns?.length || 0
|
||||
const workbook = new Exceljs.Workbook()
|
||||
const worksheet = workbook.addWorksheet(i18nt('chart.chart_data'))
|
||||
|
||||
const metaMap: Record<string, Meta> = meta?.reduce((p, n) => {
|
||||
if (n.field) {
|
||||
p[n.field] = n
|
||||
}
|
||||
return p
|
||||
}, {})
|
||||
const layoutResult = instance.facet.layoutResult
|
||||
|
||||
// 角头
|
||||
fields.columns?.forEach((column, index) => {
|
||||
@@ -1473,7 +1481,7 @@ export async function exportPivotExcel(instance: PivotSheet, chart: ChartObj) {
|
||||
const rowLength = fields?.rows?.length || 0
|
||||
const valueLength = fields?.values?.length || 0
|
||||
if (!(rowLength && valueLength)) {
|
||||
ElMessage.warning('行维度或指标维度为空不可导出!')
|
||||
ElMessage.warning(i18nt('chart.pivot_export_invalid_field'))
|
||||
return
|
||||
}
|
||||
if (chart.customAttr.basicStyle.tableLayoutMode !== 'tree') {
|
||||
|
||||
Reference in New Issue
Block a user