蜂箱
This commit is contained in:
parent
07957bf4e8
commit
191829e9f5
|
@ -3,8 +3,6 @@
|
|||
<u-navbar is-back="false" title="历史走势" :border-bottom="false" :background="bgc" title-color='#000'
|
||||
title-size='36' :title-bold='true' height='45' id="navbar">
|
||||
</u-navbar>
|
||||
|
||||
|
||||
<view class="echarts_box">
|
||||
<view class="echarts_top">
|
||||
<view class="top_left">
|
||||
|
@ -16,12 +14,10 @@
|
|||
</view>
|
||||
<view class="top_right">
|
||||
<view style="width: 1rpx;">
|
||||
|
||||
</view>
|
||||
<view class="txt">
|
||||
<!-- 历史走势<view class="iconfont icon-xiangyou1"></view> -->
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view class="echarts">
|
||||
|
@ -41,12 +37,10 @@
|
|||
</view>
|
||||
<view class="top_right">
|
||||
<view style="width: 1rpx;">
|
||||
|
||||
</view>
|
||||
<view class="txt">
|
||||
<!-- 历史走势<view class="iconfont icon-xiangyou1"></view> -->
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view class="echarts">
|
||||
|
@ -57,7 +51,6 @@
|
|||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import uniEcCanvas from '@/components/uni-ec-canvas/uni-ec-canvas.vue'
|
||||
import * as echarts from '@/components/uni-ec-canvas/echarts'
|
||||
|
@ -119,19 +112,14 @@
|
|||
this.yeartime.year = now.getFullYear()
|
||||
this.yeartime.month = String(previousDay.getMonth() + 1).padStart(2, '0')
|
||||
this.yeartime.day = String(now.getDate()).padStart(2, '0')
|
||||
|
||||
|
||||
previousDay.setDate(now.getDate() - 30)
|
||||
this.yeartimes.year = previousDay.getFullYear()
|
||||
this.yeartimes.month = String(previousDay.getMonth() + 1).padStart(2, '0')
|
||||
this.yeartimes.day = String(previousDay.getDate()).padStart(2, '0')
|
||||
|
||||
this.getchartData3()
|
||||
this.getchartData4()
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
// 重量图表
|
||||
getchartData3() {
|
||||
let time = this.yeartime.year + '-' + this.yeartime.month + '-' + this.yeartime.day
|
||||
|
@ -153,11 +141,9 @@
|
|||
}
|
||||
})
|
||||
},
|
||||
|
||||
//重量图表
|
||||
initChart3(canvas, width, height, canvasDpr) {
|
||||
let that = this
|
||||
|
||||
const option = {
|
||||
grid: {
|
||||
left: '4%',
|
||||
|
@ -251,13 +237,12 @@
|
|||
},
|
||||
data: that.chartData3,
|
||||
}],
|
||||
};
|
||||
}
|
||||
chart = echarts.init(canvas, null, {
|
||||
width: width,
|
||||
height: height,
|
||||
devicePixelRatio: canvasDpr
|
||||
})
|
||||
|
||||
option.series[0].data = that.chartData3
|
||||
canvas.setChart(chart)
|
||||
chart.setOption(option)
|
||||
|
@ -266,7 +251,6 @@
|
|||
// 进出量图表
|
||||
initChart4(canvas, width, height, canvasDpr) {
|
||||
let that = this
|
||||
|
||||
const option = {
|
||||
grid: {
|
||||
left: '4%',
|
||||
|
@ -360,20 +344,17 @@
|
|||
},
|
||||
data: that.chartData4,
|
||||
}],
|
||||
};
|
||||
}
|
||||
chart = echarts.init(canvas, null, {
|
||||
width: width,
|
||||
height: height,
|
||||
devicePixelRatio: canvasDpr
|
||||
})
|
||||
|
||||
option.series[0].data = that.chartData4
|
||||
canvas.setChart(chart)
|
||||
chart.setOption(option)
|
||||
return chart
|
||||
},
|
||||
|
||||
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -386,34 +367,24 @@
|
|||
color: red;
|
||||
}
|
||||
.page {
|
||||
// position: relative;
|
||||
width: 750rpx;
|
||||
// padding-bottom: 200rpx;
|
||||
padding: 38rpx;
|
||||
box-sizing: border-box;
|
||||
.echarts_box {
|
||||
margin-top: 26rpx;
|
||||
padding: 18rpx 36rpx;
|
||||
width: 674rpx;
|
||||
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15);
|
||||
border-radius: 28rpx 28rpx 28rpx 28rpx;
|
||||
|
||||
.echarts {
|
||||
|
||||
margin-top: 24rpx;
|
||||
// width: 100%;
|
||||
// height: 80%;
|
||||
width: 100%;
|
||||
height: 330rpx;
|
||||
}
|
||||
|
||||
.echarts_top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
// justify-content: space-between;
|
||||
.top_left {
|
||||
width: 38.33%;
|
||||
display: flex;
|
||||
|
@ -428,7 +399,6 @@
|
|||
height: 34rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.top_cont {
|
||||
width: 33.33%;
|
||||
text-align: center;
|
||||
|
@ -436,12 +406,10 @@
|
|||
font-size: 36rpx;
|
||||
color: #3D3D3D;
|
||||
}
|
||||
|
||||
.top_right {
|
||||
width: 33.33%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.txt {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
@ -450,7 +418,6 @@
|
|||
font-weight: 400;
|
||||
font-size: 32rpx;
|
||||
color: #4D4D4D;
|
||||
|
||||
.icon-xiangyou1 {
|
||||
margin-top: 4rpx;
|
||||
margin-left: 8rpx;
|
||||
|
@ -459,6 +426,5 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
|
@ -12,23 +12,22 @@
|
|||
<view class="qrcode" @click="qrcode()">
|
||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uy7BNwAMIKwvstqFnRhs" mode=""></image>
|
||||
</view>
|
||||
<input type="text" class="ips" v-model="storeId" placeholder="请扫描设备上的二维码" style="margin-left: 32rpx;"
|
||||
placeholder-class="my-placeholder" />
|
||||
<input type="text" class="ips" v-model="storeId" placeholder="请扫描设备上的二维码" style="margin-left: 32rpx;" placeholder-class="my-placeholder"/>
|
||||
</view>
|
||||
<view class="machao">
|
||||
MAC号:{{obj.mac == undefined ? '--' : obj.mac}}
|
||||
MAC号:{{obj.mac == undefined ? '--' : obj.mac}} <text v-if="onlineStatus == '离线'" style="color: red;margin-left: 50rpx;">离线</text> <text v-if="onlineStatus == '在线'" style="color: green;margin-left: 50rpx;">在线</text>
|
||||
</view>
|
||||
<view class="machao">
|
||||
总重量:{{(obj.totalWeight == undefined ? '--' : (Number(obj.totalWeight / 1000)).toFixed(2)) + 'kg'}}
|
||||
</view>
|
||||
<view class="machao">
|
||||
箱内温度:{{obj.innerTemperature == undefined ? '--' : obj.innerTemperature + '°C'}} <input type="text" v-model="wdxsn" /> <view class="" @click="btnone">校准</view>
|
||||
<text class="one">箱内温度:{{obj.innerTemperature == undefined ? '--' : obj.innerTemperature + '°C'}}</text> <input type="text" v-model="wdxsn" /> <view class="" @click="btnone">校准</view>
|
||||
</view>
|
||||
<view class="machao">
|
||||
箱内湿度:{{obj.innerHumidity == undefined ? '--' : obj.innerHumidity + '%'}}
|
||||
</view>
|
||||
<view class="machao">
|
||||
箱外温度:{{obj.outerTemperature == undefined ? '--' : obj.outerTemperature + '°C'}} <input type="text" v-model="wdxsw" /> <view class="" @click="btntwo">校准</view>
|
||||
<text class="one">箱外温度:{{obj.outerTemperature == undefined ? '--' : obj.outerTemperature + '°C'}}</text> <input type="text" v-model="wdxsw" /> <view class="" @click="btntwo">校准</view>
|
||||
</view>
|
||||
<view class="machao">
|
||||
箱外湿度:{{obj.outerHumidity == undefined ? '--' : obj.outerHumidity + '%'}}
|
||||
|
@ -45,14 +44,25 @@
|
|||
<view class="machao">
|
||||
频率:{{obj.volume == undefined ? '--' : (obj.volume / 1000).toFixed(1) + 'KHz'}}
|
||||
</view>
|
||||
<view class="machao">
|
||||
网络:<text v-if="onlineStatus == '离线'" style="color: red;">离线</text> <text v-if="onlineStatus == '在线'"
|
||||
style="color: green;">在线</text>
|
||||
</view>
|
||||
<view class="machao">
|
||||
最后在线时间:{{obj.lastOnlineTime == undefined ? '--' : obj.lastOnlineTime}}
|
||||
</view>
|
||||
|
||||
<view class="list" style="bottom: 300rpx;">
|
||||
<view class="anniulist">
|
||||
<view class="anniu" @click="btnkqjr">
|
||||
开启加热
|
||||
</view>
|
||||
<view class="anniu" @click="btngbjr">
|
||||
关闭加热
|
||||
</view>
|
||||
<view class="anniu" @click="btngnsd">
|
||||
功能锁定
|
||||
</view>
|
||||
<view class="anniu" @click="btngnjs">
|
||||
功能解锁
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="list">
|
||||
<view class="anniulist">
|
||||
<view class="anniu" @click="btnkq">
|
||||
|
@ -72,10 +82,8 @@
|
|||
返回
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
|
@ -91,7 +99,9 @@
|
|||
message: '定时器未启动',
|
||||
intervalId: null, // 用于存储定时器的ID
|
||||
wdxsn:'',
|
||||
wdxsw:''
|
||||
wdxsw:'',
|
||||
xsN:'',
|
||||
xsW:''
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
|
@ -107,7 +117,6 @@
|
|||
path: '/pages/shouye/index'
|
||||
}
|
||||
},
|
||||
|
||||
// 分享到朋友圈
|
||||
onShareTimeline: function() {
|
||||
return {
|
||||
|
@ -118,22 +127,95 @@
|
|||
},
|
||||
onUnload() {
|
||||
// 页面卸载时清除定时器
|
||||
this.clearInterval();
|
||||
this.clearInterval()
|
||||
},
|
||||
onHide() {
|
||||
// 页面隐藏时清除定时器(可选,根据需求决定是否添加)
|
||||
this.clearInterval();
|
||||
this.clearInterval()
|
||||
},
|
||||
beforeDestroy() {
|
||||
// 组件销毁前清除定时器(可选,根据需求决定是否添加)
|
||||
this.clearInterval();
|
||||
this.clearInterval()
|
||||
},
|
||||
methods: {
|
||||
// 点击开启加热
|
||||
btnkqjr(){
|
||||
this.$u.put(`/app/beehive/admin/heat?sn=${this.storeId}&open=true`).then(res=>{
|
||||
if(res.code == 200){
|
||||
uni.showToast({
|
||||
title:'开启加热成功',
|
||||
icon: 'success',
|
||||
duration:2000
|
||||
})
|
||||
}else{
|
||||
uni.showToast({
|
||||
title:res.msg,
|
||||
icon: 'none',
|
||||
duration:2000
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 点击关闭加热
|
||||
btngbjr(){
|
||||
this.$u.put(`/app/beehive/admin/heat?sn=${this.storeId}&open=false`).then(res=>{
|
||||
if(res.code == 200){
|
||||
uni.showToast({
|
||||
title:'关闭加热成功',
|
||||
icon: 'success',
|
||||
duration:2000
|
||||
})
|
||||
}else{
|
||||
uni.showToast({
|
||||
title:res.msg,
|
||||
icon: 'none',
|
||||
duration:2000
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 功能锁定
|
||||
btngnsd(){
|
||||
this.$u.put(`/app/beehive/admin/lock?sn=${this.storeId}&lock=true`).then(res=>{
|
||||
if(res.code == 200){
|
||||
uni.showToast({
|
||||
title:'开启功能锁成功',
|
||||
icon: 'success',
|
||||
duration:2000
|
||||
})
|
||||
}else{
|
||||
uni.showToast({
|
||||
title:res.msg,
|
||||
icon: 'none',
|
||||
duration:2000
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 功能解锁
|
||||
btngnjs(){
|
||||
this.$u.put(`/app/beehive/admin/lock?sn=${this.storeId}&lock=false`).then(res=>{
|
||||
if(res.code == 200){
|
||||
uni.showToast({
|
||||
title:'关闭功能锁成功',
|
||||
icon: 'success',
|
||||
duration:2000
|
||||
})
|
||||
}else{
|
||||
uni.showToast({
|
||||
title:res.msg,
|
||||
icon: 'none',
|
||||
duration:2000
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 内部温度
|
||||
btnone(){
|
||||
this.$u.put(`/app/beehive/admin/wdxsn?sn=${this.storeId}&wdxsn=${this.wdxsn}`).then(res=>{
|
||||
let num = Number(this.wdxsn) + Number(this.xsN)
|
||||
this.$u.put(`/app/beehive/admin/wdxsn?sn=${this.storeId}&wdxsn=${num}`).then(res=>{
|
||||
if(res.code == 200){
|
||||
this.obj.innerTemperature = Number(this.obj.innerTemperature) + Number(this.wdxsn)
|
||||
this.obj.innerTemperature = Number(this.obj.innerTemperature) + Number(num)
|
||||
}else{
|
||||
uni.showToast({
|
||||
title:res.msg,
|
||||
|
@ -145,9 +227,10 @@
|
|||
},
|
||||
// 外部温度
|
||||
btntwo(){
|
||||
this.$u.put(`/app/beehive/admin/wdxsw?sn=${this.storeId}&wdxsw=${this.wdxsw}`).then(res=>{
|
||||
let num = Number(this.wdxsw) + Number(this.xsW)
|
||||
this.$u.put(`/app/beehive/admin/wdxsw?sn=${this.storeId}&wdxsw=${num}`).then(res=>{
|
||||
if(res.code == 200){
|
||||
this.obj.outerTemperature = Number(this.obj.outerTemperature) + Number(this.wdxsw)
|
||||
this.obj.outerTemperature = Number(this.obj.outerTemperature) + Number(num)
|
||||
}else{
|
||||
uni.showToast({
|
||||
title:res.msg,
|
||||
|
@ -166,11 +249,13 @@
|
|||
// 每五秒执行一次的方法
|
||||
const timerCallback = () => {
|
||||
if(this.storeId == '' || this.storeId == null || this.obj == null){
|
||||
this.clearInterval();
|
||||
this.clearInterval()
|
||||
}else{
|
||||
this.$u.get(`/app/beehive/admin/sn/${this.storeId}?refresh=true`).then(res => {
|
||||
if (res.code == 200) {
|
||||
this.obj = res.data
|
||||
this.xsW = res.data.xsW
|
||||
this.xsN = res.data.xsN
|
||||
this.id = res.data.deviceId
|
||||
if (res.data.onlineStatus == 0) {
|
||||
this.onlineStatus = '离线'
|
||||
|
@ -187,13 +272,13 @@
|
|||
}
|
||||
}
|
||||
// 启动定时器,并将ID存储在intervalId中
|
||||
this.intervalId = setInterval(timerCallback, 5000);
|
||||
this.intervalId = setInterval(timerCallback, 5000)
|
||||
},
|
||||
clearInterval() {
|
||||
// 清除定时器
|
||||
if (this.intervalId !== null) {
|
||||
clearInterval(this.intervalId);
|
||||
this.intervalId = null;
|
||||
clearInterval(this.intervalId)
|
||||
this.intervalId = null
|
||||
}
|
||||
},
|
||||
// 进行扫描二维码获取设备sn
|
||||
|
@ -227,10 +312,12 @@
|
|||
this.$u.get(`/app/beehive/admin/sn/${this.storeId}?refresh=true`).then(res => {
|
||||
if (res.code == 200) {
|
||||
if(res.data == null){
|
||||
this.clearInterval();
|
||||
this.clearInterval()
|
||||
}else{
|
||||
this.obj = res.data
|
||||
this.id = res.data.deviceId
|
||||
this.xsW = res.data.xsW
|
||||
this.xsN = res.data.xsN
|
||||
if (res.data.onlineStatus == 0) {
|
||||
this.onlineStatus = '离线'
|
||||
} else if (res.data.onlineStatus == 1) {
|
||||
|
@ -253,18 +340,16 @@
|
|||
icon: 'none',
|
||||
duration: 2000,
|
||||
})
|
||||
this.clearInterval();
|
||||
this.clearInterval()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 返回录入
|
||||
btnfh() {
|
||||
uni.reLaunch({
|
||||
url:'/page_user/luru'
|
||||
})
|
||||
},
|
||||
|
||||
// 开启蜂鸣
|
||||
btnkq() {
|
||||
this.$u.put(`/app/beehive/admin/buzzer?sn=${this.storeId}`).then((res) => {
|
||||
|
@ -333,7 +418,7 @@
|
|||
this.$u.put(`/app/beehive/iot/${this.storeId}/uploadBySn`).then(res => {
|
||||
this.getsn()
|
||||
if(this.intervalId == null){
|
||||
this.startInterval();
|
||||
this.startInterval()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -347,16 +432,13 @@
|
|||
bottom: 50rpx;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
|
||||
.anniulist {
|
||||
width: 658rpx;
|
||||
margin: auto;
|
||||
margin-top: 200rpx;
|
||||
text-align: left;
|
||||
font-size: 32rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.anniu {
|
||||
width: 30%;
|
||||
height: 90rpx;
|
||||
|
@ -369,7 +451,6 @@
|
|||
margin: 0 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.fanhui {
|
||||
width: 658rpx;
|
||||
height: 90rpx;
|
||||
|
@ -383,7 +464,6 @@
|
|||
margin-top: 50rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.machao {
|
||||
width: 658rpx;
|
||||
margin: auto;
|
||||
|
@ -392,12 +472,16 @@
|
|||
font-size: 32rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.one{
|
||||
width: 280rpx;
|
||||
}
|
||||
input{
|
||||
width: 100rpx;
|
||||
height: 40rpx;
|
||||
border: 1px solid #ce9e10;
|
||||
margin-left: 50rpx;
|
||||
text-align: center;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
view{
|
||||
margin-left: 20rpx;
|
||||
|
@ -408,7 +492,6 @@
|
|||
border-radius: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 70rpx;
|
||||
font-weight: 600;
|
||||
|
@ -417,7 +500,6 @@
|
|||
margin: auto;
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
|
||||
.shuom {
|
||||
width: 658rpx;
|
||||
margin: auto;
|
||||
|
@ -425,7 +507,6 @@
|
|||
text-align: left;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.iptbox {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
@ -437,27 +518,22 @@
|
|||
background: #FFFFFF;
|
||||
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15);
|
||||
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
||||
|
||||
.qrcode {
|
||||
padding-right: 20rpx;
|
||||
border-right: 2rpx solid #D8D8D8;
|
||||
|
||||
image {
|
||||
width: 54rpx;
|
||||
height: 54rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.ips {
|
||||
width: 630rpx;
|
||||
|
||||
}
|
||||
|
||||
image {
|
||||
width: 18rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
|
||||
.my-placeholder {
|
||||
font-weight: 400;
|
||||
font-size: 32rpx;
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
</view>
|
||||
<view class="tit" style="margin-top: 58rpx;">
|
||||
<image src="https://api.ccttiot.com/smartmeter/img/static/udbzkOF4S1rNec8U44KT" mode=""></image>
|
||||
震动通知
|
||||
震动通知
|
||||
</view>
|
||||
<view class="tit1">
|
||||
<image src="https://api.ccttiot.com/smartmeter/img/static/u3I0roygrn4BHJaWAT24" mode=""></image>
|
||||
|
@ -242,12 +242,12 @@
|
|||
this.values = []
|
||||
this.list.forEach(item => {
|
||||
if (item.checked) {
|
||||
item.checked = false;
|
||||
item.checked = false
|
||||
}
|
||||
})
|
||||
this.lists.forEach(item => {
|
||||
if (item.checked) {
|
||||
item.checked = false;
|
||||
item.checked = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -286,13 +286,13 @@
|
|||
this.maxCo2 = res.data.maxCo2
|
||||
this.list.forEach(item => {
|
||||
if (res.data.singleNotice.includes(item.type.toString())) {
|
||||
item.checked = true;
|
||||
item.checked = true
|
||||
}
|
||||
})
|
||||
this.value = res.data.singleNotice
|
||||
this.lists.forEach(item => {
|
||||
if (res.data.multipleNotice.includes(item.type.toString())) {
|
||||
item.checked = true;
|
||||
item.checked = true
|
||||
}
|
||||
})
|
||||
this.values = res.data.multipleNotice
|
||||
|
|
|
@ -50,12 +50,9 @@
|
|||
</view>
|
||||
</scroll-view>
|
||||
<tab-bar :indexs='1' style=""></tab-bar>
|
||||
|
||||
<u-toast ref="uToast" />
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
|
@ -76,7 +73,6 @@
|
|||
},
|
||||
onShow() {
|
||||
this.pagesum = 1
|
||||
// this.list = []
|
||||
this.ishave()
|
||||
},
|
||||
methods: {
|
||||
|
@ -95,7 +91,6 @@
|
|||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 跳转蜂场详情
|
||||
btnapiaryxq(id) {
|
||||
uni.navigateTo({
|
||||
|
|
Loading…
Reference in New Issue
Block a user