Files
FiDA_Front/src/components/Canvas/FlowCanvas/index.vue

55 lines
1.2 KiB
Vue
Raw Normal View History

2026-02-06 16:23:22 +08:00
<template>
2026-02-26 11:45:32 +08:00
<fullscreen-dialog v-model="dialogVisible" hide-destroy>
2026-03-13 15:06:33 +08:00
<flow-canvas :config="config" @exportFlow="exportFlow" />
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'
import { ref } from 'vue'
2026-03-13 15:06:33 +08:00
import { getSketchFlowCanvas, putSketchFlowCanvas } from '@/api/flow-canvas'
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
const open = async (options) => {
let json = []
await new Promise((resolve) => {
getSketchFlowCanvas({ id: options.imgId }).then((res:any) => {
if (res) {
json = JSON.parse(res)
}
resolve(true)
}).catch(() => {
resolve(true)
})
})
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-13 15:06:33 +08:00
const exportFlow = async (str) => {
if(!config.value.imgId)return
await new Promise((resolve) => {
putSketchFlowCanvas({
id: config.value.imgId,
canvasData: str }).then(() => {
resolve(true)
}).catch(() => {
resolve(true)
})
})
}
2026-02-26 11:45:32 +08:00
const close = () => {
dialogVisible.value = false
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,
exportFlow
2026-02-26 11:45:32 +08:00
})
2026-02-06 16:23:22 +08:00
</script>
<style lang="less" scoped>
</style>