From eda449c02a59c0412a0fc770fc456482bedc1331 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Tue, 16 Apr 2024 18:55:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5=20?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=8E=A5=E5=8F=A3=E9=9C=80=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E5=BC=80=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/dragTree.jsx | 106 +++++++++++++++++++++++++++++++++++++---- src/pages/user.jsx | 2 +- 2 files changed, 98 insertions(+), 10 deletions(-) diff --git a/src/pages/dragTree.jsx b/src/pages/dragTree.jsx index ba718fb..f134c49 100644 --- a/src/pages/dragTree.jsx +++ b/src/pages/dragTree.jsx @@ -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); } diff --git a/src/pages/user.jsx b/src/pages/user.jsx index a92b7ea..56072c6 100644 --- a/src/pages/user.jsx +++ b/src/pages/user.jsx @@ -99,7 +99,7 @@ export default function userPage() { // 获取数据 useEffect(() => { document.cookie = - 'ecology_JSessionid=aaahTt6JHXEIM-HoSW-Xy; JSESSIONID=aaahTt6JHXEIM-HoSW-Xy; Systemlanguid=7; languageidweaver=7; loginuuids=2773; __randcode__=a8294fa0-56d7-430f-a35b-139d73474682; loginidweaver=zhangxy16'; + 'ecology_JSessionid=aaawGLaPO07RO41dNaL5y; JSESSIONID=aaawGLaPO07RO41dNaL5y; languageidweaver=7; Systemlanguid=7; loginuuids=1; loginidweaver=sysadmin; __randcode__=400d6da3-3b22-4eed-b772-a4d96d08b9af'; d3.json( '/api/bs/hrmorganization/orgchart/userData?fclass=0&fisvitual=0&root=0&level=3&id=0', ).then((data) => {