fix: table selector (#612)

This commit is contained in:
金昶 2022-07-10 10:15:12 +08:00 committed by GitHub
parent 451d6ae974
commit 68d35cf597
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,22 +63,31 @@ export const TableSelectorProvider = (props) => {
if (appends?.length) { if (appends?.length) {
params['appends'] = appends; params['appends'] = appends;
} }
console.log('record', record);
if (collectionField) { if (collectionField) {
if (['oho', 'o2m'].includes(collectionField.interface)) { if (['oho', 'o2m'].includes(collectionField.interface)) {
params['filter'] = { if (record?.[collectionField.sourceKey]) {
$or: [{ params['filter'] = {
$or: [{
[collectionField.foreignKey]: {
$is: null,
}
}, {
[collectionField.foreignKey]: {
$eq: record?.[collectionField.sourceKey],
}
}]
}
} else {
params['filter'] = {
[collectionField.foreignKey]: { [collectionField.foreignKey]: {
$is: null, $is: null,
} }
}, { }
[collectionField.foreignKey]: {
$eq: record?.[collectionField.sourceKey],
}
}]
} }
} }
if (['obo'].includes(collectionField.interface)) { // if (['obo'].includes(collectionField.interface)) {
} // }
} }
return ( return (
<BlockProvider {...props} params={params}> <BlockProvider {...props} params={params}>