2026-02-06 16:23:22 +08:00
|
|
|
<template>
|
2026-03-17 11:06:32 +08:00
|
|
|
<fullscreen-dialog v-model="dialogVisible" @close="close" hide-destroy>
|
2026-03-19 10:36:12 +08:00
|
|
|
<flow-canvas ref="flowCanvasRef" :config="config" />
|
2026-02-25 10:16:14 +08:00
|
|
|
</fullscreen-dialog>
|
2026-02-06 16:23:22 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2026-02-25 10:16:14 +08:00
|
|
|
import FullscreenDialog from '../components/fullscreen-dialog.vue'
|
2026-02-26 11:45:32 +08:00
|
|
|
import flowCanvas from './flow-canvas.vue'
|
2026-03-19 11:14:41 +08:00
|
|
|
import { ref } from 'vue'
|
2026-03-19 17:14:57 +08:00
|
|
|
import { getSketchFlowCanvas } from '@/api/flow-canvas'
|
2026-03-18 14:51:22 +08:00
|
|
|
import { useI18n } from 'vue-i18n'
|
2026-04-17 15:46:28 +08:00
|
|
|
import myEvent from '@/utils/myEvent'
|
2026-03-13 15:06:33 +08:00
|
|
|
|
2026-02-25 13:45:55 +08:00
|
|
|
const dialogVisible = ref(false)
|
2026-03-13 15:06:33 +08:00
|
|
|
const config = ref({}) as any
|
2026-03-17 11:06:32 +08:00
|
|
|
const flowCanvasRef = ref<any>()
|
2026-03-18 14:51:22 +08:00
|
|
|
const {t:$t} = useI18n()
|
2026-03-13 15:06:33 +08:00
|
|
|
const open = async (options) => {
|
|
|
|
|
let json = []
|
2026-04-21 16:57:31 +08:00
|
|
|
let isGetJson = false
|
2026-03-13 15:06:33 +08:00
|
|
|
await new Promise((resolve) => {
|
2026-03-18 10:59:12 +08:00
|
|
|
getSketchFlowCanvas({ id: options.imgId },true).then((res:any) => {
|
2026-03-13 15:06:33 +08:00
|
|
|
if (res) {
|
|
|
|
|
json = JSON.parse(res)
|
|
|
|
|
}
|
2026-04-21 16:57:31 +08:00
|
|
|
isGetJson = true
|
2026-03-13 15:06:33 +08:00
|
|
|
resolve(true)
|
|
|
|
|
}).catch(() => {
|
2026-04-21 16:57:31 +08:00
|
|
|
resolve(false)
|
2026-03-13 15:06:33 +08:00
|
|
|
})
|
|
|
|
|
})
|
2026-04-21 16:57:31 +08:00
|
|
|
if(!isGetJson)return
|
2026-02-27 16:47:02 +08:00
|
|
|
config.value = options || {}
|
2026-03-13 15:06:33 +08:00
|
|
|
config.value.json = json
|
|
|
|
|
dialogVisible.value = true
|
2026-02-24 13:20:57 +08:00
|
|
|
}
|
2026-03-17 11:06:32 +08:00
|
|
|
const close = async () => {
|
2026-04-20 11:10:58 +08:00
|
|
|
await flowCanvasRef.value?.putFlowJson()
|
2026-02-26 11:45:32 +08:00
|
|
|
dialogVisible.value = false
|
2026-04-17 15:46:28 +08:00
|
|
|
myEvent.emit('closeFlowCanvas')
|
2026-02-24 13:20:57 +08:00
|
|
|
}
|
2026-02-26 11:45:32 +08:00
|
|
|
defineExpose({
|
|
|
|
|
open,
|
2026-03-13 15:06:33 +08:00
|
|
|
close,
|
2026-02-26 11:45:32 +08:00
|
|
|
})
|
2026-02-06 16:23:22 +08:00
|
|
|
</script>
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
</style>
|