fix:优化 topology
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-my-loading="topologyLoading" class="overview">
|
<div v-loading="topologyLoading" class="overview">
|
||||||
<transition name = "el-zoom-in-center">
|
<transition name = "el-zoom-in-center">
|
||||||
<div v-if="allProject&&allProject.length>0" style="width: 100%;height: 100%;position: relative">
|
<div v-if="allProject&&allProject.length>0" style="width: 100%;height: 100%;position: relative">
|
||||||
<el-carousel :interval="5000" :trigger="'click'" arrow="hover">
|
<el-carousel :interval="5000" :trigger="'click'" arrow="hover">
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<!-- @import "./L5/css/props.css";-->
|
<!-- @import "./L5/css/props.css";-->
|
||||||
<!--</style>-->
|
<!--</style>-->
|
||||||
<template>
|
<template>
|
||||||
<div class="project-box list-page" v-my-loading="topologyLoading">
|
<div class="project-box list-page" v-loading="topologyLoading">
|
||||||
<div class="main-list" :style="{height: fromOverView ?'100%' : 'calc(100% - 30px)'}">
|
<div class="main-list" :style="{height: fromOverView ?'100%' : 'calc(100% - 30px)'}">
|
||||||
<div class="main-container" :class="fromOverView?'from-overview':'from-project'">
|
<div class="main-container" :class="fromOverView?'from-overview':'from-project'">
|
||||||
<div v-if="(editTopologyFlag || isPreview)&&!fromChart" class="edit-topologyLine top-tools" style="padding-left: 20px;width: calc(100% - 40px);display: inline-block">
|
<div v-if="(editTopologyFlag || isPreview)&&!fromChart" class="edit-topologyLine top-tools" style="padding-left: 20px;width: calc(100% - 40px);display: inline-block">
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
<span class="el-dropdown-title"><i class="iconfont icon-cube"></i> <i
|
<span class="el-dropdown-title"><i class="iconfont icon-cube"></i> <i
|
||||||
class="nz-icon nz-icon-arrow-down"></i></span>
|
class="nz-icon nz-icon-arrow-down"></i></span>
|
||||||
<el-dropdown-menu slot="dropdown" @click="dropdownClick" class="right-box-select-top right-public-box-dropdown-top">
|
<el-dropdown-menu slot="dropdown" @click="dropdownClick" class="right-box-select-top right-public-box-dropdown-top">
|
||||||
<div style="height: 450px" v-my-loading="imgageLoading">
|
<div style="height: 450px" v-loading="imgageLoading">
|
||||||
<el-card shadow="hover" style="height:420px;width:284px;overflow-y: auto"
|
<el-card shadow="hover" style="height:420px;width:284px;overflow-y: auto"
|
||||||
class="project-topology-add-node">
|
class="project-topology-add-node">
|
||||||
<!--<div class="drag-header">——</div>-->
|
<!--<div class="drag-header">——</div>-->
|
||||||
@@ -1067,9 +1067,10 @@ export default {
|
|||||||
|
|
||||||
getNodesArr () {
|
getNodesArr () {
|
||||||
if (!getTopology(this.topologyIndex)) return
|
if (!getTopology(this.topologyIndex)) return
|
||||||
|
let arr = []
|
||||||
this.offsetX = getTopology(this.topologyIndex).data.x
|
this.offsetX = getTopology(this.topologyIndex).data.x
|
||||||
this.offsetY = getTopology(this.topologyIndex).data.y
|
this.offsetY = getTopology(this.topologyIndex).data.y
|
||||||
this.nodesArr = getTopology(this.topologyIndex).data.pens.filter(item => {
|
arr = getTopology(this.topologyIndex).data.pens.filter(item => {
|
||||||
if (!item.data) {
|
if (!item.data) {
|
||||||
item.data = {
|
item.data = {
|
||||||
moduleId: '',
|
moduleId: '',
|
||||||
@@ -1084,7 +1085,14 @@ export default {
|
|||||||
return item.type === 0
|
return item.type === 0
|
||||||
})
|
})
|
||||||
// 打开动画 是否更新顶部图标
|
// 打开动画 是否更新顶部图标
|
||||||
|
this.nodesArr = arr.map(item => {
|
||||||
|
return {
|
||||||
|
rect: item.rect,
|
||||||
|
data: item.data
|
||||||
|
}
|
||||||
|
})
|
||||||
this.nodesArr = JSON.parse(JSON.stringify(this.nodesArr))
|
this.nodesArr = JSON.parse(JSON.stringify(this.nodesArr))
|
||||||
|
arr = null
|
||||||
},
|
},
|
||||||
|
|
||||||
modelTopClick (item, index) {
|
modelTopClick (item, index) {
|
||||||
@@ -1291,9 +1299,9 @@ export default {
|
|||||||
this.tooltipPosition.show = false
|
this.tooltipPosition.show = false
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.tooltipPosition.show = true
|
this.tooltipPosition.show = true
|
||||||
const ePosition = window.ePosition
|
let ePosition = window.ePosition
|
||||||
const boxWidth = document.getElementsByClassName('page')[0].offsetWidth
|
let boxWidth = document.getElementsByClassName('page')[0].offsetWidth
|
||||||
const boxHeight = document.getElementsByClassName('page')[0].offsetHeight
|
let boxHeight = document.getElementsByClassName('page')[0].offsetHeight
|
||||||
this.tooltipPosition.left = ePosition.layerX + 20
|
this.tooltipPosition.left = ePosition.layerX + 20
|
||||||
this.tooltipPosition.top = ePosition.layerY
|
this.tooltipPosition.top = ePosition.layerY
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
@@ -1309,6 +1317,9 @@ export default {
|
|||||||
this.tooltipPosition.top = ePosition.layerY - this.$refs.topoTooltip.offsetHeight
|
this.tooltipPosition.top = ePosition.layerY - this.$refs.topoTooltip.offsetHeight
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ePosition = null
|
||||||
|
boxWidth = null
|
||||||
|
boxHeight = null
|
||||||
})
|
})
|
||||||
}, 100)
|
}, 100)
|
||||||
break
|
break
|
||||||
@@ -1435,22 +1446,26 @@ export default {
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 'resize': {
|
case 'resize': {
|
||||||
const dom = document.getElementById('topology-canvas' + this.topologyIndexF)
|
let dom = document.getElementById('topology-canvas' + this.topologyIndexF)
|
||||||
const domRect = dom ? dom.getBoundingClientRect() : {}
|
let domRect = dom ? dom.getBoundingClientRect() : {}
|
||||||
if (getTopology(this.topologyIndex)) {
|
if (getTopology(this.topologyIndex)) {
|
||||||
getTopology(this.topologyIndex).canvasPos = domRect
|
getTopology(this.topologyIndex).canvasPos = domRect
|
||||||
}
|
}
|
||||||
|
dom = null
|
||||||
|
domRect = null
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 'scale': {
|
case 'scale': {
|
||||||
if (this.$refs.topTool) {
|
if (this.$refs.topTool) {
|
||||||
this.$refs.topTool.scaleNum = parseInt(data * 100)
|
this.$refs.topTool.scaleNum = parseInt(data * 100)
|
||||||
}
|
}
|
||||||
const dom = document.getElementById('topology-canvas' + this.topologyIndexF)
|
let dom = document.getElementById('topology-canvas' + this.topologyIndexF)
|
||||||
const domRect = dom ? dom.getBoundingClientRect() : {}
|
let domRect = dom ? dom.getBoundingClientRect() : {}
|
||||||
if (getTopology(this.topologyIndex)) {
|
if (getTopology(this.topologyIndex)) {
|
||||||
getTopology(this.topologyIndex).canvasPos = domRect
|
getTopology(this.topologyIndex).canvasPos = domRect
|
||||||
}
|
}
|
||||||
|
dom = null
|
||||||
|
domRect = null
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 'locked': {
|
case 'locked': {
|
||||||
@@ -1721,8 +1736,8 @@ export default {
|
|||||||
this.$get('monitor/project/topo/icon').then(res => {
|
this.$get('monitor/project/topo/icon').then(res => {
|
||||||
this.imgageLoading = true
|
this.imgageLoading = true
|
||||||
this.tools = [...Tools]
|
this.tools = [...Tools]
|
||||||
const imgArr = []
|
let imgArr = []
|
||||||
const promiseArr = []
|
let promiseArr = []
|
||||||
res.data.list.forEach((item, index) => {
|
res.data.list.forEach((item, index) => {
|
||||||
item.imageName = item.name
|
item.imageName = item.name
|
||||||
delete item.name
|
delete item.name
|
||||||
@@ -1780,12 +1795,14 @@ export default {
|
|||||||
|
|
||||||
this.imgInit = true
|
this.imgInit = true
|
||||||
this.imgageLoading = false
|
this.imgageLoading = false
|
||||||
|
imgArr = null
|
||||||
|
promiseArr = null
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.imgageLoading = true
|
this.imgageLoading = true
|
||||||
this.$get('monitor/project/topo/icon').then((imageAllId) => {
|
this.$get('monitor/project/topo/icon').then((imageAllId) => {
|
||||||
const promiseArr = []
|
let promiseArr = []
|
||||||
if (!imageAllId || !imageAllId.data) {
|
if (!imageAllId || !imageAllId.data) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -1818,6 +1835,7 @@ export default {
|
|||||||
})
|
})
|
||||||
this.imgInit = true
|
this.imgInit = true
|
||||||
this.imgageLoading = false
|
this.imgageLoading = false
|
||||||
|
promiseArr = null
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -2055,10 +2073,12 @@ export default {
|
|||||||
this.editTopologyFlag = false
|
this.editTopologyFlag = false
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
getTopology(this.topologyIndex).lock(1)
|
getTopology(this.topologyIndex).lock(1)
|
||||||
const dom = document.getElementById('topology-canvas' + this.topologyIndexF)
|
let dom = document.getElementById('topology-canvas' + this.topologyIndexF)
|
||||||
const domRect = dom ? dom.getBoundingClientRect() : {}
|
let domRect = dom ? dom.getBoundingClientRect() : {}
|
||||||
getTopology(this.topologyIndex).canvasPos = domRect
|
getTopology(this.topologyIndex).canvasPos = domRect
|
||||||
this.$store.commit('setShowTopoScreen', this.topoScreenState)
|
this.$store.commit('setShowTopoScreen', this.topoScreenState)
|
||||||
|
dom = null
|
||||||
|
domRect = null
|
||||||
})
|
})
|
||||||
this.reload()
|
this.reload()
|
||||||
},
|
},
|
||||||
@@ -2130,7 +2150,7 @@ export default {
|
|||||||
|
|
||||||
winResize () {
|
winResize () {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const domRect = document.getElementById('topology-canvas' + this.topologyIndex).getBoundingClientRect()
|
let domRect = document.getElementById('topology-canvas' + this.topologyIndex).getBoundingClientRect()
|
||||||
getTopology(this.topologyIndex).canvasPos = domRect
|
getTopology(this.topologyIndex).canvasPos = domRect
|
||||||
if (this.fromOverView) {
|
if (this.fromOverView) {
|
||||||
getTopology(this.topologyIndex).open(this.oldTopologyData)
|
getTopology(this.topologyIndex).open(this.oldTopologyData)
|
||||||
@@ -2153,6 +2173,7 @@ export default {
|
|||||||
getTopology(this.topologyIndex).resize()
|
getTopology(this.topologyIndex).resize()
|
||||||
getTopology(this.topologyIndex).centerView()
|
getTopology(this.topologyIndex).centerView()
|
||||||
this.getNodesArr()
|
this.getNodesArr()
|
||||||
|
domRect = null
|
||||||
}, 500)
|
}, 500)
|
||||||
},
|
},
|
||||||
contextmenuNone () {
|
contextmenuNone () {
|
||||||
@@ -2201,18 +2222,6 @@ export default {
|
|||||||
}
|
}
|
||||||
return flag
|
return flag
|
||||||
},
|
},
|
||||||
modelPopError (pen, state) {
|
|
||||||
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
|
|
||||||
},
|
|
||||||
redoIndexChange (index) {
|
redoIndexChange (index) {
|
||||||
this.redoIndex = index
|
this.redoIndex = index
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user