mirror of
https://github.com/zuiidea/antd-admin
synced 2026-10-26 18:28:57 +00:00
51 lines
1.1 KiB
JavaScript
51 lines
1.1 KiB
JavaScript
import React, { PropTypes } from 'react'
|
|
import { Form, Button, Row, Col } from 'antd'
|
|
import SearchGroup from '../ui/search'
|
|
|
|
const search = ({
|
|
field,
|
|
keyword,
|
|
onSearch,
|
|
onAdd,
|
|
form: {
|
|
getFieldDecorator,
|
|
validateFields,
|
|
getFieldsValue
|
|
}
|
|
}) => {
|
|
const searchGroupProps = {
|
|
field,
|
|
keyword,
|
|
size: 'large',
|
|
select: true,
|
|
selectOptions: [{ value: 'name', name: '姓名' }, { value: 'address', name: '地址' }],
|
|
selectProps: {
|
|
defaultValue: field || 'name'
|
|
},
|
|
onSearch: (value) => {
|
|
onSearch(value)
|
|
}
|
|
}
|
|
|
|
return (
|
|
<Row gutter={24}>
|
|
<Col lg={8} md={12} sm={16} xs={24} style={{marginBottom: 16}}>
|
|
<SearchGroup {...searchGroupProps} />
|
|
</Col>
|
|
<Col lg={{offset: 8, span: 8}} md={12} sm={8} xs={24} style={{marginBottom: 16, textAlign: 'right'}}>
|
|
<Button size='large' type='ghost' onClick={onAdd}>添加</Button>
|
|
</Col>
|
|
</Row>
|
|
)
|
|
}
|
|
|
|
search.propTypes = {
|
|
form: PropTypes.object.isRequired,
|
|
onSearch: PropTypes.func,
|
|
onAdd: PropTypes.func,
|
|
field: PropTypes.string,
|
|
keyword: PropTypes.string
|
|
}
|
|
|
|
export default Form.create()(search)
|