This commit is contained in:
lzp
2026-03-19 11:32:24 +08:00
2 changed files with 5 additions and 17 deletions

View File

@@ -52,6 +52,8 @@
const nodes = computed(() => props.stateManager.nodes.value)
const isSubord = computed(() => nodes.value.some((v) => v.data.superiorID === props.node.id))
const tier = computed(() => Number(props.node?.data?.tier || 0))
//只有3d模型才有三级菜单,目前三级菜单内容少直接禁用按钮
const isAdd3d = computed(() => (tier.value === 2 && props.node?.data?.superiorNodeType === NODE_DATATYPE.TO_3D_MODEL) || tier.value != 2)
const isReturned = computed(() => {
return (
props.node.data.type == NODE_DATATYPE.RESULT_IMAGE &&
@@ -63,7 +65,8 @@
!isSubord.value &&
NODE_DATATYPE.RESULT_IMAGE === props.node.data.type &&
!(tier.value === NODE_DATATIER.TO_3VIEW) &&
isReturned.value
isReturned.value &&
isAdd3d.value
)
const onAdd = () => {
const tier_ = tier.value + 1

View File

@@ -7,7 +7,7 @@
<script setup lang="ts">
import FullscreenDialog from '../components/fullscreen-dialog.vue'
import flowCanvas from './flow-canvas.vue'
import { ref, onMounted, onBeforeUnmount } from 'vue'
import { ref } from 'vue'
import { getSketchFlowCanvas, putSketchFlowCanvas } from '@/api/flow-canvas'
import { useI18n } from 'vue-i18n'
@@ -34,21 +34,6 @@
const close = async () => {
dialogVisible.value = false
}
const handleBeforeUnload = (event) => {
const str = flowCanvasRef.value?.getFlowJson()
if (str) {
event.preventDefault()
event.returnValue = $t('flowCanvas.confirmLeave')
return $t('flowCanvas.confirmLeave')
}
}
onMounted(() => {
// 添加事件监听
window.addEventListener('beforeunload', handleBeforeUnload)
})
onBeforeUnmount(() => {
window.removeEventListener('beforeunload', handleBeforeUnload)
})
defineExpose({
open,
close,