From 68d35cf597f3384fa6e8bbb342f7465c9c1f4c5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=87=91=E6=98=B6?= Date: Sun, 10 Jul 2022 10:15:12 +0800 Subject: [PATCH] fix: table selector (#612) --- .../block-provider/TableSelectorProvider.tsx | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/packages/core/client/src/block-provider/TableSelectorProvider.tsx b/packages/core/client/src/block-provider/TableSelectorProvider.tsx index 9281d86cf..bf66c8573 100644 --- a/packages/core/client/src/block-provider/TableSelectorProvider.tsx +++ b/packages/core/client/src/block-provider/TableSelectorProvider.tsx @@ -63,22 +63,31 @@ export const TableSelectorProvider = (props) => { if (appends?.length) { params['appends'] = appends; } + console.log('record', record); if (collectionField) { if (['oho', 'o2m'].includes(collectionField.interface)) { - params['filter'] = { - $or: [{ + if (record?.[collectionField.sourceKey]) { + params['filter'] = { + $or: [{ + [collectionField.foreignKey]: { + $is: null, + } + }, { + [collectionField.foreignKey]: { + $eq: record?.[collectionField.sourceKey], + } + }] + } + } else { + params['filter'] = { [collectionField.foreignKey]: { $is: null, } - }, { - [collectionField.foreignKey]: { - $eq: record?.[collectionField.sourceKey], - } - }] + } } } - if (['obo'].includes(collectionField.interface)) { - } + // if (['obo'].includes(collectionField.interface)) { + // } } return (