758 lines
16 KiB
Vue
758 lines
16 KiB
Vue
<template>
|
||
<view class="page">
|
||
<u-navbar :title="title" :border-bottom="false" :background="bgc" title-color='#000' title-size='36'
|
||
:title-bold='true' height='45' id="navbar">
|
||
</u-navbar>
|
||
<view class="top">
|
||
<view class="top_left">
|
||
{{apiaryName}}
|
||
</view>
|
||
<view class="top_right" @click="showmiyuan = true">
|
||
其他蜂场 <view class="iconfont icon-xiangyou1" style="font-size: 40rpx;">
|
||
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="cont_box">
|
||
<view class="left">
|
||
<view class="left_cont_box" v-for="(item, index) in tabs" :key="index"
|
||
@click="changeTag(index,item.type)" :class="currentIndex === index ? 'act4' : ''">
|
||
<view class="left_cont" :class="[
|
||
index=== currentIndex? 'act1' : '',
|
||
index + 1 === currentIndex? 'act2' : '',
|
||
index- 1 === currentIndex? 'act3' : ''
|
||
]">
|
||
{{item.title}}
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<scroll-view class="right" v-if="wuflag" scroll-y="true" @scrolltolower="loadMore">
|
||
<view class="right_cont" v-for="(item,index) in rzlist" :key="index">
|
||
<view class="right_cont_top">
|
||
<view class="cont_left">
|
||
{{item.createTime}}
|
||
</view>
|
||
<view class="cont_right" v-if="item.type == 1">
|
||
换脾
|
||
</view>
|
||
<view class="cont_right" v-if="item.type == 2">
|
||
饲喂
|
||
</view>
|
||
<view class="cont_right" v-if="item.type == 3">
|
||
取蜜
|
||
</view>
|
||
<view class="cont_right" v-if="item.type == 4">
|
||
加脾
|
||
</view>
|
||
<view class="cont_right" v-if="item.type == 5">
|
||
除螨
|
||
</view>
|
||
<view class="cont_right" v-if="item.type == 6">
|
||
换王
|
||
</view>
|
||
<view class="cont_right" v-if="item.type == 7">
|
||
换位置
|
||
</view>
|
||
|
||
</view>
|
||
<view class="cont">
|
||
{{item.content}}
|
||
</view>
|
||
|
||
<view class="imgcont" v-if="item.picture != ''">
|
||
<view class="img_box" v-for="(val,indexs) in item.picture" :key="indexs" @click="btnimg(index)">
|
||
<image :src="val" mode="aspectFill"></image>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="log_info">
|
||
<view class="txt">
|
||
{{item.beehiveName}}
|
||
</view>
|
||
<view class="txt">
|
||
{{item.beehiveSn}}
|
||
</view>
|
||
</view>
|
||
<view class="log_work">
|
||
<view class="work_cont" @click="btnedit(item.id)">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uqvAxjb2kVb4s6Zrx5s8" mode="">
|
||
</image>
|
||
<view class="cont_xtx">
|
||
编辑
|
||
</view>
|
||
</view>
|
||
<view class="work_cont" style="margin-left: 34rpx;" @click="btndel(item.id)">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uWikdpHsjtd8ggSA49gS" mode=""
|
||
style="width: 27rpx;height: 30rpx;"> </image>
|
||
<view class="cont_xtx">
|
||
删除
|
||
</view>
|
||
</view>
|
||
|
||
</view>
|
||
</view>
|
||
|
||
</scroll-view>
|
||
|
||
<view class="no_cont" v-else>
|
||
<view class="img">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uUZ3MF84e3bKgwAei8Rz" mode=""></image>
|
||
</view>
|
||
<view class="txt">
|
||
当前暂无日志...
|
||
</view>
|
||
</view>
|
||
<view class="addtj" @click="btnadd">
|
||
<view class="">
|
||
添加日志
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<u-select v-model="showmiyuan" :list="fclist" title='选择蜂场' @confirm="confirmmy"></u-select>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
bgc: {
|
||
backgroundColor: " #F4FAF8",
|
||
},
|
||
showmiyuan: false,
|
||
title: "操作日志",
|
||
currentIndex: 0,
|
||
wuflag: false,
|
||
tabs: [{
|
||
title: '全部',
|
||
type: null
|
||
},
|
||
{
|
||
title: '换脾',
|
||
type: 1
|
||
},
|
||
{
|
||
title: '饲喂',
|
||
type: 2
|
||
},
|
||
{
|
||
title: '取蜜',
|
||
type: 3
|
||
},
|
||
{
|
||
title: '加牌',
|
||
type: 4
|
||
},
|
||
{
|
||
title: '除螨',
|
||
type: 5
|
||
},
|
||
{
|
||
title: '换王',
|
||
type: 6
|
||
},
|
||
{
|
||
title: '换位置',
|
||
type: 7
|
||
},
|
||
|
||
],
|
||
textValue: '',
|
||
currentCount: 0,
|
||
showxy: false,
|
||
apiaryId: '',
|
||
beehiveId: '',
|
||
pageNum: 1,
|
||
pageSize: 10,
|
||
rzlist: [],
|
||
fclist: [],
|
||
apiaryName: '',
|
||
type: null,
|
||
total: 0,
|
||
imglist: []
|
||
}
|
||
},
|
||
onLoad(option) {
|
||
// console.log(option);
|
||
this.apiaryId = option.apiaryId
|
||
this.apiaryName = option.name
|
||
},
|
||
onShow() {
|
||
this.pageNum = 1
|
||
this.rzlist = []
|
||
this.getfc()
|
||
this.getfxrz()
|
||
},
|
||
methods: {
|
||
// btnimg(index) {
|
||
// uni.previewImage({
|
||
// current: this.rzlist[index].picture,
|
||
// urls: this.rzlist[index].picture.map(item => item),
|
||
// success: function(res) {
|
||
// // 预览成功
|
||
// },
|
||
// fail: function(err) {
|
||
// // 预览失败
|
||
// console.log(err);
|
||
// }
|
||
// })
|
||
// },
|
||
// 编辑日志
|
||
btnedit(id){
|
||
uni.navigateTo({
|
||
url:'/pages/Apiary/addrizhi?id=' + id
|
||
})
|
||
},
|
||
// 删除日志
|
||
btndel(id){
|
||
this.$u.delete(`/farm/beehive/log/${id}`).then(res=>{
|
||
if(res.code == 200){
|
||
uni.showToast({
|
||
title: '删除成功',
|
||
icon: 'success',
|
||
duration: 1000
|
||
})
|
||
this.rzlist = this.rzlist.filter(item => item.id !== id)
|
||
}else{
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 1000
|
||
})
|
||
}
|
||
})
|
||
},
|
||
loadMore() {
|
||
if (this.rzlist.length < this.total) {
|
||
this.getfxrz()
|
||
} else {
|
||
uni.showToast({
|
||
title: '没有更多日志了',
|
||
icon: 'none',
|
||
duration: 1000
|
||
});
|
||
}
|
||
},
|
||
confirmmy(e) {
|
||
// this.rzlist = []
|
||
this.apiaryId = e[0].value
|
||
this.apiaryName = e[0].label
|
||
this.getfxrz()
|
||
},
|
||
btnadd() {
|
||
uni.navigateTo({
|
||
url: '/pages/Apiary/addrizhi'
|
||
})
|
||
},
|
||
|
||
// 查询蜂箱日志
|
||
getfxrz() {
|
||
let queryParams = {
|
||
pageNum: this.pageNum,
|
||
pageSize: this.pageSize,
|
||
withApiary: true,
|
||
apiaryId: this.apiaryId,
|
||
type: this.type
|
||
};
|
||
if (this.type == null) {
|
||
delete queryParams.type;
|
||
}
|
||
let queryString = Object.keys(queryParams).filter(key => queryParams[key] != null).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(queryParams[key])}`).join('&');
|
||
this.$u.get(`/farm/beehive/log/list?${queryString}`).then(res => {
|
||
if (res.code == 200) {
|
||
this.total = res.total
|
||
if (res.total < 1) {
|
||
this.wuflag = false
|
||
} else {
|
||
this.pageNum++
|
||
this.wuflag = true
|
||
if (this.type == null) {
|
||
this.rzlist = [...this.rzlist, ...res.rows.map(row => ({
|
||
...row,
|
||
picture: row.picture.split(',')
|
||
}))]
|
||
} else {
|
||
let existingBeehiveIds = new Set(this.rzlist.filter(row => row.type == this.type).map(row => row.id));
|
||
let filteredAndDeduplicatedNewRows = res.rows.filter(row => row.type == this.type).filter(row => !existingBeehiveIds.has(row.id)).map(row => ({
|
||
...row,
|
||
picture: row.picture.split(',')
|
||
}));
|
||
this.rzlist = [...this.rzlist.filter(row => row.type == this.type), ...filteredAndDeduplicatedNewRows]
|
||
}
|
||
}
|
||
}
|
||
})
|
||
},
|
||
// 请求蜂场
|
||
getfc() {
|
||
this.$u.get(`farm/apiary/listAll`).then(res => {
|
||
if (res.code == 200) {
|
||
this.fclist = res.data.map(item => ({
|
||
value: item.apiaryId,
|
||
label: item.name
|
||
}))
|
||
}
|
||
})
|
||
},
|
||
|
||
hidePlaceholder() {
|
||
this.placeholderVisible = false;
|
||
},
|
||
showPlaceholder() {
|
||
if (!this.textValue) {
|
||
this.placeholderVisible = true;
|
||
}
|
||
},
|
||
updateWordCount() {
|
||
this.currentCount = this.textValue.trim().replace(/\s+/g, '').length;
|
||
},
|
||
btn() {
|
||
let _this = this
|
||
let math = 'static/' + _this.$u.guid(20)
|
||
uni.chooseImage({
|
||
count: 9,
|
||
type: 'all',
|
||
success(res) {
|
||
let tempFilePaths = res.tempFiles
|
||
wx.uploadFile({
|
||
url: 'https://up-z2.qiniup.com',
|
||
name: 'file',
|
||
filePath: tempFilePaths[0].path,
|
||
formData: {
|
||
token: _this.token, //后端返回的token
|
||
key: 'smartmeter/img/' + math
|
||
},
|
||
success: function(res) {
|
||
console.log(res, 'resres');
|
||
let str = JSON.parse(res.data)
|
||
console.log(str.key)
|
||
_this.userImgs = _this.upurl + '/' + str.key
|
||
console.log(_this.userImgs)
|
||
_this.imglist.push(_this.userImgs)
|
||
}
|
||
});
|
||
}
|
||
})
|
||
},
|
||
changeTag(idx, type) {
|
||
if(idx == 0){
|
||
this.rzlist = []
|
||
}
|
||
this.pageNum = 1
|
||
this.type = type
|
||
this.currentIndex = idx
|
||
this.getfxrz()
|
||
},
|
||
ClickImage(PhotoAddress) {
|
||
uni.previewImage({
|
||
urls: [PhotoAddress], //需要预览的图片http链接列表,多张的时候,url直接写在后面就行了
|
||
current: '', // 当前显示图片的http链接,默认是第一个
|
||
success: function(res) {},
|
||
fail: function(res) {},
|
||
complete: function(res) {},
|
||
})
|
||
},
|
||
|
||
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
page {
|
||
background-color: #F4FAF8;
|
||
}
|
||
|
||
.addtj {
|
||
width: 100%;
|
||
height: 200rpx;
|
||
// background-color: #FFCC25;
|
||
// background-color: #fff;
|
||
text-align: center;
|
||
line-height: 90rpx;
|
||
position: fixed;
|
||
left: 220rpx;
|
||
bottom: 0;
|
||
font-size: 36rpx;
|
||
padding-left: 80rpx;
|
||
padding-top: 30rpx;
|
||
box-sizing: border-box;
|
||
view{
|
||
width: 336rpx;
|
||
height: 88rpx;
|
||
background-color: #FFCC25;
|
||
text-align: center;
|
||
line-height: 88rpx;
|
||
color: #fff;
|
||
border-radius: 10rpx;
|
||
}
|
||
}
|
||
|
||
.page {
|
||
// position: relative;
|
||
width: 750rpx;
|
||
|
||
.no_cont {
|
||
margin: 152rpx auto 0;
|
||
width: 432rpx;
|
||
|
||
.img {
|
||
image {
|
||
width: 432rpx;
|
||
height: 432rpx;
|
||
}
|
||
}
|
||
|
||
.txt {
|
||
margin-top: 50rpx;
|
||
width: 100%;
|
||
text-align: center;
|
||
font-weight: 500;
|
||
font-size: 32rpx;
|
||
color: #808080;
|
||
}
|
||
}
|
||
|
||
.set_log_box {
|
||
padding: 50rpx 56rpx;
|
||
|
||
.btn {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
position: fixed;
|
||
left: 58rpx;
|
||
bottom: 68rpx;
|
||
width: 638rpx;
|
||
height: 88rpx;
|
||
background: #FFCC25;
|
||
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
||
font-weight: 500;
|
||
font-size: 32rpx;
|
||
color: #FFFFFF;
|
||
}
|
||
|
||
.xy {
|
||
margin-top: 46rpx;
|
||
width: 100%;
|
||
display: flex;
|
||
flex-wrap: nowrap;
|
||
align-items: center;
|
||
justify-content: center;
|
||
|
||
.yuans {
|
||
margin-top: 2rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 34rpx;
|
||
height: 34rpx;
|
||
border-radius: 50%;
|
||
border: #808080 solid 2rpx;
|
||
|
||
image {
|
||
width: 100%;
|
||
height: 100%;
|
||
border-radius: 50%;
|
||
}
|
||
}
|
||
|
||
.txt {
|
||
margin-left: 10rpx;
|
||
font-weight: 400;
|
||
font-size: 28rpx;
|
||
color: #808080;
|
||
|
||
span {
|
||
color: #3D3D3D;
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
.input-container {
|
||
position: relative;
|
||
width: 612rpx;
|
||
height: 172rpx;
|
||
background: #FFFFFF;
|
||
box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(42, 130, 228, 0.1);
|
||
border-radius: 20rpx;
|
||
margin-top: 40rpx;
|
||
overflow: hidden;
|
||
padding-right: 38rpx;
|
||
box-sizing: border-box;
|
||
border: 2rpx solid #C7C7C7;
|
||
}
|
||
|
||
.placeholder {
|
||
position: absolute;
|
||
top: 18rpx;
|
||
left: 38rpx;
|
||
color: #999;
|
||
/* placeholder颜色 */
|
||
pointer-events: none;
|
||
/* 确保点击事件可以穿透到textarea上 */
|
||
}
|
||
|
||
.custom-textarea {
|
||
width: 100%;
|
||
height: 100%;
|
||
/* 设置一个合适高度 */
|
||
padding-top: 18rpx;
|
||
/* 为placeholder留出空间 */
|
||
padding-left: 38rpx;
|
||
box-sizing: border-box;
|
||
border: 1px solid #ccc;
|
||
}
|
||
|
||
.word-count {
|
||
position: absolute;
|
||
right: 10px;
|
||
bottom: 10px;
|
||
font-size: 12px;
|
||
color: #999;
|
||
}
|
||
|
||
.icon {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
align-items: center;
|
||
margin-top: 40rpx;
|
||
|
||
.imgbox {
|
||
width: 33%;
|
||
|
||
image {
|
||
width: 222rpx;
|
||
height: 222rpx;
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
.tit {
|
||
font-weight: 600;
|
||
font-size: 36rpx;
|
||
color: #3D3D3D;
|
||
}
|
||
|
||
.set_type_box {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
|
||
// margin-top: 26rpx;
|
||
.type_li {
|
||
margin-top: 26rpx;
|
||
margin-right: 18rpx;
|
||
padding: 12rpx 50rpx;
|
||
background: #FFF5D6;
|
||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||
border: 2rpx solid #FFC107;
|
||
font-weight: 500;
|
||
font-size: 32rpx;
|
||
color: #3D3D3D;
|
||
}
|
||
|
||
.act1 {
|
||
background: #FFC107;
|
||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||
border: 2rpx solid #FFC107;
|
||
color: #FFFFFF;
|
||
}
|
||
}
|
||
}
|
||
|
||
.top {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding: 0 22rpx;
|
||
margin: 0 auto;
|
||
width: 658rpx;
|
||
height: 106rpx;
|
||
background: #FFFFFF;
|
||
box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15);
|
||
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
||
|
||
.top_left {
|
||
font-weight: 600;
|
||
font-size: 36rpx;
|
||
color: #3D3D3D;
|
||
}
|
||
|
||
.top_right {
|
||
display: flex;
|
||
align-items: center;
|
||
flex-wrap: nowrap;
|
||
font-weight: 500;
|
||
font-size: 36rpx;
|
||
color: #808080;
|
||
}
|
||
}
|
||
|
||
.cont_box {
|
||
margin-top: 26rpx;
|
||
display: flex;
|
||
flex-wrap: nowrap;
|
||
|
||
.left {
|
||
margin-left: 48rpx;
|
||
width: 170rpx;
|
||
|
||
.left_cont_box {
|
||
width: 170rpx;
|
||
height: 100rpx;
|
||
background: #fff;
|
||
|
||
.left_cont {
|
||
display: flex;
|
||
align-items: center;
|
||
// justify-content: center;
|
||
padding-left: 30rpx;
|
||
width: 170rpx;
|
||
height: 100rpx;
|
||
font-weight: 600;
|
||
font-size: 36rpx;
|
||
color: #3D3D3D;
|
||
background-color: #F4FAF8;
|
||
|
||
// border-radius: 0rpx 40rpx 40rpx 0rpx;
|
||
// border: 1rpx solid #fff;
|
||
|
||
}
|
||
|
||
.act1 {
|
||
background: #fff;
|
||
border-radius: 40rpx 0 0 40rpx;
|
||
// box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15);
|
||
}
|
||
|
||
.act2 {
|
||
border-radius: 0rpx 0rpx 40rpx 0rpx;
|
||
}
|
||
|
||
.act3 {
|
||
border-radius: 0rpx 40rpx 0rpx 0rpx;
|
||
}
|
||
}
|
||
|
||
.act4 {
|
||
background-color: #F4FAF8;
|
||
border-radius: 40rpx 0 0 40rpx;
|
||
}
|
||
|
||
}
|
||
|
||
.right {
|
||
padding: 16rpx;
|
||
margin-left: -10rpx;
|
||
width: 100%;
|
||
height: 82vh;
|
||
background: #fff;
|
||
overflow: scroll;
|
||
padding-bottom: 200rpx;
|
||
box-sizing: border-box;
|
||
|
||
.right_cont {
|
||
padding: 20rpx 26rpx;
|
||
border: 2rpx solid #D8D8D8;
|
||
border-radius: 20rpx;
|
||
margin-top: 20rpx;
|
||
|
||
.log_work {
|
||
margin-top: 16rpx;
|
||
display: flex;
|
||
flex-wrap: nowrap;
|
||
align-items: center;
|
||
|
||
.work_cont {
|
||
display: flex;
|
||
flex-wrap: nowrap;
|
||
align-items: center;
|
||
|
||
image {
|
||
width: 29rpx;
|
||
height: 29rpx;
|
||
}
|
||
|
||
.cont_xtx {
|
||
margin-left: 6rpx;
|
||
font-weight: 400;
|
||
font-size: 28rpx;
|
||
color: #3D3D3D;
|
||
}
|
||
}
|
||
}
|
||
|
||
.log_info {
|
||
margin-top: 16rpx;
|
||
display: flex;
|
||
flex-wrap: nowrap;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
|
||
.txt {
|
||
font-weight: 400;
|
||
font-size: 28rpx;
|
||
color: #3D3D3D;
|
||
}
|
||
}
|
||
|
||
.imgcont {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
margin-top: 16rpx;
|
||
|
||
.img_box {
|
||
margin-top: 16rpx;
|
||
margin-right: 14rpx;
|
||
height: 124rpx;
|
||
width: 124rpx;
|
||
|
||
image {
|
||
background: #D8D8D8;
|
||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||
height: 124rpx;
|
||
width: 124rpx;
|
||
}
|
||
}
|
||
}
|
||
|
||
// border-radius: 20rpx 20rpx 20rpx 20rpx;
|
||
.cont {
|
||
margin-top: 16rpx;
|
||
font-weight: 400;
|
||
font-size: 28rpx;
|
||
color: #3D3D3D;
|
||
}
|
||
|
||
.right_cont_top {
|
||
display: flex;
|
||
flex-wrap: nowrap;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
|
||
.cont_left {
|
||
font-weight: 400;
|
||
font-size: 28rpx;
|
||
color: #808080;
|
||
}
|
||
|
||
.cont_right {
|
||
font-weight: 500;
|
||
font-size: 28rpx;
|
||
color: #FFC107;
|
||
}
|
||
}
|
||
}
|
||
|
||
// border-radius: 40rpx 0 0 40rpx;
|
||
// box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(0, 0, 0, 0.15);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|
||
</style> |