diff --git a/packages/plugins/@nocobase/plugin-data-visualization/src/server/actions/query.ts b/packages/plugins/@nocobase/plugin-data-visualization/src/server/actions/query.ts index 2cb7d1ece..90608a314 100644 --- a/packages/plugins/@nocobase/plugin-data-visualization/src/server/actions/query.ts +++ b/packages/plugins/@nocobase/plugin-data-visualization/src/server/actions/query.ts @@ -1,6 +1,5 @@ import { Context, Next } from '@nocobase/actions'; import { Field, FilterParser, snakeCase } from '@nocobase/database'; -import ChartsV2Plugin from '../plugin'; import { formatter } from './formatter'; import compose from 'koa-compose'; import { parseFilter, getDateVars } from '@nocobase/utils'; @@ -169,7 +168,6 @@ export const parseFieldAndAssociations = async (ctx: Context, next: Next) => { const { collection: collectionName, measures, dimensions, orders, filter } = ctx.action.params.values as QueryParams; const collection = ctx.db.getCollection(collectionName); const fields = collection.fields; - const underscored = collection.options.underscored; const models: { [target: string]: { type: string; @@ -185,7 +183,8 @@ export const parseFieldAndAssociations = async (ctx: Context, next: Next) => { } else if (selected.field.length > 1) { [target, name] = selected.field; } - let field = underscored ? snakeCase(name) : name; + const rawAttributes = collection.model.getAttributes(); + let field = rawAttributes[name]?.field || name; let fieldType = fields.get(name)?.type; if (target) { const targetField = fields.get(target) as Field;