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

157 lines
3.0 KiB
Vue
Raw Normal View History

2023-12-04 17:00:40 +08:00
<template>
2024-04-10 14:17:30 +08:00
<div
id="kilnContainerB"
ref="kilnContainerB"
style="width: 100%; height: 100%">
2023-12-05 15:44:22 +08:00
<div
2024-04-10 14:17:30 +08:00
id="kilnContainer"
ref="kilnContainer"
2023-12-28 16:16:25 +08:00
class="KilnDataBoard"
style="
position: absolute;
2024-01-17 09:11:02 +08:00
transform-origin: 16px 8px;
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;
"
2024-04-10 14:17:30 +08:00
:style="{ transform: 'scale(' + scaleNum + ')' }">
<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">
2024-04-10 14:17:30 +08:00
<div
class="left-side"
style="flex: 2">
2023-12-28 16:16:25 +08:00
<LeftFour />
</div>
2024-04-10 14:17:30 +08:00
<div
class="right-side"
style="flex: 1">
2023-12-28 16:16:25 +08:00
<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';
2024-04-10 14:17:30 +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-04-10 14:17:30 +08:00
computed: {
2024-01-03 14:08:49 +08:00
sidebarStatus() {
return this.$store.state.app.sidebar.opened;
2024-04-10 14:17:30 +08:00
},
2024-01-03 14:08:49 +08:00
},
2023-12-12 11:11:10 +08:00
// provide() {
// return {
// resizeChart: null,
// };
// },
2023-12-28 16:16:25 +08:00
data() {
return {
isFullScreen: false,
2024-04-10 14:17:30 +08:00
scaleNum: 0.8,
2023-12-28 16:16:25 +08:00
};
},
2024-01-03 14:08:49 +08:00
watch: {
sidebarStatus() {
2024-04-10 14:17:30 +08:00
this.boxReset();
2024-01-03 14:08:49 +08:00
},
},
2023-12-28 16:16:25 +08:00
created() {
2024-04-10 14:17:30 +08:00
this.init();
2023-12-28 16:16:25 +08:00
},
2023-12-12 11:11:10 +08:00
mounted() {
2024-04-10 14:17:30 +08:00
this.boxReset();
window.addEventListener('resize', this.boxReset);
},
destroyed() {
window.removeEventListener('resize', this.boxReset);
this.destroy();
2023-12-04 17:00:40 +08:00
},
2023-12-28 16:16:25 +08:00
methods: {
2024-04-10 14:17:30 +08:00
boxReset() {
debounce(() => {
this.resetSize();
}, 300)();
},
2023-12-28 16:16:25 +08:00
change() {
2024-04-10 14:17:30 +08:00
this.isFullScreen = screenfull.isFullscreen;
},
2023-12-28 16:16:25 +08:00
2024-04-10 14:17:30 +08:00
init() {
if (screenfull.isEnabled) {
screenfull.on('change', this.change);
}
},
2023-12-28 16:16:25 +08:00
2024-04-10 14:17:30 +08:00
destroy() {
if (screenfull.isEnabled) {
screenfull.off('change', this.change);
}
},
2023-12-28 16:16:25 +08:00
// 全屏
screenfullChange() {
2024-04-10 14:17:30 +08:00
if (!screenfull.isEnabled) {
this.$message({
message: 'you browser can not work',
type: 'warning',
});
return false;
}
screenfull.toggle(this.$refs.kilnContainerB);
},
2023-12-28 16:16:25 +08:00
resetSize() {
2024-04-10 14:17:30 +08:00
let kilnContainerBox = document.getElementById('kilnContainer');
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;
2023-12-28 16:16:25 +08:00
if (screenfull.isFullscreen) {
2024-04-10 14:17:30 +08:00
wx = rw / bw;
hx = rh / bh;
} else {
2023-12-28 16:16:25 +08:00
if (this.$store.state.app.sidebar.opened) {
2024-04-10 14:17:30 +08:00
wx = (rw - 280) / bw;
hx = (rh - 116) / bh;
} else {
wx = (rw - 85) / bw;
hx = (rh - 116) / bh;
2023-12-28 16:16:25 +08:00
}
}
2024-04-10 14:17:30 +08:00
this.scaleNum = wx;
},
},
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>