This commit is contained in:
3321822538@qq.com 2024-06-07 10:34:42 +08:00
parent 1823955f5c
commit e24c96d280

View File

@ -1,250 +1,252 @@
<template>
<!-- 蜂箱目录 -->
<view class=" page">
<!-- <view class="loading" v-if="showloading">
<view class="loading_box">
<u-loading-icon color='#fff'></u-loading-icon>
<text>loading...</text>
</view>
</view> -->
<!-- <view class="tip_box">
<div class="tip">
<div class="txt">请将该蜂场所有蜂箱移迁后再进行此操作</div>
<div class="button">返回</div>
</div>
</view>
<u-overlay :show="show" ></u-overlay> -->
<!-- <u-toast ref="uToast"></u-toast> -->
<view class="padding-box">
<view class="serachtab-box">
<view class="scan-box">
<view class="section_3">
<view class="text_3 search-box">
<image @click="aweepClick" class="image_6 image-text-tu" src="../../static/扫描.png" />
<input type="text" v-model="qrcodevalue" @input="searchFn" placeholder="蜂箱(自定义)编号搜索" />
</view>
</view>
<image @click="xinzeng" class="scan-img" src="/static/新增蜂箱.png" />
</view>
<view class="tabs">
<u-tabs :list="tabitems" @click="clicktabs($event)" :current='currentindex'></u-tabs>
<view class="" style="background-color: #f7f7f7;height: 100vh;">
<view class="page">
<!-- <view class="loading" v-if="showloading">
<view class="loading_box">
<u-loading-icon color='#fff'></u-loading-icon>
<text>loading...</text>
</view>
</view> -->
<!-- <view class="tip_box">
<div class="tip">
<div class="txt">请将该蜂场所有蜂箱移迁后再进行此操作</div>
<div class="button">返回</div>
</div>
</view>
<!-- listData.length > 0 -->
<view v-if="listData.length > 0 " style="margin-top: 130rpx;">
<view class=" group_6">
<view class="space-y-13">
<view class="list-item" v-for="(item, index) in listData" :key="index">
<view class="group_7 bianhao-top-yi">
<view class="bianhao-zuo">
<text class="font_2" @click="detilsq(item)">{{item.name}}</text>
<view class=" text-wrapper"
:id="item.status_text == '在线' ? 'text-wrapper-bgc1' : 'text-wrapper-bgc2'">
<text class="font_33" @click="detilsq(item)">{{item.status_text}}</text>
<!-- <text class="font_3">在线</text> -->
</view>
<image v-if="item.warning_battery_low" @click="addyujings(item)" class=" image_7 image_8"
src="../../static/蜂箱-电量预警.png" />
<image v-if="item.warning_shake" @click="addyujings(item)" class=" image_7 image_9"
src="../../static/蜂箱-震动预警.png" />
<image v-if="item.warning_temperature" @click="addyujings(item)" class=" image_7 image_10"
src="../../static/蜂箱-温度预警.png" />
<image v-if="item.warning_humidity" @click="addyujings(item)" class=" image_7 image_11"
src="../../static/蜂箱-湿度预警.png" />
<image v-if="item.warning_weight" @click="addyujings(item)" class=" image_7 image_12"
src="../../static/蜂箱-重量预警.png" />
<image class=" image_7 image_13" @click="addyujings(item)" src="../../static/蜂箱-蜂场预警.png"
v-if="item.warning_attendance" />
</view>
<!-- 按钮 -->
<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>
<u-overlay :show="show" ></u-overlay> -->
<!-- <u-toast ref="uToast"></u-toast> -->
<view class="padding-box">
<view class="serachtab-box">
<view class="scan-box">
<view class="section_3">
<view class="text_3 search-box">
<image @click="aweepClick" class="image_6 image-text-tu" src="../../static/扫描.png" />
<input type="text" v-model="qrcodevalue" @input="searchFn" placeholder="蜂箱(自定义)编号搜索" />
</view>
<!-- 气泡框 -->
<view v-if="item.ShowHidden">
<view class="arrivalNavigation">
<!-- <view class="d4"></view> -->
<view class="sideNavigation">
<view class="pop-text">
<view @click="detils(item)">查看详情</view>
<view @click="addyujing(item)">查看预警</view>
<view @click="hiveTare(item)">重量去皮</view>
<view @click="anewname(item)">重新命名</view>
<view @click="migrtionHive(item)">迁移蜂场</view>
<view @click="deleteHive(item)">删除蜂箱</view>
<view @click="fenx(item)">分享蜂箱</view>
</view>
<image @click="xinzeng" class="scan-img" src="/static/新增蜂箱.png" />
</view>
<view class="tabs">
<u-tabs :list="tabitems" @click="clicktabs($event)" :current='currentindex'></u-tabs>
</view>
</view>
<!-- listData.length > 0 -->
<view v-if="listData.length > 0" style="margin-top: 130rpx;">
<view class=" group_6">
<view class="space-y-13">
<view class="list-item" @scrolltolower="onReachBottom" v-for="(item, index) in listData" :key="index">
<view class="group_7 bianhao-top-yi">
<view class="bianhao-zuo">
<text class="font_2" @click="detilsq(item)">{{item.name}}</text>
<view class=" text-wrapper"
:id="item.status_text == '在线' ? 'text-wrapper-bgc1' : 'text-wrapper-bgc2'">
<text class="font_33" @click="detilsq(item)">{{item.status_text}}</text>
<!-- <text class="font_3">在线</text> -->
</view>
<image v-if="item.warning_battery_low" @click="addyujings(item)" class=" image_7 image_8"
src="../../static/蜂箱-电量预警.png" />
<image v-if="item.warning_shake" @click="addyujings(item)" class=" image_7 image_9"
src="../../static/蜂箱-震动预警.png" />
<image v-if="item.warning_temperature" @click="addyujings(item)" class=" image_7 image_10"
src="../../static/蜂箱-温度预警.png" />
<image v-if="item.warning_humidity" @click="addyujings(item)" class=" image_7 image_11"
src="../../static/蜂箱-湿度预警.png" />
<image v-if="item.warning_weight" @click="addyujings(item)" class=" image_7 image_12"
src="../../static/蜂箱-重量预警.png" />
<image class=" image_7 image_13" @click="addyujings(item)" src="../../static/蜂箱-蜂场预警.png"
v-if="item.warning_attendance" />
</view>
<!-- 按钮 -->
<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">
<view class="arrivalNavigation">
<!-- <view class="d4"></view> -->
<view class="sideNavigation">
<view class="pop-text">
<view @click="detils(item)">查看详情</view>
<view @click="addyujing(item)">查看预警</view>
<view @click="hiveTare(item)">重量去皮</view>
<view @click="anewname(item)">重新命名</view>
<view @click="migrtionHive(item)">迁移蜂场</view>
<view @click="deleteHive(item)">删除蜂箱</view>
<view @click="fenx(item)">分享蜂箱</view>
</view>
</view>
</view>
<!-- 遮罩层 -->
<view @click.stop="tanceng(item)" class="mask-box"></view>
</view>
<!-- 向上弹窗 -->
<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>
</view>
<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="mm">
<text>重新命名</text> <text @click="flageupdate">X</text>
</view>
<input type="text" v-model="form.inputvalue"/>
<view class="btn" @click="confirmname">
确定
</view>
</view>
<view class="maskname" v-if="flage"></view> -->
<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">
<!-- 重量 -->
<view class="group_7 view_3">
<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"
v-if="item.weight_day_text">{{item.weight_day_text == '-0' ? 0 : 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" />
<text class="font_5 text_9 text-l">箱内</text>
<text class=" font_5 text_13">{{item.temperature_in_box.substring(0, 3) < -40 || item.temperature_in_box.substring(0, 3) > 100 ? '--' : item.temperature_in_box}}</text>
</view>
<view class="flex-taxt">
<image class=" image_17" src="../../static/蜂箱-湿度.png" />
<text class="font_5 text_9 text-l">箱内</text>
<text class=" font_5 text_13">{{item.temperature_in_box.substring(0, 3) < -40 || item.temperature_in_box.substring(0, 3) > 100? '--' : item.humidity_in_box}}</text>
</view>
</view>
<!-- 箱内温度 -->
<view class="group_7 view_3">
<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"
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" />
<text class="font_5 text_9 text-l">箱外</text>
<text class=" font_5 text_13">{{item.temperature_out_box.substring(0, 3) < -40 || item.temperature_out_box.substring(0, 3) > 100 ? '--' : item.temperature_out_box}}</text>
</view>
<view class="flex-taxt">
<image class=" image_17" src="../../static/蜂箱-湿度.png" />
<text class="font_5 text_9 text-l">箱外</text>
<text class=" font_5 text_13">{{item.temperature_out_box.substring(0, 3) < -40 || item.temperature_out_box.substring(0, 3) > 100 ? '--' :item.humidity_out_box}}</text>
</view>
</view>
<!-- 箱内湿度 -->
<view class="group_7 view_3">
<view class="flex-taxt1">
<image class=" image_15" src="../../static/蜂箱-电量.png" />
<text class="font_5 text_9 text-l">电量</text>
<text class=" font_5 text_13">{{item.battery}}</text>
</view>
<view class="group_8 space-x-6 flex-taxt2" @click="warmbuts(item)">
<image class=" image_19" src="../../static/加热.png" />
<text class="font_5">加热</text>
<switch @change="warmbut(item)" disabled="disabledflag"
:checked="item.heat == 1 ? true : false" class=" image_201"
:color="'#3a942b'" style="transform:scale(0.5)"/>
</view>
<view class="group_9 flex-taxt3" @click="fenlampbuts(item)">
<image class=" image_21" src="../../static/蜂箱-风扇.png" />
<text class="font_5 text_15">风扇</text>
<switch @change="fenlampbut(item,index)" disabled="disabledflag"
:checked="item.fan == 1 ? true : false" class=" image_201"
:color="'#3a942b'" style="transform:scale(0.5)" />
</view>
</view>
</view>
<!-- 遮罩层 -->
<view @click.stop="tanceng(item)" class="mask-box"></view>
</view>
<!-- 向上弹窗 -->
<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>
</view>
<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="mm">
<text>重新命名</text> <text @click="flageupdate">X</text>
</view>
<input type="text" v-model="form.inputvalue"/>
<view class="btn" @click="confirmname">
确定
</view>
</view>
<view class="maskname" v-if="flage"></view> -->
<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 class="warm-tip">
<!-- - 没有更多了, - -->
</view>
<view class="felx-99">
<!-- 重量 -->
<view class="group_7 view_3">
<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"
v-if="item.weight_day_text">{{item.weight_day_text == '-0' ? 0 : 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" />
<text class="font_5 text_9 text-l">箱内</text>
<text class=" font_5 text_13">{{item.temperature_in_box.substring(0, 3) < -40 || item.temperature_in_box.substring(0, 3) > 100 ? '--' : item.temperature_in_box}}</text>
</view>
<view class="flex-taxt">
<image class=" image_17" src="../../static/蜂箱-湿度.png" />
<text class="font_5 text_9 text-l">箱内</text>
<text class=" font_5 text_13">{{item.temperature_in_box.substring(0, 3) < -40 || item.temperature_in_box.substring(0, 3) > 100? '--' : item.humidity_in_box}}</text>
</view>
</view>
<!-- 箱内温度 -->
<view class="group_7 view_3">
<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"
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" />
<text class="font_5 text_9 text-l">箱外</text>
<text class=" font_5 text_13">{{item.temperature_out_box.substring(0, 3) < -40 || item.temperature_out_box.substring(0, 3) > 100 ? '--' : item.temperature_out_box}}</text>
</view>
<view class="flex-taxt">
<image class=" image_17" src="../../static/蜂箱-湿度.png" />
<text class="font_5 text_9 text-l">箱外</text>
<text class=" font_5 text_13">{{item.temperature_out_box.substring(0, 3) < -40 || item.temperature_out_box.substring(0, 3) > 100 ? '--' :item.humidity_out_box}}</text>
</view>
</view>
<!-- 箱内湿度 -->
<view class="group_7 view_3">
<view class="flex-taxt1">
<image class=" image_15" src="../../static/蜂箱-电量.png" />
<text class="font_5 text_9 text-l">电量</text>
<text class=" font_5 text_13">{{item.battery}}</text>
</view>
<view class="group_8 space-x-6 flex-taxt2" @click="warmbuts(item)">
<image class=" image_19" src="../../static/加热.png" />
<text class="font_5">加热</text>
<switch @change="warmbut(item)" disabled="disabledflag"
:checked="item.heat == 1 ? true : false" class=" image_201"
:color="'#3a942b'" style="transform:scale(0.5)"/>
</view>
<view class="group_9 flex-taxt3" @click="fenlampbuts(item)">
<image class=" image_21" src="../../static/蜂箱-风扇.png" />
<text class="font_5 text_15">风扇</text>
<switch @change="fenlampbut(item,index)" disabled="disabledflag"
:checked="item.fan == 1 ? true : false" class=" image_201"
:color="'#3a942b'" style="transform:scale(0.5)" />
</view>
</view>
</view>
</view>
<view class="warm-tip">
- 没有更多了, -
</view>
<!-- <view class=" section_3 space-y-7">
</view> -->
</view>
<!-- <view class=" section_3 space-y-7">
</view> -->
</view>
<!-- 空状态 -->
<view v-if="listData.length == 0" class="konghezi">
<u-empty mode="list" text="暂无蜂箱">
<view class="tjbutton">
<u-button @click="xinzeng" size="large" shape="circle" text="添 加" color="#23693f"></u-button>
</view>
</u-empty>
</view>
</view>
<!-- 空状态 -->
<view v-else class="konghezi">
<u-empty mode="list" text="暂无蜂箱">
<view class="tjbutton">
<u-button @click="xinzeng" size="large" shape="circle" text="添 加" color="#23693f"></u-button>
</view>
</u-empty>
<u-picker @cancel="showfengzhong=false" @confirm="confirmfengzhong" :show="showfengzhong"
:columns="fengzhongcolumns"></u-picker>
<!-- 二维码展示 -->
<view class="mask"
style="position: fixed;top: 0;left: 0;width: 100%;height: 100vh;background-color: #fff;z-index: 98;text-align: center;"
v-if="ewmflag" @click="ewmflag = false">
<view class="ewm" style="margin-top: 400rpx;z-index: 99;">
<image :src="ewmpic" mode=""></image>
</view>
<view class="" @click="ewmflag = false"
style="width: 200rpx;text-align: center;height: 80rpx;line-height: 80rpx;border: 1px solid #333;margin: auto;margin-top: 50rpx;">
关闭分享
</view>
</view>
<!-- 加载状态 -->
<!-- <view class="maskgun" v-if="maskgun"></view> -->
</view>
<u-picker @cancel="showfengzhong=false" @confirm="confirmfengzhong" :show="showfengzhong"
:columns="fengzhongcolumns"></u-picker>
<!-- 二维码展示 -->
<view class="mask"
style="position: fixed;top: 0;left: 0;width: 100%;height: 100vh;background-color: #fff;z-index: 98;text-align: center;"
v-if="ewmflag" @click="ewmflag = false">
<view class="ewm" style="margin-top: 400rpx;z-index: 99;">
<image :src="ewmpic" mode=""></image>
</view>
<view class="" @click="ewmflag = false"
style="width: 200rpx;text-align: center;height: 80rpx;line-height: 80rpx;border: 1px solid #333;margin: auto;margin-top: 50rpx;">
关闭分享
</view>
</view>
<!-- 加载状态 -->
<!-- <view class="maskgun" v-if="maskgun"></view> -->
</view>
</template>
@ -288,7 +290,9 @@
ewmpic: '',
ewmflag: false,
disabledflag: false,
tokenflag: false
tokenflag: false,
total:0,
showflag:false
};
},
@ -726,21 +730,44 @@
})
},
onReachBottom() {
let sum = this.total / 15
if (this.page - 1 < sum) {
this.pageData(); //
} else {
uni.showToast({
title: '没有更多蜂箱了',
icon: 'none',
duration: 1000
});
}
},
//
async pageData(page, apiary_id, qrcode) {
await request.get('/api/beehive/index', {
uni.showLoading({
title: '加载中...',
})
await request.get('/api/beehive/index?page=' + this.page, {
params: {
page,
apiary_id,
qrcode
}
}).then(res => {
uni.hideLoading()
wx.setStorageSync('user_id', res.data.data[0].user_id);
this.listData = JSON.parse(JSON.stringify(res.data.data))
wx.pageScrollTo({
scrollTop: 0,
duration: 300
});
// this.listData = JSON.parse(JSON.stringify(res.data.data))
this.total = res.data.total
if (res.data.data.length > 0) {
//
this.listData = this.listData.concat(res.data.data)
this.page++
// uni.hideLoading()
}
// wx.pageScrollTo({
// scrollTop: 0,
// duration: 300
// });
//
wx.stopPullDownRefresh();
// this.$forceUpdate()
@ -790,6 +817,8 @@
// this.currentindex=
console.log('调用了', event);
console.log('调用了', this.tabitems);
this.page = 1
this.listData = []
if (event.index = 0) {
this.checkid = ''
this.currentindex = 0
@ -813,7 +842,6 @@
/deep/ .u-popup__content {
width: 750rpx;
}
.shuaxin {
width: 32rpx;
height: 32rpx;
@ -823,7 +851,7 @@
height: 100%;
}
}
.maskgun {
width: 100%;
height: 100vh;