fix: 走马灯快速点击单独刷新 加载错误的问题

This commit is contained in:
zhangyu
2023-04-06 16:28:32 +08:00
parent 2b159467d9
commit 6dae7ed6e5
4 changed files with 25 additions and 7 deletions

View File

@@ -2,11 +2,12 @@
<div v-my-loading="topologyLoading" class="overview">
<transition name = "el-zoom-in-center">
<div v-if="allProject&&allProject.length>0" style="width: 100%;height: 100%;position: relative">
<el-carousel :interval="5000" :trigger="'click'" :autoplay="true" arrow="hover">
<el-carousel :interval="5000" :trigger="'click'" :autoplay="true" arrow="hover" @change="carouselChange">
<el-carousel-item v-for="(item,index) in allProject" :key="index" style="min-height: 10px;min-width: 10px">
<div class="maskLayer" @click="toProject(item)"></div>
<!-- <span class="project-name">{{item.name}}</span>-->
<meta2dMain
v-if="item.isLoad"
:meta2dId="'autoTopology' + item.id + (isFullscreen ? 'screen' : '')"
:topoData="item.topoData"
:isPreview="true"
@@ -47,11 +48,18 @@ export default {
initChart () {
this.queryAllProjectData()
},
carouselChange (index) {
this.allProject.forEach(item => {
item.isLoad = false
})
this.allProject[index].isLoad = true
},
queryAllProjectData () {
this.isInit = false
this.$get('monitor/project', { pageSize: -1 }).then(res => {
this.topologyLoading = true
this.allProject = []
this.timeArray = []
let axiosAll = []
let temp = []
if (res.data.list.length === 0) {
@@ -77,10 +85,15 @@ export default {
item.params = {
timeType: item.topo.timeType || 5
}
// temp.push(item)
setTimeout(() => {
this.allProject.push(item)
}, index * 200)
if (index === 0) {
item.isLoad = true
} else {
item.isLoad = false
}
this.allProject.push(item)
// setTimeout(() => {
// item.isLoad = true
// }, index * 200)
})
// temp.push(res2[2])
// this.allProject = JSON.parse(JSON.stringify(temp))

View File

@@ -16,6 +16,9 @@
<li v-for="i in $CONSTANTS.intervalList" :key="i.value + i.label" :style="{color:interval === i.value || interval.value === i.value ? theme.themeColor : ''}" class="el-dropdown-menu__item dropdown-content" @click="selectInterval(i,true)">
{{$t(i.label)}}
</li>
<li :key="-1" style="display: none" class="el-dropdown-menu__item dropdown-content" @click="selectInterval({label: 10, value: 10},true)">
{{$t(10)}}
</li>
</ul>
</transition>
</button>

View File

@@ -1,4 +1,4 @@
import { Meta2d, registerNode, s8 } from '@meta2d/core'
import { registerNode, s8 } from '@meta2d/core'
import { flowPens } from '@meta2d/flow-diagram'
import { activityDiagram } from '@meta2d/activity-diagram'
import { classPens } from '@meta2d/class-diagram'
@@ -84,7 +84,7 @@ export default {
maxScale: 2,
autoAnchor: false
}
const meta2d = new Meta2d(this.meta2dId, meta2dOptions)
const meta2d = new window.Meta2d(this.meta2dId, meta2dOptions)
meta2d.register(flowPens())
meta2d.register(activityDiagram())
meta2d.register(classPens())

View File

@@ -22,6 +22,7 @@ import plTable from 'pl-table'
import VueClipboard from 'vue-clipboard2'
import 'pl-table/themes/index.css'
import { post, get, put, del } from '@/http.js'
import { Meta2d } from '@meta2d/core'
import { clickoutside, bottomBoxWindow, stringTimeParseToUnix, unixTimeParseToString, chartResizeTool, tableSet, cancelWithChange, myLoading } from '@/components/common/js/tools.js'
import * as tools from '@/components/common/js/tools.js'
import * as constants from '@/components/common/js/constants.js'
@@ -65,6 +66,7 @@ Pace.options = {
ghostTime: 0.1,
restartOnRequestAfter: 0.1
}
window.Meta2d = Meta2d
Vue.use(VMdPreview)
Vue.use(Pace)