From 2e06fd2af55219d270890f58c11f76fecd98b0cc Mon Sep 17 00:00:00 2001 From: huyunkun <1391805182@qq.com> Date: Thu, 28 May 2026 20:24:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/MemberList/index.jsx | 152 +++++++++++++++++++++++++++------ 1 file changed, 125 insertions(+), 27 deletions(-) diff --git a/src/pages/MemberList/index.jsx b/src/pages/MemberList/index.jsx index 4ecb141..0ab87f4 100644 --- a/src/pages/MemberList/index.jsx +++ b/src/pages/MemberList/index.jsx @@ -9,9 +9,13 @@ import { UNIT_OR_ORG_TYPE_MAP, UNIT_OR_ORG_TYPE_OPTIONS, GENDER_MAP, + GENDER_OPTIONS, POLITICAL_STATUS_MAP, + POLITICAL_STATUS_OPTIONS, EDUCATION_LEVEL_MAP, + EDUCATION_LEVEL_OPTIONS, REGION_OR_UNIT_MAP, + REGION_OR_UNIT_OPTIONS, PERSONAL_MEMBER_TYPE_MAP, PERSONAL_MEMBER_TYPE_OPTIONS, } from '../../api/member' @@ -105,11 +109,18 @@ function adaptPersonalMember(item) { function MemberList() { const [activeTab, setActiveTab] = useState(MEMBER_CATEGORY.UNIT) - const [filters, setFilters] = useState({ + const initialFilters = { name: '', unitOrOrgType: undefined, memberType: undefined, - }) + gender: undefined, + politicalStatus: undefined, + educationLevel: undefined, + title: '', + regionOrUnit: undefined, + specialCommitteeMemberType: '', + } + const [filters, setFilters] = useState(initialFilters) const [appliedFilters, setAppliedFilters] = useState({}) const [pagination, setPagination] = useState({ current: 1, pageSize: 10 }) const [loading, setLoading] = useState(false) @@ -130,6 +141,24 @@ function MemberList() { } if (appliedFilters.name) params.name = appliedFilters.name + // 单位会员接口支持的筛选参数 + if (activeTab === MEMBER_CATEGORY.UNIT) { + if (appliedFilters.unitOrOrgType) params.unitOrOrgType = appliedFilters.unitOrOrgType + } + + // 个人会员接口支持的筛选参数 + if (activeTab === MEMBER_CATEGORY.PERSONAL) { + if (appliedFilters.gender) params.gender = appliedFilters.gender + if (appliedFilters.politicalStatus) params.politicalStatus = appliedFilters.politicalStatus + if (appliedFilters.memberType) params.memberType = appliedFilters.memberType + if (appliedFilters.educationLevel) params.educationLevel = appliedFilters.educationLevel + if (appliedFilters.title) params.title = appliedFilters.title + if (appliedFilters.regionOrUnit) params.regionOrUnit = appliedFilters.regionOrUnit + if (appliedFilters.specialCommitteeMemberType) { + params.specialCommitteeMemberType = appliedFilters.specialCommitteeMemberType + } + } + const fetcher = activeTab === MEMBER_CATEGORY.UNIT ? fetchUnitOrOrgMemberPage @@ -145,14 +174,6 @@ function MemberList() { ? records.map(adaptUnitOrOrgMember) : records.map(adaptPersonalMember) - // 客户端二次过滤(接口暂未提供该参数) - if (activeTab === MEMBER_CATEGORY.UNIT && appliedFilters.unitOrOrgType) { - list = list.filter((it) => it.unitOrOrgType === appliedFilters.unitOrOrgType) - } - if (activeTab === MEMBER_CATEGORY.PERSONAL && appliedFilters.memberType) { - list = list.filter((it) => it.memberType === appliedFilters.memberType) - } - setTableData(list) setTotal(totalCount) } catch (err) { @@ -176,14 +197,13 @@ function MemberList() { setPagination((prev) => ({ ...prev, current: 1 })) } const handleReset = () => { - const empty = { name: '', unitOrOrgType: undefined, memberType: undefined } - setFilters(empty) - setAppliedFilters(empty) + setFilters(initialFilters) + setAppliedFilters(initialFilters) setPagination((prev) => ({ ...prev, current: 1 })) } const handleTabChange = (key) => { setActiveTab(key) - setFilters({ name: '', unitOrOrgType: undefined, memberType: undefined }) + setFilters(initialFilters) setAppliedFilters({}) setPagination({ current: 1, pageSize: 10 }) } @@ -402,19 +422,97 @@ function MemberList() { ) : ( - - - + <> + + + + + + + + + + + + + + handleFilterChange('title', e.target.value)} + onPressEnter={handleSearch} + allowClear + style={{ width: 180, borderRadius: 6 }} + /> + + + + + + handleFilterChange('specialCommitteeMemberType', e.target.value)} + onPressEnter={handleSearch} + allowClear + style={{ width: 180, borderRadius: 6 }} + /> + + )}