feat:topolpgy 细节优化 绑定箭头参数 动画默认颜色以及预览和查看一致
This commit is contained in:
@@ -714,19 +714,19 @@
|
|||||||
<div class="props-pen-item" v-if="selection.pen.type">
|
<div class="props-pen-item" v-if="selection.pen.type">
|
||||||
<div>{{$t('project.topology.arrowColor')}}</div>
|
<div>{{$t('project.topology.arrowColor')}}</div>
|
||||||
<div class="p10 pl0">
|
<div class="p10 pl0">
|
||||||
<div class="color-show" @click="colorPickerClick('arrowColor')">
|
<div class="color-show" @click="colorPickerClick('toArrowColor')">
|
||||||
<div class="color-show-left" :style="{background:selection.pen.arrowColor}"></div>
|
<div class="color-show-left" :style="{background:selection.pen.toArrowColor}"></div>
|
||||||
<span class="color-text"> {{selection.pen.arrowColor}}</span>
|
<span class="color-text"> {{selection.pen.toArrowColor}}</span>
|
||||||
<span class="color-arrows">
|
<span class="color-arrows">
|
||||||
<i class="nz-icon nz-icon-arrow-down" v-if="$refs['arrowColor']&&!$refs['arrowColor'].showPicker"></i>
|
<i class="nz-icon nz-icon-arrow-down" v-if="$refs['toArrowColor']&&!$refs['toArrowColor'].showPicker"></i>
|
||||||
<i class="nz-icon nz-icon-arrow-up" v-if="$refs['arrowColor']&&$refs['arrowColor'].showPicker"></i>
|
<i class="nz-icon nz-icon-arrow-up" v-if="$refs['toArrowColor']&&$refs['toArrowColor'].showPicker"></i>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="color-content" ref="color-content">
|
<div class="color-content" ref="color-content">
|
||||||
<el-color-picker
|
<el-color-picker
|
||||||
v-model="selection.pen.arrowColor"
|
v-model="selection.pen.toArrowColor"
|
||||||
ref="arrowColor"
|
ref="toArrowColor"
|
||||||
@active-change="(val)=>colorChange(val,'arrowColor')"
|
@active-change="(val)=>colorChange(val,'toArrowColor')"
|
||||||
>
|
>
|
||||||
</el-color-picker>
|
</el-color-picker>
|
||||||
</div>
|
</div>
|
||||||
@@ -740,7 +740,7 @@
|
|||||||
<div class="project-content-title">{{$t('project.topology.animation')}}
|
<div class="project-content-title">{{$t('project.topology.animation')}}
|
||||||
<span class="float-right" style="margin-right: 10px">
|
<span class="float-right" style="margin-right: 10px">
|
||||||
<el-switch
|
<el-switch
|
||||||
v-model="selection.pen.animatePlay"
|
v-model="selection.pen.data.animatePlay"
|
||||||
:active-value="true"
|
:active-value="true"
|
||||||
:inactive-value="false"
|
:inactive-value="false"
|
||||||
active-color="#ee9d3f"
|
active-color="#ee9d3f"
|
||||||
@@ -897,6 +897,7 @@
|
|||||||
controls-position="right"
|
controls-position="right"
|
||||||
size="small"
|
size="small"
|
||||||
name="x"
|
name="x"
|
||||||
|
:min="0"
|
||||||
class="input"
|
class="input"
|
||||||
v-model.number="topologyData.data.gridSize"
|
v-model.number="topologyData.data.gridSize"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
@@ -1354,7 +1355,6 @@
|
|||||||
selection:{
|
selection:{
|
||||||
handler(n){
|
handler(n){
|
||||||
if(n){
|
if(n){
|
||||||
this.drowdown=0;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
deep:true,
|
deep:true,
|
||||||
@@ -1543,7 +1543,7 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
colorChange(val,name){//改变颜色
|
colorChange(val,name){//改变颜色
|
||||||
if(name==='arrowColor'){
|
if(name==='toArrowColor'){
|
||||||
this.selection.pen.fromArrowColor=this.colorRGBtoHex(val);
|
this.selection.pen.fromArrowColor=this.colorRGBtoHex(val);
|
||||||
this.selection.pen.toArrowColor=this.colorRGBtoHex(val);
|
this.selection.pen.toArrowColor=this.colorRGBtoHex(val);
|
||||||
this.selection.pen.data['fromArrowColor']=this.colorRGBtoHex(val);
|
this.selection.pen.data['fromArrowColor']=this.colorRGBtoHex(val);
|
||||||
@@ -1623,10 +1623,10 @@
|
|||||||
this.onChange();
|
this.onChange();
|
||||||
},
|
},
|
||||||
onAnimate(val){
|
onAnimate(val){
|
||||||
this.selection.pen.animateStart=this.selection.pen.animateStart?Date.now():0;
|
// this.selection.pen.animateStart=this.selection.pen.animateStart?Date.now():0;
|
||||||
this.selection.pen.data.animatePlay=this.selection.pen.animatePlay;
|
// this.selection.pen.data.animatePlay=this.selection.pen.animatePlay;
|
||||||
this.onChange();
|
this.onChange();
|
||||||
this.$emit('animate');
|
// this.$emit('animate');
|
||||||
},
|
},
|
||||||
delTopologyPen(){
|
delTopologyPen(){
|
||||||
let delObj=this.selection.pen?this.selection.pen.id:this.selection.pens
|
let delObj=this.selection.pen?this.selection.pen.id:this.selection.pens
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<div class="project-box" v-loading="topologyLoading" :style="{'border':fromOverView?'none':'1px solid #eeeeee'}">
|
<div class="project-box" v-loading="topologyLoading" :style="{'border':fromOverView?'none':'1px solid #eeeeee'}">
|
||||||
<!--project主要信息-->
|
<!--project主要信息-->
|
||||||
<div class="facade-top" v-if="!editTopologyFlag&&!fromOverView">
|
<div class="facade-top" v-if="!editTopologyFlag&&!fromOverView">
|
||||||
<div class="facade-top-left" v-loading="projectInfo.loading" v-if="projectInfoShow&&!fromPrev">
|
<div class="facade-top-left" v-loading="projectInfo.loading" v-if="projectInfoShow">
|
||||||
<div class="facade-top-title">
|
<div class="facade-top-title">
|
||||||
Project information
|
Project information
|
||||||
</div>
|
</div>
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
<span><span class="label">Module Num :</span>{{projectInfo.moduleMum}}</span>
|
<span><span class="label">Module Num :</span>{{projectInfo.moduleMum}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="facade-top-right" v-loading="projectInfo.loading" v-if="projectAlertShow&&!fromPrev" style="padding: 20px 20px 0 20px;height: calc(100% - 20px);">
|
<div class="facade-top-right" v-loading="projectInfo.loading" v-if="projectAlertShow" style="padding: 20px 20px 0 20px;height: calc(100% - 20px);">
|
||||||
<div class="facade-top-title">
|
<div class="facade-top-title">
|
||||||
<span class="label" style="padding-left: 0;">Alert :</span>
|
<span class="label" style="padding-left: 0;">Alert :</span>
|
||||||
{{projectInfo.total}}
|
{{projectInfo.total}}
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="project-title" v-if="showTopTools&&!fromOverView" :style="{'background':editTopologyFlag?'#F6F6F6':'#ffffff','border-bottom':editTopologyFlag? '1px solid #F6F6F6':'' }">
|
<div class="project-title" v-if="showTopTools&&!fromOverView&&!fromPrev" :style="{'background':editTopologyFlag?'#F6F6F6':'#ffffff','border-bottom':editTopologyFlag? '1px solid #F6F6F6':'' }">
|
||||||
<div v-show="editTopologyFlag" class="edit-topologyLine" style="padding-left: 20px">
|
<div v-show="editTopologyFlag" class="edit-topologyLine" style="padding-left: 20px">
|
||||||
<!--工具栏-->
|
<!--工具栏-->
|
||||||
<span class="project-topology-tool">
|
<span class="project-topology-tool">
|
||||||
@@ -207,13 +207,13 @@
|
|||||||
>
|
>
|
||||||
|
|
||||||
<i
|
<i
|
||||||
:class="{'nz-icon':true, 'nz-icon-shuidi':true,'model-error':item.data.state.error&&!item.data.show,'model-error-active':item.data.state.error&&item.data.show}"
|
:class="{'nz-icon':true, 'nz-icon-shuidi':true,'model-error':item.data.state&&item.data.state.error&&!item.data.show,'model-error-active':item.data.state&&item.data.state.error&&item.data.show}"
|
||||||
:ref="'modelTopId'+index"
|
:ref="'modelTopId'+index"
|
||||||
@click="showNodeTools(index,item)"
|
@click="showNodeTools(index,item)"
|
||||||
>
|
>
|
||||||
<i class="nz-icon nz-icon-model"></i>
|
<i class="nz-icon nz-icon-model"></i>
|
||||||
</i>
|
</i>
|
||||||
<!--'selpop':selpopIs(item),'no-selPop':!selpopIs(item),'error-model-stat':modelPopError(item) @click="popClick(item.id)"-->
|
<!--'selpop':selpopIs(item),'no-selPop':!selpopIs(item),'error-model-stat':modelPopError(item) @click="popClick(item.id)" -->
|
||||||
<div v-for="item1 in popData">
|
<div v-for="item1 in popData">
|
||||||
<transition name="scaleTool">
|
<transition name="scaleTool">
|
||||||
<i v-if="item.data.show"
|
<i v-if="item.data.show"
|
||||||
@@ -287,7 +287,7 @@
|
|||||||
v-if="previewShow"
|
v-if="previewShow"
|
||||||
:obj="obj"
|
:obj="obj"
|
||||||
:topoPrevDataS="topoPrevData"
|
:topoPrevDataS="topoPrevData"
|
||||||
:fromOverView="true"
|
:fromOverView="false"
|
||||||
:fromPrev="true"
|
:fromPrev="true"
|
||||||
:topologyIndexF="1">
|
:topologyIndexF="1">
|
||||||
</topologyPrev>
|
</topologyPrev>
|
||||||
@@ -297,7 +297,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {Topology,Node,Line,registerNode} from '@topology/core';
|
import {Topology,Node,Line,Rect,registerNode} from '@topology/core';
|
||||||
import * as FileSaver from 'file-saver';
|
import * as FileSaver from 'file-saver';
|
||||||
import {
|
import {
|
||||||
Tools,
|
Tools,
|
||||||
@@ -346,6 +346,7 @@
|
|||||||
name:'topologyL5',
|
name:'topologyL5',
|
||||||
data(){
|
data(){
|
||||||
return {
|
return {
|
||||||
|
objChange:false,//project 变化 用于判断 init是否执行完成 执行完成 才可以执行下次变化
|
||||||
chartDataInfo:{},
|
chartDataInfo:{},
|
||||||
topoPrevData:{},//预览数据
|
topoPrevData:{},//预览数据
|
||||||
imgInit:false,//判断图片是否加载完成
|
imgInit:false,//判断图片是否加载完成
|
||||||
@@ -402,7 +403,7 @@
|
|||||||
title:this.$t('project.topology.endpoint')
|
title:this.$t('project.topology.endpoint')
|
||||||
},
|
},
|
||||||
{top:'-40px',left:'19px',className:'nz-icon-asset',id:'asset',title:this.$t('project.topology.asset')},
|
{top:'-40px',left:'19px',className:'nz-icon-asset',id:'asset',title:this.$t('project.topology.asset')},
|
||||||
{top:'-4px',left:'40px',className:'nz-icon-chart',id:'total',title:this.$t('project.topology.total')},
|
{top:'-4px',left:'40px',className:'',id:'other',title:''},
|
||||||
{top:'30px',left:'19px',className:'',id:'other',title:''},
|
{top:'30px',left:'19px',className:'',id:'other',title:''},
|
||||||
{top:'30px',left:'-21px',className:'nz-icon-info-normal',id:'info',title:this.$t('project.topology.info')},
|
{top:'30px',left:'-21px',className:'nz-icon-info-normal',id:'info',title:this.$t('project.topology.info')},
|
||||||
{top:'-4px',left:'-40px',className:'nz-icon-gaojing',id:'alert',title:this.$t('project.topology.alert')},
|
{top:'-4px',left:'-40px',className:'nz-icon-gaojing',id:'alert',title:this.$t('project.topology.alert')},
|
||||||
@@ -496,7 +497,8 @@
|
|||||||
deep:true,
|
deep:true,
|
||||||
immediate:true,
|
immediate:true,
|
||||||
handler(n){
|
handler(n){
|
||||||
if(n){
|
if(n.id){
|
||||||
|
if( !this.objChange){
|
||||||
this.editTopologyFlag=false;
|
this.editTopologyFlag=false;
|
||||||
this.topologyLoading=true;
|
this.topologyLoading=true;
|
||||||
this.projectInfoShow=false;
|
this.projectInfoShow=false;
|
||||||
@@ -504,21 +506,48 @@
|
|||||||
if(n.id){
|
if(n.id){
|
||||||
this.getProjectData(n);
|
this.getProjectData(n);
|
||||||
}
|
}
|
||||||
if(!this.timer){
|
|
||||||
this.timer=setTimeout(()=>{
|
|
||||||
this.topologyLoading=true;
|
this.topologyLoading=true;
|
||||||
this.init();
|
this.init();
|
||||||
this.timer=null
|
this.timer=null
|
||||||
},300)
|
this.objChange=true;
|
||||||
|
}else{
|
||||||
|
if(!this.timer){
|
||||||
|
this.timer=setInterval(()=>{
|
||||||
|
if(this.objChange){return}
|
||||||
|
this.editTopologyFlag=false;
|
||||||
|
this.topologyLoading=true;
|
||||||
|
this.projectInfoShow=false;
|
||||||
|
this.projectAlertShow=false;
|
||||||
|
if(n.id){
|
||||||
|
this.getProjectData(n);
|
||||||
|
}
|
||||||
|
clearTimeout(this.timer);
|
||||||
|
this.timer=null;
|
||||||
|
this.objChange=true;
|
||||||
|
this.topologyLoading=true;
|
||||||
|
this.init();
|
||||||
|
},100)
|
||||||
}else{
|
}else{
|
||||||
clearTimeout(this.timer);
|
clearTimeout(this.timer);
|
||||||
this.timer=setTimeout(()=>{
|
this.timer=setInterval(()=>{
|
||||||
|
if(this.objChange){return}
|
||||||
|
this.editTopologyFlag=false;
|
||||||
|
this.topologyLoading=true;
|
||||||
|
this.projectInfoShow=false;
|
||||||
|
this.projectAlertShow=false;
|
||||||
|
if(n.id){
|
||||||
|
this.getProjectData(n);
|
||||||
|
}
|
||||||
|
clearTimeout(this.timer);
|
||||||
|
this.timer=null;
|
||||||
|
this.objChange=true;
|
||||||
this.topologyLoading=true;
|
this.topologyLoading=true;
|
||||||
this.init();
|
this.init();
|
||||||
this.timer=null
|
},100)
|
||||||
},300)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -583,6 +612,7 @@
|
|||||||
Promise.all(promiseArr).then((res)=>{
|
Promise.all(promiseArr).then((res)=>{
|
||||||
getTopology(this.topologyIndex).open(data);
|
getTopology(this.topologyIndex).open(data);
|
||||||
getTopology(this.topologyIndex).lock(1);
|
getTopology(this.topologyIndex).lock(1);
|
||||||
|
this.objChange=false;
|
||||||
if(this.fromOverView){
|
if(this.fromOverView){
|
||||||
let flag=false;
|
let flag=false;
|
||||||
|
|
||||||
@@ -601,6 +631,18 @@
|
|||||||
flag=true
|
flag=true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
getTopology(this.topologyIndex).centerView(50);
|
||||||
|
setTimeout(()=>{
|
||||||
|
getTopology(this.topologyIndex).data.pens.forEach(item=>{
|
||||||
|
console.log(item.animatePlay,123123123123123123123)
|
||||||
|
if(item.animatePlay){
|
||||||
|
item.stopAnimate();
|
||||||
|
setTimeout(()=>{
|
||||||
|
item.startAnimate()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},100);
|
||||||
|
})
|
||||||
// if(this.fromPrev){
|
// if(this.fromPrev){
|
||||||
// getTopology(this.topologyIndex).scaleTo(data.scale/2)
|
// getTopology(this.topologyIndex).scaleTo(data.scale/2)
|
||||||
// }
|
// }
|
||||||
@@ -646,7 +688,6 @@
|
|||||||
query+='&nullType='+'connected';
|
query+='&nullType='+'connected';
|
||||||
return this.$get('/prom/api/v1/query_range?query='+query+"&start="+this.$stringTimeParseToUnix(startTime)+"&end="+this.$stringTimeParseToUnix(endTime)+'&step='+step);
|
return this.$get('/prom/api/v1/query_range?query='+query+"&start="+this.$stringTimeParseToUnix(startTime)+"&end="+this.$stringTimeParseToUnix(endTime)+'&step='+step);
|
||||||
});
|
});
|
||||||
console.log(arr);
|
|
||||||
axiosArr.push({item,arr});
|
axiosArr.push({item,arr});
|
||||||
promiseArr.push(pensPromise(item,arr,index))
|
promiseArr.push(pensPromise(item,arr,index))
|
||||||
});
|
});
|
||||||
@@ -671,6 +712,17 @@
|
|||||||
flag=true
|
flag=true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
setTimeout(()=>{
|
||||||
|
getTopology(this.topologyIndex).data.pens.forEach(item=>{
|
||||||
|
console.log(item.animatePlay,123123123123123123123)
|
||||||
|
if(item.animatePlay){
|
||||||
|
item.stopAnimate();
|
||||||
|
setTimeout(()=>{
|
||||||
|
item.startAnimate()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},100);
|
||||||
|
})
|
||||||
// if(this.fromPrev){
|
// if(this.fromPrev){
|
||||||
// getTopology(this.topologyIndex).scaleTo(data.scale/2)
|
// getTopology(this.topologyIndex).scaleTo(data.scale/2)
|
||||||
// }
|
// }
|
||||||
@@ -705,7 +757,9 @@
|
|||||||
}
|
}
|
||||||
this.$get('/project/topo',{projectId:this.obj.id}).then(res=>{
|
this.$get('/project/topo',{projectId:this.obj.id}).then(res=>{
|
||||||
let data=res.data.topo;
|
let data=res.data.topo;
|
||||||
|
console.log(data,'topo')
|
||||||
if(!res.data.topo || !data.pens){
|
if(!res.data.topo || !data.pens){
|
||||||
|
console.log(123123123123);
|
||||||
data={
|
data={
|
||||||
bkColor:'#FFFFFF',
|
bkColor:'#FFFFFF',
|
||||||
gridSize:10,
|
gridSize:10,
|
||||||
@@ -723,29 +777,19 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
clearInterval(timer);
|
clearInterval(timer);
|
||||||
|
let promiseArr=[];
|
||||||
|
let self=this;
|
||||||
data.pens.forEach((item=>{
|
data.pens.forEach((item=>{
|
||||||
if(item.type===0&&item.data.imageId){
|
if(item.type===0&&item.data.imageId){
|
||||||
item.image=this.iconArray.find(item1=>item1.id==item.data.imageId).image
|
item.image=this.iconArray.find(item1=>item1.id==item.data.imageId).image
|
||||||
}
|
}
|
||||||
if(item.type===0){
|
if(item.type===0){
|
||||||
this.$get('/module/stat',{id:item.data.moduleId}).then(res=>{
|
promiseArr.push(this.$get('/module/stat',{id:item.data.moduleId}));
|
||||||
item.data.state=res.data;
|
}else{
|
||||||
item.data.state.asset=false;
|
promiseArr.push({type:1})
|
||||||
item.data.state.endpoint=false;
|
|
||||||
item.data.state.alert=false;
|
|
||||||
if(item.data.state.assetStat.down>0){
|
|
||||||
item.data.state.asset=true;
|
|
||||||
}
|
|
||||||
if( item.data.state.endpointStat.down>0){
|
|
||||||
item.data.state.endpoint=true;
|
|
||||||
}
|
|
||||||
if(item.data.state.alertStat.P1> 0 || item.data.state.alertStat.P3>0 || item.data.state.alertStat.P2>0){
|
|
||||||
item.data.state.alert=true;
|
|
||||||
}
|
|
||||||
item.data.state.error= item.data.state.asset && item.data.state.endpoint && item.data.state.alert;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if(!data.data){
|
if(!data.data){
|
||||||
this.projectInfoShow=true;
|
this.projectInfoShow=true;
|
||||||
this.projectAlertShow=true;
|
this.projectAlertShow=true;
|
||||||
@@ -756,8 +800,32 @@
|
|||||||
this.projectInfoShow=data.data.projectInfo;
|
this.projectInfoShow=data.data.projectInfo;
|
||||||
this.projectAlertShow=data.data.alertInfo;
|
this.projectAlertShow=data.data.alertInfo;
|
||||||
}
|
}
|
||||||
this.saveData={...data};
|
|
||||||
|
Promise.all(promiseArr).then(res=>{
|
||||||
|
console.log(res);
|
||||||
|
res.forEach((response,index)=>{
|
||||||
|
let item=data.pens[index];
|
||||||
|
if(item.type===0){
|
||||||
|
item.data.state=response.data;
|
||||||
|
item.data.state.asset=false;
|
||||||
|
item.data.state.endpoint=false;
|
||||||
|
item.data.state.alert=false;
|
||||||
|
if(item.data.state.assetStat.down>0){
|
||||||
|
item.data.state.asset=true;
|
||||||
|
}
|
||||||
|
if(item.data.state.endpointStat.down>0){
|
||||||
|
item.data.state.endpoint=true;
|
||||||
|
}
|
||||||
|
if(item.data.state.alertStat.P1> 0 || item.data.state.alertStat.P3>0 || item.data.state.alertStat.P2>0){
|
||||||
|
item.data.state.alert=true;
|
||||||
|
}
|
||||||
|
item.data.state.error= item.data.state.asset || item.data.state.endpoint || item.data.state.alert;
|
||||||
|
console.log(item.data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
self.saveData={...data};
|
||||||
resolve(data);
|
resolve(data);
|
||||||
|
});
|
||||||
},100)
|
},100)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -916,6 +984,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
getNodesArr(){
|
getNodesArr(){
|
||||||
|
if(!getTopology(this.topologyIndex)) return;
|
||||||
this.nodesArr=getTopology(this.topologyIndex).data.pens.filter(item=>{
|
this.nodesArr=getTopology(this.topologyIndex).data.pens.filter(item=>{
|
||||||
if(!item.data){
|
if(!item.data){
|
||||||
item.data={
|
item.data={
|
||||||
@@ -976,7 +1045,7 @@
|
|||||||
//具体内容点击
|
//具体内容点击
|
||||||
nodeTools(node,tool){
|
nodeTools(node,tool){
|
||||||
this.moduleId=node.data.moduleId;
|
this.moduleId=node.data.moduleId;
|
||||||
if(tool.id==='total'&&!node.data.expressArr.length){
|
if(tool.id==='total'){
|
||||||
this.popDataShowUpdate('',false,node);
|
this.popDataShowUpdate('',false,node);
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -1045,6 +1114,9 @@
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
if(!Array.isArray(data)&&data){//判断不是数组 提前个data配置好节点属性
|
if(!Array.isArray(data)&&data){//判断不是数组 提前个data配置好节点属性
|
||||||
|
// if(data.type===0){
|
||||||
|
// data.textRect=new Rect(data.rect.ex-10,data.rect.ey-10,data.rect.width,data.rect.height);
|
||||||
|
// }
|
||||||
if(data.type===0&& !data.data.moduleId){
|
if(data.type===0&& !data.data.moduleId){
|
||||||
data.data={
|
data.data={
|
||||||
...data.data,
|
...data.data,
|
||||||
@@ -1052,7 +1124,7 @@
|
|||||||
moduleName:'',
|
moduleName:'',
|
||||||
show:false,
|
show:false,
|
||||||
error:false,
|
error:false,
|
||||||
animatePlay:data.animatePlay,
|
animatePlay:false,
|
||||||
fillStyle:data.fillStyle,
|
fillStyle:data.fillStyle,
|
||||||
strokeStyle:data.strokeStyle,
|
strokeStyle:data.strokeStyle,
|
||||||
lineWidth:this.nodeDefaultWidth(data.name),
|
lineWidth:this.nodeDefaultWidth(data.name),
|
||||||
@@ -1084,7 +1156,7 @@
|
|||||||
//连线是否自动计算锚点
|
//连线是否自动计算锚点
|
||||||
// data.manualCps=true;
|
// data.manualCps=true;
|
||||||
data.data={
|
data.data={
|
||||||
animatePlay:data.animatePlay,
|
animatePlay:false,
|
||||||
strokeStyle:data.strokeStyle,
|
strokeStyle:data.strokeStyle,
|
||||||
animateColor:data.animateColor,
|
animateColor:data.animateColor,
|
||||||
arrowColor:data.arrowColor,
|
arrowColor:data.arrowColor,
|
||||||
@@ -1114,7 +1186,9 @@
|
|||||||
title:'',
|
title:'',
|
||||||
moduleName:'',
|
moduleName:'',
|
||||||
url:'',
|
url:'',
|
||||||
}
|
};
|
||||||
|
data.animateColor='#FA901C'
|
||||||
|
console.log(data);
|
||||||
}
|
}
|
||||||
if(data.type===0||data.type===1){
|
if(data.type===0||data.type===1){
|
||||||
data.lineWidth=data.data.lineWidth;
|
data.lineWidth=data.data.lineWidth;
|
||||||
@@ -1251,7 +1325,9 @@
|
|||||||
let domRect=document.getElementById('topology-canvas'+this.topologyIndexF).getBoundingClientRect();
|
let domRect=document.getElementById('topology-canvas'+this.topologyIndexF).getBoundingClientRect();
|
||||||
this.toolShow.attrCord=[domRect.width-350,0];
|
this.toolShow.attrCord=[domRect.width-350,0];
|
||||||
this.toolShow.height=domRect.height;
|
this.toolShow.height=domRect.height;
|
||||||
|
if(getTopology(this.topologyIndex)){
|
||||||
getTopology(this.topologyIndex).canvasPos=domRect;
|
getTopology(this.topologyIndex).canvasPos=domRect;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'scale':
|
case 'scale':
|
||||||
if(this.$refs.topTool){
|
if(this.$refs.topTool){
|
||||||
@@ -1289,7 +1365,10 @@
|
|||||||
case 'translate':
|
case 'translate':
|
||||||
this.moduleId='';
|
this.moduleId='';
|
||||||
this.showNodeTools('');
|
this.showNodeTools('');
|
||||||
this.popDataShowUpdate('',false)
|
this.popDataShowUpdate('',false);
|
||||||
|
if(!this.editTopologyFlag){
|
||||||
|
getTopology(this.topologyIndex)
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch(event){
|
switch(event){
|
||||||
@@ -1501,7 +1580,7 @@
|
|||||||
if(item.type===0){
|
if(item.type===0){
|
||||||
item.fillStyle=item.data.fillStyle;
|
item.fillStyle=item.data.fillStyle;
|
||||||
item.strokeStyle=item.data.strokeStyle;
|
item.strokeStyle=item.data.strokeStyle;
|
||||||
item.animatePlay=item.data.animatePlay;
|
item.animatePlay=false;
|
||||||
item.font.color="#000000";
|
item.font.color="#000000";
|
||||||
}else if(item.type===1){
|
}else if(item.type===1){
|
||||||
item.animateColor=item.data.animateColor;
|
item.animateColor=item.data.animateColor;
|
||||||
@@ -1509,7 +1588,7 @@
|
|||||||
item.arrowColor=item.data.arrowColor;
|
item.arrowColor=item.data.arrowColor;
|
||||||
item.fromArrowColor=item.data.fromArrowColor;
|
item.fromArrowColor=item.data.fromArrowColor;
|
||||||
item.toArrowColor=item.data.toArrowColor;
|
item.toArrowColor=item.data.toArrowColor;
|
||||||
item.animatePlay=item.data.animatePlay;
|
item.animatePlay=false;
|
||||||
item.font.color="#000000";
|
item.font.color="#000000";
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -1553,6 +1632,7 @@
|
|||||||
if(flag){
|
if(flag){
|
||||||
this.editTopologyFlag=false;
|
this.editTopologyFlag=false;
|
||||||
topologyData.pens.forEach(item=>{
|
topologyData.pens.forEach(item=>{
|
||||||
|
item.animatePlay=item.data.animatePlay;
|
||||||
if(item.type===0&&JSON.stringify(item.data.imageId)){
|
if(item.type===0&&JSON.stringify(item.data.imageId)){
|
||||||
item.image="";
|
item.image="";
|
||||||
item.animateFrames=[];
|
item.animateFrames=[];
|
||||||
@@ -1616,7 +1696,11 @@
|
|||||||
},
|
},
|
||||||
//预览
|
//预览
|
||||||
previewTopology(){
|
previewTopology(){
|
||||||
this.topoPrevData=getTopology(this.topologyIndex).data;
|
let data=JSON.parse(JSON.stringify(getTopology(this.topologyIndex).data));
|
||||||
|
data.pens.forEach((item)=>{
|
||||||
|
item.animatePlay=item.data.animatePlay;
|
||||||
|
});
|
||||||
|
this.topoPrevData=data;
|
||||||
this.previewShow=true;
|
this.previewShow=true;
|
||||||
},
|
},
|
||||||
/*tools 方法*/
|
/*tools 方法*/
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
@import "./L5/css/props.css";
|
@import "./L5/css/props.css";
|
||||||
</style>
|
</style>
|
||||||
<template>
|
<template>
|
||||||
<div class="project-box" v-loading="topologyLoading">
|
<div class="project-box" v-loading="topologyLoading" :style="{'border':fromOverView?'none':'1px solid #eeeeee'}">
|
||||||
<!--project主要信息-->
|
<!--project主要信息-->
|
||||||
<div class="facade-top" v-if="!editTopologyFlag&&!fromOverView">
|
<div class="facade-top" v-if="!editTopologyFlag&&!fromOverView">
|
||||||
<div class="facade-top-left" v-loading="projectInfo.loading" v-if="projectInfoShow&&!fromPrev">
|
<div class="facade-top-left" v-loading="projectInfo.loading" v-if="projectInfoShow">
|
||||||
<div class="facade-top-title">
|
<div class="facade-top-title">
|
||||||
Project information
|
Project information
|
||||||
</div>
|
</div>
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
<span><span class="label">Module Num :</span>{{projectInfo.moduleMum}}</span>
|
<span><span class="label">Module Num :</span>{{projectInfo.moduleMum}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="facade-top-right" v-loading="projectInfo.loading" v-if="projectAlertShow&&!fromPrev" style="padding: 20px 20px 0 20px;height: calc(100% - 20px);">
|
<div class="facade-top-right" v-loading="projectInfo.loading" v-if="projectAlertShow" style="padding: 20px 20px 0 20px;height: calc(100% - 20px);">
|
||||||
<div class="facade-top-title">
|
<div class="facade-top-title">
|
||||||
<span class="label" style="padding-left: 0;">Alert :</span>
|
<span class="label" style="padding-left: 0;">Alert :</span>
|
||||||
{{projectInfo.total}}
|
{{projectInfo.total}}
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="project-title" v-if="showTopTools&&!fromOverView" :style="{'background':editTopologyFlag?'#F6F6F6':'#ffffff','border-bottom':editTopologyFlag? '1px solid #F6F6F6':'' }">
|
<div class="project-title" v-if="showTopTools&&!fromOverView&&!fromPrev" :style="{'background':editTopologyFlag?'#F6F6F6':'#ffffff','border-bottom':editTopologyFlag? '1px solid #F6F6F6':'' }">
|
||||||
<div v-show="editTopologyFlag" class="edit-topologyLine" style="padding-left: 20px">
|
<div v-show="editTopologyFlag" class="edit-topologyLine" style="padding-left: 20px">
|
||||||
<!--工具栏-->
|
<!--工具栏-->
|
||||||
<span class="project-topology-tool">
|
<span class="project-topology-tool">
|
||||||
@@ -116,7 +116,7 @@
|
|||||||
<div class="flex middle special-select mb10"
|
<div class="flex middle special-select mb10"
|
||||||
style="width: 75px;height: 28px;display: inline-block;margin: 0 40px 0 20px;background: #fff">
|
style="width: 75px;height: 28px;display: inline-block;margin: 0 40px 0 20px;background: #fff">
|
||||||
<div class="full pr10">
|
<div class="full pr10">
|
||||||
<el-select v-model="lineName" placeholder="请选择" size="small"
|
<el-select v-model="lineName" :placeholder="$t('el.select.placeholder')" size="small"
|
||||||
:popper-append-to-body="false"
|
:popper-append-to-body="false"
|
||||||
@change="changeTopologyOpt(lineName,'lineName')">
|
@change="changeTopologyOpt(lineName,'lineName')">
|
||||||
<div slot="prefix">
|
<div slot="prefix">
|
||||||
@@ -181,7 +181,7 @@
|
|||||||
<i class="nz-icon nz-icon-edit" :title="$t('project.topology.edit')"></i>
|
<i class="nz-icon nz-icon-edit" :title="$t('project.topology.edit')"></i>
|
||||||
</button>
|
</button>
|
||||||
<pick-time v-show="!editTopologyFlag" :showTimePicker="false" class="float-right pickTime"
|
<pick-time v-show="!editTopologyFlag" :showTimePicker="false" class="float-right pickTime"
|
||||||
:refresh-data-func="refreshTopology" v-model="searchTime" :use-chart-unit="false"
|
:refresh-data-func="reload" v-model="searchTime" :use-chart-unit="false"
|
||||||
ref="pickTime"></pick-time>
|
ref="pickTime"></pick-time>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -207,17 +207,17 @@
|
|||||||
>
|
>
|
||||||
|
|
||||||
<i
|
<i
|
||||||
:class="{'nz-icon':true, 'nz-icon-shuidi':true,'model-error':item.data.error&&!item.data.show,'model-error-active':item.data.error&&item.data.show}"
|
:class="{'nz-icon':true, 'nz-icon-shuidi':true,'model-error':item.data.state&&item.data.state.error&&!item.data.show,'model-error-active':item.data.state&&item.data.state.error&&item.data.show}"
|
||||||
:ref="'modelTopId'+index"
|
:ref="'modelTopId'+index"
|
||||||
@click="showNodeTools(index,item)"
|
@click="showNodeTools(index,item)"
|
||||||
>
|
>
|
||||||
<i class="nz-icon nz-icon-model"></i>
|
<i class="nz-icon nz-icon-model"></i>
|
||||||
</i>
|
</i>
|
||||||
<!--'selpop':selpopIs(item),'no-selPop':!selpopIs(item),'error-model-stat':modelPopError(item) @click="popClick(item.id)"-->
|
<!--'selpop':selpopIs(item),'no-selPop':!selpopIs(item),'error-model-stat':modelPopError(item) @click="popClick(item.id)" -->
|
||||||
<div v-for="item1 in popData">
|
<div v-for="item1 in popData">
|
||||||
<transition name="scaleTool">
|
<transition name="scaleTool">
|
||||||
<i v-if="item.data.show"
|
<i v-if="item.data.show"
|
||||||
:class="{'nz-icon':true,'nz-icon-hexagonBorder':true}"
|
:class="{'nz-icon':true,'nz-icon-hexagonBorder':true,'error-model-stat':item.data.state[item1.id],'selpop':selpopIs(item,item1),'no-selPop':!selpopIs(item,item1),}"
|
||||||
:style="{top:item1.top,left:item1.left}"
|
:style="{top:item1.top,left:item1.left}"
|
||||||
:title="item1.title"
|
:title="item1.title"
|
||||||
@click="nodeTools(item,item1)"
|
@click="nodeTools(item,item1)"
|
||||||
@@ -287,7 +287,7 @@
|
|||||||
v-if="previewShow"
|
v-if="previewShow"
|
||||||
:obj="obj"
|
:obj="obj"
|
||||||
:topoPrevDataS="topoPrevData"
|
:topoPrevDataS="topoPrevData"
|
||||||
:fromOverView="true"
|
:fromOverView="false"
|
||||||
:fromPrev="true"
|
:fromPrev="true"
|
||||||
:topologyIndexF="1">
|
:topologyIndexF="1">
|
||||||
</topologyPrev>
|
</topologyPrev>
|
||||||
@@ -297,7 +297,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {Topology,Node,Line,registerNode} from '@topology/core';
|
import {Topology,Node,Line,Rect,registerNode} from '@topology/core';
|
||||||
import * as FileSaver from 'file-saver';
|
import * as FileSaver from 'file-saver';
|
||||||
import {
|
import {
|
||||||
Tools,
|
Tools,
|
||||||
@@ -346,6 +346,7 @@
|
|||||||
name:'topologyL5',
|
name:'topologyL5',
|
||||||
data(){
|
data(){
|
||||||
return {
|
return {
|
||||||
|
objChange:false,//project 变化 用于判断 init是否执行完成 执行完成 才可以执行下次变化
|
||||||
chartDataInfo:{},
|
chartDataInfo:{},
|
||||||
topoPrevData:{},//预览数据
|
topoPrevData:{},//预览数据
|
||||||
imgInit:false,//判断图片是否加载完成
|
imgInit:false,//判断图片是否加载完成
|
||||||
@@ -402,7 +403,7 @@
|
|||||||
title:this.$t('project.topology.endpoint')
|
title:this.$t('project.topology.endpoint')
|
||||||
},
|
},
|
||||||
{top:'-40px',left:'19px',className:'nz-icon-asset',id:'asset',title:this.$t('project.topology.asset')},
|
{top:'-40px',left:'19px',className:'nz-icon-asset',id:'asset',title:this.$t('project.topology.asset')},
|
||||||
{top:'-4px',left:'40px',className:'nz-icon-chart',id:'total',title:this.$t('project.topology.total')},
|
{top:'-4px',left:'40px',className:'',id:'other',title:''},
|
||||||
{top:'30px',left:'19px',className:'',id:'other',title:''},
|
{top:'30px',left:'19px',className:'',id:'other',title:''},
|
||||||
{top:'30px',left:'-21px',className:'nz-icon-info-normal',id:'info',title:this.$t('project.topology.info')},
|
{top:'30px',left:'-21px',className:'nz-icon-info-normal',id:'info',title:this.$t('project.topology.info')},
|
||||||
{top:'-4px',left:'-40px',className:'nz-icon-gaojing',id:'alert',title:this.$t('project.topology.alert')},
|
{top:'-4px',left:'-40px',className:'nz-icon-gaojing',id:'alert',title:this.$t('project.topology.alert')},
|
||||||
@@ -496,7 +497,8 @@
|
|||||||
deep:true,
|
deep:true,
|
||||||
immediate:true,
|
immediate:true,
|
||||||
handler(n){
|
handler(n){
|
||||||
if(n){
|
if(n.id){
|
||||||
|
if( !this.objChange){
|
||||||
this.editTopologyFlag=false;
|
this.editTopologyFlag=false;
|
||||||
this.topologyLoading=true;
|
this.topologyLoading=true;
|
||||||
this.projectInfoShow=false;
|
this.projectInfoShow=false;
|
||||||
@@ -504,21 +506,48 @@
|
|||||||
if(n.id){
|
if(n.id){
|
||||||
this.getProjectData(n);
|
this.getProjectData(n);
|
||||||
}
|
}
|
||||||
if(!this.timer){
|
|
||||||
this.timer=setTimeout(()=>{
|
|
||||||
this.topologyLoading=true;
|
this.topologyLoading=true;
|
||||||
this.init();
|
this.init();
|
||||||
this.timer=null
|
this.timer=null
|
||||||
},300)
|
this.objChange=true;
|
||||||
|
}else{
|
||||||
|
if(!this.timer){
|
||||||
|
this.timer=setInterval(()=>{
|
||||||
|
if(this.objChange){return}
|
||||||
|
this.editTopologyFlag=false;
|
||||||
|
this.topologyLoading=true;
|
||||||
|
this.projectInfoShow=false;
|
||||||
|
this.projectAlertShow=false;
|
||||||
|
if(n.id){
|
||||||
|
this.getProjectData(n);
|
||||||
|
}
|
||||||
|
clearTimeout(this.timer);
|
||||||
|
this.timer=null;
|
||||||
|
this.objChange=true;
|
||||||
|
this.topologyLoading=true;
|
||||||
|
this.init();
|
||||||
|
},100)
|
||||||
}else{
|
}else{
|
||||||
clearTimeout(this.timer);
|
clearTimeout(this.timer);
|
||||||
this.timer=setTimeout(()=>{
|
this.timer=setInterval(()=>{
|
||||||
|
if(this.objChange){return}
|
||||||
|
this.editTopologyFlag=false;
|
||||||
|
this.topologyLoading=true;
|
||||||
|
this.projectInfoShow=false;
|
||||||
|
this.projectAlertShow=false;
|
||||||
|
if(n.id){
|
||||||
|
this.getProjectData(n);
|
||||||
|
}
|
||||||
|
clearTimeout(this.timer);
|
||||||
|
this.timer=null;
|
||||||
|
this.objChange=true;
|
||||||
this.topologyLoading=true;
|
this.topologyLoading=true;
|
||||||
this.init();
|
this.init();
|
||||||
this.timer=null
|
},100)
|
||||||
},300)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -583,6 +612,7 @@
|
|||||||
Promise.all(promiseArr).then((res)=>{
|
Promise.all(promiseArr).then((res)=>{
|
||||||
getTopology(this.topologyIndex).open(data);
|
getTopology(this.topologyIndex).open(data);
|
||||||
getTopology(this.topologyIndex).lock(1);
|
getTopology(this.topologyIndex).lock(1);
|
||||||
|
this.objChange=false;
|
||||||
if(this.fromOverView){
|
if(this.fromOverView){
|
||||||
let flag=false;
|
let flag=false;
|
||||||
|
|
||||||
@@ -601,6 +631,18 @@
|
|||||||
flag=true
|
flag=true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
getTopology(this.topologyIndex).centerView(50);
|
||||||
|
setTimeout(()=>{
|
||||||
|
getTopology(this.topologyIndex).data.pens.forEach(item=>{
|
||||||
|
console.log(item.animatePlay,123123123123123123123)
|
||||||
|
if(item.animatePlay){
|
||||||
|
item.stopAnimate();
|
||||||
|
setTimeout(()=>{
|
||||||
|
item.startAnimate()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},100);
|
||||||
|
})
|
||||||
// if(this.fromPrev){
|
// if(this.fromPrev){
|
||||||
// getTopology(this.topologyIndex).scaleTo(data.scale/2)
|
// getTopology(this.topologyIndex).scaleTo(data.scale/2)
|
||||||
// }
|
// }
|
||||||
@@ -613,6 +655,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
reload(){
|
reload(){
|
||||||
|
this.topologyLoading=true;
|
||||||
this.getTopologyData().then((data)=>{
|
this.getTopologyData().then((data)=>{
|
||||||
this.openTopologyData(data).then(()=>{
|
this.openTopologyData(data).then(()=>{
|
||||||
//获取对应的值 给节点 连线添加对应动画
|
//获取对应的值 给节点 连线添加对应动画
|
||||||
@@ -669,6 +712,17 @@
|
|||||||
flag=true
|
flag=true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
setTimeout(()=>{
|
||||||
|
getTopology(this.topologyIndex).data.pens.forEach(item=>{
|
||||||
|
console.log(item.animatePlay,123123123123123123123)
|
||||||
|
if(item.animatePlay){
|
||||||
|
item.stopAnimate();
|
||||||
|
setTimeout(()=>{
|
||||||
|
item.startAnimate()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},100);
|
||||||
|
})
|
||||||
// if(this.fromPrev){
|
// if(this.fromPrev){
|
||||||
// getTopology(this.topologyIndex).scaleTo(data.scale/2)
|
// getTopology(this.topologyIndex).scaleTo(data.scale/2)
|
||||||
// }
|
// }
|
||||||
@@ -703,7 +757,9 @@
|
|||||||
}
|
}
|
||||||
this.$get('/project/topo',{projectId:this.obj.id}).then(res=>{
|
this.$get('/project/topo',{projectId:this.obj.id}).then(res=>{
|
||||||
let data=res.data.topo;
|
let data=res.data.topo;
|
||||||
|
console.log(data,'topo')
|
||||||
if(!res.data.topo || !data.pens){
|
if(!res.data.topo || !data.pens){
|
||||||
|
console.log(123123123123);
|
||||||
data={
|
data={
|
||||||
bkColor:'#FFFFFF',
|
bkColor:'#FFFFFF',
|
||||||
gridSize:10,
|
gridSize:10,
|
||||||
@@ -721,11 +777,19 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
clearInterval(timer);
|
clearInterval(timer);
|
||||||
|
let promiseArr=[];
|
||||||
|
let self=this;
|
||||||
data.pens.forEach((item=>{
|
data.pens.forEach((item=>{
|
||||||
if(item.type===0&&item.data.imageId){
|
if(item.type===0&&item.data.imageId){
|
||||||
item.image=this.iconArray.find(item1=>item1.id==item.data.imageId).image
|
item.image=this.iconArray.find(item1=>item1.id==item.data.imageId).image
|
||||||
}
|
}
|
||||||
|
if(item.type===0){
|
||||||
|
promiseArr.push(this.$get('/module/stat',{id:item.data.moduleId}));
|
||||||
|
}else{
|
||||||
|
promiseArr.push({type:1})
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if(!data.data){
|
if(!data.data){
|
||||||
this.projectInfoShow=true;
|
this.projectInfoShow=true;
|
||||||
this.projectAlertShow=true;
|
this.projectAlertShow=true;
|
||||||
@@ -736,8 +800,32 @@
|
|||||||
this.projectInfoShow=data.data.projectInfo;
|
this.projectInfoShow=data.data.projectInfo;
|
||||||
this.projectAlertShow=data.data.alertInfo;
|
this.projectAlertShow=data.data.alertInfo;
|
||||||
}
|
}
|
||||||
this.saveData={...data};
|
|
||||||
|
Promise.all(promiseArr).then(res=>{
|
||||||
|
console.log(res);
|
||||||
|
res.forEach((response,index)=>{
|
||||||
|
let item=data.pens[index];
|
||||||
|
if(item.type===0){
|
||||||
|
item.data.state=response.data;
|
||||||
|
item.data.state.asset=false;
|
||||||
|
item.data.state.endpoint=false;
|
||||||
|
item.data.state.alert=false;
|
||||||
|
if(item.data.state.assetStat.down>0){
|
||||||
|
item.data.state.asset=true;
|
||||||
|
}
|
||||||
|
if(item.data.state.endpointStat.down>0){
|
||||||
|
item.data.state.endpoint=true;
|
||||||
|
}
|
||||||
|
if(item.data.state.alertStat.P1> 0 || item.data.state.alertStat.P3>0 || item.data.state.alertStat.P2>0){
|
||||||
|
item.data.state.alert=true;
|
||||||
|
}
|
||||||
|
item.data.state.error= item.data.state.asset || item.data.state.endpoint || item.data.state.alert;
|
||||||
|
console.log(item.data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
self.saveData={...data};
|
||||||
resolve(data);
|
resolve(data);
|
||||||
|
});
|
||||||
},100)
|
},100)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -896,6 +984,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
getNodesArr(){
|
getNodesArr(){
|
||||||
|
if(!getTopology(this.topologyIndex)) return;
|
||||||
this.nodesArr=getTopology(this.topologyIndex).data.pens.filter(item=>{
|
this.nodesArr=getTopology(this.topologyIndex).data.pens.filter(item=>{
|
||||||
if(!item.data){
|
if(!item.data){
|
||||||
item.data={
|
item.data={
|
||||||
@@ -956,6 +1045,10 @@
|
|||||||
//具体内容点击
|
//具体内容点击
|
||||||
nodeTools(node,tool){
|
nodeTools(node,tool){
|
||||||
this.moduleId=node.data.moduleId;
|
this.moduleId=node.data.moduleId;
|
||||||
|
if(tool.id==='total'){
|
||||||
|
this.popDataShowUpdate('',false,node);
|
||||||
|
return
|
||||||
|
}
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
this.popDataShowUpdate(tool.id,false,node)
|
this.popDataShowUpdate(tool.id,false,node)
|
||||||
},100)
|
},100)
|
||||||
@@ -1021,6 +1114,9 @@
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
if(!Array.isArray(data)&&data){//判断不是数组 提前个data配置好节点属性
|
if(!Array.isArray(data)&&data){//判断不是数组 提前个data配置好节点属性
|
||||||
|
// if(data.type===0){
|
||||||
|
// data.textRect=new Rect(data.rect.ex-10,data.rect.ey-10,data.rect.width,data.rect.height);
|
||||||
|
// }
|
||||||
if(data.type===0&& !data.data.moduleId){
|
if(data.type===0&& !data.data.moduleId){
|
||||||
data.data={
|
data.data={
|
||||||
...data.data,
|
...data.data,
|
||||||
@@ -1028,7 +1124,7 @@
|
|||||||
moduleName:'',
|
moduleName:'',
|
||||||
show:false,
|
show:false,
|
||||||
error:false,
|
error:false,
|
||||||
animatePlay:data.animatePlay,
|
animatePlay:false,
|
||||||
fillStyle:data.fillStyle,
|
fillStyle:data.fillStyle,
|
||||||
strokeStyle:data.strokeStyle,
|
strokeStyle:data.strokeStyle,
|
||||||
lineWidth:this.nodeDefaultWidth(data.name),
|
lineWidth:this.nodeDefaultWidth(data.name),
|
||||||
@@ -1060,7 +1156,7 @@
|
|||||||
//连线是否自动计算锚点
|
//连线是否自动计算锚点
|
||||||
// data.manualCps=true;
|
// data.manualCps=true;
|
||||||
data.data={
|
data.data={
|
||||||
animatePlay:data.animatePlay,
|
animatePlay:false,
|
||||||
strokeStyle:data.strokeStyle,
|
strokeStyle:data.strokeStyle,
|
||||||
animateColor:data.animateColor,
|
animateColor:data.animateColor,
|
||||||
arrowColor:data.arrowColor,
|
arrowColor:data.arrowColor,
|
||||||
@@ -1090,7 +1186,9 @@
|
|||||||
title:'',
|
title:'',
|
||||||
moduleName:'',
|
moduleName:'',
|
||||||
url:'',
|
url:'',
|
||||||
}
|
};
|
||||||
|
data.animateColor='#FA901C'
|
||||||
|
console.log(data);
|
||||||
}
|
}
|
||||||
if(data.type===0||data.type===1){
|
if(data.type===0||data.type===1){
|
||||||
data.lineWidth=data.data.lineWidth;
|
data.lineWidth=data.data.lineWidth;
|
||||||
@@ -1227,7 +1325,9 @@
|
|||||||
let domRect=document.getElementById('topology-canvas'+this.topologyIndexF).getBoundingClientRect();
|
let domRect=document.getElementById('topology-canvas'+this.topologyIndexF).getBoundingClientRect();
|
||||||
this.toolShow.attrCord=[domRect.width-350,0];
|
this.toolShow.attrCord=[domRect.width-350,0];
|
||||||
this.toolShow.height=domRect.height;
|
this.toolShow.height=domRect.height;
|
||||||
|
if(getTopology(this.topologyIndex)){
|
||||||
getTopology(this.topologyIndex).canvasPos=domRect;
|
getTopology(this.topologyIndex).canvasPos=domRect;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'scale':
|
case 'scale':
|
||||||
if(this.$refs.topTool){
|
if(this.$refs.topTool){
|
||||||
@@ -1265,7 +1365,10 @@
|
|||||||
case 'translate':
|
case 'translate':
|
||||||
this.moduleId='';
|
this.moduleId='';
|
||||||
this.showNodeTools('');
|
this.showNodeTools('');
|
||||||
this.popDataShowUpdate('',false)
|
this.popDataShowUpdate('',false);
|
||||||
|
if(!this.editTopologyFlag){
|
||||||
|
getTopology(this.topologyIndex)
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch(event){
|
switch(event){
|
||||||
@@ -1477,7 +1580,7 @@
|
|||||||
if(item.type===0){
|
if(item.type===0){
|
||||||
item.fillStyle=item.data.fillStyle;
|
item.fillStyle=item.data.fillStyle;
|
||||||
item.strokeStyle=item.data.strokeStyle;
|
item.strokeStyle=item.data.strokeStyle;
|
||||||
item.animatePlay=item.data.animatePlay;
|
item.animatePlay=false;
|
||||||
item.font.color="#000000";
|
item.font.color="#000000";
|
||||||
}else if(item.type===1){
|
}else if(item.type===1){
|
||||||
item.animateColor=item.data.animateColor;
|
item.animateColor=item.data.animateColor;
|
||||||
@@ -1485,7 +1588,7 @@
|
|||||||
item.arrowColor=item.data.arrowColor;
|
item.arrowColor=item.data.arrowColor;
|
||||||
item.fromArrowColor=item.data.fromArrowColor;
|
item.fromArrowColor=item.data.fromArrowColor;
|
||||||
item.toArrowColor=item.data.toArrowColor;
|
item.toArrowColor=item.data.toArrowColor;
|
||||||
item.animatePlay=item.data.animatePlay;
|
item.animatePlay=false;
|
||||||
item.font.color="#000000";
|
item.font.color="#000000";
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -1529,6 +1632,7 @@
|
|||||||
if(flag){
|
if(flag){
|
||||||
this.editTopologyFlag=false;
|
this.editTopologyFlag=false;
|
||||||
topologyData.pens.forEach(item=>{
|
topologyData.pens.forEach(item=>{
|
||||||
|
item.animatePlay=item.data.animatePlay;
|
||||||
if(item.type===0&&JSON.stringify(item.data.imageId)){
|
if(item.type===0&&JSON.stringify(item.data.imageId)){
|
||||||
item.image="";
|
item.image="";
|
||||||
item.animateFrames=[];
|
item.animateFrames=[];
|
||||||
@@ -1536,6 +1640,14 @@
|
|||||||
delete item.img;
|
delete item.img;
|
||||||
delete item.lastImage;
|
delete item.lastImage;
|
||||||
}
|
}
|
||||||
|
item.data.expressArr=item.data.expressArr.filter((expression,i)=>{
|
||||||
|
if(!expression){
|
||||||
|
item.data.legends.splice(i,1);
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
this.$put('/project/topo',{topo:JSON.stringify(topologyData),projectId:this.projectInfo.id}).then(res=>{
|
this.$put('/project/topo',{topo:JSON.stringify(topologyData),projectId:this.projectInfo.id}).then(res=>{
|
||||||
this.prevent_opt.save=false;
|
this.prevent_opt.save=false;
|
||||||
@@ -1584,7 +1696,11 @@
|
|||||||
},
|
},
|
||||||
//预览
|
//预览
|
||||||
previewTopology(){
|
previewTopology(){
|
||||||
this.topoPrevData=getTopology(this.topologyIndex).data;
|
let data=JSON.parse(JSON.stringify(getTopology(this.topologyIndex).data));
|
||||||
|
data.pens.forEach((item)=>{
|
||||||
|
item.animatePlay=item.data.animatePlay;
|
||||||
|
});
|
||||||
|
this.topoPrevData=data;
|
||||||
this.previewShow=true;
|
this.previewShow=true;
|
||||||
},
|
},
|
||||||
/*tools 方法*/
|
/*tools 方法*/
|
||||||
@@ -1626,7 +1742,32 @@
|
|||||||
console.log(123123123123);
|
console.log(123123123123);
|
||||||
this.$emit('changeTopologyIndexF');
|
this.$emit('changeTopologyIndexF');
|
||||||
done();
|
done();
|
||||||
|
},
|
||||||
|
selpopIs(pen,state){//判断是否有图表
|
||||||
|
console.log(pen,state)
|
||||||
|
let flag=true;
|
||||||
|
if(state.id==='other'){
|
||||||
|
flag=false;
|
||||||
}
|
}
|
||||||
|
if(state.id==='total'&&pen.data.expressArr.length===0){
|
||||||
|
flag=false;
|
||||||
|
}
|
||||||
|
return flag
|
||||||
|
},
|
||||||
|
modelPopError(pen,state){
|
||||||
|
console.log(pen,state)
|
||||||
|
return false;
|
||||||
|
if(item.id==='asset'&&this.activeModelItem.assetError){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(item.id==='alert'&&this.activeModelItem.alertError){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(item.id==='endpoint'&&this.activeModelItem.endpointError){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
destroyed(){
|
destroyed(){
|
||||||
getTopology(this.topologyIndex).destroy();
|
getTopology(this.topologyIndex).destroy();
|
||||||
@@ -1911,7 +2052,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.network-pop .no-selPop {
|
.network-pop .no-selPop {
|
||||||
color: #999;
|
color: #999 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.network-pop .no-selPop .nz-icon-liubianxing {
|
.network-pop .no-selPop .nz-icon-liubianxing {
|
||||||
|
|||||||
Reference in New Issue
Block a user