mirror of
https://gitee.com/nocobase/nocobase.git
synced 2024-12-02 12:18:15 +08:00
fix: button field assignment to only update visible fields (#5104)
This commit is contained in:
parent
8740d39e70
commit
a0643713db
@ -636,8 +636,20 @@ export const SchemaSettingsActionModalItem: FC<SchemaSettingsActionModalItemProp
|
||||
|
||||
const submitHandler = useCallback(async () => {
|
||||
await form.submit();
|
||||
onSubmit?.(cloneDeep(form.values));
|
||||
setVisible(false);
|
||||
try {
|
||||
const allValues = form.values;
|
||||
// 过滤掉那些在表单 Schema 中未定义的字段
|
||||
const visibleValues = Object.keys(allValues).reduce((result, key) => {
|
||||
if (form.query(key).take()) {
|
||||
result[key] = allValues[key];
|
||||
}
|
||||
return result;
|
||||
}, {});
|
||||
await onSubmit?.(cloneDeep(visibleValues));
|
||||
setVisible(false);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
}, [form, onSubmit]);
|
||||
|
||||
const openAssignedFieldValueHandler = useCallback(async () => {
|
||||
|
Loading…
Reference in New Issue
Block a user