yudao-dev/src/views/databoard/kiln/index.vue

150 lines
3.1 KiB
Vue
Raw Normal View History

2023-12-04 17:00:40 +08:00
<template>
2023-12-29 09:26:07 +08:00
<div id='kilnContainerB' ref='kilnContainerB' style="width: 100%;height: 100%;">
2023-12-05 15:44:22 +08:00
<div
2023-12-29 09:26:07 +08:00
id='kilnContainer'
2023-12-28 16:16:25 +08:00
ref='kilnContainer'
class="KilnDataBoard"
style="
position: absolute;
2024-01-03 14:08:49 +08:00
transform-origin: left top;
2023-12-28 16:16:25 +08:00
font-size: 16px;
2024-01-03 14:08:49 +08:00
top: 0px;
left: 0px;
2023-12-28 16:16:25 +08:00
width: 1920px;
height: 1080px;
display: flex;
flex-direction: column;
gap: 24px;
"
:style="{transform:'scale('+scaleNum+')'}">
2023-12-29 09:26:07 +08:00
<KHeader :isFullScreen='isFullScreen' @screenfullChange='screenfullChange' topTitle='窑炉生产运行驾驶舱'/>
2023-12-28 16:16:25 +08:00
<div
class="main-body"
style="flex: 1; display: flex; gap: 20px; padding: 0px 16px">
<div class="left-side" style="flex: 2">
<LeftFour />
</div>
<div class="right-side" style="flex: 1">
<RightTwo />
</div>
2023-12-06 10:38:56 +08:00
</div>
2023-12-06 09:47:06 +08:00
</div>
2023-12-12 11:11:10 +08:00
</div>
2023-12-04 17:00:40 +08:00
</template>
<script>
2023-12-28 16:16:25 +08:00
import KHeader from '../components/Header';
import LeftFour from './LeftFour';
2023-12-06 10:38:56 +08:00
import RightTwo from './RightTwo.vue';
2023-12-28 16:16:25 +08:00
import screenfull from 'screenfull'
import { debounce } from '@/utils/debounce'
2023-12-05 17:00:55 +08:00
2023-12-04 17:00:40 +08:00
export default {
2024-01-03 14:08:49 +08:00
name: 'Kiln',
2023-12-05 17:00:55 +08:00
components: {
2023-12-06 09:47:06 +08:00
KHeader,
LeftFour,
2023-12-06 10:38:56 +08:00
RightTwo,
2023-12-05 17:00:55 +08:00
},
2024-01-03 14:08:49 +08:00
computed:{
sidebarStatus() {
return this.$store.state.app.sidebar.opened;
}
},
2023-12-12 11:11:10 +08:00
// provide() {
// return {
// resizeChart: null,
// };
// },
2023-12-28 16:16:25 +08:00
data() {
return {
isFullScreen: false,
scaleNum: 0.8
};
},
2024-01-03 14:08:49 +08:00
watch: {
sidebarStatus() {
this.boxReset()
},
},
2023-12-28 16:16:25 +08:00
created() {
this.init()
},
destroy() {
this.destroy()
},
2023-12-12 11:11:10 +08:00
mounted() {
2023-12-28 16:16:25 +08:00
this.boxReset = debounce(() => {
this.resetSize()
}, 300)
this.boxReset()
window.addEventListener('resize', () => {
this.boxReset()
})
2023-12-04 17:00:40 +08:00
},
2023-12-28 16:16:25 +08:00
methods: {
change() {
this.isFullScreen = screenfull.isFullscreen
},
init() {
if (screenfull.isEnabled) {
screenfull.on('change', this.change)
}
},
destroy() {
if (screenfull.isEnabled) {
screenfull.off('change', this.change)
}
},
// 全屏
screenfullChange() {
if (!screenfull.isEnabled) {
this.$message({
message: 'you browser can not work',
type: 'warning'
})
return false
}
2023-12-29 09:26:07 +08:00
screenfull.toggle(this.$refs.kilnContainerB)
2023-12-28 16:16:25 +08:00
},
resetSize() {
2023-12-29 09:26:07 +08:00
let kilnContainerBox = document.querySelector('#kilnContainer')
2023-12-28 16:16:25 +08:00
let rw = parseFloat(window.innerWidth)
let rh = parseFloat(window.innerHeight)
let bw = parseFloat(kilnContainerBox.style.width)
let bh = parseFloat(kilnContainerBox.style.height)
let wx = 0
let hx = 0
if (screenfull.isFullscreen) {
console.log('全屏')
wx = rw / bw
hx = rh / bh
console.log(this.scaleNum)
}else{
console.log('非全屏')
console.log(this.$store.state.app.sidebar.opened)
if (this.$store.state.app.sidebar.opened) {
wx = (rw-280) / bw
2023-12-28 16:16:25 +08:00
hx = (rh-116) / bh
}else{
wx = (rw-85) / bw
2023-12-28 16:16:25 +08:00
hx = (rh-116) / bh
}
}
this.scaleNum = wx
2023-12-29 09:26:07 +08:00
}
2023-12-28 16:16:25 +08:00
}
2023-12-04 17:00:40 +08:00
};
</script>
<style scoped lang="scss">
.KilnDataBoard {
2023-12-06 09:47:06 +08:00
background: url(../assets/bg.png) no-repeat;
background-size: cover;
background-position: 0 0;
2023-12-28 16:16:25 +08:00
overflow: auto;
2023-12-04 17:00:40 +08:00
}
</style>