fix:修复删除节点对应连线没有删除的bug,以及移动后切换project 没有回到中心点的问题
This commit is contained in:
@@ -223,6 +223,7 @@
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
let model=Object.assign({id:undefined},{...this.form},{color: {color:this.form.color,highlight:this.form.color,hover:this.form.color,opacity:1.0}});
|
||||
model.label=this.form.lineName;
|
||||
model.width = parseInt(model.width) || 4;
|
||||
model.smooth={
|
||||
roundness:(Math.random()*8 +1)/10 ,//获取0.1-0.9之间的随机数
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
<popDataMain :moduleId="this.selNodeId" :projectId="this.allModuleInfo.basic.id"></popDataMain>
|
||||
</div>
|
||||
<div v-if="popDataShow.total">
|
||||
<total-chart :moduleId="this.selNodeId" :projectId="this.allModuleInfo.basic.id" :nodesArray="nodesArray"></total-chart>
|
||||
<total-chart :moduleId="this.totalId" :projectId="this.allModuleInfo.basic.id" :nodesArray="totalArray"></total-chart>
|
||||
</div>
|
||||
<div v-if="popDataShow.info">
|
||||
<popDataInfo :moduleId="this.selNodeId" :projectId="this.allModuleInfo.basic.id"></popDataInfo>
|
||||
@@ -195,6 +195,8 @@
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
totalId:'',
|
||||
totalArray:[],
|
||||
allModuleInfos:[],
|
||||
relativeModelTop:{},
|
||||
moduleDataS:[],
|
||||
@@ -263,7 +265,7 @@
|
||||
saveTopology(){
|
||||
let nodes=this.formatNodes([...this.nodesArray]);
|
||||
let edges=this.formatEdges([...this.edgesArray]);
|
||||
this.$put('/project/topo',{topo:JSON.stringify({nodes:nodes,lines:edges}),projectId:this.allModuleInfo.basic.id}).then(res=>{
|
||||
this.$put('/project/topo',{topo:JSON.stringify({nodes:nodes,lines:edges,viewsCenter:this.viewsCenter,zoom:this.zoom}),projectId:this.allModuleInfo.basic.id}).then(res=>{
|
||||
if(res.code==200){
|
||||
this.$message({
|
||||
message: this.$t("tip.saveSuccess"),
|
||||
@@ -505,7 +507,9 @@
|
||||
//工具栏
|
||||
nodeDel(){
|
||||
let nodesArray=this.nodesArray.filter((item)=>item.id!==this.selNodeId);
|
||||
let edgesArray=this.edgesArray.filter((item)=>item.from!==this.selNodeId || this.to!==this.selNodeId);
|
||||
let edgesArray=this.edgesArray.filter((item)=>!(item.from===this.selNodeId || item.to===this.selNodeId));
|
||||
console.log(edgesArray,"edgesArray");
|
||||
this.selNodeId='';
|
||||
this.$emit('setTopologyData',nodesArray, edgesArray);
|
||||
this.setNetworkData(nodesArray, edgesArray);
|
||||
this.networkPopClose();
|
||||
@@ -524,6 +528,7 @@
|
||||
|
||||
// 工具的点击 对应的操作
|
||||
popClick(id){
|
||||
this.lineData='';
|
||||
this.popDataShowUpdate(id);
|
||||
},
|
||||
modelTopUpdate(){//model上的图标 实时更新
|
||||
@@ -590,6 +595,14 @@
|
||||
main:false,
|
||||
};
|
||||
if(key&&!this.editVisNetwork){
|
||||
if(key==='total'&&this.selNodeId){
|
||||
this.totalId=this.selNodeId
|
||||
this.totalArray=this.nodesArray;
|
||||
}
|
||||
if(key==='total'&&this.lineData){
|
||||
this.totalId=this.lineData.id;
|
||||
this.totalArray=this.edgesArray;
|
||||
}
|
||||
this.popDataShow[key]=true;
|
||||
}
|
||||
},
|
||||
@@ -624,7 +637,14 @@
|
||||
});
|
||||
|
||||
this.network.on("selectEdge", function (params) { // 选择边
|
||||
this_.selNodeId='';
|
||||
this_.lineData=this_.edgesArray.find((item)=>item.id===params.edges[0]);
|
||||
console.log(this_.lineData);
|
||||
if(this_.lineData.expressions&&this_.lineData.expressions.length){
|
||||
this_.popDataShowUpdate('total')
|
||||
}else{
|
||||
this_.popDataShowUpdate()
|
||||
}
|
||||
// this_.lineData.color=this_.lineData.color.color;
|
||||
// this_.addLineShow=true;
|
||||
// this_.isLineAdd=false;
|
||||
|
||||
@@ -210,7 +210,9 @@
|
||||
this.$refs['topology'].setData();
|
||||
},500)
|
||||
}
|
||||
// res.data.topo.viewsCenter?res.data.topo.viewsCenter:
|
||||
this.$refs['topology'].viewsCenter={x:0,y:0};
|
||||
// res.data.topo.zoom?res.data.topo.zoom:
|
||||
this.$refs['topology'].zoom=1;
|
||||
})
|
||||
},
|
||||
@@ -246,6 +248,7 @@
|
||||
item.dashes=[15,15];
|
||||
item.from=item.source;
|
||||
item.to=item.target;
|
||||
item.label=item.name;
|
||||
});
|
||||
return arr
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user