mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-21 02:57:54 +08:00
fix issue #I80UEX 流程设计可以选择直接上级和部门负责人
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
/// </summary>
|
||||
public const string RUNTIME_CHAIRMAN = "RUNTIME_CHAIRMAN";
|
||||
/// <summary>
|
||||
/// 发起人直属上级
|
||||
/// 上一节点执行人的直属上级
|
||||
/// </summary>
|
||||
public const string RUNTIME_PARENT = "RUNTIME_PARENT";
|
||||
|
||||
|
@@ -352,10 +352,9 @@ namespace OpenAuth.App
|
||||
throw (new Exception("审核异常,找不到审核节点"));
|
||||
}
|
||||
|
||||
flowInstanceOperationHistory.Content = "【" + wfruntime.Nodes[canCheckId].name
|
||||
+ "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm")
|
||||
+ "】" + (tag.Taged == 1 ? "同意" : "不同意") + ",备注:"
|
||||
+ tag.Description;
|
||||
flowInstanceOperationHistory.Content =
|
||||
$"{user.Account}-{DateTime.Now.ToString("yyyy-MM-dd HH:mm")}审批了【{wfruntime.Nodes[canCheckId].name}】" +
|
||||
$"结果:{(tag.Taged == 1 ? "同意" : "不同意")},备注:{tag.Description}";
|
||||
|
||||
wfruntime.MakeTagNode(canCheckId, tag); //标记审核节点状态
|
||||
string res = wfruntime.NodeConfluence(canCheckId, tag);
|
||||
@@ -393,6 +392,21 @@ namespace OpenAuth.App
|
||||
{
|
||||
wfruntime.MakeTagNode(wfruntime.currentNodeId, tag);
|
||||
if (tag.Taged == (int) TagState.Ok)
|
||||
{
|
||||
bool canNext = true;
|
||||
if (wfruntime.currentNode.setInfo.NodeDesignate == Setinfo.RUNTIME_MANY_PARENTS)
|
||||
{
|
||||
var roles = _auth.GetCurrentUser().Roles;
|
||||
//如果是连续多级直属上级且还没到指定的角色,只改变执行人,不到下一个节点
|
||||
if (!wfruntime.currentNode.setInfo.NodeDesignateData.roles.Intersect(roles.Select(u =>u.Id)).Any())
|
||||
{
|
||||
canNext = false;
|
||||
var parentId = _userManagerApp.GetParent(user.Id);
|
||||
flowInstance.MakerList = parentId;
|
||||
}
|
||||
}
|
||||
|
||||
if (canNext)
|
||||
{
|
||||
flowInstance.PreviousId = flowInstance.ActivityId;
|
||||
flowInstance.ActivityId = wfruntime.nextNodeId;
|
||||
@@ -403,6 +417,7 @@ namespace OpenAuth.App
|
||||
? FlowInstanceStatus.Finished
|
||||
: FlowInstanceStatus.Running);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
flowInstance.IsFinish = FlowInstanceStatus.Disagree; //表示该节点不同意
|
||||
@@ -412,10 +427,9 @@ namespace OpenAuth.App
|
||||
|
||||
AddTransHistory(wfruntime);
|
||||
|
||||
flowInstanceOperationHistory.Content = "【" + wfruntime.currentNode.name
|
||||
+ "】【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm")
|
||||
+ "】" + (tag.Taged == 1 ? "同意" : "不同意") + ",备注:"
|
||||
+ tag.Description;
|
||||
flowInstanceOperationHistory.Content =
|
||||
$"{user.Account}-{DateTime.Now.ToString("yyyy-MM-dd HH:mm")}审批了【{wfruntime.currentNode.name}】" +
|
||||
$"结果:{(tag.Taged == 1 ? "同意" : "不同意")},备注:{tag.Description}";
|
||||
}
|
||||
|
||||
#endregion 一般审核
|
||||
@@ -579,27 +593,20 @@ namespace OpenAuth.App
|
||||
|
||||
makerList = GenericHelpers.ArrayToString(request.NodeDesignates, makerList);
|
||||
}
|
||||
else if (wfruntime.nextNode.setInfo.NodeDesignate == Setinfo.RUNTIME_PARENT)
|
||||
else if (wfruntime.nextNode.setInfo.NodeDesignate == Setinfo.RUNTIME_PARENT
|
||||
|| wfruntime.nextNode.setInfo.NodeDesignate == Setinfo.RUNTIME_MANY_PARENTS)
|
||||
{
|
||||
//如果是发起人直属上级
|
||||
//如果是上一节点执行人的直属上级或连续多级直属上级
|
||||
if (wfruntime.nextNode.setInfo.NodeDesignate != request.NodeDesignateType)
|
||||
{
|
||||
throw new Exception("前端提交的节点权限类型异常,请检查流程");
|
||||
}
|
||||
|
||||
string createUserId = string.Empty;
|
||||
if (wfruntime.currentNode.type == FlowNode.START) //如果是创建流程
|
||||
{
|
||||
//当创建流程时,肯定执行的开始节点,登录用户就是创建用户
|
||||
//当审批流程时,能进到这里,表明当前登录用户已经有审批当前节点的权限,完全可以直接用登录用户的直接上级
|
||||
var user = _auth.GetCurrentUser().User;
|
||||
createUserId = user.Id;
|
||||
}
|
||||
else //如果是审批
|
||||
{
|
||||
FlowInstance flowInstance = Get(wfruntime.flowInstanceId);
|
||||
createUserId = flowInstance.CreateUserId;
|
||||
}
|
||||
var parentId = _userManagerApp.GetParent(user.Id);
|
||||
|
||||
var parentId = _userManagerApp.GetParent(createUserId);
|
||||
makerList = GenericHelpers.ArrayToString(new[]{parentId}, makerList);
|
||||
}
|
||||
else if (wfruntime.nextNode.setInfo.NodeDesignate == Setinfo.RUNTIME_CHAIRMAN)
|
||||
|
Reference in New Issue
Block a user