|
|
|
@ -71,14 +71,15 @@ 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: '取消',
|
|
|
|
@ -143,6 +144,26 @@ const DragTree = () => {
|
|
|
|
|
}
|
|
|
|
|
setGData(data);
|
|
|
|
|
message.success('转移成功', 2);
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
messageRemind(
|
|
|
|
|
extend,
|
|
|
|
|
'MOVE',
|
|
|
|
|
dragKey.slice(1),
|
|
|
|
|
false,
|
|
|
|
|
dropKey.slice(1),
|
|
|
|
|
'',
|
|
|
|
|
tranfeserType,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
message.warning(res.msg, 2);
|
|
|
|
|
}
|
|
|
|
@ -162,12 +183,13 @@ const DragTree = () => {
|
|
|
|
|
*/
|
|
|
|
|
const onDelete = (nodeData) => {
|
|
|
|
|
const extend = nodeData.type == '1' ? 'comp' : 'dept';
|
|
|
|
|
let id = nodeData.id.substring(1);
|
|
|
|
|
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 +201,7 @@ const DragTree = () => {
|
|
|
|
|
});
|
|
|
|
|
setGData(data);
|
|
|
|
|
message.success('删除成功', 2);
|
|
|
|
|
messageRemind(extend, 'DELETE', id);
|
|
|
|
|
} else {
|
|
|
|
|
message.warning(res.data.message, 2);
|
|
|
|
|
}
|
|
|
|
@ -189,6 +212,64 @@ const DragTree = () => {
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 工作流提醒
|
|
|
|
|
*/
|
|
|
|
|
const messageRemind = (
|
|
|
|
|
type,
|
|
|
|
|
operateType,
|
|
|
|
|
fromId,
|
|
|
|
|
canceled,
|
|
|
|
|
toId = '',
|
|
|
|
|
mergeName = '',
|
|
|
|
|
tranfeserType = null,
|
|
|
|
|
) => {
|
|
|
|
|
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) => {})
|
|
|
|
|
.catch((error) => {
|
|
|
|
|
message.error('系统默认工作流提醒失败');
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 封存
|
|
|
|
|
* @param {*} nodeData
|
|
|
|
@ -196,14 +277,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 +305,7 @@ const DragTree = () => {
|
|
|
|
|
message.success('封存成功', 2);
|
|
|
|
|
}
|
|
|
|
|
setGData(data);
|
|
|
|
|
messageRemind(extend, 'CANCELED', id, canceled);
|
|
|
|
|
} else {
|
|
|
|
|
message.warning(res.msg, 2);
|
|
|
|
|
}
|
|
|
|
@ -244,10 +328,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 +348,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);
|
|
|
|
|
}
|
|
|
|
|