You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

247 lines
7.6 KiB

<style lang="scss" scoped>
.farm-record{
display:flex;
flex-direction: column;
height: 100%;
&>.head{
flex-shrink: 0;
display:flex;
align-items: center;
margin:30rpx;
image{
height:32rpx;
width:32rpx;
margin-right:14rpx;
}
text{
font-size:24rpx;
&.title{
color:#999;
margin-right:auto;
}
&.add{
color:#10C176;
}
}
}
scroll-view{
flex-grow: 1;
height:1rpx;
.card{
margin-top:0;
.name{
display:flex;
align-items: center;
text{
&:first-child{
flex-shrink: 0;
color:#fff;
background:#10C176;
font-size:20rpx;
border-radius: 8rpx 40rpx 8rpx 40rpx;
width:80rpx;
text-align: center;
height:40rpx;
line-height: 40rpx;
margin-right:12rpx;
}
&:nth-child(2){
flex-grow: 1;
}
&:nth-child(3){
flex-shrink: 0;
color:#10C176;
font-weight: bold;
font-size:32rpx;
margin-left:10rpx;
}
}
}
.tabs{
display:flex;
flex-wrap: wrap;
margin:12rpx -18rpx -16rpx 0;
text{
border-radius: 10rpx;
margin:0 18rpx 16rpx 0;
font-size:24rpx;
height:44rpx;
line-height: 44rpx;
background-position: 20rpx 12rpx;
background-repeat: no-repeat;
color:rgba(var(--c),1);
background-color:rgba(var(--c),0.1);
padding-right:20rpx;
}
.germinate{
--c:15, 194, 119;
background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAALCAYAAAB24g05AAAAAXNSR0IArs4c6QAAAYZJREFUKFOdkU1IVHEUxc957yE45YwKSRnUpp24dKELZ4YCMdFNJNWyRdDOr3lBkMzK0PmIEsFVqzDMlRsXBcObaBuCgRjMphREUOq9USqc9z/igGKKMHi3554f955D1DCXC8/aLNu8pNgFoonSqsA5v8m8YQ1+NBZTgcB6AN8oXRF5lYAjaakKuFQcbnfgDEHoAlkHaPlfxYz+vZ37AYGxz+4aoe8S7oIwMhxRuPe+fGdmhzEv9RTA9KEAYAPALwA3INh+ItOMD/ftaMvNOYvWIIC9CszAbjxbOLqcMc+doKV9iR0EegUJ4FcJpSAx9TDqua8rDiYdKa6K+VRO5rZPvv1fBg3eWL9Nzgq4BnEeMCuw2O53Zx6dl9XZENNpq74zuP6nJ78e+ei22nXmQTmRzdcOOLXZWEw9/h3PvL0wIOaNTfiJ7POaAZEvbqsT4okl3QMZGKlEoB+EF8K82936uYjBhfC4hVNkRgujL2jbfYBuEWyu6oIvahPkssL98SD5qnTkOwB+A5pVJ9wdJQAAAABJRU5ErkJggg==);
background-size:30rpx 22rpx;
padding-left:30rpx+25rpx;
}
.organ{
--c:248, 203, 54;
background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAANCAYAAACdKY9CAAAAAXNSR0IArs4c6QAAAQ9JREFUKFOlUrtKA1EQPedeHxERFAQRCYK9GCW7Ivb+hEUqsbONhZVFCm0kYCPoD9gFS4tgYeFVsLBLmyaNWO5qmCOYjYJuksJphnmcmTMPIpPkIXoGuda3f7QEoSVgbyoOd+wH0sfoCKL/DZA0A+IAQLMQhR0moVwHXPFv5cxjuJTTIYHpQhTWmYRYA5O/AjoDUAIw+w+A0AV0QcemmTZIVAFm8+V2sBOjzq2bpnJ+fowTVwTjHtWBlGQATgHcSjgmuTUCkD+6YDVPNWjOj8fhfviWhNZrp12aW1jadbK3yc2n6xEA1QW8kFoF3IqXauy9BJbzCAlqOOpG8hVAi864//0aw473EcrbEt8NqnwCf8mG+U/vRGMAAAAASUVORK5CYII=);
background-size:26rpx 24rpx;
padding-left:26rpx+25rpx;
}
.type{
--c:235, 67, 118;
background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAAXNSR0IArs4c6QAAASBJREFUKFN9kD0vQ2EYhq/7bUUklUhEYxAMNfsDJk0TGxN/wWJ0EpvExmjpajMYTAaDxSIWg1ERFh/toCGpr55bzkk1qmmf8cl9PR+XqvPRHfY+QRH9KvY2YkXVYmTgEFjCNIBmi8sghv7MSDNtwHapfv8+OlPZ/UhCV4W1wZHJoSpiuAV1AgltxxVJL0nA9ogUCj03YC8iPWBixDiQ/fdS10lz+ZOdsSRULUanwFxfIH0IPhMD2ANIj2rGURzClsT0r5hOS62Rtq8F5aZ9miHMWo4kXXZYSrW2AZ7q942p7MSrklYu5M8Qtz0B7POBz8zCV/Z7+Y3aXi6MHSHV+2xwjZhNiUnsG4I2kC5S4Lm4fqBYxwRWwekJ3aVEdtmi9AMqTJE6K1mcKgAAAABJRU5ErkJggg==);
background-size:24rpx 22rpx;
padding-left:24rpx+25rpx;
}
}
.info{
margin-top:20rpx;
border-top:2rpx solid rgba(216, 216, 216, 0.4);
padding-top:20rpx;
display:flex;
justify-content: space-between;
text{
color:#999;
font-size:24rpx;
}
}
.detail{
display:flex;
align-items: center;
text{
color:#999;
font-size:24rpx;
&:first-child{
flex-shrink: 0;
color:#fff;
background:#10C176;
font-size:20rpx;
border-radius: 8rpx 40rpx 8rpx 40rpx;
width:80rpx;
text-align: center;
height:40rpx;
line-height: 40rpx;
margin-right:12rpx;
}
&:nth-child(2){
margin-right:auto;
}
}
}
}
}
}
</style>
<template>
<view class="farm-record">
<view class="head">
<image mode="aspectFit" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAXhJREFUOE+dk7FLw1AQxr+LbSyInQuODiIW+hc4iZP/QCfBpXmmUHR26eRopdT0ZRLX7k7FybmgKAUJjrZriTqY2Jy80IQ0aik5eMO7++7H4953hFRYlrWlaZoAcEBEG6rMzG8AboMgkKZpviRbKLo0m81cqVQ6B3BKRLk0eAb6JqIWgDPDMHyVCwHtdnu1UCj0mXn3r8Z0jpnvPc/bbzQaXyHAtm0JwFimOdIwsxRCHFOn09nJ5/OPAFaiYrVaxWAwgOM4i5hT3/crJKVsEdFJUlmr1UKAOouCmS/Jtu0hgO2MgKECfABYywIA8KkALoD1jIB3BXgCUE4DRqMRxuPx3Ahc150bLDM/K8CFMk9SqX6hWCz+mt9kMkGv14vzQRC0qNvtljVNe0h+45J+mBJRJTSSlPKKiMwlG0MZM1tCiHpsZV3X+0SUzcrRPui6rl5yBED75zUBM197nldXexAvU1I8s/YhgD0Am7PaK4A7Zr4RQijjxfEDDjS1T8RMzc4AAAAASUVORK5CYII="/>
<text class="title">农资使用情况</text>
<text class="add" @click="toAdd">+添加农事</text>
</view>
<scroll-view scroll-y @scrolltolower="search">
<view class="card" v-for="(v,k) in list" :key="k" @click="v.growthProcess && toDetail(v)">
<template v-if="v.inputName">
<view class="name">
<text>{{v.type}}</text> <text>{{v.inputName}}</text> <text>{{v.inputTotal||0}}{{v.unit}}</text> <text class="plant-youbian" v-if="v.growthProcess"/>
</view>
<view class="tabs" v-if="v.growthProcess">
<text class="germinate">{{v.growthProcess}}</text>
<text class="organ">{{v.pestSite}}</text>
<text class="type">{{v.symptom}}</text>
</view>
<view class="info">
<text>负责人:{{v.principal}}</text> <text>记录日期:{{new Date(v.time).format('yyyy-MM-dd')}}</text>
</view>
</template>
<view v-else class="detail">
<text>{{v.type}}</text> <text>负责人{{v.principal}}</text> <text>记录日期{{new Date(v.time).format('yyyy-MM-dd')}}</text>
</view>
</view>
<u-empty v-if="list.length<=0" text="为查询到相关信息" width="70%" icon="/static/noData.png"/>
</scroll-view>
</view>
</template>
<script>
import request from '@/common/request.js'
export default {
name:"farmRecord",
props:{
plotId:{
type:String,
default:""
},
plantId:{
type:String,
default:""
}
},
data(){
return{
searchVal:{
search:"",
pageNo:1,
pageSize:6,
PlantBaseInfoId: this.$store.state.baseInfo.id,
plantScheduleId: "",
startTime:"",
endTime:"",
},
total:0,
list:[],
}
},
created(){
this.search()
},
methods:{
toAdd(){
uni.navigateTo({
url:`/pages/massif/add_farming?plotId=${this.plotId}`,
events:{update: e=>{
this.$provise.emit('addFarming')
this.total=0
this.list=[]
this.searchVal.pageNo=1
this.search()
}}
})
},
reSearch(){
this.list=[]
this.total=0
this.searchVal.pageNo=1
this.search()
},
async search(){
if(this.total==0 || this.list.length<this.total){
var res=await request("/api/plantFarming/listFarmByPlotId",{
params: {
...this.searchVal,
plotId: this.plotId,
plantScheduleId: this.plantId,
}
})
if(res.statu){
this.list=this.list.concat(res.data.list)
this.total=res.data.total
this.searchVal.pageNo++
if(this.list.length==this.total)uni.showToast({title:"加载完成",icon:"none"})
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取农事记录列表失败",
showCancel:false,
})
}
}
},
toDetail(e){
uni.navigateTo({
url:`/pages/home/newsDetail?intoPage=farming`,
success(res){
res.eventChannel.emit("detail",{...e,images: (e.images||'').split(',').filter(v=>v)})
}
})
},
}
}
</script>