From 17d73b0a2bb5384e65e255c5b03181bb95a20ce9 Mon Sep 17 00:00:00 2001 From: ZLY Date: Tue, 2 Dec 2025 17:35:33 +0800 Subject: [PATCH] =?UTF-8?q?pref(component-env):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E5=88=97=E8=A1=A8=E7=AD=9B=E9=80=89=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../componentEnv/index.tsx | 44 ++++++++++++++++--- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/src/pages/componentDevelopment/componentEnv/index.tsx b/src/pages/componentDevelopment/componentEnv/index.tsx index cf5d995..1c189f3 100644 --- a/src/pages/componentDevelopment/componentEnv/index.tsx +++ b/src/pages/componentDevelopment/componentEnv/index.tsx @@ -220,14 +220,23 @@ const ComponentEnv = () => { // 获取环境列表,根据选择的类型和架构进行过滤 - const getEnvList = async (extraValue?: string, type?: string) => { + const getEnvList = async (filterParams?: any) => { // 构造查询参数 const params: any = { current: 1, size: 10 }; - if (extraValue) params[type] = extraValue; + // 合并筛选参数 + if (filterParams) { + Object.assign(params, filterParams); + } + else { + // 如果没有传入参数,使用当前状态值 + if (selectedEnvType) params.type = selectedEnvType; + if (selectedArch) params.arch = selectedArch; + if (searchText) params.name = searchText; + } const res: any = await getEnvConfigList(params); if (res.code === 200) setData(res.data.list); @@ -258,7 +267,12 @@ const ComponentEnv = () => { value={selectedEnvType} onChange={(value) => { setSelectedEnvType(value); - getEnvList(value, 'type'); + // 构建查询参数,包含所有当前筛选条件 + const params: any = {}; + if (value) params.type = value; + if (selectedArch) params.arch = selectedArch; + if (searchText) params.name = searchText; + getEnvList(params); }} > {envType.map((option, index) => ( @@ -277,7 +291,12 @@ const ComponentEnv = () => { value={selectedArch} onChange={(value) => { setSelectedArch(value); - getEnvList(value, 'arch'); + // 构建查询参数,包含所有当前筛选条件 + const params: any = {}; + if (selectedEnvType) params.type = selectedEnvType; + if (value) params.arch = value; + if (searchText) params.name = searchText; + getEnvList(params); }} > {architectureType.map((option, index) => ( @@ -299,11 +318,26 @@ const ComponentEnv = () => { style={{ width: 236, marginRight: 5 }} value={searchText} onChange={(value) => setSearchText(value)} + onPressEnter={() => { + // 构建查询参数,包含所有当前筛选条件 + const params: any = {}; + if (selectedEnvType) params.type = selectedEnvType; + if (selectedArch) params.arch = selectedArch; + if (searchText) params.name = searchText; + getEnvList(params); + }} />