From 3b652633ccb6d3dbcdf126f3b0649b7b0cd8a61c Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期四, 15 二月 2024 15:28:20 +0800 Subject: [PATCH] # --- zy-asrs-flow/src/components/TableSearch/index.jsx | 111 +++++++++++++++---------------------------------------- 1 files changed, 30 insertions(+), 81 deletions(-) diff --git a/zy-asrs-flow/src/components/TableSearch/index.jsx b/zy-asrs-flow/src/components/TableSearch/index.jsx index b799cbe..636ceb7 100644 --- a/zy-asrs-flow/src/components/TableSearch/index.jsx +++ b/zy-asrs-flow/src/components/TableSearch/index.jsx @@ -1,84 +1,33 @@ +import React from 'react'; +import { Input, Button, Space } from 'antd'; -const Main = () => { - const [searchText, setSearchText] = useState(''); - const [searchedColumn, setSearchedColumn] = useState(''); - const searchInput = useRef(null); - const getColumnSearchProps = (dataIndex) => ({ - filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters, close }) => ( - <div style={{ padding: 8 }} onKeyDown={(e) => e.stopPropagation()}> - <Input - ref={searchInput} - placeholder={`Search ${dataIndex}`} - value={selectedKeys[0]} - onChange={(e) => setSelectedKeys(e.target.value ? [e.target.value] : [])} - onPressEnter={() => handleSearch(selectedKeys, confirm, dataIndex)} - style={{ marginBottom: 8, display: 'block' }} - /> - <Space> - <Button - type="primary" - onClick={() => handleSearch(selectedKeys, confirm, dataIndex)} - icon={<SearchOutlined />} - size="small" - style={{ width: 90 }} - > - Search - </Button> - <Button - onClick={() => clearFilters && handleReset(clearFilters)} - size="small" - style={{ width: 90 }} - > - Reset - </Button> - <Button - type="link" - size="small" - onClick={() => { - confirm({ closeDropdown: false }); - setSearchText((selectedKeys)[0]); - setSearchedColumn(dataIndex); - }} - > - Filter - </Button> - <Button - type="link" - size="small" - onClick={() => { - close(); - }} - > - close - </Button> - </Space> - </div> - ), - filterIcon: (filtered) => ( - <SearchOutlined style={{ color: filtered ? '#1677ff' : undefined }} /> - ), - onFilter: (value, record) => - record[dataIndex] - .toString() - .toLowerCase() - .includes((value).toLowerCase()), - onFilterDropdownOpenChange: (visible) => { - if (visible) { - setTimeout(() => searchInput.current?.select(), 100); - } - }, - render: (text) => - searchedColumn === dataIndex ? ( - <Highlighter - highlightStyle={{ backgroundColor: '#ffc069', padding: 0 }} - searchWords={[searchText]} - autoEscape - textToHighlight={text ? text.toString() : ''} - /> - ) : ( - text - ), - }); +const Filter = (props) => { + return ( + <div style={{ padding: 8 }}> + <Input + style={{ width: 188, marginBottom: 8, display: 'block' }} + value={props.selectedKeys[0]} + onChange={e => props.setSelectedKeys(e.target.value ? [e.target.value] : [])} + /> + <Space> + <Button + type="primary" + onClick={() => props.confirm()} + size="small" + style={{ width: 90 }} + > + 纭畾 + </Button> + <Button + onClick={() => props.clearFilters && props.clearFilters()} + size="small" + style={{ width: 90 }} + > + 閲嶇疆 + </Button> + </Space> + </div> + ); } -export default Main; \ No newline at end of file +export default Filter; \ No newline at end of file -- Gitblit v1.9.1