fix(图表): 修复隐藏指标字段,导出Excel表格后,指标后的维度字段数据会不显示 #18367

This commit is contained in:
wisonic-s
2026-05-19 19:03:02 +08:00
committed by wisonic-s
parent f6a91f0d93
commit 18d398c5b1

View File

@@ -381,10 +381,8 @@ public class ChartDataServer implements ChartDataApi {
Integer totalDepth = 0;
List<CellRangeAddress> mergeConfig = new ArrayList<>();
if (StringUtils.equalsAnyIgnoreCase(viewInfo.getType(), "table-normal", "table-info")) {
exportFields = exportFields.stream().filter(tmpAxis -> !tmpAxis.isHide()).toList();
for (ChartViewFieldDTO tmpAxis : exportFields) {
if (tmpAxis.isHide()) {
continue;
}
if (tmpAxis.getDeType().equals(DeTypeConstants.DE_INT) || tmpAxis.getDeType().equals(DeTypeConstants.DE_FLOAT)) {
CellStyle formatterCellStyle = createCellStyle(wb, tmpAxis.getFormatterCfg(), null);
styles.add(formatterCellStyle);
@@ -398,7 +396,7 @@ public class ChartDataServer implements ChartDataApi {
if (tableHeaderMap.get("headerGroup") != null && Boolean.parseBoolean(tableHeaderMap.get("headerGroup").toString())) {
var tmpHeader = JsonUtil.parseObject((String) JsonUtil.toJSONString(customAttr.get("tableHeader")), TableHeader.class);
// 校验字段数量和顺序
var allAxis = new ArrayList<>(exportFields.stream().filter(x -> !x.isHide()).toList());
var allAxis = new ArrayList<>(exportFields);
if (validateHeaderGroup(tmpHeader, allAxis)) {
tableHeader = tmpHeader;
for (TableHeader.ColumnInfo column : tableHeader.getHeaderGroupConfig().getColumns()) {