Merge branch 'main' of ssh://18.167.251.121:10002/aidlab/FiDA_Front
This commit is contained in:
@@ -1,15 +1,13 @@
|
||||
<template>
|
||||
<div class="node start" :class="{ center: posCenter }">
|
||||
<template v-if="type === NODE_TYPE.INPUT">
|
||||
<Handle type="source" id="Right" :position="Position.Right" />
|
||||
</template>
|
||||
<template v-else-if="type === NODE_TYPE.SECONDARY">
|
||||
<Handle type="target" id="Left" :position="Position.Left" />
|
||||
<Handle type="source" id="Right" :position="Position.Right" />
|
||||
</template>
|
||||
<template v-else-if="type === NODE_TYPE.OUTPUT">
|
||||
<Handle type="target" id="Left" :position="Position.Left" />
|
||||
</template>
|
||||
<div class="node" :class="{ center: posCenter }">
|
||||
<Handle
|
||||
v-for="handle in handles[type]"
|
||||
:key="handle.id"
|
||||
:type="handle.type"
|
||||
:id="handle.id"
|
||||
:position="handle.position"
|
||||
:connectable="false"
|
||||
/>
|
||||
<div class="item">
|
||||
<slot></slot>
|
||||
</div>
|
||||
@@ -22,7 +20,15 @@
|
||||
import { Handle, Position } from '@vue-flow/core'
|
||||
import { NODE_TYPE } from '../tools/index.d'
|
||||
import { NODE_DATATYPE, NODE_DATATIER } from '../tools/index.d'
|
||||
import { computed } from 'vue'
|
||||
import { computed, ref } from 'vue'
|
||||
const handles = ref({
|
||||
[NODE_TYPE.INPUT]: [{ id: 'Right', type: 'source', position: Position.Right }],
|
||||
[NODE_TYPE.SECONDARY]: [
|
||||
{ id: 'Left', type: 'target', position: Position.Left },
|
||||
{ id: 'Right', type: 'source', position: Position.Right }
|
||||
],
|
||||
[NODE_TYPE.OUTPUT]: [{ id: 'Left', type: 'target', position: Position.Left }]
|
||||
})
|
||||
const props = defineProps({
|
||||
type: {
|
||||
type: String,
|
||||
|
||||
@@ -33,13 +33,10 @@ export class StateManager {
|
||||
...node,
|
||||
}
|
||||
if (index === 0) {
|
||||
obj.class = 'custom-node start';
|
||||
obj.type = NODE_TYPE.INPUT;
|
||||
} else if (index === this.nodes.value.length - 1) {
|
||||
obj.class = 'custom-node end';
|
||||
obj.type = NODE_TYPE.OUTPUT;
|
||||
} else {
|
||||
obj.class = 'custom-node';
|
||||
obj.type = NODE_TYPE.SECONDARY;
|
||||
}
|
||||
return obj
|
||||
|
||||
@@ -74,35 +74,34 @@ const openTree = (state)=>{
|
||||
}
|
||||
|
||||
const versionRestore = () => {
|
||||
|
||||
let id = ''
|
||||
if(selectItem.value?.children?.length > 0){
|
||||
function findMaxForYourFormat(items) {
|
||||
let max = 0
|
||||
// let id = ''
|
||||
// if(selectItem.value?.children?.length > 0){
|
||||
// function findMaxForYourFormat(items) {
|
||||
// let max = 0
|
||||
|
||||
for (const item of items) {
|
||||
// 直接分割并取最后一部分
|
||||
const parts = item?.versionId.split('-')
|
||||
const lastNumber = parseInt(parts[parts.length - 1], 10)
|
||||
// for (const item of items) {
|
||||
// // 直接分割并取最后一部分
|
||||
// const parts = item?.versionId.split('-')
|
||||
// const lastNumber = parseInt(parts[parts.length - 1], 10)
|
||||
|
||||
if (lastNumber > max) {
|
||||
max = lastNumber
|
||||
}
|
||||
}
|
||||
// if (lastNumber > max) {
|
||||
// max = lastNumber
|
||||
// }
|
||||
// }
|
||||
|
||||
return max
|
||||
}
|
||||
id = `${selectItem.value?.versionId}-${findMaxForYourFormat(selectItem.value?.children) + 1}`
|
||||
}else{
|
||||
id = `${selectItem.value?.versionId}-1`
|
||||
}
|
||||
let addObj = {
|
||||
id,
|
||||
name:`V${id}`
|
||||
}
|
||||
findAndAddChild(versionsList.value, selectItem.value?.versionId, addObj)
|
||||
selectItem.value = {...addObj}
|
||||
treeKey.value++
|
||||
// return max
|
||||
// }
|
||||
// id = `${selectItem.value?.versionId}-${findMaxForYourFormat(selectItem.value?.children) + 1}`
|
||||
// }else{
|
||||
// id = `${selectItem.value?.versionId}-1`
|
||||
// }
|
||||
// let addObj = {
|
||||
// id,
|
||||
// name:`V${id}`
|
||||
// }
|
||||
// findAndAddChild(versionsList.value, selectItem.value?.versionId, addObj)
|
||||
// selectItem.value = {...addObj}
|
||||
// treeKey.value++
|
||||
emit('restore')
|
||||
emit('update:versionTreeData', {...props.versionTreeData, drawer: false})
|
||||
}
|
||||
@@ -112,6 +111,11 @@ const versionDelete = (versionDetail)=>{
|
||||
treeKey.value++
|
||||
}
|
||||
|
||||
watch(()=>projectStore.state.nodeId,(newVal,oldVal)=>{
|
||||
if(!newVal || newVal === selectItem?.value?.id)return
|
||||
selectItem.value = {id:newVal}
|
||||
})
|
||||
|
||||
let data = reactive({})
|
||||
// onMounted(() => {setVersionsList('')})
|
||||
onUnmounted(() => {})
|
||||
|
||||
@@ -68,7 +68,7 @@ const initialize = ()=>{
|
||||
})
|
||||
console.log(treeList)
|
||||
isLoad.value = true
|
||||
if(!props.selectItem?.versionId)setSelectItem(treeList.value[treeList.value.length - 1])
|
||||
// if(!props.selectItem?.versionId)setSelectItem(treeList.value[treeList.value.length - 1])
|
||||
}
|
||||
|
||||
const setSelectItem = (item)=>{
|
||||
|
||||
Reference in New Issue
Block a user