fix: linkage rule config closing rules require reopening the form to take effect (#1640)
This commit is contained in:
parent
7036879ea6
commit
ffcf1d9cf1
@ -114,31 +114,36 @@ const WithForm = (props) => {
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const id = uid();
|
if (linkageRules.length > 0) {
|
||||||
form.addEffects(id, () => {
|
const id = uid();
|
||||||
const linkagefields = [];
|
const linkagefields = [];
|
||||||
return linkageRules.map((v, index) => {
|
const formGraph = form.getFormGraph();
|
||||||
return v.actions?.map((h) => {
|
form.addEffects(id, () => {
|
||||||
if (h.targetFields) {
|
return linkageRules.map((v, index) => {
|
||||||
const fields = h.targetFields.join(',');
|
return v.actions?.map((h) => {
|
||||||
return onFieldReact(`*(${fields})`, (field: any, form) => {
|
if (h.targetFields) {
|
||||||
linkagefields.push(field);
|
const fields = h.targetFields.join(',');
|
||||||
linkageMergeAction(h, field, v.condition, form?.values);
|
return onFieldReact(`*(${fields})`, (field: any, form) => {
|
||||||
if (index === linkageRules.length - 1) {
|
linkagefields.push(field);
|
||||||
setTimeout(() =>
|
linkageMergeAction(h, field, v.condition, form?.values);
|
||||||
linkagefields.map((v) => {
|
if (index === linkageRules.length - 1) {
|
||||||
v.linkageProperty = {};
|
setTimeout(() =>
|
||||||
}),
|
linkagefields.map((v) => {
|
||||||
);
|
v.linkageProperty = {};
|
||||||
}
|
}),
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
return () => {
|
||||||
return () => {
|
form.removeEffects(id);
|
||||||
form.removeEffects(id);
|
form.clearFormGraph();
|
||||||
};
|
form.setFormGraph(formGraph);
|
||||||
|
};
|
||||||
|
}
|
||||||
}, [linkageRules]);
|
}, [linkageRules]);
|
||||||
return fieldSchema['x-decorator'] === 'Form' ? <FormDecorator {...props} /> : <FormComponent {...props} />;
|
return fieldSchema['x-decorator'] === 'Form' ? <FormDecorator {...props} /> : <FormComponent {...props} />;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user