diff --git a/src/components/ui/search.js b/src/components/ui/search.js new file mode 100644 index 0000000..a81de99 --- /dev/null +++ b/src/components/ui/search.js @@ -0,0 +1,28 @@ +import React from 'react' +import styles from './search.less' +import { Input, Select, Button, Icon } from 'antd' + +const Search = (props) => { + const handleSearch = () => { + // console.log(this.refs.searchInput) + } + const handleInputChange = () => { + + } + const handleClearInput = () => { + + } + const {size, select, selectOptions, selectProps, onSearch} = props + return ( + + {select ? : ''} + + + + + ) +} + +export default Search diff --git a/src/components/ui/search.less b/src/components/ui/search.less new file mode 100644 index 0000000..d25672a --- /dev/null +++ b/src/components/ui/search.less @@ -0,0 +1,54 @@ +.no-highlight() { + border-color: #e5e5e5; + box-shadow: none; +} + +.search { + display: flex; + width: 100%; + position: relative; + + :global { + .anticon-cross{ + position: absolute; + width: 18px; + height: 18px; + right: 84px; + cursor: pointer; + color: #fff; + line-height: 18px; + border-radius: 50%!important; + background-color: rgba(0, 0, 0, .16); + top:7px; + // opacity: + } + .ant-select { + width: 80px; + flex-shrink: 0; + flex-grow: 0; + + &.ant-select-focused .ant-select-selection, + &.ant-select-open .ant-select-selection, + .ant-select-selection:active, + .ant-select-selection:focus, + .ant-select-selection:hover { + .no-highlight(); + } + } + + .ant-input { + &:focus, + &:hover { + .no-highlight(); + } + flex-shrink: 1; + flex-grow: 1; + } + + .ant-btn { + width: 80px; + flex-shrink: 0; + flex-grow: 0; + } + } +} diff --git a/src/components/users/search.js b/src/components/users/search.js index 6cb8af6..3c66beb 100644 --- a/src/components/users/search.js +++ b/src/components/users/search.js @@ -1,6 +1,7 @@ import React, { PropTypes } from 'react' -import { Form, Input, Button, Select } from 'antd' +import { Form, Input, Button, Select, Row, Col } from 'antd' import styles from './search.less' +import SearchGroup from '../ui/search' const search = ({ field, @@ -13,52 +14,39 @@ const search = ({ getFieldsValue } }) => { - function handleSubmit (e) { - e.preventDefault() - validateFields((errors) => { - if (errors) { - return - } - onSearch(getFieldsValue()) - }) + // function handleSubmit (e) { + // e.preventDefault() + // validateFields((errors) => { + // if (errors) { + // return + // } + // onSearch(getFieldsValue()) + // }) + // } + + const searchGroupProps ={ + field, + keyword, + size:'large', + select:true, + selectOptions:[{value:'姓名'},{value:'地址'}], + selectProps:{ + defaultValue:"姓名" + }, + onSearch:(res) => { + console.log(res) + } } return ( -
-
- - - - {/* */} - -
-
-
- - {getFieldDecorator('field', { - initialValue: field || 'name' - })( - - )} - - - {getFieldDecorator('keyword', { - initialValue: keyword || '' - })()} - - -
-
-
- -
-
+ + + + + + + + ) } diff --git a/src/components/users/search.less b/src/components/users/search.less index 14d06b2..9717728 100644 --- a/src/components/users/search.less +++ b/src/components/users/search.less @@ -1,8 +1,8 @@ -.normal { - display: flex; - margin-bottom: 20px; -} - -.search { - flex: 1; -} +// .normal { +// display: flex; +// margin-bottom: 20px; +// } +// +// .search { +// flex: 1; +// }