想知道这段代码的都是什么意思?请帮忙解答,谢谢各位了
我想知道这些代码都是什么意思??
import React from 'react'
import PropTypes from 'prop-types'
import { Form, Button, Row, Col, Input, Select, DatePicker } from 'antd'
import { FormattedMessage, injectIntl, intlShape } from 'react-intl'
import styles from 'components/GSOP/common/common.less'
const { Search } = Input
const Option = Select.Option
const { RangePicker } = DatePicker
const ColProps = {
xs: 24,
sm: 12,
style: {
marginBottom: 16,
},
}
const TwoColProps = {
...ColProps,
xl: 96,
}
const Filter = ({
intl, businessTypeList,
onFilterChange,
filter,
handleDeleteItems,
handleAddItem,
handleEnableItem,
handleDisableItem,
selectedCategoryRowKeys,
form: {
getFieldDecorator,
getFieldsValue,
setFieldsValue,
},
}) => {
const handleSubmit = () => {
let fields = getFieldsValue()
onFilterChange(fields)
}
const handleReset = () => {
const fields = getFieldsValue()
for (let item in fields) {
if ({}.hasOwnProperty.call(fields, item)) {
if (fields[item] instanceof Array) {
fields[item] = []
} else {
fields[item] = undefined
}
}
}
setFieldsValue(fields)
handleSubmit()
}
const handleChange = (key, values) => {
let fields = getFieldsValue()
fields.businessType = key
onFilterChange(fields)
}
const {
id, sender, recipient, status, subject, startDate, contentOfEmail, shippingStatus, businessType, category,
} = filter
return (
<Row gutter={24}>
<Col {...ColProps} xl={18} md={18} sm={24}>
<Col {...ColProps} xl={{ span: 6 }} md={{ span: 6 }}>
{intl.formatMessage({ id: 'gsop.email.businessType' })}
{getFieldDecorator('businessType', { initialValue: businessType })(<Select
showSearch
style={{ width: 170 }}
placeholder={intl.formatMessage({ id: 'india.category.status' })}
optionFilterProp="children"
onChange={handleChange}
filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
>
{
businessTypeList && businessTypeList.map((item, index) => {
return (
<Option key={index} value={item.businessType}>{item.businessType}</Option>
)
})
}
</Select>)}
</Col>
<Col {...ColProps} xl={{ span: 6 }} md={{ span: 6 }}>
{intl.formatMessage({ id: 'gsop.email.emailSubject' })}
{getFieldDecorator('subject', { initialValue: subject })(<Input placeholder={intl.formatMessage({ id: 'common.input' })} />)}
</Col>
<Col {...ColProps} xl={{ span: 6 }} md={{ span: 6 }}>
{intl.formatMessage({ id: 'gsop.email.recipient' })}
{getFieldDecorator('recipient', { initialValue: recipient })(<Input placeholder={intl.formatMessage({ id: 'common.input' })} />)}
</Col>
<Col {...ColProps} xl={{ span: 6 }} md={{ span: 6 }} id="createTimeRangePicker">
{intl.formatMessage({ id: 'gsop.email.sentTime' })}
{getFieldDecorator('startDate')(<RangePicker style={{ width: '100%' }} showTime format="YYYY-MM-DD HH:mm:ss" />)}
</Col>
<Col {...ColProps} xl={{ span: 6 }} md={{ span: 6 }}>
{intl.formatMessage({ id: 'gsop.email.shippingStatus' })}
{getFieldDecorator('shippingStatus', { initialValue: shippingStatus })(<Select
showSearch
style={{ width: 170 }}
placeholder={intl.formatMessage({ id: 'india.category.status' })}
optionFilterProp="children"
onChange={handleChange}
filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
>
<Option value="">sucuess</Option>
<Option value="">failure</Option>
</Select>)}
</Col>
</Col>
<Col {...TwoColProps} xl={{ span: 6 }} md={{ span: 4 }} sm={{ span: 12 }}>
<Col className={styles.emailtBtn} style={{ textAlign: 'center' }}>
<Button type="primary" className="margin-right" onClick={handleSubmit}><FormattedMessage id="common.list.search" /></Button>
</Col>
</Col>
<div />
</Row>
)
}
// 参数类型验证
Filter.propTypes = {
intl: intlShape.isRequired,
handleDeleteItems: PropTypes.func,
handleAddItem: PropTypes.func,
handleEnableItem: PropTypes.func,
handleDisableItem: PropTypes.func,
selectedCategoryRowKeys: PropTypes.array,
form: PropTypes.object,
filter: PropTypes.object,
onFilterChange: PropTypes.func,
businessTypeList: PropTypes.array,
}
export default Form.create()(injectIntl(Filter))