fix
This commit is contained in:
@@ -78,8 +78,6 @@
|
||||
import card from './components/nodes/cards/index.vue'
|
||||
import text from './components/nodes/text.vue'
|
||||
|
||||
// 接口
|
||||
import { getSketchFlowCanvas, putSketchFlowCanvas } from '@/api/flow-canvas'
|
||||
const components = {
|
||||
[NODE_COMPONENT.RESULT_IMAGE]: resultImage,
|
||||
[NODE_COMPONENT.CARD]: card,
|
||||
@@ -100,6 +98,7 @@
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['exportFlow'])
|
||||
|
||||
const vueFlow = ref<any>()
|
||||
const nodeTypes = ref([NODE_TYPE.INPUT, NODE_TYPE.SECONDARY, NODE_TYPE.OUTPUT, NODE_TYPE.ALONE])
|
||||
@@ -146,6 +145,7 @@
|
||||
const { layout } = useLayout()
|
||||
const index = ref(0)
|
||||
async function layoutGraph(direction) {
|
||||
if(props.config.json > 0)return
|
||||
if (index.value > 0) return
|
||||
index.value++
|
||||
setTimeout(() => {
|
||||
@@ -190,15 +190,7 @@
|
||||
// flowManager.exportFlow()
|
||||
|
||||
const str = JSON.stringify(stateManager.nodes.value)
|
||||
const json = JSON.parse(str)
|
||||
putSketchFlowCanvas({
|
||||
id: props.config.imgId,
|
||||
canvasData: str
|
||||
}).then((res) => {
|
||||
if (res) {
|
||||
console.log(res)
|
||||
}
|
||||
})
|
||||
emit('exportFlow', str)
|
||||
// localStorage.setItem('flow_json', str)
|
||||
}
|
||||
// 导入流程
|
||||
@@ -229,19 +221,9 @@
|
||||
onMounted(async () => {
|
||||
// window['vueFlow'] = vueFlow
|
||||
// window['nodes'] = nodes
|
||||
let json = []
|
||||
await new Promise((resolve) => {
|
||||
getSketchFlowCanvas({ id: props.config.imgId }).then((res:any) => {
|
||||
if (res) {
|
||||
json = JSON.parse(res)
|
||||
}
|
||||
resolve(true)
|
||||
}).catch(() => {
|
||||
resolve(true)
|
||||
})
|
||||
})
|
||||
if(json.length > 0){
|
||||
importFlow(json)
|
||||
|
||||
if(props.config.json.length > 0){
|
||||
importFlow(props.config.json)
|
||||
}else{
|
||||
const timestamp = Date.now()
|
||||
nodeManager.createResultNode({
|
||||
|
||||
Reference in New Issue
Block a user