|
|
|
@ -71,21 +71,40 @@ const DragTree = () => {
|
|
|
|
|
const dropPosition =
|
|
|
|
|
info.dropPosition - Number(dropPos[dropPos.length - 1]);
|
|
|
|
|
|
|
|
|
|
if (dropPosition == -1) {
|
|
|
|
|
if (dropPosition == -1 || dropPosition == 1) {
|
|
|
|
|
return message.error('不支持该操作!!!', 2);
|
|
|
|
|
}
|
|
|
|
|
let pos = dropPosition == 0 ? '内部' : '下方';
|
|
|
|
|
|
|
|
|
|
let pos = dropPosition == 0 ? '内部' : '下方';
|
|
|
|
|
let title = `确定将【${info.dragNode.title}】移到 【${info.node.title}】${pos}`;
|
|
|
|
|
Modal.confirm({
|
|
|
|
|
title: '转移操作',
|
|
|
|
|
title: '转移操作(仅转移到内部时工作流提醒生效)',
|
|
|
|
|
content: title,
|
|
|
|
|
okText: '确认',
|
|
|
|
|
cancelText: '取消',
|
|
|
|
|
onOk() {
|
|
|
|
|
async onOk() {
|
|
|
|
|
setLoading(true);
|
|
|
|
|
setTip('正在转移,请稍候...');
|
|
|
|
|
|
|
|
|
|
if (dropPosition == 0) {
|
|
|
|
|
let extend = 'dept';
|
|
|
|
|
let tranfeserType = 1;
|
|
|
|
|
if (dragKey.slice(0, 1).toLowerCase() === 's') {
|
|
|
|
|
extend = 'comp';
|
|
|
|
|
tranfeserType = 2;
|
|
|
|
|
}
|
|
|
|
|
if (dropKey.slice(0, 1).toLowerCase() === 's') {
|
|
|
|
|
tranfeserType = 2;
|
|
|
|
|
}
|
|
|
|
|
await messageRemind(
|
|
|
|
|
extend,
|
|
|
|
|
'MOVE',
|
|
|
|
|
dragKey.slice(1),
|
|
|
|
|
false,
|
|
|
|
|
dropKey.slice(1),
|
|
|
|
|
'',
|
|
|
|
|
tranfeserType,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
fetch('/api/bs/hrmorganization/dept/dragDepartment', {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {
|
|
|
|
@ -162,12 +181,14 @@ const DragTree = () => {
|
|
|
|
|
*/
|
|
|
|
|
const onDelete = (nodeData) => {
|
|
|
|
|
const extend = nodeData.type == '1' ? 'comp' : 'dept';
|
|
|
|
|
let id = nodeData.id.substring(1);
|
|
|
|
|
let title = nodeData.title;
|
|
|
|
|
fetch(`/api/bs/hrmorganization/${extend}/deleteByIds`, {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
|
},
|
|
|
|
|
body: JSON.stringify({ ids: nodeData.id.substring(1) }),
|
|
|
|
|
body: JSON.stringify({ ids: id }),
|
|
|
|
|
})
|
|
|
|
|
.then((response) => response.json())
|
|
|
|
|
.then((res) => {
|
|
|
|
@ -179,6 +200,7 @@ const DragTree = () => {
|
|
|
|
|
});
|
|
|
|
|
setGData(data);
|
|
|
|
|
message.success('删除成功', 2);
|
|
|
|
|
messageRemind(extend, 'DELETE', title);
|
|
|
|
|
} else {
|
|
|
|
|
message.warning(res.data.message, 2);
|
|
|
|
|
}
|
|
|
|
@ -189,6 +211,69 @@ const DragTree = () => {
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 工作流提醒
|
|
|
|
|
*/
|
|
|
|
|
const messageRemind = (
|
|
|
|
|
type,
|
|
|
|
|
operateType,
|
|
|
|
|
fromId,
|
|
|
|
|
canceled,
|
|
|
|
|
toId = '',
|
|
|
|
|
mergeName = '',
|
|
|
|
|
tranfeserType = null,
|
|
|
|
|
) => {
|
|
|
|
|
debugger;
|
|
|
|
|
return new Promise((reslove, reject) => {
|
|
|
|
|
let params = {
|
|
|
|
|
workflowId: 1,
|
|
|
|
|
operateType: operateType,
|
|
|
|
|
mergeName: mergeName,
|
|
|
|
|
type: type,
|
|
|
|
|
canceled: canceled,
|
|
|
|
|
tranfeserType: tranfeserType,
|
|
|
|
|
};
|
|
|
|
|
if (type == 'dept') {
|
|
|
|
|
params = {
|
|
|
|
|
...params,
|
|
|
|
|
departmentIdFrom: fromId,
|
|
|
|
|
};
|
|
|
|
|
if (tranfeserType == 2) {
|
|
|
|
|
params = {
|
|
|
|
|
...params,
|
|
|
|
|
subCompanyIdTo: toId,
|
|
|
|
|
};
|
|
|
|
|
} else {
|
|
|
|
|
params = {
|
|
|
|
|
...params,
|
|
|
|
|
departmentIdTo: toId,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
params = {
|
|
|
|
|
...params,
|
|
|
|
|
subCompanyIdFrom: fromId,
|
|
|
|
|
subCompanyIdTo: toId,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fetch('/api/bs/hrmorganization/remind/quickly/workflow/message', {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
|
},
|
|
|
|
|
body: JSON.stringify(params),
|
|
|
|
|
})
|
|
|
|
|
.then((response) => response.json())
|
|
|
|
|
.then((res) => {
|
|
|
|
|
reslove();
|
|
|
|
|
})
|
|
|
|
|
.catch((error) => {
|
|
|
|
|
message.error('系统默认工作流提醒失败');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 封存
|
|
|
|
|
* @param {*} nodeData
|
|
|
|
@ -196,14 +281,16 @@ const DragTree = () => {
|
|
|
|
|
const onCancel = (nodeData) => {
|
|
|
|
|
setShowCanceled(0);
|
|
|
|
|
const extend = nodeData.type == '1' ? 'comp' : 'dept';
|
|
|
|
|
let id = nodeData.id.substring(1);
|
|
|
|
|
let canceled = nodeData.canceled != '0';
|
|
|
|
|
fetch(`/api/bs/hrmorganization/${extend}/updateForbiddenTagById`, {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
|
},
|
|
|
|
|
body: JSON.stringify({
|
|
|
|
|
id: nodeData.id.substring(1),
|
|
|
|
|
canceled: nodeData.canceled != '0',
|
|
|
|
|
id: id,
|
|
|
|
|
canceled: canceled,
|
|
|
|
|
}),
|
|
|
|
|
})
|
|
|
|
|
.then((response) => response.json())
|
|
|
|
@ -222,6 +309,7 @@ const DragTree = () => {
|
|
|
|
|
message.success('封存成功', 2);
|
|
|
|
|
}
|
|
|
|
|
setGData(data);
|
|
|
|
|
messageRemind(extend, 'CANCELED', id, canceled);
|
|
|
|
|
} else {
|
|
|
|
|
message.warning(res.msg, 2);
|
|
|
|
|
}
|
|
|
|
@ -244,10 +332,13 @@ const DragTree = () => {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const onMergeCreate = (values) => {
|
|
|
|
|
let fromId = mergeId.substring(1);
|
|
|
|
|
let toId = values.department.substring(1);
|
|
|
|
|
let mergeName = values.mergeName;
|
|
|
|
|
let params = {
|
|
|
|
|
department: values.department.substring(1),
|
|
|
|
|
mergeName: values.mergeName,
|
|
|
|
|
id: mergeId.substring(1),
|
|
|
|
|
department: toId,
|
|
|
|
|
mergeName: mergeName,
|
|
|
|
|
id: fromId,
|
|
|
|
|
};
|
|
|
|
|
fetch('/api/bs/hrmorganization/dept/mergeDepartment', {
|
|
|
|
|
method: 'POST',
|
|
|
|
@ -261,6 +352,7 @@ const DragTree = () => {
|
|
|
|
|
if (res.code == 200) {
|
|
|
|
|
getMoveTree(0, values.department);
|
|
|
|
|
message.success('合并成功', 2);
|
|
|
|
|
messageRemind('dept', 'MERGE', fromId, false, toId, mergeName);
|
|
|
|
|
} else {
|
|
|
|
|
message.warning(res.msg, 2);
|
|
|
|
|
}
|
|
|
|
@ -354,7 +446,7 @@ const DragTree = () => {
|
|
|
|
|
>
|
|
|
|
|
查看
|
|
|
|
|
</span>
|
|
|
|
|
<Popconfirm
|
|
|
|
|
{/**<Popconfirm
|
|
|
|
|
title={`确认要删除[${nodeData.title}] 吗?`}
|
|
|
|
|
onConfirm={() => onDelete(nodeData)}
|
|
|
|
|
okText="确认"
|
|
|
|
@ -362,6 +454,7 @@ const DragTree = () => {
|
|
|
|
|
>
|
|
|
|
|
<span className="drag-button">删除</span>
|
|
|
|
|
</Popconfirm>
|
|
|
|
|
**/}
|
|
|
|
|
<Popconfirm
|
|
|
|
|
title={`确认要封存或恢复 [${nodeData.title}] 吗?`}
|
|
|
|
|
onConfirm={() => onCancel(nodeData)}
|
|
|
|
|