This commit is contained in:
3321822538@qq.com 2024-05-16 18:01:54 +08:00
parent 85f3246a19
commit ca38c78719
2 changed files with 215 additions and 70 deletions

View File

@ -60,10 +60,18 @@
<image class=" image_7 image_13" src="../../static/蜂箱-蜂场预警.png"
v-if="item.warning_attendance" />
</view>
<!-- 按钮 -->
<view @click.stop="HiddenClick(item)" class="dianbox">
<image class="image_14" src="/static/16994974061914098024.png" />
<view class="" style="display: flex;">
<view class="shuaxin" @click="btnsx(item)">
<image src="https://api.ccttiot.com/smartmeter/img/static/uQyHxbK49U3S5f4uLU6m"
mode=""></image>
</view>
<view @click.stop="HiddenClick(item)" class="dianbox">
<image class="image_14" src="/static/16994974061914098024.png" />
</view>
</view>
</view>
<!-- 气泡框 -->
<view v-if="item.ShowHidden">
@ -86,22 +94,25 @@
</view>
<!-- 向上弹窗 -->
<u-popup :closeOnClickOverlay="false" :round="30" :show="flage" mode="center" :safeAreaInsetBottom="true" overlayOpacity="0.1">
<u-popup :closeOnClickOverlay="false" :round="30" :show="flage" mode="center"
:safeAreaInsetBottom="true" overlayOpacity="0.1">
<view class="popup-box">
<view class="popup-top-text popup-boder-m">
<view>重新命名</view>
<view @click="flageupdate">X</view>
</view>
<view class="popup-boder-m">
<u--input shape="circle" placeholder="请输入内容" border="surround" v-model="form.inputvalue" ></u--input>
<u--input shape="circle" placeholder="请输入内容" border="surround"
v-model="form.inputvalue"></u--input>
</view>
<view class="popup-button-b" >
<u-button @click="confirmname" color="#23693f" shape="circle" type="primary" text="确 定"></u-button>
<view class="popup-button-b">
<u-button @click="confirmname" color="#23693f" shape="circle" type="primary"
text="确 定"></u-button>
</view>
</view>
</u-popup>
<!-- <view class="xiugainame" v-if="flage">
<!-- <view class="xiugainame" v-if="flage">
<view class="mm">
<text>重新命名</text> <text @click="flageupdate">X</text>
</view>
@ -114,11 +125,12 @@
<view class="d-baseline">
<text class="font_4">{{item.qrcode}}</text>
<text class="font_4 text_6"> {{item.update_time}}</text>
<text class="font_4 text_7"></text>
<text class="font_4 text_8">{{item.address}}</text>
<view class="d-baseline" style="display: flex;">
<text class="font_4" style="padding-top: 20rpx;">{{item.qrcode}}</text>
<text class="font_4 text_6" style="padding-top: 20rpx;"> {{item.update_time}}</text>
<text class="font_4 text_7" style="padding-top: 20rpx;"></text>
<text class="font_4 text_8" style="padding-top: 20rpx;">{{item.address}}</text>
</view>
<view class="felx-99">
<!-- 重量 -->
@ -126,7 +138,9 @@
<view class="flex-taxt">
<image class=" image_15" src="../../static/重量.png" />
<text class="font_5 text_9 text-l">重量</text>
<text class=" font_5 text_13">{{item.weight_day_text}}</text>
<text class=" font_5 text_13"
v-if="item.weight_day_text">{{item.weight_day_text}}</text>
<text class=" font_5 text_13" v-else>{{item.weight_day}}</text>
</view>
<view class="flex-taxt">
<image class=" image_16" src="../../static/蜂箱-温度.png" />
@ -145,7 +159,9 @@
<view class="flex-taxt">
<image class=" image_15" src="../../static/蜂箱-出勤.png" />
<text class="font_5 text_9 text-l">出勤</text>
<text class=" font_5 text_13">{{item.attendance_day_text}}</text>
<text class=" font_5 text_13"
v-if="item.attendance_day_text">{{item.attendance_day_text}}</text>
<text class=" font_5 text_13" v-else>{{item.attendance_day}}</text>
</view>
<view class="flex-taxt">
<image class=" image_16" src="../../static/蜂箱-温度.png" />
@ -224,6 +240,11 @@
</view>
</view>
<!-- 加载状态 -->
<!-- <view class="maskgun" v-if="maskgun"></view> -->
</view>
</template>
@ -233,6 +254,8 @@
components: {},
data() {
return {
maskgun: false,
curren: '',
qrcodevalue: '', //
fengzhongcolumns: [
@ -271,16 +294,16 @@
onShow() {
uni.showLoading({
title: '加载中...',
mask: true,
success: function () {
//
},
title: '加载中...',
mask: true,
success: function() {
//
},
});
this.loadData();
setTimeout(()=>{
uni.hideLoading()
},1000)
setTimeout(() => {
uni.hideLoading()
}, 1000)
},
onHide() {
uni.removeStorageSync('targetId');
@ -289,7 +312,9 @@
},
onPullDownRefresh() {
// this.listData = []
this.loadData();
setTimeout(() => {
this.loadData();
}, 2000)
},
watch: {
id(newId, oldId) {
@ -298,13 +323,12 @@
}
},
methods: {
backToTop() {
// console.log(1);
uni.pageScrollTo({
scrollTop: 0, //
duration: 1 // ms
});
} ,
backToTop() {
uni.pageScrollTo({
scrollTop: 0, //
duration: 1 // ms
});
},
async loadData() {
//
await this.getfengchangList();
@ -342,7 +366,21 @@
if (this.switchk) {
this.switchk = false
request.post('/api/beehive/fanSwitch/' + item, {}).then(res => {
this.refresh()
// this.refresh()
request.get('/api/beehive/detail/' + item, {}).then(res => {
const newData = res.data.data; //
// id
const existingItem = this.listData.find(item => item.id === newData.id);
if (existingItem) {
//
const index = this.listData.indexOf(existingItem);
this.listData.splice(index, 1, newData); //
} else {
//
this.listData.push(newData);
}
// console.log(this.listData, 101010);
})
this.$nextTick(() => {
uni.showToast({
icon: "none",
@ -354,6 +392,48 @@
})
}
},
//
btnsx(item) {
if (item.status_text == '在线') {
uni.showLoading({
mask: false
})
request.get('/api/beehive/detail/' + item.id, {}).then(res => {
const newData = res.data.data;
const existingItem = this.listData.find(item => item.id === newData.id);
if (existingItem) {
//
const index = this.listData.indexOf(existingItem);
this.listData.splice(index, 1, newData);
} else {
this.listData.push(newData);
}
// uni.hideLoading()
})
setTimeout(() => {
uni.hideLoading()
setTimeout(() => {
request.get('/api/beehive/detail/' + item.id, {}).then(res => {
const newData = res.data.data;
const existingItem = this.listData.find(item => item.id === newData
.id);
if (existingItem) {
//
const index = this.listData.indexOf(existingItem);
this.listData.splice(index, 1, newData);
} else {
this.listData.push(newData);
}
})
}, 500)
}, 4000)
} else {
uni.showToast({
icon: "none",
title: '设备不在线',
})
}
},
fenlampbuts(item) {
uni.showLoading({
title: '加载中',
@ -376,7 +456,21 @@
this.switchk = false
request.post('/api/beehive/heatSwitch/' + item, {}).then(res => {
// this.getfengchangList()
this.refresh()
// this.refresh()
request.get('/api/beehive/detail/' + item, {}).then(res => {
const newData = res.data.data; //
// id
const existingItem = this.listData.find(item => item.id === newData.id);
if (existingItem) {
//
const index = this.listData.indexOf(existingItem);
this.listData.splice(index, 1, newData); //
} else {
//
this.listData.push(newData);
}
console.log(this.listData, 101010);
})
this.$nextTick(() => {
uni.showToast({
icon: "none",
@ -385,10 +479,13 @@
})
this.switchk = true
uni.hideLoading()
this.maskgun = false
})
}
},
warmbuts(item) {
console.log(item);
this.maskgun = true
uni.showLoading({
title: '操作中',
mask: true
@ -405,6 +502,7 @@
this.warmbut(item.id)
}
},
switch1Change: function(e) {
e.detail.value = false
},
@ -484,7 +582,23 @@
})
request.post('/api/beehive/removePeel/' + item.id, {}).then(res => {
uni.hideLoading()
that.loadData()
// that.loadData()
request.get('/api/beehive/detail/' + item.id, {}).then(res => {
const newData = res.data.data; //
// id
const existingItem = this.listData.find(item => item.id ===
newData.id);
if (existingItem) {
//
const index = this.listData.indexOf(existingItem);
this.listData.splice(index, 1,
newData); //
} else {
//
this.listData.push(newData);
}
console.log(this.listData, 101010);
})
uni.showToast({
icon: "none",
title: res.data.msg
@ -614,7 +728,7 @@
qrcode
}
}).then(res => {
wx.setStorageSync('user_id', res.data.data[0].user_id);
wx.setStorageSync('user_id', res.data.data[0].user_id);
this.listData = JSON.parse(JSON.stringify(res.data.data))
wx.pageScrollTo({
scrollTop: 0,
@ -677,10 +791,32 @@
</script>
<style scoped lang="scss">
/deep/ .u-popup__content{
/deep/ .u-popup__content {
width: 750rpx;
}
.maskname{
.shuaxin {
width: 32rpx;
height: 32rpx;
image {
width: 100%;
height: 100%;
}
}
.maskgun {
width: 100%;
height: 100vh;
position: fixed;
background-color: #ccc;
opacity: .5;
top: 0;
left: 0;
z-index: 99;
}
.maskname {
position: fixed;
top: 0;
left: 0;
@ -690,7 +826,8 @@
background-color: #000;
opacity: .1;
}
.xiugainame{
.xiugainame {
width: 750rpx;
height: 564rpx;
background-color: #fff;
@ -701,12 +838,14 @@
z-index: 99;
padding: 50rpx;
box-sizing: border-box;
.mm{
.mm {
display: flex;
justify-content: space-between;
margin-top: 10rpx;
}
input{
input {
margin-top: 90rpx;
padding-left: 30rpx;
box-sizing: border-box;
@ -721,7 +860,8 @@
left: 50%;
transform: translateX(-50%);
}
.btn{
.btn {
width: 100%;
height: 72rpx;
margin-top: 270rpx;
@ -733,6 +873,7 @@
color: #fff;
}
}
.loading {
z-index: 10074;
width: 224rpx;
@ -819,6 +960,7 @@
text-align: center;
width: 100rpx;
height: 50rpx;
}
//
@ -1075,9 +1217,10 @@
}
.image_14 {
margin-top: 20rpx;
margin-top: 10rpx;
width: 45rpx;
height: 13rpx;
vertical-align: top;
}
.view_2 {
@ -1085,7 +1228,7 @@
}
.font_4 {
font-size: 20rpx;
font-size: 24rpx;
font-family: 微软雅黑;
line-height: 15rpx;
color: #888888;

View File

@ -25,7 +25,7 @@
<text class="self-start text_5">24H</text>
</view>
<!-- 22 -->
<text class="self-start text_3 text_4 ml-19">{{formData.warning_count}}</text>
<text class="self-start text_3 text_4 ml-19">{{formData.warning_count == undefined ? 0 : formData.warning_count}}</text>
<!-- 左上的箭头 -->
<image class="ml-28 self-start image_8 image_9" src="../../static/shouye-you.png" />
</view>
@ -36,13 +36,13 @@
<text class="font_3 text_8 padding-top-bootm">电量不足</text>
<text
:id="formData.battery_low_count < 1 ? 'color-text-shu1' : formData.battery_low_count < 5 ? 'color-text-shu2' : 'color-text-shu3'"
class="font_5 text_12">{{formData.battery_low_count}}</text>
class="font_5 text_12">{{formData.battery_low_count == undefined ? 0 : formData.battery_low_count}}</text>
</view>
<view class="flex-row group_5 tac-dainlaing">
<text class="ml-30 font_3 text_9 padding-top-bootm">震动异常</text>
<text
:id="formData.shake_count < 1 ? 'color-text-shu1' : formData.shake_count < 5 ? 'color-text-shu2' : 'color-text-shu3'"
class="ml-68 font_5">{{formData.shake_count}}</text>
class="ml-68 font_5">{{formData.shake_count == undefined ? 0 : formData.shake_count}}</text>
</view>
</view>
@ -51,13 +51,13 @@
<text class="font_3 text_13 padding-top-bootm">出勤异常</text>
<text
:id="formData.work_count < 1 ? 'color-text-shu1' : formData.work_count < 5 ? 'color-text-shu2' : 'color-text-shu3'"
class="font_5 ml-67">{{formData.work_count}}</text>
class="font_5 ml-67">{{formData.work_count== undefined ? 0 :formData.work_count}}</text>
</view>
<view class="flex-row group_5 tac-dainlaing">
<text class="font_3 ml-31 padding-top-bootm">重量异常</text>
<text
:id="formData.weight_count < 1 ? 'color-text-shu1' : formData.weight_count < 5 ? 'color-text-shu2' : 'color-text-shu3'"
class="font_5 text_14">{{formData.weight_count}}</text>
class="font_5 text_14">{{formData.weight_count== undefined ? 0 :formData.weight_count}}</text>
</view>
</view>
@ -66,13 +66,13 @@
<text class="font_3 text_16 padding-top-bootm">温度异常</text>
<text
:id="formData.temperature_count < 1 ? 'color-text-shu1' : formData.temperature_count < 5 ? 'color-text-shu2' : 'color-text-shu3'"
class="font_5 text_19">{{formData.temperature_count}}</text>
class="font_5 text_19">{{formData.temperature_count== undefined ? 0 :formData.temperature_count}}</text>
</view>
<view class="flex-row group_7 tac-dainlaing">
<text class="font_3 text_17 ml-31 padding-top-bootm">湿度异常</text>
<text
:id="formData.humidity_count < 1 ? 'color-text-shu1' : formData.humidity_count < 5 ? 'color-text-shu2' : 'color-text-shu3'"
class="font_5 text_20 ml-61">{{formData.humidity_count}}</text>
class="font_5 text_20 ml-61">{{formData.humidity_count== undefined? 0 :formData.humidity_count}}</text>
</view>
</view>
@ -94,7 +94,7 @@
<view class="top-jinbaoqi" @click="topage(1)">
<view class="mt-8 flex-row tac-dainlaing">
<text class="font text_6 padding-top-bootm">蜂箱数量</text>
<text class="self-center font_4 text_3 text_10">{{formData.beehive_count}}</text>
<text class="self-center font_4 text_3 text_10">{{formData.beehive_count==undefined?0:formData.beehive_count}}</text>
</view>
<view class="mt-8 flex-row tac-dainlaing">
@ -111,7 +111,7 @@
<view class="flex-row items-center tac-dainlaing">
<image class="image_12" src="../../static/shouye-fangchang-shuliang.png" />
<text class="font padding-top-bootm">蜂场数量</text>
<text class="font_4 text_3 text_10 padding-top-bootm">{{formData.apiary_count}}</text>
<text class="font_4 text_3 text_10 padding-top-bootm">{{formData.apiary_count==undefined?0:formData.apiary_count}}</text>
</view>
<!-- -->
<view class="ml-18 flex-col items-end">
@ -123,19 +123,19 @@
</view> -->
</view>
<view class="font_2 text_15 mt-13 hg-num" v-if="formData.apiary_data[0]">
<view>{{formData.apiary_data[0].name}}</view>
<view>{{formData.apiary_data[0].name==undefined?0:formData.apiary_data[0].name}}</view>
<view class="taxt-wen"></view>
<view class="taxt-wen-1">{{formData.apiary_data[0].count}}</view>
<view class="taxt-wen-1">{{formData.apiary_data[0].count==undefined?0:formData.apiary_data[0].count}}</view>
</view>
<view class="font_2 text_15 mt-13 hg-num" v-if="formData.apiary_data[1]">
<view>{{formData.apiary_data[1].name}}</view>
<view>{{formData.apiary_data[1].name==undefined?0:formData.apiary_data[1].name}}</view>
<view class="taxt-wen"></view>
<view class="taxt-wen-1">{{formData.apiary_data[1].count}}</view>
<view class="taxt-wen-1">{{formData.apiary_data[1].count==undefined?0:formData.apiary_data[1].count}}</view>
</view>
<view class="font_2 text_15 mt-13 hg-num" v-if="formData.apiary_data[2]">
<view>{{formData.apiary_data[2].name}}</view>
<view>{{formData.apiary_data[2].name==undefined?0:formData.apiary_data[2].name}}</view>
<view class="taxt-wen"></view>
<view class="taxt-wen-1">{{formData.apiary_data[2].count}}</view>
<view class="taxt-wen-1">{{formData.apiary_data[2].count==undefined?0:formData.apiary_data[2].count}}</view>
</view>
</view>
@ -145,8 +145,8 @@
<!-- 卡片图表 -->
<!-- 柱状 -->
<view @click="chuqingbianhua" class="xin-box" style="margin-top: 20rpx;">
<view class="xin-box-title">
<view class="xin-box" style="margin-top: 20rpx;">
<view class="xin-box-title" @click="chuqingbianhua" v-if="logoflag">
<view style="flex: 1;display: flex;align-items: center;">
<image style="width: 40rpx;height: 40rpx;"
src="../../static/e5e18447349367492c81f64ccec7ebcb.png"></image>
@ -154,14 +154,14 @@
</view>
<image class="image_8 image_13 padding-top-bootm" src="../../static/shouye-you.png" />
</view>
<view class="charts-box">
<qiun-data-charts type="column" :opts="optsZhu" :chartData="chartDataZhu" :errorShow="false"
:errorReload="false" :animation="false" :tooltipShow="false" :tapLegend="false" />
<view class="charts-box" >
<qiun-data-charts v-if="logoflag" type="column" :opts="optsZhu" :chartData="chartDataZhu" :errorShow="false" :errorReload="false" :animation="false" :tooltipShow="false" :tapLegend="false" />
<view class="" v-else style="color: #ccc;font-size: 36rpx;width: 100%;text-align: center;margin-top: 50rpx;">暂无蜂箱...</view>
</view>
</view>
<!-- 折线 -->
<view @click="zhongliangbianhua" class="xin-box">
<view class="xin-box-title">
<view class="xin-box" v-if="logoflag">
<view class="xin-box-title" @click="zhongliangbianhua" v-if="logoflag">
<view style="flex: 1;display: flex;align-items: center;">
<image style="width: 40rpx;height: 40rpx;" src="../../static/kg.png"></image>
<text style="margin-left: 10rpx;">近7天蜂箱总重量变化(KG)</text>
@ -169,12 +169,10 @@
<image class="image_8 image_13 padding-top-bootm" src="../../static/shouye-you.png" />
</view>
<view class="charts-box">
<qiun-data-charts type="line" :opts="optsZhe" :chartData="chartDataZhe" :animation="false"
:tooltipShow="false" :tapLegend="false" />
<qiun-data-charts v-if="logoflag" type="line" :opts="optsZhe" :chartData="chartDataZhe" :animation="false" :tooltipShow="false" :tapLegend="false" />
<view class="" v-else style="color: #ccc;font-size: 36rpx;width: 100%;text-align: center;margin-top: 50rpx;">暂无蜂箱...</view>
</view>
</view>
</view>
</view>
</view>
@ -188,6 +186,7 @@
props: {},
data() {
return {
logoflag:true,
showloading: false,
uchartsData: {}, // ucharts
formData: {}, //
@ -516,8 +515,10 @@
this.formData = {
...res.data.data
}
this.logoflag = true
// console.log(this.formData,'101010')
} catch (error) {
this.logoflag = false
// setTimeout(()=> {
// wx.navigateTo({
// url: '/pages/login/index'
@ -622,7 +623,8 @@
7)] // Y
}]
};
this.chartDataZhu = JSON.parse(JSON.stringify(res));
this.chartDataZhu = JSON.parse(JSON.stringify(res));
console.log(this.chartDataZhu, '柱状图数据');
}else{
let res = {