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.

194 lines
4.6 KiB

2 years ago
<style lang="scss">
2 years ago
.container{
background:#F6F6F6;
height:100%;
scroll-view{
flex-grow: 1;
height:1rpx;
border-bottom:1rpx solid transparent;
.card.item{
2 years ago
display:flex;
2 years ago
margin-top:0;
&>.u-transition{
2 years ago
flex-shrink: 0;
margin-right:24rpx;
}
&>.info{
flex-grow: 1;
2 years ago
width:1rpx;
2 years ago
.title{
display:flex;
align-items: center;
text{
2 years ago
&:first-child{
flex-grow: 1;
font-weight: bold;
}
&:nth-child(2){
color:#333;
}
2 years ago
}
}
.code,.area{
color:#999;
font-size:24rpx;
margin-top:14rpx;
}
.data{
margin-top:16rpx;
display:flex;
align-items: center;
text{
&:first-child{
color:#10C176;
font-size:32rpx;
font-weight: bold;
&:after{
content:"亩";
}
}
&:nth-child(2){
color:#F8CB36;
font-size:24rpx;
margin-left:16rpx;
}
}
}
.btns{
display: flex;
justify-content: space-between;
align-items: center;
border-top:2rpx solid #D8D8D8;
2 years ago
margin:20rpx 0 -30rpx 0;
2 years ago
text{
color:#999;
font-size:24rpx;
2 years ago
padding:16rpx 0 30rpx 0;
2 years ago
&:before{
color:#10C176;
margin-right:8rpx;
}
}
}
}
}
}
}
</style>
<template>
2 years ago
<view class="container flex">
2 years ago
<d-navbar style="--bg:#10C176;--c:#fff;" text="地块管理">
<text class="plant-xinjian" slot="right" @click="toInfo"/>
2 years ago
</d-navbar>
2 years ago
2 years ago
<d-search v-model="searchVal.search" @search="clean();search()"/>
2 years ago
2 years ago
<scroll-view scroll-y @scrolltolower="search">
<view class="card item" v-for="(v,k) in list" :key="k" @click="$u.route({url:'pages/massif/detail',params:{id:v.id}})">
<u-image width="220rpx" height="220rpx" radius="16rpx" :src="`${host}/${v.image}`" mode="aspectFill">
<text slot="error" style="font-size:65rpx" class="plant-xiaopangchetupianjiazaishibai"/>
</u-image>
2 years ago
<view class="info">
2 years ago
<view class="title"><text class="over">{{v.plotName}}</text> <text class="plant-youbian"/></view>
2 years ago
<view class="code">编号{{v.plotNumber}}</view>
<view class="area">地块面积{{v.realityArea}}</view>
<view class="data">
<text>{{v.usedArea}}</text> <text>(在用面积)</text>
</view>
2 years ago
<view class="btns" @click.stop=''>
<text class="plant-xiugai" @click.stop="reDetail(v.id)">修改</text>
2 years ago
<text class="plant-shanchu" @click.stop="del(k)">删除</text>
<text class="plant-xinzeng" @click.stop="$u.route({url:'pages/massif/mana/index',params:{id:v.id}})">地块管理</text>
2 years ago
</view>
2 years ago
</view>
</view>
<u-empty v-if="list.length==0" width="70%" icon="/static/noData.png"/>
2 years ago
</scroll-view>
2 years ago
</view>
</template>
<script>
import request,{host} from '@/common/request'
2 years ago
export default{
2 years ago
data(){
return{
host:host('imgUrl'),
2 years ago
searchVal:{
companyId:this.$store.getters.userInfo.companyId,
plantBaseInfoId:this.$store.state.plantBaseInfoId,
2 years ago
search:"",
pageNo:1,
pageSize:5,
},
list:[],
total:0,
}
},
onLoad(){
this.search()
},
2 years ago
methods:{
toInfo(){
uni.navigateTo({
url:"/pages/massif/info",
events:{update:()=>{ this.clean();this.search() }}
})
},
//修改详情
reDetail(id){
uni.navigateTo({
url:`/pages/massif/info?id=${id}`,
events:{update:()=>{ this.clean();this.search() }}
})
},
2 years ago
clean(){
this.searchVal.pageNo=1
this.total=0
this.list=[]
},
async search(){
if(this.total==0 || this.list.length<this.total){
var res=await request("/api/plantPlot/list",{
params: this.searchVal
})
if(res.statu){
this.list=this.list.concat(res.data.records)
2 years ago
this.total=res.data.total
this.searchVal.pageNo++
if(this.list.length==this.total)uni.showToast({title:"加载完成!",icon:"none"})
2 years ago
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取地块列表失败!",
showCancel:false,
})
}
}
},
2 years ago
async del(index){
if((await uni.showModal({ title:"提示", content:"确定删除?" }))[1].confirm){
var res=await request("/api/plantPlot/deletePlantPlotInfo",{
method:"DELETE",
params:{id:this.list[index].id}
})
if(res.statu){
if(this.list.length>6){
this.list.splice(index,1)
this.total--
}else{
this.clean()
2 years ago
this.search()
}
}else{
uni.showModal({
title:"提示",
content:res.msg||"删除失败!",
showCancel:false,
})
}
}
},
2 years ago
},
}
</script>