提交 b7842e6f authored 作者: 徐立's avatar 徐立
......@@ -16,12 +16,13 @@ export default class ChildForm extends React.Component {
// Should provide an event to pass value to Form.
const onChange = this.props.onChange;
if (onChange) {
onChange(Object.assign({}, this.state, changedValue));
onChange(changedValue);
}
};
componentWillReceiveProps(nextProps) {
// Should be a controlled component.
if ('value' in nextProps) {
const value = nextProps.value;
this.state = value;
}
......@@ -41,9 +42,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 +61,16 @@ 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.state=x
}
this.triggerChange({ ...objs });
this.triggerChange(x);
if (numCode != null) {
this.props.form.setFieldsValue({ [numCode]: Object.keys(objs).length });
......@@ -83,11 +89,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 +101,6 @@ 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;
......
......@@ -9,6 +9,6 @@ export default class MobileItem extends Component {
render() {
const {isPreview}=this.props
return (<Form.Item {...this.props} label={isPreview?this.props.label:this.props.label+"::"}/>)
return (<Form.Item {...this.props} className={isPreview?"isPreview":null} label={isPreview?this.props.label:this.props.label+"::"}/>)
}
}
\ No newline at end of file
......@@ -165,6 +165,10 @@
text-align: right;
font-weight: bold;
}
#mobile_table .isPreview > .ant-form-item-label {
padding-top: 0px;
}
#MobileList .am-list-item {
background-color: #fff;
border-radius: 4px;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论