安琪酵母(西藏)益生菌信息采集中心智能实验室
longyvfengyun
2023-06-17 8314896662be6eb3ceec24aa59c2a59cd1a50e86
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<script setup>
import FlexLayout from "@/components/FlexLayout.vue";
import CardBox from "@/components/CardBox.vue";
import {onMounted, onUnmounted, ref, watch} from "vue";
import MapPin from "@/components/MapPin.vue";
import slideMenu from "@/views/mainLayout/js/slideMenu";
 
const {isCollapse} = slideMenu();
const homeInfo = ref([]);
for(let i=1; i<10; i++) {
    homeInfo.value.push({
        name: "#"+i+"室",
        temp: 32,
        hum: 7,
        diffPre: 1
    });
}
 
const homeContentDom = ref(null);
const cWidth = ref(0);
const cHeight = ref(0);
const dWidth = ref(1279);
const dHeight = ref(649);
 
const setContainerSize = ()=>{
    cWidth.value = homeContentDom.value.offsetWidth;
    cHeight.value = homeContentDom.value.offsetHeight;
}
 
watch(isCollapse, ()=>{
    setTimeout(()=>{
        setContainerSize();
    }, 500);
});
 
onMounted(()=>{
    setContainerSize();
    // 监听windows窗口的缩放,绑定resize事件
    window.addEventListener("resize", setContainerSize);
});
 
 
onUnmounted(()=>{
    // 销毁resize事件
    window.removeEventListener("resize", setContainerSize);
});
</script>
 
<template>
    <flex-layout x-no-hidden>
        <div class="home-content" ref="homeContentDom">
            <map-pin
                name="培养间"
                :c-width="cWidth" :c-height="cHeight"
                :d-width="dWidth" :d-height="dHeight"
                :x="0" :y="0"></map-pin>
            <map-pin
                name="培养间"
                :c-width="cWidth" :c-height="cHeight"
                :d-width="dWidth" :d-height="dHeight"
                :x="555" :y="385"></map-pin>
            <map-pin
                name="测序间"
                :c-width="cWidth" :c-height="cHeight"
                :d-width="dWidth" :d-height="dHeight"
                :x="765" :y="450"></map-pin>
            <div class="card-box-list">
                <div
                    class="card-box-item"
                    v-for="(item, index) in homeInfo" :key="'key'+index">
                    <card-box>
                        <div class="home-info-list">
                            <div class="home-info-item">
                                {{ item.name }}温度:{{ item.temp }}
                            </div>
                            <div class="home-info-item">
                                {{ item.name }}湿度:{{ item.hum }}
                            </div>
                            <div class="home-info-item">
                                {{ item.name }}压差:{{ item.diffPre }}
                            </div>
                        </div>
                    </card-box>
                </div>
            </div>
 
        </div>
    </flex-layout>
</template>
 
<style scoped>
.home-content {
    position: relative;
    height: 100%;
    background-image: url("./images/home.png");
    background-repeat: no-repeat;
    background-size: 100% 100%;
}
.card-box-list {
    text-align: center;
    .card-box-item {
        display: inline-block;
        margin-left: 16px;
    }
}
 
.home-info-list {
    padding: 8px;
}
</style>