From 957c525627e76c913476284e0298bd056847f685 Mon Sep 17 00:00:00 2001 From: LiuJiaNan <15703339975@163.com> Date: Tue, 11 Nov 2025 16:41:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EHiddenPartSelectTree?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/SelectTree/HiddenLevel/Gwj/index.js | 2 +- components/SelectTree/HiddenPart/Gwj/index.d.ts | 12 ++++++++++++ components/SelectTree/HiddenPart/Gwj/index.js | 17 ++++++++++++++--- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/components/SelectTree/HiddenLevel/Gwj/index.js b/components/SelectTree/HiddenLevel/Gwj/index.js index 942c940..7aa8c29 100644 --- a/components/SelectTree/HiddenLevel/Gwj/index.js +++ b/components/SelectTree/HiddenLevel/Gwj/index.js @@ -63,7 +63,7 @@ function HiddenLevelSelectTree(props) { }, []); return ( - + ); } diff --git a/components/SelectTree/HiddenPart/Gwj/index.d.ts b/components/SelectTree/HiddenPart/Gwj/index.d.ts index 888cdca..e83519f 100644 --- a/components/SelectTree/HiddenPart/Gwj/index.d.ts +++ b/components/SelectTree/HiddenPart/Gwj/index.d.ts @@ -1,10 +1,22 @@ import type { FC } from "react"; import type { BasicSelectTreeProps } from "../../Basic"; +/** + * 请求参数 + */ +export interface Params { + /** 企业id */ + eqCorpinfoId?: string; +} + /** * 组件属性 */ export interface HiddenPartSelectTreeProps extends Omit { + /** 请求参数 */ + params?: Params; + /** 是否需要企业id,默认 false */ + isNeedCorpInfoId?: boolean; } /** diff --git a/components/SelectTree/HiddenPart/Gwj/index.js b/components/SelectTree/HiddenPart/Gwj/index.js index 441f994..0f26e45 100644 --- a/components/SelectTree/HiddenPart/Gwj/index.js +++ b/components/SelectTree/HiddenPart/Gwj/index.js @@ -6,20 +6,31 @@ import BasicSelectTree from "../../Basic"; * 隐患部位下拉树组件(港务局版本) */ function HiddenPartSelectTree(props) { + const { + params = {}, + isNeedCorpInfoId = false, + ...restProps + } = props; + const [treeData, setTreeData] = useState([]); const getData = async () => { setTreeData([]); - const { data } = await request("/hidden/hiddenRegion/listByTree", "post", { eqCorpinfoId: "" }); + + // 根据参数决定是否发送请求 + if (isNeedCorpInfoId && !params.eqCorpinfoId) + return; + + const { data } = await request("/hidden/hiddenRegion/listByTree", "post", params); setTreeData(data); }; useEffect(() => { getData(); - }, []); + }, [JSON.stringify(params), isNeedCorpInfoId]); return ( - + ); }