mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 13:39:24 +08:00
fix: incorrect parameters passed in table block filtering (#5773)
This commit is contained in:
parent
38e79d41af
commit
fa315a1261
@ -110,12 +110,8 @@ export const useTableBlockProps = () => {
|
||||
dataBlocks.forEach((block) => {
|
||||
const target = targets.find((target) => target.uid === block.uid);
|
||||
if (!target) return;
|
||||
|
||||
const isForeignKey = block.foreignKeyFields?.some((field) => field.name === target.field);
|
||||
const sourceKey = getSourceKey(currentBlock, target.field);
|
||||
const recordKey = isForeignKey ? sourceKey : ctx.rowKey;
|
||||
const value = [record[recordKey]];
|
||||
|
||||
const sourceKey = getSourceKey(currentBlock, target.field) || ctx.rowKey || 'id';
|
||||
const value = [record[sourceKey]];
|
||||
const param = block.service.params?.[0] || {};
|
||||
// 保留原有的 filter
|
||||
const storedFilter = block.service.params?.[1]?.filters || {};
|
||||
@ -165,5 +161,5 @@ export const useTableBlockProps = () => {
|
||||
|
||||
function getSourceKey(currentBlock: DataBlock, field: string) {
|
||||
const associationField = currentBlock?.associatedFields?.find((item) => item.foreignKey === field);
|
||||
return associationField?.sourceKey || 'id';
|
||||
return associationField?.sourceKey || field?.split?.('.')?.[1];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user