import{p as m,r as n,f as I,ae as o,j as r,K as w,I as N,bT as S}from"./index-CKIL6d0V.js";import{T as j}from"./index-C-LPyJas.js";const y=m.div`
  height: 100%;
  .organize {
      height: 100%;
      border-radius: 15px;
      font-size: 12px;
      display: flex;
      flex-direction: column;
      .title {
        padding-left: 20px;
        font-size: 14px;
        height: 50px;
        padding-top: 15px;
        padding-right: 15px;
      }

      .ysh_tree {
        flex: 1;
        overflow: auto;
        &::-webkit-scrollbar{
          display: none;
        }
        white-space: nowrap;
        .ant-tree-node-content-wrapper {
          min-height: 30px;
          line-height: 30px;
          font-size: 12px;
        }
      }
    }
`,b=n.memo(({onSelectOrg:p})=>{const{organ:t}=I(e=>e),{Search:h}=N,[l,u]=n.useState(null),[d,s]=n.useState([]);n.useEffect(()=>{const e=o(t,t[0].PId);s(e)},[t]);const x=(e,a)=>{g(a.node.Id)},g=e=>{p(e)},f=()=>{if(l){const e=S(o(t,t[0].PId),l);let a=[];e.forEach(c=>{a=[...a,...c.ParentNames]}),a=[...new Set(a)];const i=t.filter(c=>a.includes(c.Id));i.length>0?s(o(i,i[0].PId)):s([{Id:3,Name:"全球总部",CascadeId:null,PId:0,Depth:0,children:[]}])}else s(o(t,t[0].PId))};return r.jsx(y,{children:r.jsxs("div",{className:"organize",children:[r.jsx("p",{className:"title",children:r.jsx(h,{className:"ysh_antd_input",value:l,allowClear:!0,placeholder:"组织名称...",onChange:e=>u(e.target.value),onSearch:f})}),d.length>0&&r.jsx(j,{className:"ysh_tree",showLine:!0,virtual:!1,defaultExpandAll:!0,autoExpandParent:!0,fieldNames:{title:"Name",key:"Id",children:"children"},blockNode:!0,onSelect:x,treeData:d,switcherIcon:r.jsx(w,{})})]})})});b.displayName="Organ";export{b as O};
