This commit is contained in:
3321822538@qq.com 2025-02-21 13:45:15 +08:00
parent 07957bf4e8
commit 191829e9f5
4 changed files with 127 additions and 90 deletions

View File

@ -3,8 +3,6 @@
<u-navbar is-back="false" title="历史走势" :border-bottom="false" :background="bgc" title-color='#000' <u-navbar is-back="false" title="历史走势" :border-bottom="false" :background="bgc" title-color='#000'
title-size='36' :title-bold='true' height='45' id="navbar"> title-size='36' :title-bold='true' height='45' id="navbar">
</u-navbar> </u-navbar>
<view class="echarts_box"> <view class="echarts_box">
<view class="echarts_top"> <view class="echarts_top">
<view class="top_left"> <view class="top_left">
@ -16,12 +14,10 @@
</view> </view>
<view class="top_right"> <view class="top_right">
<view style="width: 1rpx;"> <view style="width: 1rpx;">
</view> </view>
<view class="txt"> <view class="txt">
<!-- 历史走势<view class="iconfont icon-xiangyou1"></view> --> <!-- 历史走势<view class="iconfont icon-xiangyou1"></view> -->
</view> </view>
</view> </view>
</view> </view>
<view class="echarts"> <view class="echarts">
@ -41,12 +37,10 @@
</view> </view>
<view class="top_right"> <view class="top_right">
<view style="width: 1rpx;"> <view style="width: 1rpx;">
</view> </view>
<view class="txt"> <view class="txt">
<!-- 历史走势<view class="iconfont icon-xiangyou1"></view> --> <!-- 历史走势<view class="iconfont icon-xiangyou1"></view> -->
</view> </view>
</view> </view>
</view> </view>
<view class="echarts"> <view class="echarts">
@ -57,7 +51,6 @@
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import uniEcCanvas from '@/components/uni-ec-canvas/uni-ec-canvas.vue' import uniEcCanvas from '@/components/uni-ec-canvas/uni-ec-canvas.vue'
import * as echarts from '@/components/uni-ec-canvas/echarts' import * as echarts from '@/components/uni-ec-canvas/echarts'
@ -119,19 +112,14 @@
this.yeartime.year = now.getFullYear() this.yeartime.year = now.getFullYear()
this.yeartime.month = String(previousDay.getMonth() + 1).padStart(2, '0') this.yeartime.month = String(previousDay.getMonth() + 1).padStart(2, '0')
this.yeartime.day = String(now.getDate()).padStart(2, '0') this.yeartime.day = String(now.getDate()).padStart(2, '0')
previousDay.setDate(now.getDate() - 30) previousDay.setDate(now.getDate() - 30)
this.yeartimes.year = previousDay.getFullYear() this.yeartimes.year = previousDay.getFullYear()
this.yeartimes.month = String(previousDay.getMonth() + 1).padStart(2, '0') this.yeartimes.month = String(previousDay.getMonth() + 1).padStart(2, '0')
this.yeartimes.day = String(previousDay.getDate()).padStart(2, '0') this.yeartimes.day = String(previousDay.getDate()).padStart(2, '0')
this.getchartData3() this.getchartData3()
this.getchartData4() this.getchartData4()
}, },
methods: { methods: {
// //
getchartData3() { getchartData3() {
let time = this.yeartime.year + '-' + this.yeartime.month + '-' + this.yeartime.day let time = this.yeartime.year + '-' + this.yeartime.month + '-' + this.yeartime.day
@ -153,11 +141,9 @@
} }
}) })
}, },
// //
initChart3(canvas, width, height, canvasDpr) { initChart3(canvas, width, height, canvasDpr) {
let that = this let that = this
const option = { const option = {
grid: { grid: {
left: '4%', left: '4%',
@ -251,13 +237,12 @@
}, },
data: that.chartData3, data: that.chartData3,
}], }],
}; }
chart = echarts.init(canvas, null, { chart = echarts.init(canvas, null, {
width: width, width: width,
height: height, height: height,
devicePixelRatio: canvasDpr devicePixelRatio: canvasDpr
}) })
option.series[0].data = that.chartData3 option.series[0].data = that.chartData3
canvas.setChart(chart) canvas.setChart(chart)
chart.setOption(option) chart.setOption(option)
@ -266,7 +251,6 @@
// //
initChart4(canvas, width, height, canvasDpr) { initChart4(canvas, width, height, canvasDpr) {
let that = this let that = this
const option = { const option = {
grid: { grid: {
left: '4%', left: '4%',
@ -360,20 +344,17 @@
}, },
data: that.chartData4, data: that.chartData4,
}], }],
}; }
chart = echarts.init(canvas, null, { chart = echarts.init(canvas, null, {
width: width, width: width,
height: height, height: height,
devicePixelRatio: canvasDpr devicePixelRatio: canvasDpr
}) })
option.series[0].data = that.chartData4 option.series[0].data = that.chartData4
canvas.setChart(chart) canvas.setChart(chart)
chart.setOption(option) chart.setOption(option)
return chart return chart
}, },
} }
} }
</script> </script>
@ -386,34 +367,24 @@
color: red; color: red;
} }
.page { .page {
// position: relative;
width: 750rpx; width: 750rpx;
// padding-bottom: 200rpx;
padding: 38rpx; padding: 38rpx;
box-sizing: border-box; box-sizing: border-box;
.echarts_box { .echarts_box {
margin-top: 26rpx; margin-top: 26rpx;
padding: 18rpx 36rpx; padding: 18rpx 36rpx;
width: 674rpx; width: 674rpx;
background: #FFFFFF; background: #FFFFFF;
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15); box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15);
border-radius: 28rpx 28rpx 28rpx 28rpx; border-radius: 28rpx 28rpx 28rpx 28rpx;
.echarts { .echarts {
margin-top: 24rpx; margin-top: 24rpx;
// width: 100%;
// height: 80%;
width: 100%; width: 100%;
height: 330rpx; height: 330rpx;
} }
.echarts_top { .echarts_top {
display: flex; display: flex;
align-items: center; align-items: center;
// justify-content: space-between;
.top_left { .top_left {
width: 38.33%; width: 38.33%;
display: flex; display: flex;
@ -428,7 +399,6 @@
height: 34rpx; height: 34rpx;
} }
} }
.top_cont { .top_cont {
width: 33.33%; width: 33.33%;
text-align: center; text-align: center;
@ -436,12 +406,10 @@
font-size: 36rpx; font-size: 36rpx;
color: #3D3D3D; color: #3D3D3D;
} }
.top_right { .top_right {
width: 33.33%; width: 33.33%;
display: flex; display: flex;
align-items: center; align-items: center;
.txt { .txt {
display: flex; display: flex;
align-items: center; align-items: center;
@ -450,7 +418,6 @@
font-weight: 400; font-weight: 400;
font-size: 32rpx; font-size: 32rpx;
color: #4D4D4D; color: #4D4D4D;
.icon-xiangyou1 { .icon-xiangyou1 {
margin-top: 4rpx; margin-top: 4rpx;
margin-left: 8rpx; margin-left: 8rpx;
@ -459,6 +426,5 @@
} }
} }
} }
} }
</style> </style>

