Merge branch 'main' into next

This commit is contained in:
nocobase[bot] 2024-12-03 11:32:34 +00:00
commit f46a1b203c

View File

@ -113,12 +113,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 || {};
@ -168,5 +164,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];
}