fix
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<fullscreen-dialog v-model="dialogVisible" hide-destroy>
|
||||
<flow-canvas :config="config" />
|
||||
<flow-canvas :config="config" @exportFlow="exportFlow" />
|
||||
</fullscreen-dialog>
|
||||
</template>
|
||||
|
||||
@@ -8,18 +8,46 @@
|
||||
import FullscreenDialog from '../components/fullscreen-dialog.vue'
|
||||
import flowCanvas from './flow-canvas.vue'
|
||||
import { ref } from 'vue'
|
||||
import { getSketchFlowCanvas, putSketchFlowCanvas } from '@/api/flow-canvas'
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const config = ref({})
|
||||
const open = (options) => {
|
||||
dialogVisible.value = true
|
||||
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)
|
||||
})
|
||||
})
|
||||
config.value = options || {}
|
||||
config.value.json = json
|
||||
dialogVisible.value = true
|
||||
}
|
||||
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)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const close = () => {
|
||||
dialogVisible.value = false
|
||||
}
|
||||
defineExpose({
|
||||
open,
|
||||
close
|
||||
close,
|
||||
exportFlow
|
||||
})
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
|
||||
Reference in New Issue
Block a user