141 lines
3.4 KiB
Vue
141 lines
3.4 KiB
Vue
<template>
|
|
<div ref='dataBoardBoxB' class='dataBoardBoxB'>
|
|
<div id="dataBoardBox" class='dataBoardBox' style="width: 1920px;height: 1080px;" :style="{ transform: 'scale(' + scaleNum + ')' }">
|
|
<DataBoardHeader
|
|
:is-full-screen="isFullScreen"
|
|
@screenfullChange="screenfullChange"
|
|
/>
|
|
<LeftTop />
|
|
<LeftBottom />
|
|
<CenterTop :scaleNum='scaleNum'/>
|
|
<CenterBottomL />
|
|
<CenterBottomR />
|
|
<RightTop />
|
|
<RightBottom />
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import DataBoardHeader from './components/Header.vue';
|
|
import LeftTop from './components/LeftTop.vue';
|
|
import LeftBottom from './components/LeftBottom.vue';
|
|
import CenterTop from './components/CenterTop.vue';
|
|
import CenterBottomL from './components/CenterBottomL.vue';
|
|
import CenterBottomR from './components/CenterBottomR.vue';
|
|
import RightTop from './components/RightTop.vue';
|
|
import RightBottom from './components/RightBottom.vue';
|
|
import { debounce } from '@/utils/debounce';
|
|
import screenfull from 'screenfull';
|
|
export default {
|
|
name: 'DataBoard',
|
|
components: { DataBoardHeader,LeftTop,LeftBottom,CenterTop,CenterBottomL,CenterBottomR,RightTop,RightBottom },
|
|
props: {},
|
|
data() {
|
|
return {
|
|
isFullScreen: false,
|
|
scaleNum: 0.8,
|
|
};
|
|
},
|
|
created() {
|
|
this.init()
|
|
},
|
|
mounted() {
|
|
this.boxReset = debounce(() => {
|
|
this.resetSize()
|
|
}, 300)
|
|
this.boxReset()
|
|
window.addEventListener('resize', () => {
|
|
this.boxReset()
|
|
})
|
|
},
|
|
computed: {
|
|
sidebarOpened() {
|
|
return this.$store.state.app.sidebar.opened
|
|
}
|
|
},
|
|
watch: {
|
|
sidebarOpened(newVal, oldVal) {
|
|
this.boxReset()
|
|
}
|
|
},
|
|
methods: {
|
|
change() {
|
|
this.isFullScreen = screenfull.isFullscreen
|
|
},
|
|
init() {
|
|
if (!screenfull.isEnabled) {
|
|
this.$message({
|
|
message: 'you browser can not work',
|
|
type: 'warning'
|
|
})
|
|
return false
|
|
}
|
|
screenfull.on('change', this.change)
|
|
},
|
|
destroy() {
|
|
if (!screenfull.isEnabled) {
|
|
this.$message({
|
|
message: 'you browser can not work',
|
|
type: 'warning'
|
|
})
|
|
return false
|
|
}
|
|
screenfull.off('change', this.change)
|
|
},
|
|
// 全屏
|
|
screenfullChange() {
|
|
if (!screenfull.isEnabled) {
|
|
this.$message({
|
|
message: 'you browser can not work',
|
|
type: 'warning'
|
|
})
|
|
return false
|
|
}
|
|
screenfull.toggle(this.$refs.dataBoardBoxB)
|
|
},
|
|
resetSize() {
|
|
const dataBoardBox = document.getElementById('dataBoardBox')
|
|
const rw = parseFloat(window.innerWidth)
|
|
const rh = parseFloat(window.innerHeight)
|
|
const bw = parseFloat(dataBoardBox.style.width)
|
|
const bh = parseFloat(dataBoardBox.style.height)
|
|
let wx = 0
|
|
let hy = 0
|
|
if (screenfull.isFullscreen) {
|
|
wx = rw / bw
|
|
hy = rh / bh
|
|
} else {
|
|
if (this.$store.state.app.sidebar.opened) {
|
|
wx = (rw - 283) / bw
|
|
} else {
|
|
wx = (rw - 88) / bw
|
|
}
|
|
hy = (rh - 150) / bh
|
|
}
|
|
this.scaleNum = wx < hy ? wx : hy
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.dataBoardBoxB {
|
|
width: 100%;
|
|
height: calc(100vh - 150px);
|
|
position: relative;
|
|
overflow: auto;
|
|
.dataBoardBox {
|
|
position: absolute;
|
|
transform-origin: 16px 8px;
|
|
font-size: 16px;
|
|
top: 0px;
|
|
left: 0px;
|
|
background: url('../../../assets/images/dataBoard/background.png') no-repeat;
|
|
background-size: cover;
|
|
background-position: 0 0;
|
|
overflow: auto;
|
|
}
|
|
}
|
|
</style>
|