From 02de75bdded6cea36ab763453898c1792f3dc1ed Mon Sep 17 00:00:00 2001 From: liangkun Date: Tue, 6 Jul 2021 14:36:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=B5=81=E5=AE=A1=E6=89=B9?= =?UTF-8?q?=E4=BA=BA=E5=A2=9E=E5=8A=A0=E9=83=A8=E9=97=A8=E8=B4=9F=E8=B4=A3?= =?UTF-8?q?=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/NWFScheme/NodeForm.cshtml | 1 + .../Views/NWFScheme/NodeForm.js | 16 ++ .../Process/NWFProcessBLL.cs | 212 ++++++++++++------ 3 files changed, 165 insertions(+), 64 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFScheme/NodeForm.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFScheme/NodeForm.cshtml index c9e4f65f6..beebc1a61 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFScheme/NodeForm.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFScheme/NodeForm.cshtml @@ -199,6 +199,7 @@  添加节点执行人  添加表字段  添加分管校长 +  添加部门负责人  移除 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFScheme/NodeForm.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFScheme/NodeForm.js index b03b2762c..17c49f579 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFScheme/NodeForm.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_NewWorkFlow/Views/NWFScheme/NodeForm.js @@ -185,6 +185,9 @@ var bootstrap = function ($, learun) { case '7': return '分管校长'; break; + case '8': + return '部门负责人'; + break; } } }, @@ -350,6 +353,19 @@ var bootstrap = function ($, learun) { } }); }); + //添加部门负责人 + $('#lr_form_deptmaster').on('click', function () { + learun.layerConfirm('是否确认增加部门负责人?', function (res) { + if (res) { + var data = { auditorId: 'bmfzrid', type: '8', auditorName: '部门负责人' }; + if (!isRepeat(data.auditorId)) { + data.id = learun.newGuid(); + auditors.push(data); + $('#auditor_girdtable').jfGridSet('refreshdata', auditors); + } + } + }); + }); /*表单添加*/ $('#workform_girdtable').jfGrid({ diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Process/NWFProcessBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Process/NWFProcessBLL.cs index 32901ca50..bd0438667 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Process/NWFProcessBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.WorkFlow/Process/NWFProcessBLL.cs @@ -534,7 +534,7 @@ namespace Learun.Application.WorkFlow foreach (var item in nodeAuditorList) { switch (item.type)//1.岗位2.角色3.用户4.上下级5.表单指定字段6.某一个节点执行人 - //liang 20200813 新增type=7 分管校长 + //liang 20200813 新增type=7 分管校长 20210706增加部门负责人type=8 { case 1:// 岗位 var userRelationList = userRelationIBLL.GetUserIdList(item.auditorId); @@ -547,17 +547,35 @@ namespace Learun.Application.WorkFlow { if (userEntity.F_DepartmentId == paramConfig.CreateUser.DepartmentId) { - list.Add(new NWFUserInfo() + if (!list.Exists(m => m.Id == userEntity.F_UserId)) { - Id = userEntity.F_UserId, - Account = userEntity.F_Account, - Name = userEntity.F_RealName - }); + list.Add(new NWFUserInfo() + { + Id = userEntity.F_UserId, + Account = userEntity.F_Account, + Name = userEntity.F_RealName + }); + } } } else if (item.condition == 2) { if (userEntity.F_CompanyId == paramConfig.CreateUser.CompanyId) + { + if (!list.Exists(m => m.Id == userEntity.F_UserId)) + { + list.Add(new NWFUserInfo() + { + Id = userEntity.F_UserId, + Account = userEntity.F_Account, + Name = userEntity.F_RealName + }); + } + } + } + else + { + if (!list.Exists(m => m.Id == userEntity.F_UserId)) { list.Add(new NWFUserInfo() { @@ -567,15 +585,6 @@ namespace Learun.Application.WorkFlow }); } } - else - { - list.Add(new NWFUserInfo() - { - Id = userEntity.F_UserId, - Account = userEntity.F_Account, - Name = userEntity.F_RealName - }); - } } } break; @@ -591,24 +600,30 @@ namespace Learun.Application.WorkFlow { if (userEntity.F_DepartmentId == paramConfig.CreateUser.DepartmentId) { - list.Add(new NWFUserInfo() + if (!list.Exists(m => m.Id == userEntity.F_UserId)) { - Id = userEntity.F_UserId, - Account = userEntity.F_Account, - Name = userEntity.F_RealName - }); + list.Add(new NWFUserInfo() + { + Id = userEntity.F_UserId, + Account = userEntity.F_Account, + Name = userEntity.F_RealName + }); + } } } else if (item.condition == 2) { if (userEntity.F_CompanyId == paramConfig.CreateUser.CompanyId) { - list.Add(new NWFUserInfo() + if (!list.Exists(m => m.Id == userEntity.F_UserId)) { - Id = userEntity.F_UserId, - Account = userEntity.F_Account, - Name = userEntity.F_RealName - }); + list.Add(new NWFUserInfo() + { + Id = userEntity.F_UserId, + Account = userEntity.F_Account, + Name = userEntity.F_RealName + }); + } } } else if (item.condition == 3) // 需要存在上级关系 @@ -619,12 +634,15 @@ namespace Learun.Application.WorkFlow if (postIBLL.IsUp(postList1, postList2)) { - list.Add(new NWFUserInfo() + if (!list.Exists(m => m.Id == userEntity.F_UserId)) { - Id = userEntity.F_UserId, - Account = userEntity.F_Account, - Name = userEntity.F_RealName - }); + list.Add(new NWFUserInfo() + { + Id = userEntity.F_UserId, + Account = userEntity.F_Account, + Name = userEntity.F_RealName + }); + } } } else if (item.condition == 4) // 需要存在下级关系 @@ -634,6 +652,21 @@ namespace Learun.Application.WorkFlow var postList2 = userRelationIBLL.GetObjectIds(userEntity.F_UserId, 2);// 节点审核人岗位 if (postIBLL.IsDown(postList1, postList2)) + { + if (!list.Exists(m => m.Id == userEntity.F_UserId)) + { + list.Add(new NWFUserInfo() + { + Id = userEntity.F_UserId, + Account = userEntity.F_Account, + Name = userEntity.F_RealName + }); + } + } + } + else + { + if (!list.Exists(m => m.Id == userEntity.F_UserId)) { list.Add(new NWFUserInfo() { @@ -643,15 +676,6 @@ namespace Learun.Application.WorkFlow }); } } - else - { - list.Add(new NWFUserInfo() - { - Id = userEntity.F_UserId, - Account = userEntity.F_Account, - Name = userEntity.F_RealName - }); - } } } break; @@ -664,12 +688,15 @@ namespace Learun.Application.WorkFlow var userEntity3 = userIBLL.GetEntityByUserId(userItem); if (userEntity3 != null) { - list.Add(new NWFUserInfo() + if (!list.Exists(m => m.Id == userEntity3.F_UserId)) { - Id = userEntity3.F_UserId, - Account = userEntity3.F_Account, - Name = userEntity3.F_RealName - }); + list.Add(new NWFUserInfo() + { + Id = userEntity3.F_UserId, + Account = userEntity3.F_Account, + Name = userEntity3.F_RealName + }); + } } } } @@ -695,12 +722,15 @@ namespace Learun.Application.WorkFlow var userEntity = userIBLL.GetEntityByUserId(userRelationItem.F_UserId); if (userEntity != null) { - list.Add(new NWFUserInfo() + if (!list.Exists(m => m.Id == userEntity.F_UserId)) { - Id = userEntity.F_UserId, - Account = userEntity.F_Account, - Name = userEntity.F_RealName - }); + list.Add(new NWFUserInfo() + { + Id = userEntity.F_UserId, + Account = userEntity.F_Account, + Name = userEntity.F_RealName + }); + } } } break; @@ -723,12 +753,15 @@ namespace Learun.Application.WorkFlow var userEntity5 = userIBLL.GetEntityByUserId(row[0].ToString()); if (userEntity5 != null) { - list.Add(new NWFUserInfo() + if (!list.Exists(m => m.Id == userEntity5.F_UserId)) { - Id = userEntity5.F_UserId, - Account = userEntity5.F_Account, - Name = userEntity5.F_RealName - }); + list.Add(new NWFUserInfo() + { + Id = userEntity5.F_UserId, + Account = userEntity5.F_Account, + Name = userEntity5.F_RealName + }); + } } } } @@ -741,12 +774,15 @@ namespace Learun.Application.WorkFlow var userEntity6 = userIBLL.GetEntityByUserId(task.F_CreateUserId); if (userEntity6 != null) { - list.Add(new NWFUserInfo() + if (!list.Exists(m => m.Id == userEntity6.F_UserId)) { - Id = userEntity6.F_UserId, - Account = userEntity6.F_Account, - Name = userEntity6.F_RealName - }); + list.Add(new NWFUserInfo() + { + Id = userEntity6.F_UserId, + Account = userEntity6.F_Account, + Name = userEntity6.F_RealName + }); + } } } break; @@ -782,12 +818,60 @@ namespace Learun.Application.WorkFlow if (null != userEntity7) { - list.Add(new NWFUserInfo() + if (!list.Exists(m => m.Id == userEntity7.F_UserId)) { - Id = userEntity7.F_UserId, - Account = userEntity7.F_Account, - Name = userEntity7.F_RealName - }); + list.Add(new NWFUserInfo() + { + Id = userEntity7.F_UserId, + Account = userEntity7.F_Account, + Name = userEntity7.F_RealName + }); + } + } + } + break; + case 8://liang 20210706新增部门负责人判断 + //获取流程创建用户的分管领导 + //判断用户所在部门是否有上级部门:如果有,找到上级部门的负责人;如果没有,找本部门的分管校长; + string deptMasterId = ""; + var selfDepart2 = departmentIBLL.GetEntity(paramConfig.CreateUser.DepartmentId); + if (selfDepart2 != null) + { + //本部门存在部门负责人 + if (!string.IsNullOrEmpty(selfDepart2.F_Manager)) + { + deptMasterId = selfDepart2.F_Manager; + } + else + { + //本部门不存在就找上级部门 + var parentDepart = departmentIBLL.GetEntity(selfDepart2.F_ParentId); + if (parentDepart != null) + { + if (!string.IsNullOrEmpty(selfDepart2.F_Manager)) + { + deptMasterId = parentDepart.F_Manager; + } + } + } + } + //找到部门负责人就增加审批人 + if (!string.IsNullOrEmpty(deptMasterId)) + { + var userEntity7 = userIBLL.GetEntityByUserId(deptMasterId); + + if (null != userEntity7) + { + if (!list.Exists(m => m.Id == userEntity7.F_UserId)) + { + list.Add(new NWFUserInfo() + { + Id = userEntity7.F_UserId, + Account = userEntity7.F_Account, + Name = userEntity7.F_RealName + }); + } + } }