Skip to content

Commit

Permalink
fix(mis-web): 充值记录页面搜索条件的时间筛选与账户/租户条件筛选交互不一致 (#974)
Browse files Browse the repository at this point in the history
### 修改前

租户管理与平台管理下的账户/租户充值记录页面
时间条件的筛选后只有点击搜索才生效
租户/账户筛选时直接发送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)
  • Loading branch information
piccaSun authored Nov 13, 2023
1 parent 135f2b1 commit e20be6f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/cold-ravens-applaud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@scow/mis-web": patch
---

修改充值页面时间筛选与账户/租户筛选交互不一致问题。修改为只有当点击搜索时才发起查询请求。
9 changes: 6 additions & 3 deletions apps/mis-web/src/pageComponents/common/PaymentTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ export const PaymentTable: React.FC<Props> = ({

const [form] = Form.useForm<FilterForm>();

const [selectedName, setSelectedName] = useState<string | undefined>(accountName);

const [query, setQuery] = useState(() => ({
name: accountName,
time: [today.subtract(1, "year"), today],
Expand Down Expand Up @@ -107,6 +109,7 @@ export const PaymentTable: React.FC<Props> = ({

useDidUpdateEffect(() => {
setQuery((q) => ({ ...q, name: accountName }));
setSelectedName(accountName);
}, [accountName]);

return (
Expand All @@ -118,7 +121,7 @@ export const PaymentTable: React.FC<Props> = ({
initialValues={query}
onFinish={async () => {
const { name, time } = await form.validateFields();
setQuery({ name: accountName ?? name, time });
setQuery({ name: selectedName ?? name, time });
}}
>
{searchType ? (
Expand All @@ -130,14 +133,14 @@ export const PaymentTable: React.FC<Props> = ({
{searchType === SearchType.account ? (
<AccountSelector
onChange={(item) => {
setQuery({ ...query, name:item });
setSelectedName(item);
}}
placeholder={t(pCommon("selectAccount"))}
/>
) : (
<TenantSelector
onChange={(item) => {
setQuery({ ...query, name:item });
setSelectedName(item);

}}
placeholder={t(pCommon("selectTenant"))}
Expand Down

0 comments on commit e20be6f

Please sign in to comment.