refactor: 流程模板end round 切换为end

统一判断流程结束
          流程节点类型统一用字符串表示
This commit is contained in:
yubaolee
2025-04-17 14:44:57 +08:00
parent d32ef5b78d
commit 831053aaf1
12 changed files with 138 additions and 114 deletions

View File

@@ -45,8 +45,8 @@
//节点类型
public const string NODE_TYPE_START = "start round mix"; //开始节点
public const string NODE_TYPE_END = "end round"; //结束节点
public const string NODE_TYPE_START = "start"; //开始节点
public const string NODE_TYPE_END = "end"; //结束节点
public const string NODE_TYPE_TASK = "node"; //任务节点
public const string NODE_TYPE_FORK = "fork"; //网关开始
public const string NODE_TYPE_JOIN = "join"; //网关结束

View File

@@ -141,6 +141,14 @@ namespace OpenAuth.App.Flow
#region
/// <summary>
/// 判断流程是否完成
/// </summary>
public bool IsFinish()
{
return GetNextNodeType() == Define.NODE_TYPE_END;
}
//获取下一个节点
public FlowNode GetNextNode(string nodeId = null)
{
@@ -157,8 +165,7 @@ namespace OpenAuth.App.Flow
{
return GetNodeType(nextNodeId);
}
return "error";
return Define.NODE_TYPE_END;
}
/// <summary>
@@ -490,7 +497,7 @@ namespace OpenAuth.App.Flow
ToNodeId = nextNodeId,
ToNodeName = nextNode?.name,
// ToNodeType = GetNextNodeType(),
IsFinish = GetNextNodeType() == Define.NODE_TYPE_END ? FlowInstanceStatus.Finished : FlowInstanceStatus.Running,
IsFinish = IsFinish() ? FlowInstanceStatus.Finished : FlowInstanceStatus.Running,
TransitionSate = 0
};

View File

@@ -120,8 +120,8 @@ namespace OpenAuth.App
addFlowInstanceReq.CreateUserName = user.User.Account;
flowInstance.MakerList =
wfruntime.GetNextNodeType() != Define.NODE_TYPE_END ? wfruntime.GetNextMakers(addFlowInstanceReq) : "";
flowInstance.IsFinish = wfruntime.GetNextNodeType() == Define.NODE_TYPE_END
(!wfruntime.IsFinish()) ? wfruntime.GetNextMakers(addFlowInstanceReq) : "";
flowInstance.IsFinish = wfruntime.IsFinish()
? FlowInstanceStatus.Finished
: FlowInstanceStatus.Running;
@@ -403,11 +403,11 @@ namespace OpenAuth.App
flowInstance.PreviousId = flowInstance.ActivityId;
flowInstance.ActivityId = wfruntime.nextNodeId;
flowInstance.ActivityName = wfruntime.nextNode.name;
flowInstance.IsFinish = wfruntime.GetNextNodeType() == Define.NODE_TYPE_END
flowInstance.IsFinish = wfruntime.IsFinish()
? FlowInstanceStatus.Finished
: FlowInstanceStatus.Running;
flowInstance.MakerList =
wfruntime.GetNextNodeType() == Define.NODE_TYPE_END ? "" : wfruntime.GetNextMakers();
wfruntime.IsFinish() ? "" : wfruntime.GetNextMakers();
wfruntime.SaveTransitionHis();
}
@@ -502,8 +502,8 @@ namespace OpenAuth.App
flowInstance.PreviousId = flowInstance.ActivityId;
flowInstance.ActivityId = wfruntime.nextNodeId;
flowInstance.ActivityName = wfruntime.nextNode.name;
flowInstance.MakerList = wfruntime.GetNextNodeType() == Define.NODE_TYPE_END ? "" : wfruntime.GetNextMakers(request);
flowInstance.IsFinish = wfruntime.GetNextNodeType() == Define.NODE_TYPE_END
flowInstance.MakerList = wfruntime.IsFinish() ? "" : wfruntime.GetNextMakers(request);
flowInstance.IsFinish = wfruntime.IsFinish()
? FlowInstanceStatus.Finished
: FlowInstanceStatus.Running;
}
@@ -869,8 +869,8 @@ namespace OpenAuth.App
flowInstance.PreviousId = wfruntime.currentNodeId;
flowInstance.CreateUserId = user.User.Id;
flowInstance.CreateUserName = user.User.Account;
flowInstance.MakerList = wfruntime.GetNextNodeType() != Define.NODE_TYPE_END ? wfruntime.GetNextMakers() : "";
flowInstance.IsFinish = wfruntime.GetNextNodeType() == Define.NODE_TYPE_END
flowInstance.MakerList = (!wfruntime.IsFinish()) ? wfruntime.GetNextMakers() : "";
flowInstance.IsFinish = wfruntime.IsFinish()
? FlowInstanceStatus.Finished
: FlowInstanceStatus.Running;

