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); + }} />