机械分厂车间环境页面显示

This commit is contained in:
hzz 2023-05-16 14:46:59 +08:00
parent 1c5eb321bc
commit 7a793f9f86

View File

@ -13,8 +13,8 @@
<template v-slot> <template v-slot>
<div class="box" ref="classBox1"> <div class="box" ref="classBox1">
<h2>{{ item.name }}</h2> <h2>{{ item.name }}</h2>
<h5 v-if="value.unit">{{ <h5 v-if="value.unit">{{ `${t('messages.NormalValue')}0-${value.quota}${value.unit}` }}</h5>
`${t('messages.NormalValue')}0-${value.quota}${value.unit}` }}</h5> <h5 v-else>&nbsp; </h5>
<!-- <h2>{{ `${t(item.i18n[0])}${t(item.i18n[1])}`}}</h2> --> <!-- <h2>{{ `${t(item.i18n[0])}${t(item.i18n[1])}`}}</h2> -->
<i :class="+item.val > +value.quota <i :class="+item.val > +value.quota
? 'iconfont ' + value.iconname + ' icon-red iconbig-size' ? 'iconfont ' + value.iconname + ' icon-red iconbig-size'
@ -24,68 +24,72 @@
<p class="num">{{ item.val }}&nbsp;</p> <p class="num">{{ item.val }}&nbsp;</p>
<span>{{ value.unit }}</span> <span>{{ value.unit }}</span>
</p> </p>
<p class="unit" v-else>
<p class="num">&nbsp;</p>
<span>&nbsp;</span>
</p>
</div> </div>
</template> </template>
</border3> </border3>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, reactive, ref, watch, computed, onUnmounted } from "vue"; import { onMounted, reactive, ref, watch, computed, onUnmounted } from "vue";
import border3 from "@/components/borderBox/border3.vue"; import border3 from "@/components/borderBox/border3.vue";
import { verticalNumPerson } from "@/type/realtimeSecurity"; import { verticalNumPerson } from "@/type/realtimeSecurity";
import { warningNot } from "@/utils/notification"; import { warningNot } from "@/utils/notification";
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
let { t } = useI18n(); let { t } = useI18n();
let props = defineProps<{ let props = defineProps<{
title: string; title: string;
}>(); }>();
let i = ref(0) let i = ref(0)
let item = computed(() => { let item = computed(() => {
return value.data[i.value] || { "name": "", "val": "0", "type": "", "field": "", "ts": 0 }; return value.data[i.value] || { "name": "", "val": "0", "type": "", "field": "", "ts": 0 };
}); });
let keynum = ref(0); let keynum = ref(0);
const value = reactive<any>({ const value = reactive<any>({
data: [], data: [],
unit: "", unit: "",
quota: null, quota: null,
iconname: "", iconname: "",
}); });
let refborder3 = ref(); let refborder3 = ref();
let numBox1 = ref(); let numBox1 = ref();
const classBox1 = ref() const classBox1 = ref()
let timer: any = null; let timer: any = null;
onMounted(() => { onMounted(() => {
}); });
onUnmounted(() => { onUnmounted(() => {
clearInterval(timer); clearInterval(timer);
}) })
const boxSize = reactive({ const boxSize = reactive({
height: '', height: '',
width: '' width: ''
}) })
function setchartWH(width: any, height: any) { function setchartWH(width: any, height: any) {
boxSize.height = height + 'px' boxSize.height = height + 'px'
boxSize.width = width + 'px' boxSize.width = width + 'px'
refborder3.value.resetWH(); refborder3.value.resetWH();
} }
const setData = ( const setData = (
data?: object[] | null, data?: object[] | null,
iconname?: string, iconname?: string,
quota?: number | null, quota?: number | null,
unit?: string unit?: string
) => { ) => {
let temp_data = data.map((item: any) => { let temp_data = data.map((item: any) => {
return { return {
name: item.name.split("车间")[1]||item.name, name: item.name.split("车间")[1] || item.name,
val: item.val, val: item.val,
}; };
}); });
@ -102,18 +106,18 @@
i.value = 0; i.value = 0;
} }
}, 5000); }, 5000);
}; };
defineExpose({ defineExpose({
setchartWH, setchartWH,
setData, setData,
}); });
</script> </script>
<style scoped> <style scoped>
@import "@/assets/css/iconfont.css"; @import "@/assets/css/iconfont.css";
.box { .box {
height: 50%; height: 50%;
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
@ -121,15 +125,15 @@
flex-direction: column; flex-direction: column;
justify-content: space-evenly; justify-content: space-evenly;
align-items: center; align-items: center;
} }
.box>h5 { .box>h5 {
font-size: 15px; font-size: 15px;
/* margin-bottom: 20px; */ /* margin-bottom: 20px; */
margin-top: 20px; margin-top: 20px;
} }
/* .contentbox{ /* .contentbox{
height: 100%; height: 100%;
width: 100%; width: 100%;
display: flex; display: flex;
@ -137,38 +141,38 @@
justify-content: space-around; justify-content: space-around;
align-items: center; align-items: center;
} */ } */
h2 { h2 {
color: #fff; color: #fff;
} }
p { p {
color: #fff; color: #fff;
} }
.icon-red { .icon-red {
font-size: 100px; font-size: 100px;
color: #E43961; color: #E43961;
animation: redstart 2s infinite; animation: redstart 2s infinite;
/* position: relative; */ /* position: relative; */
/* top: -15px; */ /* top: -15px; */
} }
.icon-blue { .icon-blue {
font-size: 100px; font-size: 100px;
color: #20AEC5; color: #20AEC5;
/* position: relative; */ /* position: relative; */
/* top: -15px; */ /* top: -15px; */
} }
.iconsmall-size { .iconsmall-size {
font-size: 20px; font-size: 20px;
} }
.num { .num {
font-size: 24px; font-size: 24px;
} }
.unit { .unit {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
@ -176,14 +180,14 @@
font-size: 20px; font-size: 20px;
height: 5; height: 5;
width: 100px; width: 100px;
} }
.box>h2 { .box>h2 {
font-size: 20px; font-size: 20px;
} }
.icontip { .icontip {
display: flex; display: flex;
margin-top: -60px; margin-top: -60px;
width: 100px; width: 100px;
@ -191,25 +195,25 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 60px; height: 60px;
} }
.icontipBox li { .icontipBox li {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-start; justify-content: flex-start;
margin-bottom: 5px; margin-bottom: 5px;
} }
.icontipBox li p:nth-child(1) { .icontipBox li p:nth-child(1) {
width: 40%; width: 40%;
text-align: left; text-align: left;
} }
.icontipBox li p:nth-child(2) { .icontipBox li p:nth-child(2) {
flex: 1; flex: 1;
} }
@keyframes redstart { @keyframes redstart {
0% {} 0% {}
50% { 50% {
@ -217,5 +221,6 @@
} }
100% {} 100% {}
}</style> }
</style>