fix(data-vi): bug when filtering chart with assocations (#3867)

* fix(data-vi): bug when filtering chart with assocations

* fix: remote select
This commit is contained in:
YANG QIA 2024-03-29 14:13:59 +08:00 committed by GitHub
parent 11536cb0e0
commit 868a487b2d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View File

@ -52,7 +52,8 @@ const InternalRemoteSelect = connect(
const { getField } = useCollection_deprecated();
const searchData = useRef(null);
const { getCollectionJoinField, getInterface } = useCollectionManager_deprecated();
const collectionField = getField(fieldSchema.name) || getCollectionJoinField(fieldSchema.name as string);
const colletionFieldName = fieldSchema['x-collection-field'] || fieldSchema.name;
const collectionField = getField(colletionFieldName) || getCollectionJoinField(colletionFieldName);
const targetField =
_targetField ||
(collectionField?.target &&

View File

@ -305,12 +305,15 @@ export const useChartFilter = () => {
.filter(([_, props]) => props)
.forEach(([name, props]) => {
const { operator } = props || {};
const { dataSource, fieldName } = parseFilterFieldName(name);
const { dataSource, fieldName: _fieldName } = parseFilterFieldName(name);
let fieldName = _fieldName;
const ds = dm.getDataSource(dataSource);
const cm = ds.collectionManager;
const field = cm.getCollectionField(fieldName);
if (field?.target) {
name = `${fieldName}.${field.targetKey || 'id'}`;
const tk = field.targetKey || 'id';
fieldName = `${fieldName}.${tk}`;
name = `${name}.${tk}`;
}
const [collection, ...fields] = fieldName.split('.');
const value = getValuesByPath(values, name);