提交 f96eab9d authored 作者: chlolch's avatar chlolch

修改bug

上级 3f7314d6
......@@ -22,8 +22,10 @@ export default class ChildForm extends React.Component {
componentWillReceiveProps(nextProps) {
// Should be a controlled component.
if ('value' in nextProps) {
const value = nextProps.value;
this.state = value;
this.setState(value)
}
}
componentDidMount = () => {
......@@ -41,9 +43,9 @@ export default class ChildForm extends React.Component {
}
if (!('value' in this.props)) {
this.setState({ ...objs });
this.setState(objs );
}
this.triggerChange({ ...objs });
this.triggerChange(objs );
}
}
};
......@@ -60,11 +62,14 @@ export default class ChildForm extends React.Component {
return;
}
delete objs[uuid];
const x = form.getFieldValue(base52);
delete x[uuid];
delete x[""];
if (!('value' in this.props)) {
this.setState({ ...objs });
this.setState(x);
}
this.triggerChange({ ...objs });
this.triggerChange(x);
if (numCode != null) {
this.props.form.setFieldsValue({ [numCode]: Object.keys(objs).length });
......@@ -83,11 +88,11 @@ export default class ChildForm extends React.Component {
return;
}
objs['id_' + UUID.v4().replace(/-/g, '2')] = {};
if (!('value' in this.props)) {
this.setState({ ...objs });
this.setState(objs);
}
this.triggerChange({ ...objs });
this.triggerChange(objs);
if (numCode != null) {
this.props.form.setFieldsValue({ [numCode]: Object.keys(objs).length });
}
......@@ -95,7 +100,7 @@ export default class ChildForm extends React.Component {
render() {
const objs = this.state;
const {
form,
mapData,
......@@ -112,6 +117,7 @@ export default class ChildForm extends React.Component {
modalInit,
isPreview,
} = this.props;
const span = json.span || 24;
const gutter = json.gutter != null ? json.gutter : 0;
const rights = this.props.rights;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论