adtec-core-package 3.1.1 → 3.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adtec-core-package",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {
@@ -152,6 +152,7 @@ provide('flowDesign', {
152
152
  nodesError: nodesError,
153
153
  getTaskNodes: getTaskNodes,
154
154
  getParentNodes: getParentNodes,
155
+ getPathNodes: (id: string) => getPathNodes(id, props.process, []),
155
156
  addFormItem: addFormItem,
156
157
  deleteFormItem: deleteFormItem,
157
158
  getNodeById: getNodeById,
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import type { ErrorInfo, FlowNode, NodeType } from './type'
2
+ import type { BranchNode, ErrorInfo, FlowNode, NodeType } from './type'
3
3
  import { ClickOutside as vClickOutside, type InputInstance } from 'element-plus'
4
4
  import Add from './Add.vue'
5
5
  import { computed, inject, nextTick, ref, type Ref, watchEffect } from 'vue'
@@ -10,6 +10,8 @@ const _inject = inject<{
10
10
  readOnly?: Ref<boolean>
11
11
  nodesError: Ref<Recordable<ErrorInfo[]>>
12
12
  processInst: Ref<IWfProcessInstVo>
13
+ getNodeById?: (id: string) => FlowNode | undefined
14
+ getPathNodes?: (id: string) => FlowNode[]
13
15
  }>('flowDesign', {
14
16
  readOnly: ref(false),
15
17
  nodesError: ref({}),
@@ -120,15 +122,41 @@ watchEffect(() => {
120
122
  headColor.value = '#9B9EA1'
121
123
  }
122
124
  if ($props.node.type === 'jump') {
123
- //jump节点若pid完成,则其也完成
124
- if (
125
- $props.node.pid &&
126
- ((_inject.processInst.value.hisTasks?.some((x) => x.taskDefKey == $props.node.pid) &&
127
- !_inject.processInst.value.activeTasks?.some((x) => x.taskDefKey == $props.node.pid)) ||
128
- _inject.processInst.value.flows?.some((x) => x.taskDefKey == $props.node.pid))
129
- ) {
130
- nodeClass.value = 'node-complete'
131
- headColor.value = '#18AD43'
125
+ const flowKeys = (_inject.processInst.value.flows ?? []).map((x) => x.taskDefKey)
126
+ const pathNodes = _inject.getPathNodes?.($props.node.id) ?? []
127
+ const parentCondition = [...pathNodes].reverse().find((x) => x.type === 'condition')
128
+
129
+ if (parentCondition) {
130
+ // jump BPMN 中仅为连线,以所属条件分支的 sequenceFlow 是否执行判断
131
+ if (flowKeys.includes(parentCondition.id)) {
132
+ nodeClass.value = 'node-complete'
133
+ headColor.value = '#18AD43'
134
+ } else {
135
+ nodeClass.value = 'node-unstart'
136
+ headColor.value = '#9B9EA1'
137
+ }
138
+ } else if ($props.node.pid) {
139
+ const parentNode = _inject.getNodeById?.($props.node.pid)
140
+ if (parentNode?.type === 'approval') {
141
+ // 线性审批后的 jump:父审批已完成即可
142
+ if (
143
+ _inject.processInst.value.hisTasks?.some((x) => x.taskDefKey == $props.node.pid) &&
144
+ !_inject.processInst.value.activeTasks?.some((x) => x.taskDefKey == $props.node.pid)
145
+ ) {
146
+ nodeClass.value = 'node-complete'
147
+ headColor.value = '#18AD43'
148
+ }
149
+ } else if (parentNode?.type === 'exclusive' || parentNode?.type === 'inclusive') {
150
+ // 网关主干 default jump:默认条件连线已执行时高亮
151
+ const defaultCondition = (parentNode as BranchNode).children?.find((c) => c.def)
152
+ if (defaultCondition && flowKeys.includes(defaultCondition.id)) {
153
+ nodeClass.value = 'node-complete'
154
+ headColor.value = '#18AD43'
155
+ } else {
156
+ nodeClass.value = 'node-unstart'
157
+ headColor.value = '#9B9EA1'
158
+ }
159
+ }
132
160
  }
133
161
  }
134
162
  }