CN-430 DNS Dashboard添加满屏翻页效果

This commit is contained in:
hyx
2022-04-13 20:34:43 +08:00
parent 3f0181de1e
commit 0bf3534f0d
6 changed files with 68 additions and 13 deletions

View File

@@ -65,7 +65,7 @@
} }
} }
} }
.cn-panel2 .chart-list > .vue-grid-layout > .vue-grid-item > .panel-chart .chart-header { .cn-panel2 .chart-list > .vue-grid-layout > .vue-grid-item > .panel-chart .chart-header,.cn-panel2 .chart-list > .dns-screen> .panel-chart .chart-header {
border-bottom: 1px solid $--right-box-border-color; border-bottom: 1px solid $--right-box-border-color;
} }
.cn-panel2 .chart-list > .vue-grid-layout > .vue-grid-item > .panel-chart .chart-header.is-group-collapse { .cn-panel2 .chart-list > .vue-grid-layout > .vue-grid-item > .panel-chart .chart-header.is-group-collapse {

View File

@@ -11,7 +11,7 @@
} }
} }
.chart-list { .chart-list {
&>.vue-grid-layout>.vue-grid-item { &>.vue-grid-layout>.vue-grid-item, &>.dns-screen {
&>.panel-chart { &>.panel-chart {
border: 1px solid $--chart-box-border-color; border: 1px solid $--chart-box-border-color;
background-color: #FFFFFF; background-color: #FFFFFF;

View File

@@ -185,7 +185,6 @@ export default {
this.$refs.panelChartList.groupParentCalcHeight(params.chart, params.childrenList) this.$refs.panelChartList.groupParentCalcHeight(params.chart, params.childrenList)
}, },
wholeScreenScroll (e) { wholeScreenScroll (e) {
return
if (this.scroll.prevent) { if (this.scroll.prevent) {
return return
} }
@@ -206,11 +205,11 @@ export default {
// 向上滚动若top在clientHeight内则滚动到最顶部 // 向上滚动若top在clientHeight内则滚动到最顶部
this.scroll.prevScrollTop = currentScrollTop this.scroll.prevScrollTop = currentScrollTop
if (currentScrollTop < clientHeight) { if (currentScrollTop < clientHeight) {
//console.info('up', this.scroll.prevScrollTop, currentScrollTop) // console.info('up', this.scroll.prevScrollTop, currentScrollTop)
scrollToTop(e.target, 0, 200, 'up') scrollToTop(e.target, 0, 200, 'up')
setTimeout(() => { setTimeout(() => {
this.scroll.prevScrollTop = e.target.scrollTop this.scroll.prevScrollTop = e.target.scrollTop
//console.info('up2', this.scroll.prevScrollTop, currentScrollTop) // console.info('up2', this.scroll.prevScrollTop, currentScrollTop)
}, 210) }, 210)
} }
} }

View File

@@ -206,6 +206,7 @@ export default {
if (requestUrl && requestUrl.indexOf('dnsServerRole') > -1) { if (requestUrl && requestUrl.indexOf('dnsServerRole') > -1) {
this.queryParams.dnsServerRole = extraParams.dnsServerRole || dnsServerRole.RTDNS this.queryParams.dnsServerRole = extraParams.dnsServerRole || dnsServerRole.RTDNS
} }
if (requestUrl) { if (requestUrl) {
get(replaceUrlPlaceholder(requestUrl, this.queryParams)).then(response => { get(replaceUrlPlaceholder(requestUrl, this.queryParams)).then(response => {
if (response.code === 200) { if (response.code === 200) {

View File

@@ -1,12 +1,17 @@
<template> <template>
<div style="height: calc(100vh - 70px);width: 100%;background-color: lightyellow;display: none;" v-if="wholeScreenScroll"> <div style="height: calc(100vh - 70px);width: 100%;" v-if="wholeScreenScroll">
<dns-screen v-if="currentPath === wholeScreenRouterMapping.dns"></dns-screen> <dns-screen v-if="currentPath === wholeScreenRouterMapping.dns"
:copy-data-list="copyDataList"
ref="dnsScreen"
:time-filter="timeFilter"
:entity="entity">
</dns-screen>
</div> </div>
<div :id='`chartList${(isGroup ? "Group" : "") + timestamp}`' class="chart-list" ref="layoutBox"> <div :id='`chartList${(isGroup ? "Group" : "") + timestamp}`' class="chart-list" ref="layoutBox">
<grid-layout <grid-layout
ref="layout" ref="layout"
v-if="gridLayoutShow" v-if="gridLayoutShow"
v-model:layout="copyDataList" v-model:layout="normalCopyDataList"
:col-num="30" :col-num="30"
:is-draggable="!panelLock" :is-draggable="!panelLock"
:is-resizable="!panelLock" :is-resizable="!panelLock"
@@ -16,7 +21,7 @@
:use-css-transforms="false" :use-css-transforms="false"
> >
<grid-item <grid-item
v-for="item in copyDataList" v-for="item in normalCopyDataList"
:key="item.id" :key="item.id"
:h="item.h" :h="item.h"
:i="item.i" :i="item.i"
@@ -95,7 +100,7 @@ export default {
gridLayoutLoading: false, gridLayoutLoading: false,
gridLayoutShow: false, gridLayoutShow: false,
rowHeight: 40, rowHeight: 40,
copyDataList: [], copyDataList: [], // 所有的图表
noData: false, // no data noData: false, // no data
tempDom: { height: '', width: '' }, tempDom: { height: '', width: '' },
stepWidth: null, stepWidth: null,
@@ -120,8 +125,12 @@ export default {
}, },
reload () { reload () {
this.copyDataList.forEach(item => { this.copyDataList.forEach(item => {
if (this.$refs['chart' + item.id]) {
this.$refs['chart' + item.id].getChartData() this.$refs['chart' + item.id].getChartData()
}
}) })
this.$refs.dnsScreen.reload()
}, },
showFullscreen (show, chartInfo) { showFullscreen (show, chartInfo) {
this.fullscreen.chartInfo = chartInfo this.fullscreen.chartInfo = chartInfo
@@ -162,6 +171,11 @@ export default {
return '' return ''
} }
} }
},
normalCopyDataList: function () {
return this.copyDataList.filter(function (item) {
return item.y >= 0
})
} }
}, },
setup (props) { setup (props) {

View File

@@ -1,9 +1,50 @@
<template> <template>
<div>dns screen</div> <div class="chart-list" style="display:grid;height:calc(100vh - 70px);width:100%;grid-template-columns:repeat(30,1fr);grid-template-rows:repeat(19,1fr);grid-gap:10px;padding-left: 10px;padding-right: 10px;">
<div v-for="item in copyDataList"
:key="item.id"
:ref="'grid-item' + item.id"
class="dns-screen"
:style="'grid-area: '+(item.y+1+30) +'/ '+(item.x+1) +' / '+(item.y+item.h+1+30) +'/ '+(item.x+item.w+1)+';'"
>
<panel-chart
:ref="'chart' + item.id"
:chart-info="item"
:time-filter="timeFilter"
:entity="entity"
></panel-chart>
</div>
</div>
</template> </template>
<script> <script>
import PanelChart from '@/views/charts/PanelChart'
export default { export default {
name: 'DnsScreen' name: 'DnsScreen',
components: {
PanelChart
},
props: {
timeFilter: Object, // 时间范围
copyDataList: Array, // 图表信息
entity: Object
},
methods: {
reload () {
this.copyDataList.forEach(item => {
if (this.$refs['chart' + item.id]) {
this.$refs['chart' + item.id].getChartData()
}
})
}
},
computed: {
copyDataList: function () {
return this.copyDataList.filter(function (item) {
return item.y < 0
})
}
}
} }
</script> </script>