288 lines
6.7 KiB
Vue
288 lines
6.7 KiB
Vue
<template>
|
||
<div v-if="isShow" class="site-detail">
|
||
<div class="title">
|
||
<el-image :src="require('@/assets/copy.png')" class="icon" />
|
||
<span>{{ deviceInfo.name }}</span>
|
||
<!-- <span style="color: #3281fd">({{ 20 }})</span>-->
|
||
</div>
|
||
<div class="body">
|
||
<div class="body-item">
|
||
<div class="base-item">
|
||
<div v-if="deviceInfo.status == 1" class="item status">
|
||
<el-image
|
||
class="tips-image"
|
||
:src="require('@/assets/success.png')"
|
||
/>
|
||
<div class="tips">通讯正常</div>
|
||
</div>
|
||
<div v-else class="item status">
|
||
<el-image
|
||
class="tips-image"
|
||
:src="require('@/assets/interrupt.png')"
|
||
style="width: 54px; height: 54px"
|
||
/>
|
||
<div class="tips">通讯中断</div>
|
||
</div>
|
||
<div class="item flow">
|
||
<div class="flow-container">
|
||
<div class="flow-value">{{ todayWater }}</div>
|
||
<div class="flow-unit">
|
||
<span>m</span>
|
||
<sup>3</sup>
|
||
</div>
|
||
</div>
|
||
<div class="tips">今日水量</div>
|
||
</div>
|
||
</div>
|
||
<div class="line"></div>
|
||
<div class="contact-item">
|
||
<div class="label">联系人</div>
|
||
<div class="value">{{ deviceInfo.leader }}</div>
|
||
</div>
|
||
<div class="contact-item">
|
||
<div class="label">联系电话</div>
|
||
<div class="value">{{ deviceInfo.contact }}</div>
|
||
</div>
|
||
</div>
|
||
<div
|
||
v-if="deviceInfo.boardImg != '' && deviceInfo.boardImg != undefined"
|
||
class="body-item"
|
||
>
|
||
<el-image
|
||
:src="filePath + deviceInfo.boardImg"
|
||
fit="cover"
|
||
style="width: 250px; height: 180px; display: block"
|
||
/>
|
||
</div>
|
||
<div v-else class="body-item" style="text-align: center">
|
||
<text style="line-height: 180px">暂无公示牌</text>
|
||
</div>
|
||
<div class="body-item">
|
||
<div v-for="(label, key) in sensorData" :key="key" class="label-item">
|
||
<div class="name">{{ key }}</div>
|
||
<div class="data" style="color: #3281fd">{{ label }}</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import { getDeviceInfo } from '@/api/monitor';
|
||
import { baseURL } from '@/config';
|
||
export default {
|
||
name: 'SiteDetail',
|
||
props: {
|
||
markerSiteData: {
|
||
type: Object,
|
||
requied: true,
|
||
default: () => ({}),
|
||
},
|
||
},
|
||
data() {
|
||
return {
|
||
deviceInfo: [],
|
||
filePath: baseURL + '/static/img/',
|
||
sensorData: [],
|
||
todayWater: '',
|
||
isShow: false,
|
||
};
|
||
},
|
||
watch: {
|
||
markerSiteData: {
|
||
handler(newVal) {
|
||
this.getDeviceInfo({ deviceCode: newVal.code });
|
||
},
|
||
},
|
||
},
|
||
methods: {
|
||
async getDeviceInfo(pram) {
|
||
const { data } = await getDeviceInfo(pram);
|
||
this.deviceInfo = data.device;
|
||
this.todayWater = data.todayWater;
|
||
this.sensorData = data.sensorData;
|
||
this.isShow = true;
|
||
},
|
||
isDetailShow(status) {
|
||
this.isShow = status;
|
||
},
|
||
},
|
||
};
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.site-detail {
|
||
width: 600px;
|
||
max-height: 415px;
|
||
box-sizing: border-box;
|
||
border-radius: 4px;
|
||
background: #fff;
|
||
box-shadow: 0 3px 14px rgb(0 0 0 / 40%);
|
||
display: flex;
|
||
flex-direction: column;
|
||
padding-bottom: 15px;
|
||
overflow-y: auto;
|
||
z-index: 9999;
|
||
.title {
|
||
background: #f5f6fa;
|
||
height: 40px;
|
||
line-height: 40px;
|
||
padding-left: 8px;
|
||
display: flex;
|
||
align-items: center;
|
||
font-weight: bolder;
|
||
overflow: auto;
|
||
|
||
.icon {
|
||
height: 20px;
|
||
width: 20px;
|
||
display: inline-flex;
|
||
margin-right: 2px;
|
||
}
|
||
}
|
||
|
||
.body {
|
||
padding: 15px 15px 0;
|
||
display: flex;
|
||
align-items: flex-start;
|
||
flex-wrap: wrap;
|
||
justify-content: space-between;
|
||
overflow: auto;
|
||
|
||
&-item:nth-child(1) {
|
||
width: 180px;
|
||
height: 180px;
|
||
flex-shrink: 0;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: flex-start;
|
||
padding: 17px 15px 11px;
|
||
background: lightblue;
|
||
background: linear-gradient(
|
||
180deg,
|
||
rgba(246, 255, 250, 0) 0%,
|
||
#f2fff7 100%
|
||
);
|
||
|
||
.base-item {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
width: 100%;
|
||
margin-top: 8px;
|
||
|
||
.item {
|
||
width: 50%;
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
flex-wrap: wrap;
|
||
}
|
||
.tips-image {
|
||
width: 36px;
|
||
height: 36px;
|
||
}
|
||
.tips {
|
||
margin-top: 12px;
|
||
height: 18px;
|
||
font-size: 14px;
|
||
color: #333;
|
||
line-height: 1;
|
||
}
|
||
.flow-container {
|
||
height: 36px;
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: flex-end;
|
||
.flow-value {
|
||
font-size: 32px;
|
||
color: #333;
|
||
font-weight: bolder;
|
||
line-height: 36px;
|
||
}
|
||
.flow-unit {
|
||
line-height: 26px;
|
||
}
|
||
}
|
||
}
|
||
|
||
.line {
|
||
margin-top: 19px;
|
||
margin-bottom: 12px;
|
||
width: 150px;
|
||
height: 1px;
|
||
background: #e5e5e5;
|
||
line-height: 1;
|
||
}
|
||
.contact-item {
|
||
display: flex;
|
||
justify-content: flex-start;
|
||
padding: 5px 0;
|
||
color: #999;
|
||
font-size: 12px;
|
||
line-height: 1;
|
||
width: 100%;
|
||
align-items: center;
|
||
align-content: flex-start;
|
||
|
||
.label {
|
||
width: 72px;
|
||
}
|
||
}
|
||
}
|
||
&-item:nth-child(2) {
|
||
width: 351px;
|
||
height: 180px;
|
||
flex-shrink: 0;
|
||
}
|
||
&-item:nth-child(3) {
|
||
width: 100%;
|
||
flex-shrink: 0;
|
||
margin-top: 15px;
|
||
border: 1px solid #f2f6ff;
|
||
background: #fafbff;
|
||
display: flex;
|
||
align-content: flex-start;
|
||
justify-content: flex-start;
|
||
flex-wrap: wrap;
|
||
padding: 5px 0;
|
||
height: auto;
|
||
|
||
.label-item {
|
||
width: 112px;
|
||
padding: 4px;
|
||
box-sizing: border-box;
|
||
display: flex;
|
||
align-items: center;
|
||
flex-direction: column;
|
||
justify-content: center;
|
||
height: 70px;
|
||
position: relative;
|
||
&::after {
|
||
content: '';
|
||
position: absolute;
|
||
right: 0;
|
||
top: 50%;
|
||
height: 20px;
|
||
width: 1px;
|
||
margin-top: -10px;
|
||
background: #e5e5e5;
|
||
}
|
||
&:nth-child(5n)::after,
|
||
&:last-child::after {
|
||
width: 0;
|
||
}
|
||
.name {
|
||
color: #333;
|
||
}
|
||
.data {
|
||
color: #ccc;
|
||
margin-top: 10px;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
</style>
|