534 lines
12 KiB
Vue
534 lines
12 KiB
Vue
<template>
|
||
<view class="fullHeight">
|
||
<levitatedsphere :x="100" :y="80"></levitatedsphere>
|
||
<headers :showBack="true">
|
||
<view class="headerName">
|
||
混凝土监测
|
||
</view>
|
||
</headers>
|
||
<view class="menuBox">
|
||
<view class="menuItem" @click="changeMenu(0)" :class="tabIndex==0?'active':''">
|
||
数据总览
|
||
</view>
|
||
<!-- <view class="menuItem" @click="changeMenu(1)" :class="tabIndex==1?'active':''">
|
||
数据趋势
|
||
</view> -->
|
||
<view class="menuItem" @click="changeMenu(2)" :class="tabIndex==2?'active':''">
|
||
报警列表
|
||
</view>
|
||
</view>
|
||
<!-- 数据总览 -->
|
||
<view class="" v-if="tabIndex==0">
|
||
<view class="selectContent">
|
||
<picker mode="selector" :range="environmentDevList" @change="changeDev" range-key="devName"
|
||
:value="devIndex">
|
||
<view class="selectVideoBox">
|
||
<text class="videoName"
|
||
v-if="environmentDevList.length>0">{{environmentDevList[devIndex].devName}}</text>
|
||
<uni-icons2 class="arrow" type="arrowdown" size="15"></uni-icons2>
|
||
</view>
|
||
</picker>
|
||
</view>
|
||
<view class="blockBox">
|
||
<view class="realTimeBox">
|
||
<view class="item" :class="currentPointDetail.id==item.id?'active':''"
|
||
v-for="(item,index) in pointList" :key="index" @click="changePoint(item)">
|
||
<view class="itemInner">
|
||
<view class="num">
|
||
{{Array.isArray(item.list) && item.list.length > 0 ? item.list[0].temperature:'--'}}
|
||
°C
|
||
</view>
|
||
<view class="label">
|
||
{{item.pointName?item.pointName:'--'}}
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="blockBox">
|
||
<view class="chartTitle">
|
||
{{currentPointDetail.pointName}}温度曲线 (°C)
|
||
<text
|
||
class="temperatureThreshold">阈值:{{currentPointDetail.temperatureThreshold?currentPointDetail.temperatureThreshold:'--'}}°C</text>
|
||
</view>
|
||
<view class="tabBox">
|
||
<text class="item" :class="timeType==1?'active':''" @click="changeTime(1)">24小时</text>
|
||
<text class="item" :class="timeType==2?'active':''" @click="changeTime(2)">48小时</text>
|
||
</view>
|
||
<u-charts canvas-id="lineChart1" chartType="line" :opts="lineChartData1" ref="lineChart1" :cWidth="cWidth"
|
||
:cHeight="cHeight" :legends="false" />
|
||
</view>
|
||
</view>
|
||
<view class="" v-if="tabIndex==2">
|
||
<view class="selectContent selectContent2">
|
||
<picker mode="selector" :range="environmentDevList" @change="changeDev" range-key="devName"
|
||
:value="devIndex">
|
||
<view class="selectVideoBox">
|
||
<text class="videoName"
|
||
v-if="environmentDevList.length>0">{{environmentDevList[devIndex].devName}}</text>
|
||
<uni-icons2 class="arrow" type="arrowdown" size="15"></uni-icons2>
|
||
</view>
|
||
</picker>
|
||
<picker mode="date" @change="changeDate" :value="searchDate" style="margin-left:30rpx">
|
||
<view class="selectVideoBox">
|
||
<text class="videoName">{{searchDate}}</text>
|
||
<uni-icons2 class="arrow" type="arrowdown" size="15"></uni-icons2>
|
||
</view>
|
||
</picker>
|
||
</view>
|
||
<view class="blockBox" v-for="(item,index) in alarmList" :key="index">
|
||
<view class="alarmItem">
|
||
<text class="label">设备名称:</text><text class="value">{{item.devName}}</text>
|
||
</view>
|
||
<view class="alarmItem">
|
||
<text class="label">监测点名称:</text><text class="value">{{item.pointName}}</text>
|
||
</view>
|
||
<view class="alarmItem">
|
||
<text class="label">报警值:</text><text class="value">{{item.alarmValue}}°C</text>
|
||
</view>
|
||
<text class="alarmType" :class="item.alarmType=='报警'?'redAlarmType':''">{{item.alarmType}}</text>
|
||
<!-- <view class="alarmItem">
|
||
<text class="label">报警类型:</text><text class="value">{{item.alarmType}}</text>
|
||
</view> -->
|
||
<view class="alarmItem">
|
||
<text class="label">报警等级:</text><text class="value">{{alarmLevelArr[item.alarmLevel-1]}}</text>
|
||
</view>
|
||
<view class="alarmItem">
|
||
<text class="label">报警时间:</text><text class="value">{{item.addTime}}</text>
|
||
</view>
|
||
</view>
|
||
<!-- <view class="placeholderBox" v-if="alarmList.length==0">
|
||
<image src="/static/noData.png" mode="" class="noDataImg"></image>
|
||
<view class="text">
|
||
暂无报警
|
||
</view>
|
||
</view> -->
|
||
<view class="no_data1" v-if="alarmList.length==0">
|
||
<image src="/static/bthgIcon/noData1.png"></image>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import uCharts from '@/components/u-charts/component.vue';
|
||
import headers from "../../../components/headers/headers.vue"
|
||
import {
|
||
GetDateStr
|
||
} from "../../../static/js/util.js"
|
||
export default {
|
||
components: {
|
||
uCharts
|
||
},
|
||
data() {
|
||
return {
|
||
projectDetail: '',
|
||
environmentDevList: [],
|
||
pointList: [],
|
||
currentPointDetail: {},
|
||
devIndex: 0,
|
||
realTimeData: {
|
||
loading: '--',
|
||
biasRatio: '--',
|
||
biasAngle: '--',
|
||
heightRatio: '--',
|
||
height: '--',
|
||
loadRatio: '--',
|
||
peopleNumber: '--',
|
||
loading: '--',
|
||
},
|
||
alarmList: [],
|
||
dustData_24: [],
|
||
currentDevDetail: {},
|
||
searchDate: '',
|
||
lineChartData1: {
|
||
categories: [],
|
||
series: [{
|
||
name: "温度",
|
||
data: []
|
||
}]
|
||
},
|
||
tabIndex: 0,
|
||
onlineDevNum: 0,
|
||
timeType: 1,
|
||
alarmLevelArr: ['紧急告警', '重要告警', '次要告警', '提示告警'],
|
||
cWidth: 315,
|
||
cHeight: 200,
|
||
};
|
||
},
|
||
mounted() {
|
||
this.projectDetail = JSON.parse(uni.getStorageSync('projectDetail'))
|
||
this.searchDate = GetDateStr(0, '-')
|
||
this.getEnvironmentDev()
|
||
const that = this;
|
||
uni.getSystemInfo({
|
||
success: function(res) {
|
||
console.log(res.windowWidth);
|
||
console.log(11111, res.windowHeight);
|
||
that.cWidth = res.windowWidth - uni.upx2px(60) - uni.upx2px(60);
|
||
that.cHeight = uni.upx2px(400)
|
||
}
|
||
});
|
||
},
|
||
methods: {
|
||
changeTime(type) {
|
||
this.timeType = type;
|
||
this.getDustData()
|
||
},
|
||
changePoint(item) {
|
||
this.currentPointDetail = item
|
||
this.getDustData()
|
||
},
|
||
changeDate(e) {
|
||
this.searchDate = e.target.value
|
||
this.getAlarmData()
|
||
},
|
||
changeMenu(index) {
|
||
this.tabIndex = index;
|
||
this.loadData()
|
||
},
|
||
loadData() {
|
||
if (this.environmentDevList.length > 0) {
|
||
switch (this.tabIndex) {
|
||
case 0:
|
||
this.getRealTimeData()
|
||
break;
|
||
case 2:
|
||
this.getAlarmData()
|
||
break;
|
||
}
|
||
}
|
||
},
|
||
changeDev(e) {
|
||
this.devIndex = e.target.value
|
||
this.currentDevDetail = this.environmentDevList[this.devIndex]
|
||
this.loadData()
|
||
},
|
||
//获取温度曲线
|
||
getDustData() {
|
||
var that = this
|
||
this.sendRequest({
|
||
url: "xmgl/concreteMonitorCurrentData/getTodayConcreteMonitorCurrentDataList",
|
||
data: {
|
||
pointNo: this.currentPointDetail.pointNo,
|
||
devSn: this.currentDevDetail.devSn,
|
||
type: this.timeType
|
||
},
|
||
method: "POST",
|
||
success(res) {
|
||
var DATA = res.result
|
||
var xdata = [],
|
||
ydata1 = [];
|
||
DATA.forEach(element => {
|
||
// .substring(12)
|
||
xdata.push(element.receiveTime.substring(12))
|
||
ydata1.push(element.temperature)
|
||
})
|
||
that.lineChartData1.categories = xdata
|
||
that.lineChartData1.series = [{
|
||
name: "温度",
|
||
data: ydata1
|
||
}]
|
||
that.$refs.lineChart1.changeData('lineChart1', that.lineChartData1)
|
||
}
|
||
})
|
||
},
|
||
//获取报警列表
|
||
getAlarmData() {
|
||
var that = this
|
||
this.sendRequest({
|
||
url: "xmgl/concreteMonitorAlarm/list",
|
||
data: {
|
||
projectSn: this.projectDetail.projectSn,
|
||
pageNo: 1,
|
||
pageSize: 100,
|
||
startTime: this.searchDate,
|
||
endTime: this.searchDate,
|
||
devSn: this.currentDevDetail.devSn
|
||
},
|
||
method: "POST",
|
||
success(res) {
|
||
that.alarmList = res.result.records
|
||
}
|
||
})
|
||
},
|
||
//获取设备
|
||
getEnvironmentDev() {
|
||
var that = this
|
||
this.sendRequest({
|
||
url: "xmgl/concreteMonitorDev/selectConcreteMonitorDevList",
|
||
data: {
|
||
projectSn: this.projectDetail.projectSn
|
||
},
|
||
method: "POST",
|
||
success(res) {
|
||
that.environmentDevList = res.result
|
||
if (res.result.length > 0) {
|
||
// for (var i = 0; i < res.result.length; i++) {
|
||
// if(res.result[i].isClosed==1){
|
||
// that.onlineDevNum+=1
|
||
// }
|
||
// }
|
||
that.currentDevDetail = res.result[0]
|
||
that.getRealTimeData()
|
||
}
|
||
|
||
}
|
||
})
|
||
},
|
||
|
||
//获取实时数据
|
||
getRealTimeData() {
|
||
var that = this
|
||
this.sendRequest({
|
||
url: "xmgl/concreteMonitorCurrentData/getNewestConcreteMonitorCurrentData",
|
||
data: {
|
||
// projectSn: this.projectDetail.projectSn,
|
||
devSn: this.currentDevDetail.devSn
|
||
},
|
||
method: "POST",
|
||
success(res) {
|
||
that.pointList = res.result
|
||
if (res.result.length > 0) {
|
||
that.currentPointDetail = res.result[0]
|
||
that.getDustData()
|
||
}
|
||
}
|
||
})
|
||
},
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.menuBox {
|
||
display: flex;
|
||
align-items: center;
|
||
height: 36px;
|
||
font-size: 30rpx;
|
||
background-color: white;
|
||
margin-top: -1px;
|
||
position: relative;
|
||
z-index: 999;
|
||
border-bottom: 1px solid rgba(194, 194, 194, 0.2);
|
||
|
||
.menuItem {
|
||
flex: 1;
|
||
text-align: center;
|
||
|
||
&.active {
|
||
color: rgba(43, 141, 243, 1);
|
||
}
|
||
}
|
||
}
|
||
|
||
.blockBox {
|
||
box-shadow: 0 4px 24px 0px rgba(212, 220, 236, 0.69);
|
||
border-radius: 16rpx;
|
||
margin: 30rpx;
|
||
padding: 30rpx;
|
||
position: relative;
|
||
}
|
||
|
||
.numContent {
|
||
text-align: center;
|
||
}
|
||
|
||
.numBox {
|
||
width: 130px;
|
||
height: 100rpx;
|
||
border-radius: 16rpx;
|
||
background-image: linear-gradient(rgba(134, 145, 252, 1), rgba(16, 97, 254, 1));
|
||
font-size: 24rpx;
|
||
color: white;
|
||
text-align: center;
|
||
display: inline-block;
|
||
|
||
.num {
|
||
font-size: 30rpx;
|
||
margin: 10rpx 0 0px;
|
||
|
||
}
|
||
}
|
||
|
||
.numBox1 {
|
||
margin-right: 20rpx;
|
||
}
|
||
|
||
.selectContent {
|
||
text-align: center;
|
||
margin-top: 30rpx;
|
||
}
|
||
|
||
.selectVideoBox {
|
||
border: 1px solid rgba(42, 43, 91, 0.2);
|
||
border-radius: 36rpx;
|
||
height: 70rpx;
|
||
font-size: 30rpx;
|
||
|
||
display: inline-block;
|
||
|
||
.videoName {
|
||
padding: 0 24rpx 0 30rpx;
|
||
// border-right: 1px solid rgba(42, 43, 91, 0.2);
|
||
line-height: 70rpx;
|
||
height: 70rpx;
|
||
}
|
||
|
||
.arrow {
|
||
padding: 0 24rpx 0 4rpx;
|
||
}
|
||
}
|
||
|
||
.arrow {
|
||
margin-left: 20rpx;
|
||
}
|
||
|
||
.realTimeBox {
|
||
overflow: hidden;
|
||
|
||
.item {
|
||
float: left;
|
||
width: 33.33%;
|
||
|
||
.itemInner {
|
||
// box-shadow: 0 4px 24px 0px rgba(212, 220, 236, 0.69);
|
||
border: 1px solid rgba(220, 220, 220, 0.3);
|
||
margin: 3.10rpx;
|
||
font-size: 24rpx;
|
||
text-align: center;
|
||
padding: 7px 0;
|
||
}
|
||
|
||
.num {
|
||
font-size: 30rpx;
|
||
color: rgba(43, 141, 243, 1);
|
||
}
|
||
}
|
||
|
||
.active .itemInner {
|
||
border-color: rgba(43, 141, 243, 0.4);
|
||
}
|
||
}
|
||
|
||
.alarmIcon {
|
||
width: 40rpx;
|
||
height: 40rpx;
|
||
}
|
||
|
||
.switchIcon {
|
||
width: 100rpx;
|
||
height: 29px;
|
||
}
|
||
|
||
.blockTitle {
|
||
text-align: center;
|
||
}
|
||
|
||
.tableBox {
|
||
font-size: 28rpx;
|
||
width: 100%;
|
||
|
||
.tableHead {
|
||
font-weight: bold;
|
||
display: flex;
|
||
border-bottom: 1px solid rgba(42, 43, 91, 0.1);
|
||
|
||
.item {
|
||
flex: 1;
|
||
padding: 0 0 20rpx;
|
||
text-align: center;
|
||
}
|
||
}
|
||
|
||
.tableBody {
|
||
display: flex;
|
||
align-items: center;
|
||
|
||
.item {
|
||
flex: 1;
|
||
text-align: center;
|
||
justify-content: center;
|
||
padding: 20rpx 0 0px;
|
||
}
|
||
}
|
||
}
|
||
|
||
.chartTitle {
|
||
font-size: 28rpx;
|
||
font-weight: 500;
|
||
margin-bottom: 30rpx;
|
||
}
|
||
|
||
.selectContent2 {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.alarmItem {
|
||
font-size: 28rpx;
|
||
|
||
.label {
|
||
opacity: 0.6;
|
||
}
|
||
}
|
||
|
||
.profile_photo {
|
||
width: 60rpx;
|
||
height: 60rpx;
|
||
}
|
||
|
||
.moudleTitle2 {
|
||
font-size: 20rpx;
|
||
opacity: 0.69;
|
||
font-weight: 400;
|
||
margin: 30rpx 0;
|
||
text-align: center;
|
||
}
|
||
|
||
.videoBox {
|
||
width: calc(100% - 60rpx);
|
||
height: 225px;
|
||
margin: 0px 30rpx;
|
||
border-radius: 20rpx;
|
||
}
|
||
|
||
.temperatureThreshold {
|
||
float: right;
|
||
color: #f03f3f;
|
||
}
|
||
|
||
.tabBox {
|
||
border: 1px solid rgba(220, 220, 220, 0.3);
|
||
display: inline-block;
|
||
margin-bottom: 20rpx;
|
||
|
||
.item {
|
||
padding: 3px 6px;
|
||
font-size: 26rpx;
|
||
}
|
||
|
||
.active {
|
||
background-color: #2b8df3;
|
||
color: white;
|
||
}
|
||
}
|
||
|
||
.alarmType {
|
||
position: absolute;
|
||
top: 0;
|
||
right: 30rpx;
|
||
font-size: 24rpx;
|
||
padding: 4rpx 6px;
|
||
border-bottom-left-radius: 6px;
|
||
border-bottom-right-radius: 6px;
|
||
background-color: #ef901a;
|
||
color: white;
|
||
}
|
||
|
||
.redAlarmType {
|
||
background-color: #fd4c4c;
|
||
}
|
||
</style> |