import{request as e}from"@cqsjjb/jjb-common-lib/http.js";import{useState as r,useEffect as t}from"react";import{executeWithCache as n}from"../../../../utils/index.js";import i from"../../Basic/index.js";import{jsx as a}from"react/jsx-runtime";function p(p){const{params:s={},placeholder:o="部门",isNeedCorpInfoId:d=!1,isNeedParentId:l=!1,searchType:c="current",...m}=p,[y,f]=r([]);return t(()=>{(async()=>{if("current"===c){if(d&&!s.eqCorpinfoId)return;if(l&&!s.eqParentId)return}let r="";const t={...s,time:(new Date).getTime()};"current"===c&&(r="/basicInfo/department/listTree",delete t.inType,delete t.enterpriseType),"all"===c&&(r="/basicInfo/department/listAllTree",delete t.inType,delete t.enterpriseType,delete t.eqCorpinfoId,delete t.eqParentId),"inType"===c&&(r="/basicInfo/department/listAllTreeByCorpType",delete t.eqCorpinfoId,delete t.eqParentId,t.enterpriseType&&!Array.isArray(t.enterpriseType)&&(t.enterpriseType=[t.enterpriseType]));const i={searchType:c,params:s};await n(i,async()=>{const{data:n}=await e(r,"post",t);return n},f)})()},[JSON.stringify(s),d,l,c]),a(i,{treeData:y,placeholder:o,childrenKey:"childrenList",...m})}p.displayName="DepartmentSelectTree";export{p as default};
