From d6749f95c526c0e71ec946bd3bb777bc42b2c34a Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期日, 20 十月 2024 17:59:31 +0800 Subject: [PATCH] 工艺绑定优化 --- src/components/FlowChart/src/FlowChart.vue | 81 +++++++++++++++++++++++----------------- 1 files changed, 47 insertions(+), 34 deletions(-) diff --git a/src/components/FlowChart/src/FlowChart.vue b/src/components/FlowChart/src/FlowChart.vue index 36397f0..0db0f7a 100644 --- a/src/components/FlowChart/src/FlowChart.vue +++ b/src/components/FlowChart/src/FlowChart.vue @@ -30,7 +30,8 @@ import { useModal, BasicModal } from '@/components/Modal'; import { JsonPreview } from '@/components/CodeEditor'; import { configDefaultDndPanel } from './config'; - import '@logicflow/core/dist/style/index.css'; + import '@logicflow/core/lib/style/index.css'; + // import '@logicflow/core/dist/style/index.css'; import '@logicflow/extension/lib/style/index.css'; import { useGlobSetting } from '/@/hooks/setting'; import customEdge from './customEdge'; @@ -74,6 +75,8 @@ 'init', 'undo', 'redo', + 'anchor-drop', + 'anchor-dragend', ]); const lfElRef = ref(null); const graphData = ref({}); @@ -187,7 +190,17 @@ } }); } + emit('anchor-drop', data, lf); }); + + /** + * @description: 閿氱偣杩炵嚎缁撴潫锛屼笉绠℃槸鍚﹀垱寤鸿繛绾块兘浼氳Е鍙戙�� + * @return {*} + */ + lf.on('anchor:dragend', (data, e, nodeModel) => { + emit('anchor-dragend',data, e, nodeModel, lf); + }); + lf.on('node:click,edge:click', (data) => { if (data.isSelected) { console.log(data.data.text.value, data.isSelected); @@ -223,48 +236,48 @@ openModal(); } -function handleSave() { - // console.log('handleSave'); - const lf = unref(lfInstance); - if (!lf) { - return; + function handleSave() { + // console.log('handleSave'); + const lf = unref(lfInstance); + if (!lf) { + return; + } + emit('save-data', lf); } - emit('save-data', lf); -} -function handleAdd() { - const lf = unref(lfInstance); - console.log('handleAdd'); - if (!lf) { - return; + function handleAdd() { + const lf = unref(lfInstance); + console.log('handleAdd'); + if (!lf) { + return; + } + // lf.clearData(); + lf.render({}); } - // lf.clearData(); - lf.render({}); -} -function handleAddlf() { - const lf = unref(lfInstance); - if (!lf) { - return; + function handleAddlf() { + const lf = unref(lfInstance); + if (!lf) { + return; + } + emit('add-lf', lf); } - emit('add-lf', lf); -} -function handleUndo() { - const lf = unref(lfInstance); - if (!lf) { - return; + function handleUndo() { + const lf = unref(lfInstance); + if (!lf) { + return; + } + emit('undo', lf); } - emit('undo', lf); -} -function handleRedo() { - const lf = unref(lfInstance); - if (!lf) { - return; + function handleRedo() { + const lf = unref(lfInstance); + if (!lf) { + return; + } + emit('redo', lf); } - emit('redo', lf); -} onMounted(init); </script> -- Gitblit v1.9.3