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.

186 lines
4.5 KiB

2 years ago
<style lang="scss" scoped>
.farm-record{
2 years ago
display:flex;
flex-direction: column;
height: 100%;
2 years ago
&>.head{
2 years ago
flex-shrink: 0;
2 years ago
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;
}
}
}
2 years ago
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;
}
2 years ago
}
}
2 years ago
.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;
}
2 years ago
}
.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;
}
}
}
2 years ago
}
}
}
</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>
2 years ago
<text class="add" @click="toAdd">+添加农事</text>
2 years ago
</view>
2 years ago
<scroll-view scroll-y @scrollotower="search">
<view class="card" v-for="(v,k) in list" :key="k">
<template v-if="v.inputName">
<view class="name">
<text>{{v.type}}</text> <text>{{v.inputName}}</text> <text>{{v.inputTotal||0}}{{v.unit}}</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>
2 years ago
</view>
2 years ago
</view>
<u-empty v-if="list.length<=0" text="为查询到相关信息" width="70%" icon="/static/noData.png"/>
2 years ago
</scroll-view>
2 years ago
</view>
</template>
<script>
2 years ago
import request from '@/common/request.js'
2 years ago
export default {
name:"farmRecord",
2 years ago
props:{
plotId:{
type:String,
default:""
}
},
2 years ago
data(){
return{
2 years ago
searchVal:{
search:"",
pageNo:1,
pageSize:6,
PlantBaseInfoId: this.$store.state.plantBaseInfoId,
startTime:"",
endTime:"",
},
total:0,
list:[],
2 years ago
}
2 years ago
},
2 years ago
created(){
this.search()
},
2 years ago
methods:{
toAdd(){
uni.navigateTo({
url:`/pages/massif/add_farming?plotId=${this.plotId}`,
events:{update: e=>{
this.total=0
this.list=[]
this.searchVal.pageNo=1
this.search()
}}
2 years ago
})
2 years ago
},
async search(){
if(this.total==0 || this.list.length<this.total){
var res=await request("/api/plantFarming/listFarmByPlotId",{
params: {
...this.searchVal,
plotId: this.plotId,
}
})
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,
})
}
}
2 years ago
}
2 years ago
}
}
</script>