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

修改bug

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