hookehuyr

fix 主屏幕的流程保存后,预览界面流程需要更新节点信息

...@@ -519,7 +519,7 @@ ...@@ -519,7 +519,7 @@
519 <vue-flow-editor-form 519 <vue-flow-editor-form
520 ref="editor1" 520 ref="editor1"
521 :height="state.window_height" 521 :height="state.window_height"
522 - :data="flowData" 522 + :data="rawFlowData"
523 :miniMap="showMiniMap" 523 :miniMap="showMiniMap"
524 :onRef="onRef1" 524 :onRef="onRef1"
525 :multipleSelect="showMultipleSelect" 525 :multipleSelect="showMultipleSelect"
...@@ -796,6 +796,8 @@ export default { ...@@ -796,6 +796,8 @@ export default {
796 796
797 // TAG: 接口获取流程图数据 797 // TAG: 接口获取流程图数据
798 const flowData = ref<any>(null); 798 const flowData = ref<any>(null);
799 + const rawFlowData = ref<any>(null); // 预览数据
800 +
799 const getFlowData = async (flow_id: any) => { 801 const getFlowData = async (flow_id: any) => {
800 flowData.value = null; 802 flowData.value = null;
801 state.reloadLoading = true; // 打开loading 803 state.reloadLoading = true; // 打开loading
...@@ -810,12 +812,14 @@ export default { ...@@ -810,12 +812,14 @@ export default {
810 // 没有流程图数据 812 // 没有流程图数据
811 if (!nodes.length && !edges.length) { 813 if (!nodes.length && !edges.length) {
812 flowData.value = AppData; // 设置默认的数据 814 flowData.value = AppData; // 设置默认的数据
815 + rawFlowData.value = AppData; // 设置默认的数据
813 } else { 816 } else {
814 flowData.value = { nodes, edges }; // 获取已存在的数据 817 flowData.value = { nodes, edges }; // 获取已存在的数据
815 - 818 + rawFlowData.value = _.cloneDeep({ nodes, edges }); // 获取已存在的数据
816 // 内部刷新graph数据 819 // 内部刷新graph数据
817 nextTick(() => { 820 nextTick(() => {
818 editor.editorState.graph.read(flowData.value) 821 editor.editorState.graph.read(flowData.value)
822 + editor1.editorState.graph.read(rawFlowData.value)
819 }); 823 });
820 } 824 }
821 825
...@@ -1467,6 +1471,22 @@ export default { ...@@ -1467,6 +1471,22 @@ export default {
1467 } 1471 }
1468 } 1472 }
1469 } 1473 }
1474 + let editor1: {
1475 + clearStates(arg0: any): () => void
1476 + openModel: () => void
1477 + closeModel: () => void
1478 + openPreview1: () => void
1479 + addNode: (arg0: any) => void
1480 + updateModel: (arg0: any) => void
1481 + editorState: {
1482 + graph: {
1483 + addItem: any
1484 + removeItem: any
1485 + save: () => { nodes: any; edges: any }
1486 + read: any
1487 + }
1488 + }
1489 + }
1470 1490
1471 /** 1491 /**
1472 * 双击节点回调 1492 * 双击节点回调
...@@ -1852,6 +1872,7 @@ export default { ...@@ -1852,6 +1872,7 @@ export default {
1852 type: 'success', 1872 type: 'success',
1853 message: '保存流程图成功', 1873 message: '保存流程图成功',
1854 }); 1874 });
1875 + rawFlowData.value = flowData.value;
1855 } 1876 }
1856 } else { 1877 } else {
1857 ElNotification.error('缺少一条从开始节点到结束节点的完整流程!'); 1878 ElNotification.error('缺少一条从开始节点到结束节点的完整流程!');
...@@ -2284,7 +2305,10 @@ export default { ...@@ -2284,7 +2305,10 @@ export default {
2284 } 2305 }
2285 2306
2286 const openPreview = () => { 2307 const openPreview = () => {
2308 + // 打开弹框
2287 state.dialogPreviewVisible = true; 2309 state.dialogPreviewVisible = true;
2310 + // 获取最新数据
2311 + getFlowData(flow_id);
2288 // 创建一个resize事件 2312 // 创建一个resize事件
2289 const resizeEvent = new Event('resize'); 2313 const resizeEvent = new Event('resize');
2290 2314
...@@ -2341,6 +2365,7 @@ export default { ...@@ -2341,6 +2365,7 @@ export default {
2341 rules, 2365 rules,
2342 formRef, 2366 formRef,
2343 flowData, 2367 flowData,
2368 + rawFlowData,
2344 2369
2345 showGrid: true, // 是否开启网格 2370 showGrid: true, // 是否开启网格
2346 showMiniMap: false, // 是否开启缩略图 2371 showMiniMap: false, // 是否开启缩略图
...@@ -2399,6 +2424,7 @@ export default { ...@@ -2399,6 +2424,7 @@ export default {
2399 handleDrawerClosed, 2424 handleDrawerClosed,
2400 2425
2401 onRef: (e: any) => (editor = e), 2426 onRef: (e: any) => (editor = e),
2427 + onRef1: (e: any) => (editor1 = e),
2402 staticPath, 2428 staticPath,
2403 } 2429 }
2404 }, 2430 },
......