Commit b37a74f0 authored by zhangwenshuai's avatar zhangwenshuai

fix 表单校验时机

parent 8b53279a
...@@ -28,6 +28,7 @@ const FormItem = Form.Item; ...@@ -28,6 +28,7 @@ const FormItem = Form.Item;
class FormWrap extends Component { class FormWrap extends Component {
wrapDom: any; wrapDom: any;
handleSubmit = (e) => { handleSubmit = (e) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
...@@ -120,9 +121,7 @@ class FormWrap extends Component { ...@@ -120,9 +121,7 @@ class FormWrap extends Component {
const transferColumn = transferAttr(columnType, newProps); const transferColumn = transferAttr(columnType, newProps);
const disabled = readOnlyFlag || (dynamicCellConfigDTO && dynamicCellConfigDTO.readonlyFlag); const disabled = readOnlyFlag || (dynamicCellConfigDTO && dynamicCellConfigDTO.readonlyFlag);
const onBlurFn1 = (changedValue: any, newVal: any) => { const onBlurFn1 = (changedValue: any, newVal: any) => {
validateFieldsAndScroll((err:any) => { if (typeof onBlurFn === 'function') {
// 即时编辑时需要对表单必填等规则校验
if (!err) {
let temp: any[] = []; let temp: any[] = [];
value.map((item: any) => { value.map((item: any) => {
temp.push({ text: item.text, value: item.value }); temp.push({ text: item.text, value: item.value });
...@@ -136,11 +135,13 @@ class FormWrap extends Component { ...@@ -136,11 +135,13 @@ class FormWrap extends Component {
if (_.isEqual(temp, newVal)) { if (_.isEqual(temp, newVal)) {
return; return;
} }
if (typeof onBlurFn === 'function') { validateFieldsAndScroll((err:any) => {
// 即时编辑时需要对表单必填等规则校验
if (!err) {
onBlurFn(changedValue); onBlurFn(changedValue);
} }
}
}); });
}
}; };
return ( return (
<FormItem key={columnName} label={this.renderLabel(item)}> <FormItem key={columnName} label={this.renderLabel(item)}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment