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

修改bug

上级 c98d63ff
...@@ -26,7 +26,7 @@ export default class ChildForm extends React.Component { ...@@ -26,7 +26,7 @@ export default class ChildForm extends React.Component {
// 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
} }
} }
componentDidMount = () => { componentDidMount = () => {
...@@ -54,7 +54,7 @@ export default class ChildForm extends React.Component { ...@@ -54,7 +54,7 @@ export default class ChildForm extends React.Component {
} }
delete = (uuid) => { delete = (uuid) => {
const objs = this.state const objs = this.state
const {json:{numCode},form,base52}=this.props const { json: { numCode }, form, base52 } = this.props
if (this.props.min != null && Object.keys(objs).length - 1 < this.props.min) { if (this.props.min != null && Object.keys(objs).length - 1 < this.props.min) {
message.error("不能小于最小限制") message.error("不能小于最小限制")
...@@ -67,14 +67,14 @@ export default class ChildForm extends React.Component { ...@@ -67,14 +67,14 @@ export default class ChildForm extends React.Component {
} }
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 })
} }
} }
add = () => { add = () => {
const objs = this.state const objs = this.state
const {json:{numCode},form,base52}=this.props const { json: { numCode }, form, base52 } = this.props
if (this.props.max != null && Object.keys(objs).length + 1 > this.props.max) { if (this.props.max != null && Object.keys(objs).length + 1 > this.props.max) {
message.error("不能大于最大限制") message.error("不能大于最大限制")
...@@ -86,8 +86,8 @@ export default class ChildForm extends React.Component { ...@@ -86,8 +86,8 @@ export default class ChildForm extends React.Component {
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 })
} }
...@@ -98,7 +98,8 @@ export default class ChildForm extends React.Component { ...@@ -98,7 +98,8 @@ export default class ChildForm extends React.Component {
render() { render() {
const objs = this.state; const objs = this.state;
const { form, mapData, sqlData, defaultValues, datas, base52, isEdit, addName, deleteName, obj, isMobile, json,modalInit } = this.props
const { form, mapData, sqlData, defaultValues, datas, base52, isEdit, addName, deleteName, obj, isMobile, json, modalInit } = 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
...@@ -129,8 +130,8 @@ export default class ChildForm extends React.Component { ...@@ -129,8 +130,8 @@ export default class ChildForm extends React.Component {
})} })}
{rights.includes("add") ? <Row> {rights.includes("add") ? <Row>
<Col style={{textAlign:"center"}}><Button type="primary" size="small" style={{ margin: "auto"}} onClick={this.add}>{addName || "新增"}</Button> </Col> <Col style={{ textAlign: "center" }}><Button type="primary" size="small" style={{ margin: "auto" }} onClick={this.add}>{addName || "新增"}</Button> </Col>
</Row>:""} </Row> : ""}
</Card.Body> </Card.Body>
</Card> : ""} </Card> : ""}
...@@ -141,7 +142,9 @@ export default class ChildForm extends React.Component { ...@@ -141,7 +142,9 @@ export default class ChildForm extends React.Component {
return ( return (
<div style={{ width: "100%" }}> <div style={{ width: "100%" }}>
<Row gutter={gutter}> <Row gutter={gutter}>
{Object.keys(objs).map((r) => { {Object.keys(objs).map((r) => {
if (r == "") { if (r == "") {
return "" return ""
} }
......
...@@ -1832,16 +1832,18 @@ export default class tableCom extends Component { ...@@ -1832,16 +1832,18 @@ export default class tableCom extends Component {
var title = json.label || (dataColumn && dataColumn.title); var title = json.label || (dataColumn && dataColumn.title);
var initValue; var initValue;
if (init != null) { const objinit = { ...init, ...obj }
if (objinit != null) {
if (this.props.fatherCode != null) { if (this.props.fatherCode != null) {
initValue = initValue = objinit[this.props.index] != null
init[this.props.index] != null ? objinit[this.props.index][bindObj ? bindObj.base52 : this.props.uuid]
? init[this.props.index][bindObj ? bindObj.base52 : this.props.uuid]
: null; : null;
} else { } else {
initValue = init[dataColumn.base52]; initValue = objinit[dataColumn.base52];
} }
} else { } else {
if (json.initialValue != null) { if (json.initialValue != null) {
try { try {
initValue = JSON.parse(json.initialValue); initValue = JSON.parse(json.initialValue);
...@@ -1850,6 +1852,8 @@ export default class tableCom extends Component { ...@@ -1850,6 +1852,8 @@ export default class tableCom extends Component {
} }
} }
} }
if (!isEdit) { if (!isEdit) {
if (this.props.fatherCode) { if (this.props.fatherCode) {
if (bindObj != null) { if (bindObj != null) {
...@@ -2748,7 +2752,7 @@ export default class tableCom extends Component { ...@@ -2748,7 +2752,7 @@ export default class tableCom extends Component {
} }
}); });
} }
: () => {} : () => { }
} }
format={json.format ? json.format : 'YYYY-MM-DD HH:mm:ss'} format={json.format ? json.format : 'YYYY-MM-DD HH:mm:ss'}
/>, />,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论