| | |
| | | </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> |
| | |
| | | </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> |
| | |
| | | }, |
| | | tooltipShow: true, |
| | | tooltipData: [], |
| | | existNodes: this.chartData.nodes || [] |
| | | existNodes: this.chartData.nodes || [], |
| | | existEdges: this.chartData.edges || [], |
| | | currentSelectedLine: {} |
| | | }; |
| | | }, |
| | | |
| | |
| | | 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; |
| | |
| | | getFlowData() { |
| | | return this.$refs.flowChart.propsAPI.save(); |
| | | }, |
| | | getEdgesEvents() { |
| | | return this.$refs.EditorDetailPanel.edgeEventList; |
| | | } |
| | | }, |
| | | }; |
| | | </script> |