Commit 991ce2105b4b16dfd81b1937a78834068c898c09

Authored by YunaiV
1 parent e12c1736

优化 bpm 高亮流程图的排它节点~~~

yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/ProcessViewer.vue
... ... @@ -154,12 +154,32 @@ export default {
154 154 }
155 155 });
156 156 } else if (n.$type === 'bpmn:ExclusiveGateway') { // 排它网关
  157 + if (!activity) {
  158 + return
  159 + }
  160 + // 设置【bpmn:ExclusiveGateway】排它网关的高亮
  161 + canvas.addMarker(n.id, this.getActivityHighlightCss(activity));
  162 + // 查找需要高亮的连线
  163 + let matchNN = undefined;
  164 + let matchActivity = undefined;
157 165 n.outgoing?.forEach(nn => {
158   - let targetTask = activityList.find(m => m.key === nn.targetRef.id);
159   - if (targetTask) {
160   - canvas.addMarker(nn.id, targetTask.endTime ? 'highlight' : 'highlight-todo');
  166 + let targetActivity = activityList.find(m => m.key === nn.targetRef.id);
  167 + if (!targetActivity) {
  168 + return;
  169 + }
  170 + // 特殊判断 endEvent 类型的原因,ExclusiveGateway 可能后续连有 2 个路径:
  171 + // 1. 一个是 UserTask => EndEvent
  172 + // 2. 一个是 EndEvent
  173 + // 在选择路径 1 时,其实 EndEvent 可能也存在,导致 1 和 2 都高亮,显然是不正确的。
  174 + // 所以,在 matchActivity 为 EndEvent 时,需要进行覆盖~~
  175 + if (!matchActivity || matchActivity.type === 'endEvent') {
  176 + matchNN = nn;
  177 + matchActivity = targetActivity;
161 178 }
162 179 })
  180 + if (matchNN && matchActivity) {
  181 + canvas.addMarker(matchNN.id, this.getActivityHighlightCss(matchActivity));
  182 + }
163 183 } else if (n.$type === 'bpmn:ParallelGateway') { // 并行网关
164 184 if (!activity) {
165 185 return
... ...