mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-06 05:59:25 +08:00
fix: association field support data scope linkage (#3888)
This commit is contained in:
parent
f909f4c376
commit
25c902b2a7
@ -58,7 +58,6 @@ const InternalAssociationSelect = observer(
|
|||||||
const form = useForm();
|
const form = useForm();
|
||||||
const api = useAPIClient();
|
const api = useAPIClient();
|
||||||
const resource = api.resource(collectionField.target);
|
const resource = api.resource(collectionField.target);
|
||||||
const linkageFields = filterAnalyses(field.componentProps?.service?.params?.filter);
|
|
||||||
const recordData = useCollectionRecordData();
|
const recordData = useCollectionRecordData();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const initValue = isVariable(field.value) ? undefined : field.value;
|
const initValue = isVariable(field.value) ? undefined : field.value;
|
||||||
@ -68,15 +67,14 @@ const InternalAssociationSelect = observer(
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const id = uid();
|
const id = uid();
|
||||||
form.addEffects(id, () => {
|
form.addEffects(id, () => {
|
||||||
if (linkageFields?.length > 0) {
|
|
||||||
//支持深层次子表单
|
//支持深层次子表单
|
||||||
onFieldChange('*', (fieldPath: any) => {
|
onFieldChange('*', (fieldPath: any) => {
|
||||||
if (linkageFields.includes(fieldPath.props.name) && field.value) {
|
const linkageFields = filterAnalyses(field.componentProps?.service?.params?.filter) || [];
|
||||||
|
if (linkageFields.includes(fieldPath?.props?.name) && field.value) {
|
||||||
props.onChange(field.initialValue);
|
props.onChange(field.initialValue);
|
||||||
setInnerValue(field.initialValue);
|
setInnerValue(field.initialValue);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user