mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 13:39:24 +08:00
fix: linkage conflict between same-named association fields in different sub-tables within the same form (#6577)
* fix: linkage conflict between same-named association fields in different sub-tables within same form * fix: bug
This commit is contained in:
parent
63caa541cb
commit
eba3f79134
@ -69,6 +69,11 @@ export const filterAnalyses = (filters): any[] => {
|
|||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function getFieldPath(str) {
|
||||||
|
const lastIndex = str.lastIndexOf('.');
|
||||||
|
return lastIndex === -1 ? str : str.slice(0, lastIndex);
|
||||||
|
}
|
||||||
|
|
||||||
const InternalAssociationSelect = observer(
|
const InternalAssociationSelect = observer(
|
||||||
(props: AssociationSelectProps) => {
|
(props: AssociationSelectProps) => {
|
||||||
const { objectValue = true, addMode: propsAddMode, ...rest } = props;
|
const { objectValue = true, addMode: propsAddMode, ...rest } = props;
|
||||||
@ -100,11 +105,14 @@ const InternalAssociationSelect = observer(
|
|||||||
//支持深层次子表单
|
//支持深层次子表单
|
||||||
onFieldInputValueChange('*', (fieldPath: any) => {
|
onFieldInputValueChange('*', (fieldPath: any) => {
|
||||||
const linkageFields = filterAnalyses(field.componentProps?.service?.params?.filter) || [];
|
const linkageFields = filterAnalyses(field.componentProps?.service?.params?.filter) || [];
|
||||||
|
const linageFieldEntire = getFieldPath(fieldPath.address.entire);
|
||||||
|
const targetFieldEntire = getFieldPath(field.address.entire);
|
||||||
if (
|
if (
|
||||||
linkageFields.includes(fieldPath?.props?.name) &&
|
linkageFields.includes(fieldPath?.props?.name) &&
|
||||||
field.value &&
|
field.value &&
|
||||||
isEqual(fieldPath?.indexes, field?.indexes) &&
|
isEqual(fieldPath?.indexes, field?.indexes) &&
|
||||||
fieldPath?.props?.name !== field.props.name
|
fieldPath?.props?.name !== field.props.name &&
|
||||||
|
(!field?.indexes?.length || isEqual(linageFieldEntire, targetFieldEntire))
|
||||||
) {
|
) {
|
||||||
field.setValue(null);
|
field.setValue(null);
|
||||||
setInnerValue(null);
|
setInnerValue(null);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user