fix(bi): fix T-2643 (#3101)
This commit is contained in:
parent
cbcf70e587
commit
6819366049
@ -1,6 +1,5 @@
|
|||||||
import { Context, Next } from '@nocobase/actions';
|
import { Context, Next } from '@nocobase/actions';
|
||||||
import { Field, FilterParser, snakeCase } from '@nocobase/database';
|
import { Field, FilterParser, snakeCase } from '@nocobase/database';
|
||||||
import ChartsV2Plugin from '../plugin';
|
|
||||||
import { formatter } from './formatter';
|
import { formatter } from './formatter';
|
||||||
import compose from 'koa-compose';
|
import compose from 'koa-compose';
|
||||||
import { parseFilter, getDateVars } from '@nocobase/utils';
|
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: collectionName, measures, dimensions, orders, filter } = ctx.action.params.values as QueryParams;
|
||||||
const collection = ctx.db.getCollection(collectionName);
|
const collection = ctx.db.getCollection(collectionName);
|
||||||
const fields = collection.fields;
|
const fields = collection.fields;
|
||||||
const underscored = collection.options.underscored;
|
|
||||||
const models: {
|
const models: {
|
||||||
[target: string]: {
|
[target: string]: {
|
||||||
type: string;
|
type: string;
|
||||||
@ -185,7 +183,8 @@ export const parseFieldAndAssociations = async (ctx: Context, next: Next) => {
|
|||||||
} else if (selected.field.length > 1) {
|
} else if (selected.field.length > 1) {
|
||||||
[target, name] = selected.field;
|
[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;
|
let fieldType = fields.get(name)?.type;
|
||||||
if (target) {
|
if (target) {
|
||||||
const targetField = fields.get(target) as Field;
|
const targetField = fields.get(target) as Field;
|
||||||
|
Loading…
Reference in New Issue
Block a user