From 404d14431ad51ebb9a2477a0bca8671c2df5e086 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 15 二月 2024 14:26:37 +0800
Subject: [PATCH] #
---
zy-asrs-flow/src/components/TableSearch/index.jsx | 84 ++++++++++++++++++++++++++++++++++++++++++
zy-asrs-flow/src/pages/system/role/index.jsx | 11 ++++-
2 files changed, 92 insertions(+), 3 deletions(-)
diff --git a/zy-asrs-flow/src/components/TableSearch/index.jsx b/zy-asrs-flow/src/components/TableSearch/index.jsx
new file mode 100644
index 0000000..b799cbe
--- /dev/null
+++ b/zy-asrs-flow/src/components/TableSearch/index.jsx
@@ -0,0 +1,84 @@
+
+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
+ ),
+ });
+}
+
+export default Main;
\ 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 b6561d6..104128b 100644
--- a/zy-asrs-flow/src/pages/system/role/index.jsx
+++ b/zy-asrs-flow/src/pages/system/role/index.jsx
@@ -1,14 +1,18 @@
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,
+ FooterToolbar,
+ PageContainer,
+ ProTable,
+ LightFilter,
ProFormDatePicker,
} 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'
+
const handleSave = async (val) => {
const hide = message.loading('姝e湪娣诲姞');
@@ -82,6 +86,7 @@
}
};
+
const Main = () => {
const formTableRef = useRef();
const actionRef = useRef();
--
Gitblit v1.9.1