| | |
| | | import React from 'react'; |
| | | import { Input, Button, Space } from 'antd'; |
| | | import { Input, Button, Space, Select } from 'antd'; |
| | | |
| | | const TextFilter = (props) => { |
| | | return ( |
| | |
| | | ); |
| | | } |
| | | |
| | | export { TextFilter }; |
| | | const SelectFilter = (props) => { |
| | | return ( |
| | | <div style={{ padding: 8 }}> |
| | | <Select |
| | | style={{ width: 188, marginBottom: 8 }} |
| | | placeholder="选择一个选项" |
| | | value={props.selectedKeys[0]} |
| | | onChange={value => props.setSelectedKeys(value ? [value] : [])} |
| | | > |
| | | {props.data.map(item => ( |
| | | <Select.Option key={item.value} value={item.value}> |
| | | {item.label} |
| | | </Select.Option> |
| | | ))} |
| | | </Select> |
| | | <Space> |
| | | <Button |
| | | type="primary" |
| | | onClick={() => { |
| | | props.confirm(); |
| | | props.setSearchParam(prevState => ({ |
| | | ...prevState, |
| | | [props.name]: props.selectedKeys[0] |
| | | })); |
| | | props.actionRef.current?.reload(); |
| | | }} |
| | | size="small" |
| | | style={{ width: 90 }} |
| | | > |
| | | 确定 |
| | | </Button> |
| | | <Button |
| | | onClick={() => { |
| | | setSelectedKeys([]); |
| | | clearFilters(); |
| | | }} |
| | | size="small" |
| | | style={{ width: 90 }} |
| | | > |
| | | 重置 |
| | | </Button> |
| | | </Space> |
| | | </div> |
| | | ); |
| | | } |
| | | |
| | | export { TextFilter, SelectFilter }; |
| | |
| | | import { PlusOutlined, ExportOutlined } from '@ant-design/icons'; |
| | | import Http from '@/utils/http'; |
| | | import Edit from './components/edit' |
| | | import { TextFilter } from '@/components/TableSearch' |
| | | import { TextFilter, SelectFilter } from '@/components/TableSearch' |
| | | |
| | | const handleSave = async (val) => { |
| | | const hide = message.loading('正在添加'); |
| | |
| | | dataIndex: 'name', |
| | | valueType: 'text', |
| | | copyable: true, |
| | | filterDropdown: (props) => <TextFilter name='name' {...props} actionRef={actionRef} setSearchParam={setSearchParam} />, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='name' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '标识', |
| | | dataIndex: 'code', |
| | | valueType: 'text', |
| | | filterDropdown: (props) => <TextFilter name='code' {...props} actionRef={actionRef} setSearchParam={setSearchParam} />, |
| | | filterDropdown: (props) => <TextFilter |
| | | name='code' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | />, |
| | | }, |
| | | { |
| | | title: '公司', |
| | |
| | | title: '状态', |
| | | dataIndex: 'status$', |
| | | valueType: 'text', |
| | | filterDropdown: (props) => <SelectFilter |
| | | name='status' |
| | | {...props} |
| | | actionRef={actionRef} |
| | | setSearchParam={setSearchParam} |
| | | data={[ |
| | | { label: '正常', value: 1 }, |
| | | { label: '禁用', value: 0 }, |
| | | ]} |
| | | />, |
| | | |
| | | }, |
| | | { |
| | | title: '修改时间', |