refactor: assocation select file clear linkage (#2885)

This commit is contained in:
katherinehhh 2023-10-20 17:31:08 +08:00 committed by GitHub
parent d2bf691b69
commit 2dbb095529
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,5 @@
import { LoadingOutlined, PlusOutlined } from '@ant-design/icons'; import { LoadingOutlined, PlusOutlined } from '@ant-design/icons';
import { onFieldChange } from '@formily/core'; import { onFieldChange, FormPath } from '@formily/core';
import { RecursionField, connect, mapProps, observer, useField, useFieldSchema, useForm } from '@formily/react'; import { RecursionField, connect, mapProps, observer, useField, useFieldSchema, useForm } from '@formily/react';
import { uid } from '@formily/shared'; import { uid } from '@formily/shared';
import { Space, message } from 'antd'; import { Space, message } from 'antd';
@ -63,8 +63,9 @@ const InternalAssociationSelect = observer((props: AssociationSelectProps) => {
form.addEffects(id, () => { form.addEffects(id, () => {
linkageFields?.forEach((v) => { linkageFields?.forEach((v) => {
if (v) { if (v) {
onFieldChange(v, () => { //支持深层次子表单
if (field.value) { onFieldChange('*', (fieldPath: any) => {
if (fieldPath.props.name === v && field.value) {
props.onChange(null); props.onChange(null);
setInnerValue(null); setInnerValue(null);
} }