From e7f1c5329d3322b10e6bea7c17347cd7aaaaabcb Mon Sep 17 00:00:00 2001 From: LiuJiaNan <15703339975@163.com> Date: Mon, 26 Jan 2026 14:50:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96DepartmentLeftTree?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LeftTree/Department/Gwj/index.d.ts | 6 +++++ .../LeftTree/Department/Gwj/index.js | 26 ++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/components/LeftTree/Department/Gwj/index.d.ts b/src/components/LeftTree/Department/Gwj/index.d.ts index bec6d89..d22c86e 100644 --- a/src/components/LeftTree/Department/Gwj/index.d.ts +++ b/src/components/LeftTree/Department/Gwj/index.d.ts @@ -9,6 +9,10 @@ export interface Params { eqCorpinfoId?: string; /** 父级部门id */ eqParentId?: string; + /** 企业类型 */ + inType?: number[]; + /** 企业类型 */ + enterpriseType?: number[] | number; } /** @@ -17,6 +21,8 @@ export interface Params { export interface DepartmentLeftTreeProps extends Omit { /** 请求参数 */ params?: Params; + /** 查询的企业类型,默认current,current 接收 eqCorpinfoId 或者 eqParentId,all 不接受任何参数,inType 接收 inType 或者 enterpriseType */ + searchType?: "current" | "all" | "inType"; } /** diff --git a/src/components/LeftTree/Department/Gwj/index.js b/src/components/LeftTree/Department/Gwj/index.js index 7cec0e0..0f5423e 100644 --- a/src/components/LeftTree/Department/Gwj/index.js +++ b/src/components/LeftTree/Department/Gwj/index.js @@ -8,13 +8,37 @@ import BasicLeftTree from "../../Basic"; function DepartmentLeftTree(props) { const { params = {}, + searchType = "current", ...restProps } = props; const [treeData, setTreeData] = useState([]); const getData = async () => { - const { data } = await request("/basicInfo/department/listTree", "post", params); + let requestUrl = ""; + const actualParams = { ...params, time: new Date().getTime() }; + if (searchType === "current") { + requestUrl = "/basicInfo/department/listTree"; + actualParams.inType = undefined; + actualParams.enterpriseType = undefined; + } + if (searchType === "all") { + requestUrl = "/basicInfo/department/listAllTree"; + actualParams.inType = undefined; + actualParams.enterpriseType = undefined; + actualParams.eqCorpinfoId = undefined; + actualParams.eqParentId = undefined; + } + if (searchType === "inType") { + requestUrl = "/basicInfo/department/listAllTreeByCorpType"; + actualParams.eqCorpinfoId = undefined; + actualParams.eqParentId = undefined; + if (actualParams.enterpriseType && !Array.isArray(actualParams.enterpriseType)) { + actualParams.enterpriseType = [actualParams.enterpriseType]; + } + } + + const { data } = await request(requestUrl, "post", actualParams); setTreeData(data); };