View File

@ -12,23 +12,22 @@
<view class="qrcode" @click="qrcode()"> <view class="qrcode" @click="qrcode()">
<image src="https://api.ccttiot.com/smartmeter/img/static/uy7BNwAMIKwvstqFnRhs" mode=""></image> <image src="https://api.ccttiot.com/smartmeter/img/static/uy7BNwAMIKwvstqFnRhs" mode=""></image>
</view> </view>
<input type="text" class="ips" v-model="storeId" placeholder="请扫描设备上的二维码" style="margin-left: 32rpx;" <input type="text" class="ips" v-model="storeId" placeholder="请扫描设备上的二维码" style="margin-left: 32rpx;" placeholder-class="my-placeholder"/>
placeholder-class="my-placeholder" />
</view> </view>
<view class="machao"> <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>
<view class="machao"> <view class="machao">
总重量{{(obj.totalWeight == undefined ? '--' : (Number(obj.totalWeight / 1000)).toFixed(2)) + 'kg'}} 总重量{{(obj.totalWeight == undefined ? '--' : (Number(obj.totalWeight / 1000)).toFixed(2)) + 'kg'}}
</view> </view>
<view class="machao"> <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>
<view class="machao"> <view class="machao">
箱内湿度{{obj.innerHumidity == undefined ? '--' : obj.innerHumidity + '%'}} 箱内湿度{{obj.innerHumidity == undefined ? '--' : obj.innerHumidity + '%'}}
</view> </view>
<view class="machao"> <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>
<view class="machao"> <view class="machao">
箱外湿度{{obj.outerHumidity == undefined ? '--' : obj.outerHumidity + '%'}} 箱外湿度{{obj.outerHumidity == undefined ? '--' : obj.outerHumidity + '%'}}
@ -45,14 +44,25 @@
<view class="machao"> <view class="machao">
频率{{obj.volume == undefined ? '--' : (obj.volume / 1000).toFixed(1) + 'KHz'}} 频率{{obj.volume == undefined ? '--' : (obj.volume / 1000).toFixed(1) + 'KHz'}}
</view> </view>
<view class="machao">
网络<text v-if="onlineStatus == '离线'" style="color: red;">离线</text> <text v-if="onlineStatus == '在线'"
style="color: green;">在线</text>
</view>
<view class="machao"> <view class="machao">
最后在线时间{{obj.lastOnlineTime == undefined ? '--' : obj.lastOnlineTime}} 最后在线时间{{obj.lastOnlineTime == undefined ? '--' : obj.lastOnlineTime}}
</view> </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="list">
<view class="anniulist"> <view class="anniulist">
<view class="anniu" @click="btnkq"> <view class="anniu" @click="btnkq">
@ -72,10 +82,8 @@
返回 返回
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
@ -91,7 +99,9 @@
message: '定时器未启动', message: '定时器未启动',
intervalId: null, // ID intervalId: null, // ID
wdxsn:'', wdxsn:'',
wdxsw:'' wdxsw:'',
xsN:'',
xsW:''
} }
}, },
onLoad(options) { onLoad(options) {
@ -107,7 +117,6 @@
path: '/pages/shouye/index' path: '/pages/shouye/index'
} }
}, },
// //
onShareTimeline: function() { onShareTimeline: function() {
return { return {
@ -118,22 +127,95 @@
}, },
onUnload() { onUnload() {
// //
this.clearInterval(); this.clearInterval()
}, },
onHide() { onHide() {
// //
this.clearInterval(); this.clearInterval()
}, },
beforeDestroy() { beforeDestroy() {
// //
this.clearInterval(); this.clearInterval()
}, },
methods: { 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(){ 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){ if(res.code == 200){
this.obj.innerTemperature = Number(this.obj.innerTemperature) + Number(this.wdxsn) this.obj.innerTemperature = Number(this.obj.innerTemperature) + Number(num)
}else{ }else{
uni.showToast({ uni.showToast({
title:res.msg, title:res.msg,
@ -145,9 +227,10 @@
}, },
// //
btntwo(){ 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){ if(res.code == 200){
this.obj.outerTemperature = Number(this.obj.outerTemperature) + Number(this.wdxsw) this.obj.outerTemperature = Number(this.obj.outerTemperature) + Number(num)
}else{ }else{
uni.showToast({ uni.showToast({
title:res.msg, title:res.msg,
@ -166,11 +249,13 @@
// //
const timerCallback = () => { const timerCallback = () => {
if(this.storeId == '' || this.storeId == null || this.obj == null){ if(this.storeId == '' || this.storeId == null || this.obj == null){
this.clearInterval(); this.clearInterval()
}else{ }else{
this.$u.get(`/app/beehive/admin/sn/${this.storeId}?refresh=true`).then(res => { this.$u.get(`/app/beehive/admin/sn/${this.storeId}?refresh=true`).then(res => {
if (res.code == 200) { if (res.code == 200) {
this.obj = res.data this.obj = res.data
this.xsW = res.data.xsW
this.xsN = res.data.xsN
this.id = res.data.deviceId this.id = res.data.deviceId
if (res.data.onlineStatus == 0) { if (res.data.onlineStatus == 0) {
this.onlineStatus = '离线' this.onlineStatus = '离线'
@ -187,13 +272,13 @@
} }
} }
// IDintervalId // IDintervalId
this.intervalId = setInterval(timerCallback, 5000); this.intervalId = setInterval(timerCallback, 5000)
}, },
clearInterval() { clearInterval() {
// //
if (this.intervalId !== null) { if (this.intervalId !== null) {
clearInterval(this.intervalId); clearInterval(this.intervalId)
this.intervalId = null; this.intervalId = null
} }
}, },
// sn // sn
@ -227,10 +312,12 @@
this.$u.get(`/app/beehive/admin/sn/${this.storeId}?refresh=true`).then(res => { this.$u.get(`/app/beehive/admin/sn/${this.storeId}?refresh=true`).then(res => {
if (res.code == 200) { if (res.code == 200) {
if(res.data == null){ if(res.data == null){
this.clearInterval(); this.clearInterval()
}else{ }else{
this.obj = res.data this.obj = res.data
this.id = res.data.deviceId this.id = res.data.deviceId
this.xsW = res.data.xsW
this.xsN = res.data.xsN
if (res.data.onlineStatus == 0) { if (res.data.onlineStatus == 0) {
this.onlineStatus = '离线' this.onlineStatus = '离线'
} else if (res.data.onlineStatus == 1) { } else if (res.data.onlineStatus == 1) {
@ -253,18 +340,16 @@
icon: 'none', icon: 'none',
duration: 2000, duration: 2000,
}) })
this.clearInterval(); this.clearInterval()
} }
}) })
}, },
// //
btnfh() { btnfh() {
uni.reLaunch({ uni.reLaunch({
url:'/page_user/luru' url:'/page_user/luru'
}) })
}, },
// //
btnkq() { btnkq() {
this.$u.put(`/app/beehive/admin/buzzer?sn=${this.storeId}`).then((res) => { 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.$u.put(`/app/beehive/iot/${this.storeId}/uploadBySn`).then(res => {
this.getsn() this.getsn()
if(this.intervalId == null){ if(this.intervalId == null){
this.startInterval(); this.startInterval()
} }
}) })
} }
@ -347,16 +432,13 @@
bottom: 50rpx; bottom: 50rpx;
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
.anniulist { .anniulist {
width: 658rpx; width: 658rpx;
margin: auto; margin: auto;
margin-top: 200rpx;
text-align: left; text-align: left;
font-size: 32rpx; font-size: 32rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
.anniu { .anniu {
width: 30%; width: 30%;
height: 90rpx; height: 90rpx;
@ -369,7 +451,6 @@
margin: 0 10rpx; margin: 0 10rpx;
} }
} }
.fanhui { .fanhui {
width: 658rpx; width: 658rpx;
height: 90rpx; height: 90rpx;
@ -383,7 +464,6 @@
margin-top: 50rpx; margin-top: 50rpx;
} }
} }
.machao { .machao {
width: 658rpx; width: 658rpx;
margin: auto; margin: auto;
@ -392,12 +472,16 @@
font-size: 32rpx; font-size: 32rpx;
display: flex; display: flex;
align-items: center; align-items: center;
.one{
width: 280rpx;
}
input{ input{
width: 100rpx; width: 100rpx;
height: 40rpx; height: 40rpx;
border: 1px solid #ce9e10; border: 1px solid #ce9e10;
margin-left: 50rpx; margin-left: 50rpx;
text-align: center; text-align: center;
border-radius: 10rpx;
} }
view{ view{
margin-left: 20rpx; margin-left: 20rpx;
@ -408,7 +492,6 @@
border-radius: 10rpx; border-radius: 10rpx;
} }
} }
.title { .title {
font-size: 70rpx; font-size: 70rpx;
font-weight: 600; font-weight: 600;
@ -417,7 +500,6 @@
margin: auto; margin: auto;
margin-top: 30rpx; margin-top: 30rpx;
} }
.shuom { .shuom {
width: 658rpx; width: 658rpx;
margin: auto; margin: auto;
@ -425,7 +507,6 @@
text-align: left; text-align: left;
font-size: 32rpx; font-size: 32rpx;
} }
.iptbox { .iptbox {
display: flex; display: flex;
align-items: center; align-items: center;
@ -437,27 +518,22 @@
background: #FFFFFF; background: #FFFFFF;
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15); box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15);
border-radius: 20rpx 20rpx 20rpx 20rpx; border-radius: 20rpx 20rpx 20rpx 20rpx;
.qrcode { .qrcode {
padding-right: 20rpx; padding-right: 20rpx;
border-right: 2rpx solid #D8D8D8; border-right: 2rpx solid #D8D8D8;
image { image {
width: 54rpx; width: 54rpx;
height: 54rpx; height: 54rpx;
} }
} }
.ips { .ips {
width: 630rpx; width: 630rpx;
} }
image { image {
width: 18rpx; width: 18rpx;
height: 32rpx; height: 32rpx;
} }
.my-placeholder { .my-placeholder {
font-weight: 400; font-weight: 400;
font-size: 32rpx; font-size: 32rpx;

View File

@ -242,12 +242,12 @@
this.values = [] this.values = []
this.list.forEach(item => { this.list.forEach(item => {
if (item.checked) { if (item.checked) {
item.checked = false; item.checked = false
} }
}) })
this.lists.forEach(item => { this.lists.forEach(item => {
if (item.checked) { if (item.checked) {
item.checked = false; item.checked = false
} }
}) })
} }
@ -286,13 +286,13 @@
this.maxCo2 = res.data.maxCo2 this.maxCo2 = res.data.maxCo2
this.list.forEach(item => { this.list.forEach(item => {
if (res.data.singleNotice.includes(item.type.toString())) { if (res.data.singleNotice.includes(item.type.toString())) {
item.checked = true; item.checked = true
} }
}) })
this.value = res.data.singleNotice this.value = res.data.singleNotice
this.lists.forEach(item => { this.lists.forEach(item => {
if (res.data.multipleNotice.includes(item.type.toString())) { if (res.data.multipleNotice.includes(item.type.toString())) {
item.checked = true; item.checked = true
} }
}) })
this.values = res.data.multipleNotice this.values = res.data.multipleNotice

View File

@ -50,12 +50,9 @@
</view> </view>
</scroll-view> </scroll-view>
<tab-bar :indexs='1' style=""></tab-bar> <tab-bar :indexs='1' style=""></tab-bar>
<u-toast ref="uToast" /> <u-toast ref="uToast" />
</view> </view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
@ -76,7 +73,6 @@
}, },
onShow() { onShow() {
this.pagesum = 1 this.pagesum = 1
// this.list = []
this.ishave() this.ishave()
}, },
methods: { methods: {
@ -95,7 +91,6 @@
} }
}) })
}, },
// //
btnapiaryxq(id) { btnapiaryxq(id) {
uni.navigateTo({ uni.navigateTo({