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

166 lines
3.4 KiB
Vue
Raw Normal View History

2023-12-29 09:26:07 +08:00
<template>
2024-04-10 14:17:30 +08:00
<div
id="deepProcessingContainerB"
ref="deepProcessingContainerB"
style="width: 100%; height: 100%">
2023-12-29 09:26:07 +08:00
<div
2024-04-10 14:17:30 +08:00
id="deepProcessingContainer"
ref="deepProcessingContainer"
2023-12-29 09:26:07 +08:00
class="deepProcessingBoard"
style="
position: absolute;
2024-01-03 14:08:49 +08:00
transform-origin: left top;
2023-12-29 09:26:07 +08:00
font-size: 16px;
2024-01-03 14:08:49 +08:00
top: 0px;
left: 0px;
2023-12-29 09:26:07 +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="深加工生产运行驾驶舱" />
2024-01-04 16:37:14 +08:00
<div
2024-01-03 14:08:49 +08:00
class="main-body"
2024-04-10 14:17:30 +08:00
style="display: grid; gap: 16px; grid-template-rows: 462px 462px">
2024-01-04 16:37:14 +08:00
<TopThree />
<BottomTwo />
</div>
2024-01-03 14:08:49 +08:00
2024-01-04 16:37:14 +08:00
<!-- <div
2023-12-29 09:26:07 +08:00
class="main-body"
style="flex: 1; display: flex; gap: 20px; padding: 0px 16px">
<div class="left-side" style="flex: 1">
<TopThree />
</div>
<div class="middle-side" style="flex: 1">
<BottomTwo />
</div>
2024-01-04 16:37:14 +08:00
</div> -->
2023-12-29 09:26:07 +08:00
</div>
</div>
</template>
<script>
import KHeader from '../components/Header';
import TopThree from './TopThree';
import BottomTwo from './BottomTwo';
2024-04-10 14:17:30 +08:00
import screenfull from 'screenfull';
import { debounce } from '@/utils/debounce';
import { getDcsMsg, getMesMsg } from './../utils/wsInterface';
2023-12-29 09:26:07 +08:00
export default {
name: 'deepProcessingBoard',
components: {
KHeader,
TopThree,
2024-04-10 14:17:30 +08:00
BottomTwo,
2023-12-29 09:26:07 +08:00
},
// provide() {
// return {
// resizeChart: null,
// };
// },
data() {
return {
isFullScreen: false,
2024-04-10 14:17:30 +08:00
scaleNum: 0.8,
2023-12-29 09:26:07 +08:00
};
},
created() {
2024-04-10 14:17:30 +08:00
this.init();
2023-12-29 09:26:07 +08:00
},
destroy() {
2024-04-10 14:17:30 +08:00
this.destroy();
2023-12-29 09:26:07 +08:00
},
mounted() {
this.boxReset = debounce(() => {
2024-04-10 14:17:30 +08:00
this.resetSize();
}, 300);
this.boxReset();
window.addEventListener('resize', () => {
this.boxReset();
});
2023-12-29 09:26:07 +08:00
// closeWebsocket()
// getDcsMsg()
// getMesMsg()
2024-04-10 14:17:30 +08:00
},
mounted() {
this.boxReset();
window.addEventListener('resize', this.boxReset);
2023-12-29 09:26:07 +08:00
},
destroyed() {
2024-04-10 14:17:30 +08:00
window.removeEventListener('resize', this.boxReset);
this.destroy();
2023-12-29 09:26:07 +08:00
},
methods: {
2024-04-10 14:17:30 +08:00
boxReset() {
debounce(() => {
this.resetSize();
}, 300)();
},
2023-12-29 09:26:07 +08:00
change() {
2024-04-10 14:17:30 +08:00
this.isFullScreen = screenfull.isFullscreen;
},
init() {
if (screenfull.isEnabled) {
screenfull.on('change', this.change);
}
},
destroy() {
if (screenfull.isEnabled) {
screenfull.off('change', this.change);
}
},
2023-12-29 09:26:07 +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.deepProcessingContainerB);
},
2023-12-29 09:26:07 +08:00
resetSize() {
2024-04-10 14:17:30 +08:00
let deepProcessingContainer = document.getElementById(
'deepProcessingContainer'
);
let rw = parseFloat(window.innerWidth);
let rh = parseFloat(window.innerHeight);
let bw = parseFloat(deepProcessingContainer.style.width);
let bh = parseFloat(deepProcessingContainer.style.height);
let wx = 0;
let hx = 0;
2023-12-29 09:26:07 +08:00
if (screenfull.isFullscreen) {
2024-04-10 14:17:30 +08:00
wx = rw / bw;
hx = rh / bh;
} else {
2023-12-29 09:26:07 +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-29 09:26:07 +08:00
}
}
2024-04-10 14:17:30 +08:00
this.scaleNum = wx;
},
},
2023-12-29 09:26:07 +08:00
};
</script>
<style scoped lang="scss">
.deepProcessingBoard {
background: url(../assets/bg.png) no-repeat;
background-size: cover;
background-position: 0 0;
overflow: auto;
}
</style>