import{d as m,r as n,f as w,I,af as o,j as r,J as N,bI as v}from"./index-BtzNP73w.js";import{T as j}from"./index-B6m4IotF.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;

        .tree-node-title {  
          white-space: nowrap;
          overflow: hidden;
          width: 100%;
          text-overflow: ellipsis;
          display: inline-block;
        }
        .ant-tree-node-content-wrapper {
          min-height: 30px;
          line-height: 30px;
          font-size: 12px;
          overflow: auto;
        }
      }
    }
`,S=n.memo(({onSelectOrg:h})=>{const{organ:t}=w(e=>e),{Search:p}=I,[i,f]=n.useState(null),[c,s]=n.useState([]);n.useEffect(()=>{const e=o(t,t[0].PId);s(e)},[t]);const x=(e,a)=>{u(a.node.Id)},u=e=>{h(e)},g=()=>{if(i){const e=v(o(t,t[0].PId),i);let a=[];e.forEach(d=>{a=[...a,...d.ParentNames]}),a=[...new Set(a)];const l=t.filter(d=>a.includes(d.Id));l.length>0?s(o(l,l[0].PId)):s([])}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(p,{className:"ysh_antd_input",value:i,allowClear:!0,placeholder:"组织名称...",onChange:e=>f(e.target.value),onSearch:g})}),c.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:c,titleRender:e=>r.jsx("div",{className:"tree-node-title",children:e.Name}),switcherIcon:r.jsx(N,{})})]})})});S.displayName="Organ";export{S as O};
