This commit is contained in:
katherinehhh 2025-06-26 15:38:00 +08:00
parent f9be668b49
commit ccc981b98e

View File

@ -17,7 +17,7 @@ import { TreeNode } from '../TreeLabel';
// 过滤掉系统字段 // 过滤掉系统字段
export const systemKeys = [ export const systemKeys = [
// 'id', // 'id',
// 'sort', 'sort',
'createdById', 'createdById',
'createdBy', 'createdBy',
'createdAt', 'createdAt',
@ -61,7 +61,7 @@ export const useCollectionState = (currentCollectionName: string, displayType =
if (!field.interface) { if (!field.interface) {
return; return;
} }
if (['password', 'sequence'].includes(field.type)) { if (depth === 0 && ['sort', 'password', 'sequence'].includes(field.type)) {
return; return;
} }
if (filterFields && filterFields(field)) { if (filterFields && filterFields(field)) {
@ -97,7 +97,7 @@ export const useCollectionState = (currentCollectionName: string, displayType =
depth: depth + 1, depth: depth + 1,
maxDepth, maxDepth,
prefix: option.key, prefix: option.key,
exclude: ['id', ...systemKeys], exclude: ['id', ...systemKeys.filter((v) => v !== 'sort')],
}); });
} }
return option; return option;
@ -290,7 +290,7 @@ function loadChildren({ node, traverseAssociations, traverseFields, systemKeys,
}); });
} else if (['hasOne', 'hasMany'].includes(node.field.type) || node?.type === 'duplicate') { } else if (['hasOne', 'hasMany'].includes(node.field.type) || node?.type === 'duplicate') {
children = traverseFields(node.field.target, { children = traverseFields(node.field.target, {
exclude: ['id', ...systemKeys], exclude: ['id', ...systemKeys.filter((v) => v !== 'sort')],
prefix: node.key, prefix: node.key,
maxDepth: 1, maxDepth: 1,
}); });