| | |
| | | import React from 'react'; |
| | | import { Input, Button, Space, Select, DatePicker } from 'antd'; |
| | | import { FormattedMessage, useIntl } from '@umijs/max'; |
| | | import Http from '@/utils/http'; |
| | | import moment from 'moment'; |
| | | |
| | |
| | | const DATE_FORMAT = 'YYYY-MM-DD HH:mm:ss'; |
| | | |
| | | const TextFilter = (props) => { |
| | | const intl = useIntl(); |
| | | const [condition, setCondition] = React.useState(''); |
| | | |
| | | return ( |
| | | <div style={{ padding: 8 }}> |
| | | <Input |
| | | style={{ width: 188, marginBottom: 8, display: 'block' }} |
| | | placeholder="请输入" |
| | | placeholder={intl.formatMessage({ id: 'commont.enter', defaultMessage: '请输入' })} |
| | | value={condition} |
| | | onChange={e => { |
| | | props.setSelectedKeys(e.target.value ? [e.target.value] : []); |
| | |
| | | size="small" |
| | | style={{ width: 90 }} |
| | | > |
| | | 确定 |
| | | <FormattedMessage id='common.submit' defaultMessage='确定' /> |
| | | </Button> |
| | | <Button |
| | | onClick={() => { |
| | |
| | | size="small" |
| | | style={{ width: 90 }} |
| | | > |
| | | 重置 |
| | | <FormattedMessage id='common.reset' defaultMessage='重置' /> |
| | | </Button> |
| | | </Space> |
| | | </div> |
| | |
| | | } |
| | | |
| | | const SelectFilter = (props) => { |
| | | const intl = useIntl(); |
| | | const [currentOption, setCurrentOption] = React.useState(); |
| | | |
| | | return ( |
| | |
| | | <div> |
| | | <Select |
| | | style={{ width: 188, marginBottom: 8, display: 'block' }} |
| | | placeholder="请选择" |
| | | placeholder={intl.formatMessage({ id: 'commont.select', defaultMessage: '请选择' })} |
| | | value={currentOption === NONE_OPTION ? undefined : currentOption} |
| | | onChange={value => { |
| | | setCurrentOption(value) |
| | |
| | | size="small" |
| | | style={{ width: 90 }} |
| | | > |
| | | 确定 |
| | | <FormattedMessage id='common.submit' defaultMessage='确定' /> |
| | | </Button> |
| | | <Button |
| | | onClick={() => { |
| | |
| | | size="small" |
| | | style={{ width: 90 }} |
| | | > |
| | | 重置 |
| | | <FormattedMessage id='common.reset' defaultMessage='重置' /> |
| | | </Button> |
| | | </Space> |
| | | </div> |
| | |
| | | } |
| | | |
| | | const DatetimeRangeFilter = (props) => { |
| | | const intl = useIntl(); |
| | | const [dates, setDates] = React.useState([null, null]); |
| | | const [startDate, setStartDate] = React.useState(null); |
| | | const [endDate, setEndDate] = React.useState(null); |
| | |
| | | }} |
| | | size="small" |
| | | > |
| | | 确定 |
| | | <FormattedMessage id='common.submit' defaultMessage='确定' /> |
| | | </Button> |
| | | <Button |
| | | onClick={() => { |
| | |
| | | }} |
| | | size="small" |
| | | > |
| | | 重置 |
| | | <FormattedMessage id='common.reset' defaultMessage='重置' /> |
| | | </Button> |
| | | </Space> |
| | | </Space> |
| | |
| | | } |
| | | |
| | | const LinkFilter = (props) => { |
| | | const intl = useIntl(); |
| | | const [currentOption, setCurrentOption] = React.useState(); |
| | | const [options, setOptions] = React.useState([]); |
| | | |
| | | |
| | | const fetchData = async (value) => { |
| | | return await Http.doPostForm(`api/${props.major}/query`, { condition: value }); |
| | | } |
| | |
| | | <div> |
| | | <Select |
| | | style={{ width: 188, marginBottom: 8, display: 'block' }} |
| | | placeholder="请选择" |
| | | placeholder={intl.formatMessage({ id: 'commont.select', defaultMessage: '请选择' })} |
| | | value={currentOption === NONE_OPTION ? undefined : currentOption} |
| | | onChange={value => { |
| | | setCurrentOption(value) |
| | |
| | | size="small" |
| | | style={{ width: 90 }} |
| | | > |
| | | 确定 |
| | | <FormattedMessage id='common.submit' defaultMessage='确定' /> |
| | | </Button> |
| | | <Button |
| | | onClick={() => { |
| | |
| | | size="small" |
| | | style={{ width: 90 }} |
| | | > |
| | | 重置 |
| | | <FormattedMessage id='common.reset' defaultMessage='重置' /> |
| | | </Button> |
| | | </Space> |
| | | </div> |