提交 b1ee5caf authored 作者: 徐立's avatar 徐立
...@@ -94,7 +94,7 @@ const CreateForm = Form.create()(props => { ...@@ -94,7 +94,7 @@ const CreateForm = Form.create()(props => {
formItem.map((item, index) => { formItem.map((item, index) => {
if (item.type.indexOf('DATE') > -1) { if (item.type.indexOf('DATE') > -1) {
for (let d in fieldsValue) { for (let d in fieldsValue) {
if (item.name == d) { if (item.name === d&&fieldsValue[d]) {
fieldsValue[d] = fieldsValue[d].format('YYYY-MM-DD HH:mm:ss'); fieldsValue[d] = fieldsValue[d].format('YYYY-MM-DD HH:mm:ss');
} }
} }
...@@ -186,7 +186,7 @@ class FormList extends React.Component { ...@@ -186,7 +186,7 @@ class FormList extends React.Component {
} }
} }
modify = record => { modify = record => {
if (this.state.formItem.length < 10) { // if (this.state.formItem.length < 10) {
this.getOptions() this.getOptions()
this.setState({ this.setState({
formData: record, formData: record,
...@@ -194,23 +194,23 @@ class FormList extends React.Component { ...@@ -194,23 +194,23 @@ class FormList extends React.Component {
isAdd: false, isAdd: false,
isView:false isView:false
}); });
} else { // } else {
router.push({ // router.push({
pathname: '/admin/ddl/dataObj/formEdit', // pathname: '/admin/ddl/dataObj/formEdit',
state: { // state: {
id: this.state.objId, // id: this.state.objId,
recordId: record[this.state.primaryKey], // recordId: record[this.state.primaryKey],
recordKey: this.state.primaryKey, // recordKey: this.state.primaryKey,
isAdd: false, // isAdd: false,
isView:false // isView:false
}, // },
}); // });
} // }
}; };
view = record => { view = record => {
if (this.state.formItem.length < 10) { // if (this.state.formItem.length < 10) {
this.getOptions() this.getOptions()
this.setState({ this.setState({
formData: record, formData: record,
...@@ -218,18 +218,18 @@ class FormList extends React.Component { ...@@ -218,18 +218,18 @@ class FormList extends React.Component {
isAdd: false, isAdd: false,
isView:true isView:true
}); });
} else { // } else {
router.push({ // router.push({
pathname: '/admin/ddl/dataObj/formEdit', // pathname: '/admin/ddl/dataObj/formEdit',
state: { // state: {
id: this.state.objId, // id: this.state.objId,
recordId: record[this.state.primaryKey], // recordId: record[this.state.primaryKey],
recordKey: this.state.primaryKey, // recordKey: this.state.primaryKey,
isAdd: false, // isAdd: false,
isView:true // isView:true
}, // },
}); // });
} // }
}; };
delete = record => { delete = record => {
...@@ -606,7 +606,7 @@ class FormList extends React.Component { ...@@ -606,7 +606,7 @@ class FormList extends React.Component {
}; };
add = () => { add = () => {
if (this.state.formItem.length < 10) { // if (this.state.formItem.length < 10) {
this.getOptions() this.getOptions()
this.setState({ this.setState({
modalVisible: true, modalVisible: true,
...@@ -614,12 +614,12 @@ class FormList extends React.Component { ...@@ -614,12 +614,12 @@ class FormList extends React.Component {
isAdd: true, isAdd: true,
isView:false isView:false
}); });
} else { // } else {
router.push({ // router.push({
pathname: '/admin/ddl/dataObj/formEdit', // pathname: '/admin/ddl/dataObj/formEdit',
state: { id: this.state.objId,isAdd: true,isView:false } // state: { id: this.state.objId,isAdd: true,isView:false }
}); // });
} // }
}; };
handleSelectRows = rows => { handleSelectRows = rows => {
...@@ -678,7 +678,7 @@ class FormList extends React.Component { ...@@ -678,7 +678,7 @@ class FormList extends React.Component {
formItem.map((item, index) => { formItem.map((item, index) => {
if (item.type.indexOf('DATE') > -1) { if (item.type.indexOf('DATE') > -1) {
for (let d in fieldsValue) { for (let d in fieldsValue) {
if (item.name == d && fieldsValue[d]) { if (item.name === d && fieldsValue[d]) {
if(fieldsValue[d]!=null&&fieldsValue[d].length>0){ if(fieldsValue[d]!=null&&fieldsValue[d].length>0){
fieldsValue[d]=[fieldsValue[d][0].format('YYYY-MM-DD HH:mm:ss'),fieldsValue[d][1].format('YYYY-MM-DD HH:mm:ss')]; fieldsValue[d]=[fieldsValue[d][0].format('YYYY-MM-DD HH:mm:ss'),fieldsValue[d][1].format('YYYY-MM-DD HH:mm:ss')];
}else { }else {
...@@ -744,7 +744,7 @@ class FormList extends React.Component { ...@@ -744,7 +744,7 @@ class FormList extends React.Component {
{form.getFieldDecorator(item.name, { {form.getFieldDecorator(item.name, {
initialValue: formData == null ? '' : formData[item.name], initialValue: formData == null ? '' : formData[item.name],
rules: [{ required: !item.isNull }], rules: [{ required: !item.isNull }],
})(<Select style={{ width: 200 }} placeholder="请选择" allowClear> })(<Select style={{ width: '70%' }} placeholder="请选择" allowClear>
{ops.map((r) => <Option value={r[item.referenceCodeName]} {ops.map((r) => <Option value={r[item.referenceCodeName]}
key={r[item.referenceCodeName]}>{r[item.referenceNameName]}</Option>)} key={r[item.referenceCodeName]}>{r[item.referenceNameName]}</Option>)}
...@@ -759,7 +759,7 @@ class FormList extends React.Component { ...@@ -759,7 +759,7 @@ class FormList extends React.Component {
{form.getFieldDecorator(item.name, { {form.getFieldDecorator(item.name, {
initialValue: formData == null ? '' : formData[item.name], initialValue: formData == null ? '' : formData[item.name],
rules: [{ required: !item.isNull }], rules: [{ required: !item.isNull }],
})(<Select style={{ width: 200 }} placeholder="请选择" allowClear> })(<Select style={{ width: '70%' }} placeholder="请选择" allowClear>
{ops.map((r) => <Option value={r.value} {ops.map((r) => <Option value={r.value}
key={r.value}>{r.value}</Option>)} key={r.value}>{r.value}</Option>)}
</Select>)} </Select>)}
...@@ -792,15 +792,16 @@ class FormList extends React.Component { ...@@ -792,15 +792,16 @@ class FormList extends React.Component {
rules: [{ required: !item.isNull }], rules: [{ required: !item.isNull }],
})( })(
<RangePicker format={item.dataFormatStrWeb==null?"YYYY-MM-DD HH:mm:ss":item.dataFormatStrWeb} <RangePicker format={item.dataFormatStrWeb==null?"YYYY-MM-DD HH:mm:ss":item.dataFormatStrWeb}
style={{ width: '100%' }} />)} style={{ width: '95%' }} />)}
</FormItem> </FormItem>
); );
}else if (data.indexOf(item.type) > -1) { }else if (data.indexOf(item.type) > -1) {
return ( return (
<FormItem labelCol={labelCol} wrapperCol={wrapperCol} label={item.title} key={item.id}> <FormItem labelCol={labelCol} wrapperCol={wrapperCol} label={item.title} key={item.id}>
{form.getFieldDecorator(item.name, { {form.getFieldDecorator(item.name, {
initialValue: formData == null ? null : moment(formData[item.name]), initialValue: formData == null ? moment() :(formData[item.name]?moment(formData[item.name]):null),
rules: [{ required: !item.isNull }], rules: [{ required: !item.isNull }],
})( })(
<DatePicker <DatePicker
...@@ -833,13 +834,9 @@ class FormList extends React.Component { ...@@ -833,13 +834,9 @@ class FormList extends React.Component {
} }
return ( return (
<Form layout="inline"> <Form layout="inline">
<Row gutter={{ <Row >
md: 8,
lg: 24,
xl: 48
}}>
{querys.map((item) => {querys.map((item) =>
<Col md={6} sm={24} key={item.id}> <Col span={8} key={item.id}>
{this.getItem(true,form, { {this.getItem(true,form, {
...item, ...item,
isNull: true isNull: true
...@@ -847,7 +844,7 @@ class FormList extends React.Component { ...@@ -847,7 +844,7 @@ class FormList extends React.Component {
</Col> </Col>
)} )}
<Col md={6} sm={24}> <Col span={8} >
<span className={styles.submitButtons}> <span className={styles.submitButtons}>
<Button type="primary" loading={this.props.loading} onClick={this.handleSearch}> <Button type="primary" loading={this.props.loading} onClick={this.handleSearch}>
查询 查询
...@@ -883,7 +880,7 @@ class FormList extends React.Component { ...@@ -883,7 +880,7 @@ class FormList extends React.Component {
showMobileDiv, showMobileDiv,
isView isView
} = this.state } = this.state
let scrollWidth = document.documentElement.clientWidth || document.body.clientWidth; //可使宽度 let scrollWidth = document.documentElement.clientWidth || document.body.clientWidth; //可使宽度
let isMobile = scrollWidth < 1200 let isMobile = scrollWidth < 1200
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论