mirror of
https://github.com/nocobase/nocobase.git
synced 2026-10-24 12:34:23 +08:00
fix: association data not submitted when exposing association fields in subform/subTable (#6883)
This commit is contained in:
@@ -107,7 +107,11 @@ function getFilteredFormValues(form) {
|
||||
});
|
||||
const readonlyPaths = _.uniq(
|
||||
allFields
|
||||
.filter((field) => field?.componentProps?.readOnlySubmit)
|
||||
.filter((field) => {
|
||||
const segments = field.path?.segments || [];
|
||||
const path = segments.length <= 1 ? segments.join('.') : segments.slice(0, -1).join('.');
|
||||
return field?.componentProps?.readOnlySubmit && !get(values, path)[field?.componentProps.filterTargetKey];
|
||||
})
|
||||
.map((field) => {
|
||||
const segments = field.path?.segments || [];
|
||||
if (segments.length <= 1) {
|
||||
@@ -122,7 +126,6 @@ function getFilteredFormValues(form) {
|
||||
_.unset(values, path);
|
||||
}
|
||||
});
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -29,7 +29,7 @@ import { isDisplayField } from '../utils';
|
||||
*/
|
||||
const useLazyLoadDisplayAssociationFieldsOfForm = () => {
|
||||
const { name } = useCollection_deprecated();
|
||||
const { getCollectionJoinField } = useCollectionManager_deprecated();
|
||||
const { getCollectionJoinField, getCollection } = useCollectionManager_deprecated();
|
||||
const form = useForm();
|
||||
const fieldSchema = useFieldSchema();
|
||||
const variables = useVariables();
|
||||
@@ -90,7 +90,7 @@ const useLazyLoadDisplayAssociationFieldsOfForm = () => {
|
||||
}
|
||||
|
||||
const { appends } = getAssociationAppends();
|
||||
|
||||
const collection = getCollection(collectionFieldRef.current?.collectionName);
|
||||
variables
|
||||
.parseVariable(variableString, formVariable, { appends })
|
||||
.then(({ value }) => {
|
||||
@@ -104,6 +104,7 @@ const useLazyLoadDisplayAssociationFieldsOfForm = () => {
|
||||
field.componentProps = {
|
||||
...field.componentProps,
|
||||
readOnlySubmit: true,
|
||||
filterTargetKey: collection?.filterTargetKey || 'id',
|
||||
}; // 让它不参与提交
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user