feat:调用保存接口的按钮
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="mc" @click.self="clickOutside">
|
<!--<div class="mc" @click.self="clickOutside">-->
|
||||||
<div class="right-box right-box-project-alert">
|
<div class="right-box right-box-project-alert" v-clickoutside="clickOutside">
|
||||||
<!-- begin--顶部按钮-->
|
<!-- begin--顶部按钮-->
|
||||||
<div class="right-box-top-btns">
|
<div class="right-box-top-btns">
|
||||||
<!--<button id="edit-ep-del" type="button" @click="del" class="nz-btn nz-btn-size-normal nz-btn-size-alien nz-btn-style-light ">-->
|
<!--<button id="edit-ep-del" type="button" @click="del" class="nz-btn nz-btn-size-normal nz-btn-size-alien nz-btn-style-light ">-->
|
||||||
@@ -147,7 +147,7 @@
|
|||||||
<Pagination :pageObj="pageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination"></Pagination>
|
<Pagination :pageObj="pageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination"></Pagination>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<!--</div>-->
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -133,11 +133,9 @@
|
|||||||
this.projectInfo.loading=true;
|
this.projectInfo.loading=true;
|
||||||
this.$get('project/info', {id:n.id}).then(response => {
|
this.$get('project/info', {id:n.id}).then(response => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
|
this.projectInfo.loading=false;
|
||||||
this.projectInfo={...this.projectInfo,...response.data.basic,moduleMum:response.data.module.length};
|
this.projectInfo={...this.projectInfo,...response.data.basic,moduleMum:response.data.module.length};
|
||||||
this.allModuleInfo=response.data;
|
this.allModuleInfo=response.data;
|
||||||
this.$nextTick(()=>{
|
|
||||||
this.projectInfo.loading=false;
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -256,11 +256,44 @@
|
|||||||
},
|
},
|
||||||
methods:{// 保存拓扑图数据
|
methods:{// 保存拓扑图数据
|
||||||
saveTopology(){
|
saveTopology(){
|
||||||
let nodes=[...this.nodesArray];
|
let nodes=this.formatNodes([...this.nodesArray]);
|
||||||
let edges=[...this.edgesArray];
|
let edges=this.formatEdges([...this.edgesArray]);
|
||||||
console.log(nodes,edges);
|
console.log(nodes,edges,this.nodesArray,this.edgesArray);
|
||||||
|
this.$put('/project/topo',{topo:JSON.stringify({nodes,edges}),projectId:this.allModuleInfo.basic.id});
|
||||||
this.$emit('editVisNetworkChange',false);
|
this.$emit('editVisNetworkChange',false);
|
||||||
},
|
},
|
||||||
|
formatNodes(arr){
|
||||||
|
let arr1=[];
|
||||||
|
arr.forEach(item=>{
|
||||||
|
let obj={
|
||||||
|
"x": item.x,
|
||||||
|
"y": item.y,
|
||||||
|
"moduleId": item.moduleId,
|
||||||
|
"label":item.label,
|
||||||
|
"iconId": item.iconId,
|
||||||
|
"expressions": item.expressions
|
||||||
|
};
|
||||||
|
arr1.push(obj)
|
||||||
|
});
|
||||||
|
return arr1
|
||||||
|
},
|
||||||
|
formatEdges(arr){
|
||||||
|
let arr1=[];
|
||||||
|
arr.forEach(item=>{
|
||||||
|
let obj={
|
||||||
|
"name": item.lineName,
|
||||||
|
"width": item.width,
|
||||||
|
"arrows": item.arrows,
|
||||||
|
"color": item.color,
|
||||||
|
"source": item.from,
|
||||||
|
"target": item.to,
|
||||||
|
"smooth": item.smooth,
|
||||||
|
"expressions": item.expressions,
|
||||||
|
};
|
||||||
|
arr1.push(obj)
|
||||||
|
});
|
||||||
|
return arr1
|
||||||
|
},
|
||||||
//拓扑图方法
|
//拓扑图方法
|
||||||
init(){
|
init(){
|
||||||
let this_ = this;
|
let this_ = this;
|
||||||
|
|||||||
@@ -139,27 +139,26 @@
|
|||||||
alertData:{}
|
alertData:{}
|
||||||
},
|
},
|
||||||
watch:{
|
watch:{
|
||||||
allModuleInfo:{
|
// allModuleInfo:{
|
||||||
immediate: true,
|
// immediate: true,
|
||||||
deep: true,
|
// deep: true,
|
||||||
handler(n){
|
// handler(n){
|
||||||
this.getNetworkData(n);
|
// this.getNetworkData(n);
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
projectInfo:{
|
projectInfo:{
|
||||||
immediate: true,
|
immediate: true,
|
||||||
deep: true,
|
|
||||||
handler(n){
|
|
||||||
this.getNetworkData(n);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
alertData:{
|
|
||||||
immediate: true,
|
|
||||||
deep: true,
|
|
||||||
handler(n){
|
handler(n){
|
||||||
this.getNetworkData(n);
|
this.getNetworkData(n);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
// alertData:{
|
||||||
|
// immediate: true,
|
||||||
|
// deep: true,
|
||||||
|
// handler(n){
|
||||||
|
// this.getNetworkData(n);
|
||||||
|
// },
|
||||||
|
// },
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
@@ -184,13 +183,16 @@
|
|||||||
},
|
},
|
||||||
getNetworkData(n){
|
getNetworkData(n){
|
||||||
this.topologyLoading=true;
|
this.topologyLoading=true;
|
||||||
// this.$get('/project/topo',{projectId:n.id}).then(res=>{
|
console.log(n);
|
||||||
// console.log(res);
|
this.$get('/project/topo',{projectId:n.id}).then(res=>{
|
||||||
|
console.log(res);
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
this.topologyLoading=false;
|
this.topologyLoading=false;
|
||||||
|
this.nodesArray=[];
|
||||||
|
this.edgesArray=[];
|
||||||
this.$refs['topology'].setNetworkData( this.edgesArray,this.nodesArray);
|
this.$refs['topology'].setNetworkData( this.edgesArray,this.nodesArray);
|
||||||
},500)
|
},500)
|
||||||
// })
|
})
|
||||||
},
|
},
|
||||||
editVisNetworkChange(flag){
|
editVisNetworkChange(flag){
|
||||||
this.editVisNetwork=flag;
|
this.editVisNetwork=flag;
|
||||||
|
|||||||
Reference in New Issue
Block a user