Skip to content

Commit

Permalink
feat(mis-web): 管理系统的租户管理和平台管理中的账户列表新增拥有者姓名或 id 搜索项 (#1052)
Browse files Browse the repository at this point in the history
在管理系统的租户管理和平台管理中的账户列表新增拥有者姓名或 id 搜索项。这一块是前端搜索不需要改接口

![image](https://github.com/PKUHPC/SCOW/assets/140392039/45661bbf-ed79-4119-b370-425b485fe5d1)
  • Loading branch information
Miracle575 authored Jan 5, 2024
1 parent abb7e84 commit 5144723
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/sixty-pugs-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@scow/mis-web": patch
---

管理系统的租户管理和平台管理中的账户列表新增拥有者姓名或 id 搜索项
1 change: 1 addition & 0 deletions apps/mis-web/src/i18n/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ export default {
account: "Account",
accountName: "Account Name",
owner: "Owner",
ownerIdOrName: "Owner ID or Name",
tenant: "Tenant",
comment: "Comment",
status: "Status",
Expand Down
1 change: 1 addition & 0 deletions apps/mis-web/src/i18n/zh_cn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ export default {
account:"账户",
accountName:"账户名",
owner:"拥有者",
ownerIdOrName: "拥有者ID或姓名",
tenant:"租户",
comment:"备注",
status:"状态",
Expand Down
9 changes: 8 additions & 1 deletion apps/mis-web/src/pageComponents/accounts/AccountTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ interface Props {

interface FilterForm {
accountName: string | undefined;
ownerIdOrName: string | undefined;
}

const filteredStatuses = {
Expand Down Expand Up @@ -65,15 +66,18 @@ export const AccountTable: React.FC<Props> = ({

const [query, setQuery] = useState<FilterForm>({
accountName: undefined,
ownerIdOrName: undefined,
});

const filteredData = useMemo(() => data ? data.results.filter((x) => (
(!query.accountName || x.accountName.includes(query.accountName))
&& (!query.ownerIdOrName || x.ownerId.includes(query.ownerIdOrName) || x.ownerName.includes(query.ownerIdOrName))
&& (rangeSearchStatus === "ALL" || (rangeSearchStatus === "BLOCKED" ? x.blocked : !x.balance.positive))
)) : undefined, [data, query, rangeSearchStatus]);

const searchData = useMemo(() => data ? data.results.filter((x) => (
!query.accountName || x.accountName.includes(query.accountName)
(!query.accountName || x.accountName.includes(query.accountName))
&& (!query.ownerIdOrName || x.ownerId.includes(query.ownerIdOrName) || x.ownerName.includes(query.ownerIdOrName))
)) : undefined, [data, query]);

const usersStatusCount = useMemo(() => {
Expand Down Expand Up @@ -154,6 +158,9 @@ export const AccountTable: React.FC<Props> = ({
<Form.Item label={t(p("account"))} name="accountName">
<Input />
</Form.Item>
<Form.Item label={t(p("ownerIdOrName"))} name="ownerIdOrName">
<Input />
</Form.Item>
<Form.Item>
<Button type="primary" htmlType="submit">{t(pCommon("search"))}</Button>
</Form.Item>
Expand Down

0 comments on commit 5144723

Please sign in to comment.