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