import { request } from "@cqsjjb/jjb-common-lib/http";
import { useEffect, useState } from "react";
import BasicLeftTree from "../../Basic";

/**
 * 部门左侧树组件（港务局版本）
 */
function DepartmentLeftTree(props) {
  const {
    params = {},
    ...restProps
  } = props;

  const [treeData, setTreeData] = useState([]);

  const getData = async () => {
    const { data } = await request("/basicInfo/department/listTree", "post", params);
    setTreeData(data);
  };

  useEffect(() => {
    getData();
  }, []);

  return (
    <BasicLeftTree treeData={treeData} childrenKey="childrenList" {...restProps} />
  );
}

DepartmentLeftTree.displayName = "DepartmentLeftTree";

export default DepartmentLeftTree;
