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.

218 lines
5.2 KiB

<style lang="scss">
.container{
height:100%;
background:#f6f6f6;
2 years ago
.date-range{
flex-shrink: 0;
2 years ago
display: flex;
align-items: center;
color:#999;
picker{
2 years ago
width:50%;
background:#fff;
margin:0 30rpx;
border-radius:10rpx;
height:60rpx;
line-height: 60rpx;
text-align:center;
position:relative;
color:#333;
2 years ago
&:before{
transform: rotate(90deg);
position:absolute;
right:10rpx;
}
&.noData{
color:#999;
}
2 years ago
}
}
scroll-view{
flex-grow: 1;
height:1rpx;
.card{
.info{
display:flex;
align-items: center;
2 years ago
margin-bottom:20rpx;
padding-bottom:20rpx;
border-bottom:2rpx solid rgba(216, 216, 216, 0.3);
text{
&:first-child{
flex-shrink: 0;
background:#10C176;
border-radius:4rpx 40rpx 4rpx 40rpx;
padding:0 10rpx;
box-sizing: border-box;
color:#fff;
height:40rpx;
line-height: 40rpx;
min-width:80rpx;
text-align: center;
font-size:20rpx;
margin-right:12rpx;
}
&:nth-child(3){
margin-left:auto;
flex-shrink: 0;
color:#10C176;
font-size:24rpx;
font-weight: bold;
}
}
}
2 years ago
.adder{
display:flex;
align-items: center;
font-size:24rpx;
text:first-child{
color:#999;
margin-right:auto;
}
text:nth-child(2){
color:#10C176;
flex-shrink: 0;
margin-left:20rpx;
}
}
.record{
2 years ago
margin-top:15rpx;
display:flex;
align-items: center;
justify-content: space-between;
text{
font-size:24rpx;
color:#999;
}
}
.detail{
display: flex;
align-items: center;
2 years ago
margin-bottom:20rpx;
padding-bottom:20rpx;
border-bottom:2rpx solid rgba(216, 216, 216, 0.3);
text{
font-size:24rpx;
color:#999;
&.type{
flex-shrink: 0;
background:#10C176;
border-radius:4rpx 40rpx 4rpx 40rpx;
padding:0 10rpx;
box-sizing: border-box;
color:#fff;
height:40rpx;
line-height: 40rpx;
min-width:80rpx;
text-align: center;
font-size:20rpx;
margin-right:12rpx;
}
&.time{
margin-left:auto;
}
}
}
}
}
}
</style>
<template>
<view class="container flex">
<d-search v-model="searchVal.search" :selectVal="searchVal.value" :list="typeList" @select="searchVal.value=$event" @search="clean();search()"/>
<view class="date-range">
<picker mode="date" class="plant-youbian" :class="{noData:!searchVal.startTime}" @change="searchVal.startTime=$event.detail.value;clean();search()">{{searchVal.startTime||"请选择开始时间"}}</picker>
~
<picker mode="date" class="plant-youbian" :class="{noData:!searchVal.endTime}" @change="searchVal.endTime=$event.detail.value;clean();search()">{{searchVal.endTime||"请选择结束时间"}}</picker>
</view>
2 years ago
<scroll-view scroll-y @scrolltolower="search">
2 years ago
<view class="card" v-for="(v,k) in list" :key="k">
<template v-if="v.inputName">
<view class="info">
<text>{{v.type}}</text> <text class="over">{{v.inputName}}</text> <text>{{v.inputTotal}}{{v.unit}}</text>
</view>
2 years ago
<view class="adder">
<text class="over">{{v.plotName}}</text> <text>{{v.productName}}</text>
</view>
<view class="record">
2 years ago
<text>记录时间{{new Date(v.time).format('yyyy-MM-dd')}}</text> <text>负责人{{v.principal}}</text>
</view>
</template>
<template v-else>
<view class="detail">
<text class="type">{{v.type}}</text>
<text class="people">负责人{{v.principal}}</text>
<text class="time">记录时间{{new Date(v.time).format('yyyy-MM-dd')}}</text>
</view>
<view class="adder">
<text class="over">{{v.plotName}}</text> <text>{{v.productName}}</text>
</view>
</template>
</view>
2 years ago
<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 {
data(){
return{
2 years ago
searchVal:{
search:"",
value:"",
2 years ago
pageNo:1,
pageSize:6,
plotId:"",
PlantBaseInfoId: this.$store.state.baseInfo.id,
2 years ago
startTime:"",
endTime:"",
},
total:0,
list:[],
typeList:[],
}
},
2 years ago
onLoad(){
this.init()
this.search()
},
methods:{
2 years ago
async init(){
var res=await request("/api/plantFarming/listFarmName")
2 years ago
if(res.statu){
this.typeList=res.data
2 years ago
}
},
clean(){
this.list=[]
this.total=0
this.searchVal.pageNo=1
},
async search(){
2 years ago
if(this.total==0 || this.list.length<this.total){
var res=await request("/api/plantFarming/listFarmByPlotId",{
params: this.searchVal
})
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,
})
}
}
}
}
}
</script>