Skip to content

Commit deb3844

Browse files
authored
fix: Judgment tool drag and drop sorting (#2837)
1 parent 26f36cc commit deb3844

File tree

1 file changed

+6
-6
lines changed
  • ui/src/workflow/nodes/condition-node

1 file changed

+6
-6
lines changed

ui/src/workflow/nodes/condition-node/index.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
>
1111
<VueDraggable
1212
ref="el"
13-
v-model="form_data.branch"
13+
v-bind:modelValue="form_data.branch"
1414
:disabled="form_data.branch === 2"
1515
:filter="'.no-drag'"
1616
handle=".handle"
@@ -169,6 +169,7 @@ import { compareList } from '@/workflow/common/data'
169169
import { VueDraggable } from 'vue-draggable-plus'
170170
171171
const props = defineProps<{ nodeModel: any }>()
172+
172173
const form = {
173174
branch: [
174175
{
@@ -248,13 +249,12 @@ function onEnd(event?: any) {
248249
if (oldIndex === undefined || newIndex === undefined) return
249250
const list = cloneDeep(props.nodeModel.properties.node_data.branch)
250251
if (oldIndex === list.length - 1 || newIndex === list.length - 1) {
251-
list[newIndex] = list[oldIndex]
252-
list[oldIndex] = clonedData
253-
set(props.nodeModel.properties.node_data, 'branch', list)
254252
return
255253
}
256-
list[newIndex].type = list[oldIndex].type
257-
list[oldIndex].type = clonedData.type // 恢复原始 type
254+
const newInstance = { ...list[oldIndex], type: list[newIndex].type, id: list[newIndex].id }
255+
const oldInstance = { ...list[newIndex], type: list[oldIndex].type, id: list[oldIndex].id }
256+
list[newIndex] = newInstance
257+
list[oldIndex] = oldInstance
258258
set(props.nodeModel.properties.node_data, 'branch', list)
259259
}
260260

0 commit comments

Comments
 (0)