View File

@@ -17,7 +17,7 @@
haveHead: false,
haveTool: true,
headLabel: true,
toolBtns: ["start round mix", "end round", "node", "join", "fork"],
toolBtns: ["start", "end", "node", "join", "fork"],
haveGroup: true,
useOperStack: true
};
@@ -78,14 +78,14 @@
var _node = data.nodes[j];
var _flag = false;
switch (_node.type) {
case "start round mix":
case "start":
startroundFlag++;
if (fromlines[_node.id] == undefined) {
layer.msg("开始节点无法流转到下一个节点");
return -1;
}
break;
case "end round":
case "end":
endroundFlag++;
if (tolines[_node.id] == undefined) {
layer.msg("无法流转到结束节点");
@@ -173,7 +173,7 @@
$.each(options.nodeData,
function (i, item) {
$("#" + item.id).css("background", "#999");
if (item.type == "start round mix") {
if (item.type == "start") {
$("#" + item.id).css("background", "#5cb85c");
} else {
if (item.id == options.activityId) {

View File

@@ -36,7 +36,7 @@
OpenNode: function (object) {
FlowDesignObject = object; //为NodeInfo窗口提供调用
if (object.type == 'start round mix' || object.type == 'end round') {
if (object.type == 'start' || object.type == 'end') {
return false;
}

View File

@@ -60,7 +60,7 @@
OpenNode: function (object) {
FlowDesignObject = object; //为NodeInfo窗口提供调用
if (object.type == 'start round mix' || object.type == 'end round') {
if (object.type == 'start' || object.type == 'end') {
layer.msg("开始节点与结束节点不能设置");
return false;
}

View File

@@ -16,7 +16,7 @@
OpenNode: function (object) {
FlowDesignObject = object; //为NodeInfo窗口提供调用
if (object.type == 'start round mix' || object.type == 'end round') {
if (object.type == 'start' || object.type == 'end') {
layer.msg("开始节点与结束节点不能设置");
return false;
}

View File

@@ -17,20 +17,6 @@
#### ActivityId: 当前活动节点,即待审批的节点
#### ActivityType当前节点的类型
- -1 无法运行,
- 0 会签开始,
- 1 会签结束,
- 2 一般节点,
- 3 开始节点,
- 4 流程运行结束
#### SchemeContent流程实例的具体内容
该字段存储的是一个JSON对象具体内容如下所示
@@ -45,8 +31,8 @@
"belongto": "commonNodes", //节点样式类型:普通四边形节点,菱形网关
"id": "node-011c37dd1db34596b9cbd6812971b8a6", //节点id
"setInfo": {
"NodeRejectType": 0, //节点驳回类型:0-不驳回1-驳回
"NodeConfluenceType": "", //节点会签/网关类型""-不会签,"AND"-与,"OR"-或
"NodeRejectType": 0, //节点驳回类型:
"NodeConfluenceType": "", //节点会签/网关类型
"NodeDesignate": "SPECIAL_ROLE",//执行权限类型:指定角色、指定用户等
"ThirdPartyUrl": "",//执行完成后回调地址
"NodeDesignateData": { //根据NodeDesignate不同表示不同的权限数据角色、用户等
@@ -67,7 +53,7 @@
{
"type": "sl", //原有gooflow里面的值"sl":直线, "lr":中段可左右移动型折线, "tb":中段可上下移动型折线
"id": "link-6351c01fd31d4e6d85d476be6e0b0ae2",
"from": "start round mix-3fcaf7e8577644ff8b52fabaf975437e",
"from": "start-3fcaf7e8577644ff8b52fabaf975437e",
"to": "node-011c37dd1db34596b9cbd6812971b8a6",
"label": "值>3", //连线上面显示的文字
"cls": {
@@ -85,7 +71,7 @@
"type": "sl",
"id": "link-785f8823a60e4472884f482b16c16f26",
"from": "node-011c37dd1db34596b9cbd6812971b8a6",
"to": "end round-a749ef5b89bb49d588009b71f53316f5",
"to": "end-a749ef5b89bb49d588009b71f53316f5",
"label": "",
"cls": {
"linkType": "Flowchart",
@@ -97,19 +83,50 @@
}
```
其中nodes为流程实例的所有节点。lines为流程实例的所有连线。节点的type属性为节点的类型属性对应上面提到的ActivityType
其中nodes为流程实例的所有节点。lines为流程实例的所有连线。节点属性如下
- -1无法运行
- 0会签开始即type为fork
## 基础属性
- 1会签结束,即type为join
| 属性名 | 类型 | 说明 | 可选值 |
|--------|------|------|---------|
| type | 字符串 | 节点类型 | start开始节点<br>node普通节点<br>fork分支节点<br>join合并节点<br>end结束节点 |
| name | 字符串 | 节点名称 | - |
| icon | 字符串 | 节点图标 | - |
| belongto | 字符串 | 节点样式类型 | - |
| id | 字符串 | 节点id | - |
- 2一般节点,即type为node
## 配置信息(setInfo)
- 3开始节点,即type为start
### 节点驳回配置
| 属性名 | 类型 | 说明 | 可选值 |
|--------|------|------|---------|
| NodeRejectType | 数字 | 节点驳回类型 | 0前一步<br>1第一步<br>2指定节点 |
| NodeRejectStep | 字符串 | 驳回节点id | 当NodeRejectType=2时使用 |
### 节点会签/网关配置
| 属性名 | 类型 | 说明 | 可选值 |
|--------|------|------|---------|
| NodeConfluenceType | 字符串 | 节点会签/网关类型 | sequential顺序<br>all全部通过<br>one至少一个通过 |
### 执行权限配置
| 属性名 | 类型 | 说明 | 可选值 |
|--------|------|------|---------|
| NodeDesignate | 字符串 | 执行权限类型 | SPECIAL_ROLE指定角色<br>SPECIAL_USER指定用户<br>SPECIAL_SQL指定SQL<br>RUNTIME_SPECIAL_ROLE运行时指定角色<br>RUNTIME_SPECIAL_USER运行时指定用户 |
| NodeDesignateData | 对象 | 执行权限数据 | - |
| NodeDesignateData.datas | 数组 | 执行权限数据 | - |
| NodeDesignateData.Texts | 字符串 | 执行权限数据 | - |
### 其他配置
| 属性名 | 类型 | 说明 |
|--------|------|------|
| ThirdPartyUrl | 字符串 | 执行完成后回调地址 |
| CanWriteFormItemIds | 数组 | 可写表单项id |
- 4流程运行结束即type为end
与流程实例密切相关的还有两个表流程实例的操作记录FlowInstanceOperationHistory及流转记录FlowInstanceTransitionHistory。它们有不同的作用

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long