From 9d0acfb65c80c4948c305ca01338f894b87346a0 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期一, 08 四月 2024 09:44:37 +0800
Subject: [PATCH] Merge branch 'Four-Way-Rack' of http://47.97.1.152:5880/r/zy-asrs-master into Four-Way-Rack

---
 zy-asrs-flow/src/components/TableSearch/index.jsx |   59 +++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 41 insertions(+), 18 deletions(-)

diff --git a/zy-asrs-flow/src/components/TableSearch/index.jsx b/zy-asrs-flow/src/components/TableSearch/index.jsx
index 909d0c9..2da0dcf 100644
--- a/zy-asrs-flow/src/components/TableSearch/index.jsx
+++ b/zy-asrs-flow/src/components/TableSearch/index.jsx
@@ -1,5 +1,6 @@
 import React from 'react';
 import { Input, Button, Space, Select, DatePicker } from 'antd';
+import { FormattedMessage, useIntl } from '@umijs/max';
 import Http from '@/utils/http';
 import moment from 'moment';
 
@@ -7,14 +8,15 @@
 const DATE_FORMAT = 'YYYY-MM-DD HH:mm:ss';
 
 const TextFilter = (props) => {
+    const intl = useIntl();
     const [condition, setCondition] = React.useState('');
 
     return (
         <div style={{ padding: 8 }}>
             <Input
                 style={{ width: 188, marginBottom: 8, display: 'block' }}
-                placeholder="璇疯緭鍏�"
-                value={props.selectedKeys[0]}
+                placeholder={intl.formatMessage({ id: 'commont.enter', defaultMessage: '璇疯緭鍏�' })}
+                value={condition}
                 onChange={e => {
                     props.setSelectedKeys(e.target.value ? [e.target.value] : []);
                     setCondition(e.target.value)
@@ -25,25 +27,43 @@
                     type="primary"
                     onClick={() => {
                         props.confirm();
-                        props.setSearchParam(prevState => ({
-                            ...prevState,
-                            [props.name]: props.selectedKeys[0]
-                        }));
+                        if (condition === '' || condition === null || condition === undefined) {
+                            props.setSearchParam(prevState => {
+                                const state = { ...prevState };
+                                delete state[props.name];
+                                return state;
+                            })
+                        } else {
+                            props.setSearchParam(prevState => ({
+                                ...prevState,
+                                [props.name]: condition
+                            }));
+                        }
                         props.actionRef.current?.reload();
                     }}
                     size="small"
                     style={{ width: 90 }}
                 >
-                    纭畾
+                    <FormattedMessage id='common.submit' defaultMessage='纭畾' />
                 </Button>
                 <Button
                     onClick={() => {
-                        props.clearFilters && props.clearFilters()
+                        setCondition('')
+                        props.setSelectedKeys([]);
+                        props.clearFilters()
+
+                        props.confirm();
+                        props.setSearchParam(prevState => {
+                            const state = { ...prevState };
+                            delete state[props.name];
+                            return state;
+                        })
+                        props.actionRef.current?.reload();
                     }}
                     size="small"
                     style={{ width: 90 }}
                 >
-                    閲嶇疆
+                    <FormattedMessage id='common.reset' defaultMessage='閲嶇疆' />
                 </Button>
             </Space>
         </div>
@@ -51,6 +71,7 @@
 }
 
 const SelectFilter = (props) => {
+    const intl = useIntl();
     const [currentOption, setCurrentOption] = React.useState();
 
     return (
@@ -58,7 +79,7 @@
             <div>
                 <Select
                     style={{ width: 188, marginBottom: 8, display: 'block' }}
-                    placeholder="璇烽�夋嫨"
+                    placeholder={intl.formatMessage({ id: 'commont.select', defaultMessage: '璇烽�夋嫨' })}
                     value={currentOption === NONE_OPTION ? undefined : currentOption}
                     onChange={value => {
                         setCurrentOption(value)
@@ -94,7 +115,7 @@
                     size="small"
                     style={{ width: 90 }}
                 >
-                    纭畾
+                    <FormattedMessage id='common.submit' defaultMessage='纭畾' />
                 </Button>
                 <Button
                     onClick={() => {
@@ -113,7 +134,7 @@
                     size="small"
                     style={{ width: 90 }}
                 >
-                    閲嶇疆
+                    <FormattedMessage id='common.reset' defaultMessage='閲嶇疆' />
                 </Button>
             </Space>
         </div>
@@ -121,6 +142,7 @@
 }
 
 const DatetimeRangeFilter = (props) => {
+    const intl = useIntl();
     const [dates, setDates] = React.useState([null, null]);
     const [startDate, setStartDate] = React.useState(null);
     const [endDate, setEndDate] = React.useState(null);
@@ -164,7 +186,7 @@
                             }}
                             size="small"
                         >
-                            纭畾
+                            <FormattedMessage id='common.submit' defaultMessage='纭畾' />
                         </Button>
                         <Button
                             onClick={() => {
@@ -184,7 +206,7 @@
                             }}
                             size="small"
                         >
-                            閲嶇疆
+                            <FormattedMessage id='common.reset' defaultMessage='閲嶇疆' />
                         </Button>
                     </Space>
                 </Space>
@@ -194,11 +216,12 @@
 }
 
 const LinkFilter = (props) => {
+    const intl = useIntl();
     const [currentOption, setCurrentOption] = React.useState();
     const [options, setOptions] = React.useState([]);
 
     const fetchData = async (value) => {
-        return await Http.doPostForm(`api/${props.name}/query`, { condition: value });
+        return await Http.doPostForm(`api/${props.major}/query`, { condition: value });
     }
 
     async function initOptions(value) {
@@ -219,7 +242,7 @@
             <div>
                 <Select
                     style={{ width: 188, marginBottom: 8, display: 'block' }}
-                    placeholder="璇烽�夋嫨"
+                    placeholder={intl.formatMessage({ id: 'commont.select', defaultMessage: '璇烽�夋嫨' })}
                     value={currentOption === NONE_OPTION ? undefined : currentOption}
                     onChange={value => {
                         setCurrentOption(value)
@@ -254,7 +277,7 @@
                     size="small"
                     style={{ width: 90 }}
                 >
-                    纭畾
+                    <FormattedMessage id='common.submit' defaultMessage='纭畾' />
                 </Button>
                 <Button
                     onClick={() => {
@@ -274,7 +297,7 @@
                     size="small"
                     style={{ width: 90 }}
                 >
-                    閲嶇疆
+                    <FormattedMessage id='common.reset' defaultMessage='閲嶇疆' />
                 </Button>
             </Space>
         </div>

--
Gitblit v1.9.1