From e20be6f9f108947b26cf99ae77e6276a55c8489f Mon Sep 17 00:00:00 2001 From: Yixin Sun <43978285+piccaSun@users.noreply.github.com> Date: Mon, 13 Nov 2023 21:38:51 +0800 Subject: [PATCH] =?UTF-8?q?fix(mis-web):=20=E5=85=85=E5=80=BC=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E9=A1=B5=E9=9D=A2=E6=90=9C=E7=B4=A2=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E9=97=B4=E7=AD=9B=E9=80=89=E4=B8=8E=E8=B4=A6?= =?UTF-8?q?=E6=88=B7/=E7=A7=9F=E6=88=B7=E6=9D=A1=E4=BB=B6=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E4=BA=A4=E4=BA=92=E4=B8=8D=E4=B8=80=E8=87=B4=20(#974)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### 修改前 租户管理与平台管理下的账户/租户充值记录页面 时间条件的筛选后只有点击搜索才生效 租户/账户筛选时直接发送api请求,造成了二者交互不一致 选择时间后不点击搜索,筛选账户发送了API请求,但是请求参数不是当前选择的时间 ![image](https://github.com/PKUHPC/SCOW/assets/43978285/623c28b7-9da3-4bce-914a-fcc02c541109) 经与产品老师沟通,此PR修改为充值记录页面所有条件单独筛选时不发送请求,点击搜索时才发送请求 ### 修改后 所有条件的筛选都需要点击搜索才能生效 ![chrome-capture-2023-10-13](https://github.com/PKUHPC/SCOW/assets/43978285/dd44aa5c-b224-4b51-8248-ba55514e712a) --- .changeset/cold-ravens-applaud.md | 5 +++++ apps/mis-web/src/pageComponents/common/PaymentTable.tsx | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 .changeset/cold-ravens-applaud.md diff --git a/.changeset/cold-ravens-applaud.md b/.changeset/cold-ravens-applaud.md new file mode 100644 index 0000000000..6ad0321b71 --- /dev/null +++ b/.changeset/cold-ravens-applaud.md @@ -0,0 +1,5 @@ +--- +"@scow/mis-web": patch +--- + +修改充值页面时间筛选与账户/租户筛选交互不一致问题。修改为只有当点击搜索时才发起查询请求。 diff --git a/apps/mis-web/src/pageComponents/common/PaymentTable.tsx b/apps/mis-web/src/pageComponents/common/PaymentTable.tsx index 7f77c30aa8..6975031a87 100644 --- a/apps/mis-web/src/pageComponents/common/PaymentTable.tsx +++ b/apps/mis-web/src/pageComponents/common/PaymentTable.tsx @@ -74,6 +74,8 @@ export const PaymentTable: React.FC = ({ const [form] = Form.useForm(); + const [selectedName, setSelectedName] = useState(accountName); + const [query, setQuery] = useState(() => ({ name: accountName, time: [today.subtract(1, "year"), today], @@ -107,6 +109,7 @@ export const PaymentTable: React.FC = ({ useDidUpdateEffect(() => { setQuery((q) => ({ ...q, name: accountName })); + setSelectedName(accountName); }, [accountName]); return ( @@ -118,7 +121,7 @@ export const PaymentTable: React.FC = ({ initialValues={query} onFinish={async () => { const { name, time } = await form.validateFields(); - setQuery({ name: accountName ?? name, time }); + setQuery({ name: selectedName ?? name, time }); }} > {searchType ? ( @@ -130,14 +133,14 @@ export const PaymentTable: React.FC = ({ {searchType === SearchType.account ? ( { - setQuery({ ...query, name:item }); + setSelectedName(item); }} placeholder={t(pCommon("selectAccount"))} /> ) : ( { - setQuery({ ...query, name:item }); + setSelectedName(item); }} placeholder={t(pCommon("selectTenant"))}