From 515aea3f9ee31d26ec93bf471b2491caf8ac16ed Mon Sep 17 00:00:00 2001 From: fujunling <2984387807@qq.com> Date: 星期二, 18 七月 2023 11:03:58 +0800 Subject: [PATCH] fjl --- Source/UBCS-WEB/src/components/flow-cycle/flowchartEditor.vue | 39 +++++++++++++++++++++++++++++++++------ 1 files changed, 33 insertions(+), 6 deletions(-) diff --git a/Source/UBCS-WEB/src/components/flow-cycle/flowchartEditor.vue b/Source/UBCS-WEB/src/components/flow-cycle/flowchartEditor.vue index 78b4dd5..4ffe6fe 100644 --- a/Source/UBCS-WEB/src/components/flow-cycle/flowchartEditor.vue +++ b/Source/UBCS-WEB/src/components/flow-cycle/flowchartEditor.vue @@ -14,7 +14,11 @@ </div> <!-- Main Chart --> <div class="vfe-chart-main"> - <flow :data="flowChartData" :onAfterChange="onAfterChange" /> + <flow + :data="flowChartData" + :onAfterChange="onAfterChange" + :onAfterItemSelected="onAfterItemSelected" + /> <div class="tooltip"> <template v-for="item in tooltipData"> <p>{{ item.name }}: {{ item.value }}</p> @@ -23,7 +27,14 @@ </div> <div class="vfe-chart-panel" v-if="type !== 'detail'"> <div class="vfe-chart-panel-detail"> - <editor-detail-panel :rowData="rowData" ref="EditorDetailPanel" :existNodes="existNodes" :type="type"/> + <editor-detail-panel + :rowData="rowData" + ref="EditorDetailPanel" + :existNodes="existNodes" + :existEdges="existEdges" + :currentSelectedLine="currentSelectedLine" + :type="type" + /> </div> </div> </div> @@ -83,7 +94,9 @@ }, tooltipShow: true, tooltipData: [], - existNodes: this.chartData.nodes || [] + existNodes: this.chartData.nodes || [], + existEdges: this.chartData.edges || [], + currentSelectedLine: {} }; }, @@ -114,10 +127,21 @@ this.$message.error("涓嶈兘娣诲姞宸插瓨鍦ㄧ殑鑺傜偣锛�"); } } - const { nodes } = this.$refs.flowChart.propsAPI.save() - this.existNodes = nodes || [] - console.log(this.$refs.flowChart.propsAPI.save()); + const { nodes, edges } = this.$refs.flowChart.propsAPI.save(); + this.existNodes = nodes || []; + this.existEdges = edges || []; }, + onAfterItemSelected({item}) { + if (item.target) { + const currentEdge = this.existEdges.filter(itm => itm.id === item.id)[0] || {} + console.log(currentEdge, 'currentEdgecurrentEdge'); + if (!Array.isArray(currentEdge.events)) { + currentEdge.events = [] + } + this.currentSelectedLine = currentEdge + } + }, + _downloadImage(data, filename = "flowchart.png") { const a = document.createElement("a"); a.href = data; @@ -136,6 +160,9 @@ getFlowData() { return this.$refs.flowChart.propsAPI.save(); }, + getEdgesEvents() { + return this.$refs.EditorDetailPanel.edgeEventList; + } }, }; </script> -- Gitblit v1.9.3