forked from p96170835/amis
Merge pull request #30 from catchonme/master
修复combo提交验证唯一值失败,修改单一item时只验证当前item的问题
This commit is contained in:
commit
40710a6d2f
|
@ -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,11 +303,15 @@ export default class FormControl extends React.Component<FormControlProps, any>
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
if (this.model) {
|
if (this.model) {
|
||||||
this.model.validate(this.hook);
|
if (form.parentStore && form.parentStore.storeType === 'ComboStore') {
|
||||||
|
const combo = form.parentStore as IComboStore;
|
||||||
// 可能出现同名的表单项
|
const group = combo.uniques.get(this.model.name) as IUniqueGroup;
|
||||||
form.getItemsByName(this.model.name)
|
group && group.items.forEach(item => item.validate());
|
||||||
.forEach(item => item !== this.model && 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