diff --git a/dist.zip b/dist.zip
index 1fa52e3..56f3df8 100644
Binary files a/dist.zip and b/dist.zip differ
diff --git a/src/components/topBar/index.jsx b/src/components/topBar/index.jsx
index 3ee4c2e..b854923 100644
--- a/src/components/topBar/index.jsx
+++ b/src/components/topBar/index.jsx
@@ -290,6 +290,15 @@ export class TopBar extends React.Component {
>
查询
+
diff --git a/src/pages/dragTree.jsx b/src/pages/dragTree.jsx
index 09bd176..1a905bc 100644
--- a/src/pages/dragTree.jsx
+++ b/src/pages/dragTree.jsx
@@ -1,4 +1,4 @@
-import { Tree, message, Modal, Popconfirm, Spin } from 'antd';
+import { Tree, message, Modal, Popconfirm, Spin, Layout, Drawer } from 'antd';
import React, { useEffect, useState, useRef } from 'react';
import * as d3 from 'd3';
import qs from 'qs';
@@ -10,7 +10,9 @@ import {
FolderOutlined,
ClusterOutlined,
ApartmentOutlined,
+ ExclamationCircleOutlined,
} from '@ant-design/icons';
+const { Header, Footer, Sider, Content } = Layout;
import './index.less';
const DragTree = () => {
@@ -21,6 +23,8 @@ const DragTree = () => {
const [tip, setTip] = useState('正在加载,请稍候...');
const [loading, setLoading] = useState(false);
const [showCanceled, setShowCanceled] = useState(0);
+ const [drawerOpen, setDrawerOpen] = useState(false);
+ const [iframe, setIframe] = useState('');
const [open, setOpen] = useState(false);
const [mergeId, setMergeId] = useState(null);
@@ -60,80 +64,95 @@ const DragTree = () => {
};
const onDrop = (info) => {
- setLoading(true);
- setTip('正在转移,请稍候...');
const dropKey = info.node.key;
const dragKey = info.dragNode.key;
const dropPos = info.node.pos.split('-');
const dropPosition =
info.dropPosition - Number(dropPos[dropPos.length - 1]);
- fetch('/api/bs/hrmorganization/dept/dragDepartment', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({
- sourcekey: dragKey,
- targetkey: dropKey,
- dropPosition: dropPosition,
- }),
- })
- .then((response) => response.json())
- .then((res) => {
- if (res.code == 200) {
- const data = [...gData];
- // Find dragObject
- let dragObj;
- loop(data, dragKey, (item, index, arr) => {
- arr.splice(index, 1);
- dragObj = item;
- });
- if (!info.dropToGap) {
- // Drop on the content
- loop(data, dropKey, (item) => {
- item.children = item.children || [];
- // where to insert 示例添加到头部,可以是随意位置
- item.children.unshift(dragObj);
- });
- } else if (
- (info.node.props.children || []).length > 0 &&
- // Has children
- info.node.props.expanded &&
- // Is expanded
- dropPosition === 1 // On the bottom gap
- ) {
- loop(data, dropKey, (item) => {
- item.children = item.children || [];
- // where to insert 示例添加到头部,可以是随意位置
- item.children.unshift(dragObj);
- // in previous version, we use item.children.push(dragObj) to insert the
- // item to the tail of the children
- });
- } else {
- let ar = [];
- let i;
- loop(data, dropKey, (_item, index, arr) => {
- ar = arr;
- i = index;
- });
- if (dropPosition === -1) {
- ar.splice(i, 0, dragObj);
- } else {
- ar.splice(i + 1, 0, dragObj);
- }
- }
- setGData(data);
- message.success('转移成功', 2);
- } else {
- message.warning(res.msg, 2);
- }
- setLoading(false);
- })
- .catch((error) => {
- message.error('接口异常,请联系管理员');
- });
- setTimeout(function () {}, 1000);
+ if (dropPosition == -1) {
+ return message.error('不支持该操作!!!', 2);
+ }
+ let pos = dropPosition == 0 ? '内部' : '下方';
+
+ let title = `确定将【${info.dragNode.title}】移到 【${info.node.title}】${pos}`;
+ Modal.confirm({
+ title: '转移操作',
+ content: title,
+ okText: '确认',
+ cancelText: '取消',
+ onOk() {
+ setLoading(true);
+ setTip('正在转移,请稍候...');
+
+ fetch('/api/bs/hrmorganization/dept/dragDepartment', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify({
+ sourcekey: dragKey,
+ targetkey: dropKey,
+ dropPosition: dropPosition,
+ }),
+ })
+ .then((response) => response.json())
+ .then((res) => {
+ if (res.code == 200) {
+ const data = [...gData];
+ // Find dragObject
+ let dragObj;
+ loop(data, dragKey, (item, index, arr) => {
+ arr.splice(index, 1);
+ dragObj = item;
+ });
+ if (!info.dropToGap) {
+ // Drop on the content
+ loop(data, dropKey, (item) => {
+ item.children = item.children || [];
+ // where to insert 示例添加到头部,可以是随意位置
+ item.children.unshift(dragObj);
+ });
+ } else if (
+ (info.node.props.children || []).length > 0 &&
+ // Has children
+ info.node.props.expanded &&
+ // Is expanded
+ dropPosition === 1 // On the bottom gap
+ ) {
+ loop(data, dropKey, (item) => {
+ item.children = item.children || [];
+ // where to insert 示例添加到头部,可以是随意位置
+ item.children.unshift(dragObj);
+ // in previous version, we use item.children.push(dragObj) to insert the
+ // item to the tail of the children
+ });
+ } else {
+ let ar = [];
+ let i;
+ loop(data, dropKey, (_item, index, arr) => {
+ ar = arr;
+ i = index;
+ });
+ if (dropPosition === -1) {
+ ar.splice(i, 0, dragObj);
+ } else {
+ ar.splice(i + 1, 0, dragObj);
+ }
+ }
+ setGData(data);
+ message.success('转移成功', 2);
+ } else {
+ message.warning(res.msg, 2);
+ }
+ setLoading(false);
+ })
+ .catch((error) => {
+ message.error('接口异常,请联系管理员');
+ });
+ },
+ onCancel() {},
+ });
};
/**
@@ -256,12 +275,17 @@ const DragTree = () => {
};
const onCopyCreate = (values) => {
+ let params = {
+ company: values.company,
+ copySubDept: values.copySubDept ? '1' : '0',
+ ids: copyId.substring(1),
+ };
fetch(`/api/bs/hrmorganization/dept/copyDepartment`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
- body: JSON.stringify({ ...values, ids: copyId.substring(1) }),
+ body: JSON.stringify(params),
})
.then((response) => response.json())
.then((res) => {
@@ -310,19 +334,19 @@ const DragTree = () => {