From ce70c5d88bdcd8e263cfad913efdf4a75200ec6a Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 15 二月 2024 21:34:16 +0800
Subject: [PATCH] #
---
zy-asrs-flow/src/components/TableSearch/index.jsx | 56 ++++++++++++++++++++++++++++++++++++++------------------
zy-asrs-flow/src/pages/system/role/index.jsx | 1 -
2 files changed, 38 insertions(+), 19 deletions(-)
diff --git a/zy-asrs-flow/src/components/TableSearch/index.jsx b/zy-asrs-flow/src/components/TableSearch/index.jsx
index 3e7fdb5..86c4939 100644
--- a/zy-asrs-flow/src/components/TableSearch/index.jsx
+++ b/zy-asrs-flow/src/components/TableSearch/index.jsx
@@ -1,11 +1,14 @@
import React from 'react';
import { Input, Button, Space, Select } from 'antd';
+const NONE_OPTION = -9999;
+
const TextFilter = (props) => {
return (
<div style={{ padding: 8 }}>
<Input
style={{ width: 188, marginBottom: 8, display: 'block' }}
+ placeholder="璇疯緭鍏�"
value={props.selectedKeys[0]}
onChange={e => {
props.setSelectedKeys(e.target.value ? [e.target.value] : [])
@@ -40,29 +43,45 @@
}
const SelectFilter = (props) => {
+ const NONE_OPTION = -9999;
+ const [currentOption, setCurrentOption] = React.useState();
+
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>
+ <div>
+ <Select
+ style={{ width: 188, marginBottom: 8, display: 'block' }}
+ placeholder="璇烽�夋嫨"
+ value={currentOption === NONE_OPTION ? undefined : currentOption}
+ onChange={value => {
+ setCurrentOption(value)
+ props.setSelectedKeys(value !== undefined && value !== null ? [value] : []);
+ }}
+ >
+ {props.data.map(item => (
+ <Select.Option key={item.value} value={item.value}>
+ {item.label}
+ </Select.Option>
+ ))}
+ </Select>
+ </div>
<Space>
<Button
type="primary"
onClick={() => {
props.confirm();
- props.setSearchParam(prevState => ({
- ...prevState,
- [props.name]: props.selectedKeys[0]
- }));
+ if (currentOption === NONE_OPTION) {
+ props.setSearchParam(prevState => {
+ const state = { ...prevState };
+ delete state[props.name];
+ return state;
+ })
+ } else {
+ props.setSearchParam(prevState => ({
+ ...prevState,
+ [props.name]: currentOption
+ }));
+ }
props.actionRef.current?.reload();
}}
size="small"
@@ -72,8 +91,9 @@
</Button>
<Button
onClick={() => {
- setSelectedKeys([]);
- clearFilters();
+ setCurrentOption(NONE_OPTION)
+ props.setSelectedKeys([]);
+ props.clearFilters();
}}
size="small"
style={{ width: 90 }}
diff --git a/zy-asrs-flow/src/pages/system/role/index.jsx b/zy-asrs-flow/src/pages/system/role/index.jsx
index d0661d0..b26f477 100644
--- a/zy-asrs-flow/src/pages/system/role/index.jsx
+++ b/zy-asrs-flow/src/pages/system/role/index.jsx
@@ -149,7 +149,6 @@
{ label: '绂佺敤', value: 0 },
]}
/>,
-
},
{
title: '淇敼鏃堕棿',
--
Gitblit v1.9.1