修复combo提交验证失败后修改,只验证当前item的问题
This commit is contained in:
parent
37e38d718a
commit
a3d6417150
|
@ -9,7 +9,8 @@ import {
|
||||||
} from '../../factory';
|
} from '../../factory';
|
||||||
import {
|
import {
|
||||||
ComboStore,
|
ComboStore,
|
||||||
IComboStore
|
IComboStore,
|
||||||
|
IUniqueGroup
|
||||||
} from '../../store/combo';
|
} from '../../store/combo';
|
||||||
import {
|
import {
|
||||||
anyChanged,
|
anyChanged,
|
||||||
|
@ -302,13 +303,17 @@ export default class FormControl extends React.Component<FormControlProps, any>
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
if (this.model) {
|
if (this.model) {
|
||||||
|
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);
|
this.model.validate(this.hook);
|
||||||
|
|
||||||
// 可能出现同名的表单项
|
|
||||||
form.getItemsByName(this.model.name)
|
form.getItemsByName(this.model.name)
|
||||||
.forEach(item => item !== this.model && item.validate())
|
.forEach(item => item !== this.model && item.validate())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
handleChange(value:any, submitOnChange:boolean = this.props.control.submitOnChange) {
|
handleChange(value:any, submitOnChange:boolean = this.props.control.submitOnChange) {
|
||||||
const {
|
const {
|
||||||
|
|
Loading…
Reference in New Issue