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 +++++++++++++++----------------------------------------
zy-asrs-flow/src/pages/system/role/index.jsx | 8 ++-
2 files changed, 35 insertions(+), 84 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
diff --git a/zy-asrs-flow/src/pages/system/role/index.jsx b/zy-asrs-flow/src/pages/system/role/index.jsx
index e07569d..d770d00 100644
--- a/zy-asrs-flow/src/pages/system/role/index.jsx
+++ b/zy-asrs-flow/src/pages/system/role/index.jsx
@@ -1,17 +1,17 @@
import React, { useState, useRef, useEffect } from 'react';
import { useIntl, FormattedMessage } from '@umijs/max';
-import { Button, message, Modal } from 'antd';
+import { Button, message, Modal, Input, Space } from 'antd';
import {
FooterToolbar,
PageContainer,
ProTable,
LightFilter,
} from '@ant-design/pro-components';
-import { PlusOutlined, ExportOutlined } from '@ant-design/icons';
+import { PlusOutlined, ExportOutlined, SearchOutlined } from '@ant-design/icons';
import Http from '@/utils/http';
import Edit from './components/edit'
-
+import Filter from '@/components/TableSearch'
const handleSave = async (val) => {
const hide = message.loading('姝e湪娣诲姞');
@@ -117,6 +117,7 @@
title: '鏍囪瘑',
dataIndex: 'code',
valueType: 'text',
+ filterDropdown: (props) => <Filter {...props} />,
},
{
title: '鎿嶄綔',
@@ -233,6 +234,7 @@
// ]}
request={(params, sorter, filter) =>
Http.doPostPromise('/api/role/page', { ...params, ...searchParam }, (res) => {
+ console.log(filter);
return {
data: res.data.records,
total: res.data.total,
--
Gitblit v1.9.1