mirror of
https://github.com/dataease/dataease.git
synced 2026-06-17 04:51:43 +08:00
fix(图表): 修复存量明细表表头分组显示错误
This commit is contained in:
@@ -56,7 +56,7 @@ const onCancelConfig = () => {
|
||||
|
||||
const onConfigChange = () => {
|
||||
const { fields } = s2.dataCfg
|
||||
emits('onConfigChange', { columns: fields.columns })
|
||||
emits('onConfigChange', { columns: fields.columns, meta: [] })
|
||||
}
|
||||
|
||||
const init = () => {
|
||||
@@ -79,7 +79,7 @@ const init = () => {
|
||||
pre[cur.field] = cur.title
|
||||
return pre
|
||||
}, {})
|
||||
if (!headerGroupConfig.meta?.length) {
|
||||
if (headerGroupConfig.meta?.length) {
|
||||
headerGroupConfig.meta.forEach(item => {
|
||||
nameFieldMap[item.field] = item.name
|
||||
})
|
||||
|
||||
@@ -2139,37 +2139,23 @@ export const getLeafNodes = (tree: Array<ColumnNode>): ColumnNode[] => {
|
||||
|
||||
export const mapKeyToField = (nodes: Array<ColumnNode>) => {
|
||||
nodes.forEach(node => {
|
||||
if (node.key) {
|
||||
node.field = node.key
|
||||
delete node.key
|
||||
}
|
||||
if (node.children) {
|
||||
node.children.forEach(child => {
|
||||
if (child.key) {
|
||||
// 如果有 key 字段,则将其映射到 field 字段
|
||||
child.field = child.key
|
||||
delete child.key
|
||||
}
|
||||
})
|
||||
mapKeyToField(node.children as Array<ColumnNode>)
|
||||
} else {
|
||||
if (node.key) {
|
||||
node.field = node.key
|
||||
delete node.key
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const setupColumnTitle = (nodes: Array<ColumnNode>, nameMap: Record<string, string>) => {
|
||||
nodes.forEach(node => {
|
||||
if (nameMap[node.field]) {
|
||||
node.title = nameMap[node.field]
|
||||
}
|
||||
if (node.children) {
|
||||
node.children.forEach(child => {
|
||||
if (nameMap[child.field]) {
|
||||
child.title = nameMap[child.field]
|
||||
}
|
||||
})
|
||||
setupColumnTitle(node.children as Array<ColumnNode>, nameMap)
|
||||
} else {
|
||||
if (nameMap[node.field]) {
|
||||
node.title = nameMap[node.field]
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user