<template>
    <div class="layout-pd">
        <LogicFlow ref='designerRef' v-model="flowData" />
    </div>
</template>
<script setup lang="ts" name="workflowEdit">
import { defineAsyncComponent, ref, onMounted } from "vue";
import { useRoute } from "vue-router";
import { getWorkFlowDetail } from '/@/api/system/workflow';
const LogicFlow = defineAsyncComponent(() => import('/@/components/LogicFlow/index.vue'));
const designerRef = ref(null as any);
let flowData = ref({
    "name": "",
    "code": "",
    "id": "",
    "moduleName": "",
    "moduleCode": "",
    "nodes": [
        {
            "id": "start",
            "type": "hotline:start",
            "x": 780,
            "y": 120,
            "properties": {},
            "text": {
                "x": 780,
                "y": 80,
                "value": "开始"
            }
        },
        {
            "id": "end",
            "type": "hotline:end",
            "x": 780,
            "y": 400,
            "properties": {},
            "text": {
                "x": 780,
                "y": 440,
                "value": "结束"
            }
        }
    ],
    "edges": []
});
const route = useRoute();
onMounted(async () => {
    // 查询详情
    if (route.params.id) {
        const res: any = await getWorkFlowDetail(route.params.id);
        flowData.value = res.result;
    }
})
</script>

<style scoped>
</style>