59 lines
1.2 KiB
JavaScript
59 lines
1.2 KiB
JavaScript
import { request } from "@cqsjjb/jjb-common-lib/http";
|
|
import { useEffect, useState } from "react";
|
|
import BasicLeftTree from "../../Basic";
|
|
|
|
/**
|
|
* 部门左侧树组件(港务局版本)
|
|
*/
|
|
function DepartmentSelectTree(props) {
|
|
const {
|
|
params = {},
|
|
...restProps
|
|
} = props;
|
|
|
|
const [treeData, setTreeData] = useState([
|
|
{
|
|
name: "parent 1",
|
|
id: "0-0",
|
|
childrenList: [
|
|
{
|
|
name: "parent 1-0",
|
|
id: "0-0-0",
|
|
childrenList: [
|
|
{
|
|
name: "leaf",
|
|
id: "0-0-0-0",
|
|
},
|
|
{
|
|
name: "leaf",
|
|
id: "0-0-0-1",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: "parent 1-1",
|
|
id: "0-0-1",
|
|
childrenList: [{ name: <span style={{ color: "#1677ff" }}>sss</span>, id: "0-0-1-0" }],
|
|
},
|
|
],
|
|
},
|
|
]);
|
|
|
|
const getData = async () => {
|
|
const { data } = await request("/basic-info/department/listTree", "post", params);
|
|
setTreeData(data);
|
|
};
|
|
|
|
useEffect(() => {
|
|
getData();
|
|
}, []);
|
|
|
|
return (
|
|
<BasicLeftTree treeData={treeData} placeholder="部门" {...restProps} />
|
|
);
|
|
}
|
|
|
|
DepartmentSelectTree.displayName = "DepartmentSelectTree";
|
|
|
|
export default DepartmentSelectTree;
|