提交 b7842e6f authored 作者: 徐立's avatar 徐立
...@@ -16,12 +16,13 @@ export default class ChildForm extends React.Component { ...@@ -16,12 +16,13 @@ export default class ChildForm extends React.Component {
// Should provide an event to pass value to Form. // Should provide an event to pass value to Form.
const onChange = this.props.onChange; const onChange = this.props.onChange;
if (onChange) { if (onChange) {
onChange(Object.assign({}, this.state, changedValue)); onChange(changedValue);
} }
}; };
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.state = value;
} }
...@@ -41,9 +42,9 @@ export default class ChildForm extends React.Component { ...@@ -41,9 +42,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 +61,16 @@ export default class ChildForm extends React.Component { ...@@ -60,11 +61,16 @@ 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.state=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 +91,9 @@ export default class ChildForm extends React.Component { ...@@ -85,9 +91,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 });
} }
...@@ -95,7 +101,6 @@ export default class ChildForm extends React.Component { ...@@ -95,7 +101,6 @@ export default class ChildForm extends React.Component {
render() { render() {
const objs = this.state; const objs = this.state;
const { const {
form, form,
mapData, mapData,
...@@ -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;
......
...@@ -9,6 +9,6 @@ export default class MobileItem extends Component { ...@@ -9,6 +9,6 @@ export default class MobileItem extends Component {
render() { render() {
const {isPreview}=this.props 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 @@ ...@@ -165,6 +165,10 @@
text-align: right; text-align: right;
font-weight: bold; font-weight: bold;
} }
#mobile_table .isPreview > .ant-form-item-label {
padding-top: 0px;
}
#MobileList .am-list-item { #MobileList .am-list-item {
background-color: #fff; background-color: #fff;
border-radius: 4px; border-radius: 4px;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论