From fd2cf41c5f53dd5712f92b6e943dd264965ffa46 Mon Sep 17 00:00:00 2001 From: LiuJiaNan <15703339975@163.com> Date: Tue, 27 Jan 2026 15:49:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96PersonnelSelect?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Select/Personnel/Gwj/index.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/components/Select/Personnel/Gwj/index.js b/src/components/Select/Personnel/Gwj/index.js index 94f1e22..15a918e 100644 --- a/src/components/Select/Personnel/Gwj/index.js +++ b/src/components/Select/Personnel/Gwj/index.js @@ -15,18 +15,22 @@ function PersonnelSelect(props) { isNeedCorpInfoId = false, isNeedDepartmentId = true, isNeedPostId = false, - extraParams = { - noMain: "", - eqEmploymentFlag: 1, - }, + extraParams = {}, ...restProps } = props; + const defaultExtraParams = { + noMain: "", + eqEmploymentFlag: 1, + }; + const [data, setData] = useState([]); const getData = async () => { + const actualExtraParams = { ...defaultExtraParams, ...extraParams }; + // 生成缓存键 - const cacheKey = JSON.stringify({ params, extraParams }); + const cacheKey = JSON.stringify({ params, extraParams: actualExtraParams }); // 检查缓存,如果存在直接返回缓存结果 if (cacheMap.has(cacheKey)) { @@ -47,7 +51,7 @@ function PersonnelSelect(props) { return; } - const { data } = await request("/basicInfo/user/listAll", "get", { ...params, ...extraParams, time: new Date().getTime() }); + const { data } = await request("/basicInfo/user/listAll", "get", { ...params, ...actualExtraParams, time: new Date().getTime() }); // 存入缓存 cacheMap.set(cacheKey, data);