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

修改bug

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