From 8c5d53ee9720c0aba542d1dd7c02b0c1ca792ae9 Mon Sep 17 00:00:00 2001 From: ZLY Date: Tue, 11 Nov 2025 17:02:16 +0800 Subject: [PATCH] =?UTF-8?q?feat(component):=20=E6=B7=BB=E5=8A=A0=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E7=8A=B6=E6=80=81=E7=AD=9B=E9=80=89=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增组件状态筛选状态管理 - 实现组件状态筛选逻辑并集成到请求参数中 - 更新分页依赖以包含组件状态变化 - 添加重置搜索时清空组件状态的功能 - 创建组件状态变更处理函数- 配置 Radio.Group 以支持状态筛选交互 - 扩展筛选选项以包括“全部”状态 - 调整按钮显示逻辑以匹配新的筛选结构 --- .../componentList/index.tsx | 36 +++++++++++++++---- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/src/pages/componentDevelopment/componentList/index.tsx b/src/pages/componentDevelopment/componentList/index.tsx index 1b919f7..1ef6256 100644 --- a/src/pages/componentDevelopment/componentList/index.tsx +++ b/src/pages/componentDevelopment/componentList/index.tsx @@ -32,6 +32,7 @@ const GlobalVarContainer = () => { const [visible, setVisible] = useState(false); const [mode, setMode] = useState<'create' | 'edit' | 'copy'>('create'); // 添加模式状态 const [searchValue, setSearchValue] = useState(''); // 添加搜索状态 + const [componentStatus, setComponentStatus] = useState(''); // 添加组件状态筛选 const menuItems = [ { @@ -231,7 +232,7 @@ const GlobalVarContainer = () => { else if (selectedItem === '组件审核') { fetchComponentReview(); } - }, [selectedItem, searchValue]); // 添加 searchValue 作为依赖项 + }, [selectedItem, searchValue]); // 获取组件列表数据,支持传入额外参数 const fetchComponentData = async (extraParams: any = {}) => { @@ -252,6 +253,11 @@ const GlobalVarContainer = () => { params.name = searchValue.trim(); } + // 如果选择了组件状态,则添加到参数中 + if (componentStatus) { + params.componentStatus = componentStatus.toUpperCase(); + } + const res: any = await apiMap[selectedItem](params); setComponentData(res.data.list); @@ -293,7 +299,7 @@ const GlobalVarContainer = () => { if (selectedItem === '我的组件' || selectedItem === '协同组件') { fetchComponentData(); } - }, [pagination.currPage, pagination.pageSize]); + }, [pagination.currPage, pagination.pageSize, componentStatus]); // 搜索处理函数 const searchHandle = () => { @@ -308,6 +314,7 @@ const GlobalVarContainer = () => { // 重置搜索 const resetSearch = () => { setSearchValue(''); + setComponentStatus(''); // 同时重置组件状态筛选 setPagination({ ...pagination, currPage: 1 @@ -326,6 +333,11 @@ const GlobalVarContainer = () => { } }; + // 组件状态筛选处理函数 + const handleStatusChange = (value) => { + setComponentStatus(value); + }; + return ( <>
@@ -373,14 +385,24 @@ const GlobalVarContainer = () => {
- - {['未设计', '编码中', '已部署'].map((item) => { + + {[{ label: '全部', value: '' }, ...componentStatusDict].map((item) => { return ( - + {({ checked }) => { return ( - ); }}