From 94b01c5bc58a284027437c46d2caeb4899bec430 Mon Sep 17 00:00:00 2001 From: v_xugzhou <941071842@qq.com> Date: Wed, 30 Aug 2023 11:34:28 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=20=E8=8A=82=E7=82=B9=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E6=A0=91=E7=AE=97=E6=B3=95=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/task/TaskExecute/TaskOperation.vue | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/frontend/desktop/src/pages/task/TaskExecute/TaskOperation.vue b/frontend/desktop/src/pages/task/TaskExecute/TaskOperation.vue index c086f5b2f0..f5bd9156cc 100644 --- a/frontend/desktop/src/pages/task/TaskExecute/TaskOperation.vue +++ b/frontend/desktop/src/pages/task/TaskExecute/TaskOperation.vue @@ -1467,7 +1467,8 @@ outgoing.forEach(line => { this.retrieveLines(data, line, ordered) }) - if (ordered[ordered.findLastIndex(order => order.type !== 'ServiceActivity')]) { + const lastIndex = this.findLastIndex(ordered, (order) => order.type !== 'ServiceActivity') + if (ordered[lastIndex]) { renderNodelist = [] renderNodeOutgoing = [] this.nodeIds.forEach(item => { @@ -1521,7 +1522,8 @@ outgoing.forEach(line => { this.retrieveLines(data, line, ordered) }) - if (ordered[ordered.findLastIndex(order => order.type === 'ParallelGateway')]) { + const lastIndex = this.findLastIndex(ordered, (order) => order.type === 'ParallelGateway') + if (ordered[lastIndex]) { renderNodelist = [] renderNodeOutgoing = [] this.nodeIds.forEach(item => { @@ -1570,7 +1572,8 @@ }) if (gateway.incoming.every(item => outgoingList.concat(this.conditionOutgoing).includes(item))) { // 汇聚网关push在最近的条件网关下 - const prev = ordered[ordered.findLastIndex(order => order.type !== 'ServiceActivity' && order.type !== 'ConvergeGateway')] + const lastIndex = this.findLastIndex(ordered, (order) => order.type !== 'ServiceActivity' && order.type !== 'ConvergeGateway') + const prev = ordered[lastIndex] // 独立子流程的children为 subChildren this.nodeIds.push(gateway.id) if (prev && prev.children && !prev.children.find(item => item.id === gateway.id) && !this.converNodeList.includes(gateway.id)) { @@ -1608,6 +1611,15 @@ } } }, + findLastIndex (arr, callback, thisArg) { + for (let index = arr.length - 1; index >= 0; index--) { + const value = arr[index] + if (callback.call(thisArg, value, index, arr)) { + return index + } + } + return -1 + }, renderConverGateway (ids, ordered, data) { const allNode = Object.assign({}, data.activities, data.gateways) ids.forEach(id => { @@ -1616,7 +1628,7 @@ const node = Object.keys(allNode).find(item => Array.isArray(allNode[item].outgoing) ? allNode[item].outgoing.includes(incoming) : allNode[item].outgoing === incoming) ordered.forEach(item => { if (item.id === node && allNode[node].type !== 'ServiceActivity' && allNode[node].type !== 'ConvergeGateway') { - if (!item.children.map(chd => chd.id).includes(data.gateways[id].id) && !this.renderedCoverNode.includes(id)) { + if (item.children && !item.children.map(chd => chd.id).includes(data.gateways[id].id) && !this.renderedCoverNode.includes(id)) { this.renderedCoverNode.push(id) item.children.push(Object.assign(data.gateways[id], { name: this.$t('汇聚网关') })) }