mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
修复combo提交验证失败后修改,只验证当前item的问题
This commit is contained in:
parent
1905daa3ca
commit
7b31280ac5
@ -9,7 +9,8 @@ import {
|
||||
} from '../../factory';
|
||||
import {
|
||||
ComboStore,
|
||||
IComboStore
|
||||
IComboStore,
|
||||
IUniqueGroup
|
||||
} from '../../store/combo';
|
||||
import {
|
||||
anyChanged,
|
||||
@ -302,11 +303,15 @@ export default class FormControl extends React.Component<FormControlProps, any>
|
||||
} = this.props;
|
||||
|
||||
if (this.model) {
|
||||
this.model.validate(this.hook);
|
||||
|
||||
// 可能出现同名的表单项
|
||||
form.getItemsByName(this.model.name)
|
||||
.forEach(item => item !== this.model && item.validate())
|
||||
if (form.parentStore && form.parentStore.storeType === 'ComboStore') {
|
||||
const combo = form.parentStore as IComboStore;
|
||||
const group = combo.uniques.get(this.model.name) as IUniqueGroup;
|
||||
group.items.forEach(item => item.validate());
|
||||
} else {
|
||||
this.model.validate(this.hook);
|
||||
form.getItemsByName(this.model.name)
|
||||
.forEach(item => item !== this.model && item.validate())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user