diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 7fca03e..f1105c8 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,11 +2,8 @@ - - - - + - + - + @@ -37,17 +34,6 @@ - - - - - - - - - - - @@ -68,9 +54,9 @@ - @@ -347,9 +333,6 @@ - - - @@ -379,12 +362,15 @@ + + + + ); +}; +export default CopyDialog; diff --git a/src/components/dialog/index.less b/src/components/dialog/index.less new file mode 100644 index 0000000..b286550 --- /dev/null +++ b/src/components/dialog/index.less @@ -0,0 +1,3 @@ +.ant-tree .ant-tree-treenode-disabled .ant-tree-node-content-wrapper { + color: #222526; +} diff --git a/src/components/dialog/mergeDialog.jsx b/src/components/dialog/mergeDialog.jsx index e69de29..7c9cb59 100644 --- a/src/components/dialog/mergeDialog.jsx +++ b/src/components/dialog/mergeDialog.jsx @@ -0,0 +1,107 @@ +import { Form, Input, Modal, TreeSelect, message } from 'antd'; +import React, { + useState, + useEffect, + useRef, + forwardRef, + useImperativeHandle, +} from 'react'; +import * as d3 from 'd3'; +import './index.less'; + +const layout = { + labelCol: { span: 6 }, + wrapperCol: { span: 14 }, +}; + +const MergeDialog = forwardRef(({ open, onCreate, onCancel }, ref) => { + const [treeData, setData] = useState([]); + const [form] = Form.useForm(); + const formRef = useRef(null); + + useImperativeHandle(ref, () => ({ + getTreeData() { + form.resetFields(); + d3.json('/api/bs/hrmorganization/orgchart/getDepartmentTree').then( + (data) => { + setData(data.departmentTree); + }, + ); + }, + })); + + /** + * 根节点树异步加载 + * @param {} parentId + * @returns + */ + const onRootLoadData = (treeNode) => + new Promise((resolve) => { + const { id } = treeNode.props; + setTimeout(() => { + d3.json( + `/api/bs/hrmorganization/orgchart/getDepartmentTree?subcompany=${id}`, + ).then((data) => { + let arr = [...treeData, ...data.departmentTree]; + setData(arr); + }); + resolve(undefined); + }, 200); + }); + + return ( + { + form + .validateFields() + .then((values) => { + onCreate(values); + }) + .catch((info) => { + console.log('Validate Failed:', info); + }); + }} + > +
+ + + + + + + +
+
+ ); +}); +export default MergeDialog; diff --git a/src/d3-org-chart.js b/src/d3-org-chart.js index 7ad62d3..f6d466c 100644 --- a/src/d3-org-chart.js +++ b/src/d3-org-chart.js @@ -230,8 +230,8 @@ export class OrgChart { top: { nodeLeftX: (node) => -node.width / 2, nodeRightX: (node) => node.width / 2, - //nodeTopY: (node) => 0, - nodeTopY: (node) => node.height / 0.3, + nodeTopY: (node) => 0, + //nodeTopY: (node) => node.height / 0.3, nodeBottomY: (node) => node.height, nodeJoinX: (node) => node.x - node.width / 2, nodeJoinY: (node) => node.y + node.height, diff --git a/src/pages/company.jsx b/src/pages/company.jsx index 1885fcf..4700f79 100644 --- a/src/pages/company.jsx +++ b/src/pages/company.jsx @@ -141,10 +141,7 @@ export default function companyPage() { const nodeContentRender = (d, i, arr, state) => { if (d.data.ftype == 0) { - return `
-
- -
+ return `
- - window.open( - `/spa/organization/static/index.html#/main/organization/${extend}/${nodeData.id}`, - '_blank', - ) - } - > - 查看 - - - 删除 - - - 封存 - - - 合并 - - - 复制 + <> + {nodeData.type == 0 ? ( + + {' '} + + {nodeData.title} -
-
+ ) : ( + <> + + {icon} + {nodeData.title} + +
+ + window.open( + `/spa/organization/static/index.html#/main/organization/${extend}/${nodeData.id}`, + '_blank', + ) + } + > + 查看 + + onDelete(nodeData)} + okText="确认" + cancelText="取消" + > + 删除 + + onCancel(nodeData)} + okText="确认" + cancelText="取消" + > + + {nodeData.canceled == '0' ? '封存' : '恢复'} + + + onMerge(nodeData)} + > + 合并 + + onCopy(nodeData)} + > + 复制 + +
+ + )} + ); }; return ( - + <> + { + const value = showCanceled == 0 ? 1 : 0; + setShowCanceled(value); + getMoveTree(value); + }} + /> + + + { + setOpen(false); + }} + /> + {/* { + setCopyOpen(false); + }}/> */} + + ); }; export default DragTree; diff --git a/src/pages/index.less b/src/pages/index.less index de053ab..59cd9b4 100644 --- a/src/pages/index.less +++ b/src/pages/index.less @@ -18,6 +18,10 @@ display: inline-block; } +.ant-tree .ant-tree-treenode-disabled .ant-tree-node-content-wrapper { + color: rgba(0, 0, 0, 0.85); +} + #drag-button-ops { display: none; width: 500px; diff --git a/src/pages/user.jsx b/src/pages/user.jsx index 4114a1a..ea21bb6 100644 --- a/src/pages/user.jsx +++ b/src/pages/user.jsx @@ -99,7 +99,7 @@ export default function userPage() { // 获取数据 useEffect(() => { document.cookie = - 'ecology_JSessionid=aaaqxkKrIiwa59VyYrwMy; JSESSIONID=aaaqxkKrIiwa59VyYrwMy; loginidweaver=1; languageidweaver=7; loginuuids=1; __randcode__=61884b51-d206-4953-8fd2-78cfc6cc7044'; + 'ecology_JSessionid=aaaUMPsdM5DKIgXzYrwMy; JSESSIONID=aaaUMPsdM5DKIgXzYrwMy; __randcode__=f5b6cc86-28ff-416b-bc87-569246714d54; loginidweaver=1; languageidweaver=7; loginuuids=1'; d3.json( // "/user/data" '/api/bs/hrmorganization/orgchart/userData?fclass=0&fisvitual=0&root=0&level=3&id=0',