web
昨天 010ce04ba6e27f2bd603cec692d2695d7a8a3c1f
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<template>
    <div class="home">
        <div class="home-bg"></div>
        <div class="home-c">
            <div class="point" v-for="(item, index) in monitorList" :key="index"
                 :style="{left: item.left, top: item.top}">
                <div class="point-address" @click="handleShow(index)"></div>
                <div class="point-message" v-show="item.showMsg">
                    <div class="msg-box">
                        <div class="msg-t">{{ item.pointName }}</div>
                        <div class="num">
                            <div class="item">
                                <div class="item-t">水温:</div>
                                <div class="item-num"><span>{{ item?.dataList?.find(f => f.code === selectDeep[index]).value }}</span>°C</div>
                            </div>
                            <div class="item">
                                <div class="item-t">水位:</div>
                                <div class="item-num">
                                    <el-select
                                        v-model="selectDeep[index]"
                                        class="val-select"
                                        placeholder="Select"
                                        style="width: 10rem"
                                    >
                                        <el-option
                                            v-for="item in item?.dataList"
                                            :key="item.code"
                                            :label='item.code'
                                            :value="item.code"
                                        />
                                    </el-select>
                                    m
                                </div>
                            </div>
                        </div>
                        <div class="shebei">
                            监测设备:
                            <span v-if="item.isOnline === 1">设备运作正常</span>
                            <span v-else style="color: red">设备运作异常</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
 
 
<script setup>
import pointApi from '@/api/facility/point.js'
import {ref, onMounted} from "vue";
 
const monitorList = ref([])
const selectDeep = ref([])
 
// 标点配置
const config = [
    {left: '15%', top: '53%', showMsg: false},
    {left: '12%', top: '68%', showMsg: false},
]
 
// 获取监控点列表
const getMonitorList = () => {
    pointApi().search({type: 1, page: 1, limit: 3}).then(res => {
        let data = res.data.list.filter(el => el.parentId !== 0)
        if (data.length > 2) data = data.splice(0, 1)
        monitorList.value = data.map((item, index) => {
            selectDeep.value[index] = item?.dataList[0].code
            return {
                ...item,
                ...config[index]
            }
        })
    })
}
 
const handleShow = (index) => {
    monitorList.value[index].showMsg = !monitorList.value[index].showMsg;
}
 
onMounted(() => {
    getMonitorList()
})
</script>
 
 
<style scoped lang="scss">
.home {
    height: 100%;
 
    .home-bg {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        background: url("@/assets/images/tempture-bg.png") no-repeat;
        background-size: 100% 100%;
        z-index: 11;
    }
 
    .home-c {
        width: 100%;
        height: 100%;
        position: relative;
        z-index: 20;
 
        .point {
            position: absolute;
 
            .point-address {
                width: 35px;
                height: 40px;
                background: url("@/assets/images/point.png") no-repeat;
                background-size: 100% 100%;
            }
 
            .point-message {
                width: 500px;
                height: 180px;
                background: url("@/assets/images/messageInfo-right.png") no-repeat;
                background-size: 100% 100%;
                position: absolute;
                left: 30px;
                top: -60px;
                padding: 30px 50px;
                color: #fff;
 
                .msg-box {
                    width: 100%;
                    height: 100%;
                    display: flex;
                    flex-direction: column;
                    justify-content: space-between;
                }
 
                .msg-t {
                    font-size: 26px;
                    font-weight: bold;
                }
 
                .num {
                    display: flex;
                    align-items: center;
                    gap: 30px;
 
                    .item {
                        display: flex;
                        align-items: center;
 
                        span {
                            display: inline-block;
                            padding: 0 20px;
                            font-size: 22px;
                            font-weight: bold;
                        }
                        .val-select{
                            padding: 0 20px;
                            :deep(.el-select__wrapper){
                                background-color: transparent;
                                box-shadow: 0 0 0 1px #fff inset;
                                font-size: 20px;
                                .el-select__caret{
                                    color: #fff;
                                }
                                .el-select__placeholder{
                                    color: #fff;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
</style>