diff --git a/dist.zip b/dist.zip deleted file mode 100644 index 88723e5..0000000 Binary files a/dist.zip and /dev/null differ diff --git a/public/img/change.png b/public/img/change.png new file mode 100644 index 0000000..b08b481 Binary files /dev/null and b/public/img/change.png differ diff --git a/src/components/drawer/index.jsx b/src/components/drawer/index.jsx new file mode 100644 index 0000000..e434c86 --- /dev/null +++ b/src/components/drawer/index.jsx @@ -0,0 +1,348 @@ +import React from 'react'; +import { Drawer, Space, Button, Dropdown, Menu, Table } from 'antd'; +import { OrgChartComponent } from '@/components/orgChart'; +import * as d3 from 'd3'; +import qs from 'qs'; +import { message } from 'antd'; +import jsPDF from 'jspdf'; +import styles from './index.less'; + +let addNodeChildFunc = null; +let orgChart = null; +let active = 'top'; +export default class DrawerComponents extends React.Component { + constructor(props) { + super(props); + this.state = { + open: false, + data: [], + detailType: 'chart', + rootId: '', + }; + } + + componentDidMount() { + //this.getDeatilDatas(); + } + + // 点击节点 + onNodeClick(node) {} + + onButtonClick(event, d) { + if (d.children) { + let idsList = []; + d.children.forEach((item) => { + if (item.data.hasChildren && !item._children) { + idsList.push(item.data.id); + } + }); + if (idsList.length == 0) { + return; + } + let idsStr = idsList.join(','); + let api = '/api/bs/hrmorganization/orgchart/asyncUserData?ids=' + idsStr; + fetch(api) + .then((res) => res.json()) + .then((data) => { + if (data.data) { + data.data.forEach((item) => { + window.chart.addNode(item); + }); + } + }); + } + } + + // 获取部门图片 + getDepartmentImage() { + let index = Math.floor(Math.random() * 8) + 1; + return `./img/department/${index}.png`; + } + + //获取数据 + getDeatilDatas(rootId) { + const { detailType } = this.state; + d3.json( + '/api/bs/hrmorganization/orgchart/userData?' + + qs.stringify({ detauleType: detailType, rootId: rootId }), + ).then((data) => { + this.setState(data.data); + }); + } + + // ButtonContent渲染 + buttonContentRender = ({ node, state }) => { + return ` +
+
+
+
+
+
+
+
+ }
+ >
+ {detailType == 'chart' ? (
+