fix:dag优化

This commit is contained in:
shijing 2025-04-03 09:26:53 +08:00
parent 125e82d310
commit 315494d99e
1 changed files with 8 additions and 7 deletions

View File

@ -58,7 +58,7 @@ export default {
let that = this; let that = this;
that.$nextTick(() => { that.$nextTick(() => {
if(that.g!==null){ if(that.g!==null){
that.updataGraph(); that.updateGraph();
}else{ }else{
that.g = new dagreD3.graphlib.Graph().setGraph({ that.g = new dagreD3.graphlib.Graph().setGraph({
rankdir: that.rankdir, rankdir: that.rankdir,
@ -104,7 +104,6 @@ export default {
let mySvgWdith =document.getElementsByClassName("output")[0].getBoundingClientRect().width+150 ; let mySvgWdith =document.getElementsByClassName("output")[0].getBoundingClientRect().width+150 ;
document.getElementById('mySvg').setAttribute("height", mySvgHeight); document.getElementById('mySvg').setAttribute("height", mySvgHeight);
document.getElementById('mySvg').setAttribute("width", mySvgWdith); document.getElementById('mySvg').setAttribute("width", mySvgWdith);
svg.selectAll("g.node").on("click", function(event, d) { svg.selectAll("g.node").on("click", function(event, d) {
// //
const node = d3.select(this); const node = d3.select(this);
@ -125,15 +124,17 @@ export default {
}); });
// //
function onNodeClick(nodeData) { function onNodeClick(nodeData) {
console.log("Node clicked:", nodeData); let batch = "";
this.$emit("nodeClick", nodeData); that.nodes.forEach((item) => {
if (item.id === nodeData){
batch = item.label;
}
})
that.$emit("nodeClick", batch);
// //
} }
} }
}) })
},
updataGraph(){
}, },
// //
updateGraph() { updateGraph() {