Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

节点详情节点树算法问题修复 #7030

Merged
merged 1 commit into from
Aug 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions frontend/desktop/src/pages/task/TaskExecute/TaskOperation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down Expand Up @@ -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 => {
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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 => {
Expand All @@ -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('汇聚网关') }))
}
Expand Down
Loading