diff --git a/pages/massif/add_farming.vue b/pages/massif/add_farming.vue index aa306ca..8c39295 100644 --- a/pages/massif/add_farming.vue +++ b/pages/massif/add_farming.vue @@ -213,8 +213,8 @@ --> ({value:v.label,label:v.label})) + }else{ + uni.showModal({ + title:"提示", + content:res.msg||"获取农事类型失败!", + showCancel:false, + }) + } } } }, onLoad(options){ this.eventChannel=this.getOpenerEventChannel() + this.eventChannel.on("detail", e=>{ + this.formData={ + ...e, + images:e?.images?.split?.(',')?.filter(v=>v)||[], + inputList: e?.inputList?.map?.(v=>({...v, unit:(v.specDescribe.match(/\d+(\w+)\/./)||[])[1]}))||[] + } + this.fields.images.value=e.images + this.fields.farmingPlanId.value=[e.farmingPlanId] + this.saveInput=e?.inputList?.map?.(v=>({...v})) + }) this.formData.plotId=options.plotId this.init() this.getMassifDetail() diff --git a/pages/massif/mana/farmRecord.vue b/pages/massif/mana/farmRecord.vue index cd18ae1..f3d4875 100644 --- a/pages/massif/mana/farmRecord.vue +++ b/pages/massif/mana/farmRecord.vue @@ -117,6 +117,24 @@ } } } + &>.footer{ + margin:10rpx -32rpx -32rpx; + background:#eee; + height:60rpx; + display: flex; + align-items: center; + justify-content: space-around; + button{ + font-size:24rpx; + padding:0; + height:100%; + color:#999; + &:before{ + color:#FFB000; + margin-right:10rpx; + } + } + } } } } @@ -126,10 +144,10 @@ 农资使用情况 - +添加农事 + +添加农事 - + @@ -183,25 +206,26 @@ export default { this.search() }, methods:{ - toAdd(){ + toAdd(v){ 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() - }} + this.search('refresh') + }}, + success:res=>{ + if(v){ + res.eventChannel.emit("detail", v) + } + } }) }, - reSearch(){ - this.list=[] - this.total=0 - this.searchVal.pageNo=1 - this.search() - }, - async search(){ + async search(type){ + if(type=='refresh'){ + this.list=[] + this.total=0 + this.searchVal.pageNo=1 + } if(this.total==0 || this.list.lengthv)}) + del(index){ + uni.showModal({ + title:"提示", + content:"确定删除?", + success:async e=>{ + if(e.confirm){ + var res=await request("/suyuan/farmingApi/delete",{ + method:"delete", + params:{id:this.list[index].id} + }) + if(res.statu){ + uni.showToast({title:"删除成功!",icon:"success"}) + if(this.list.length>this.searchVal.pageSize+3){ + this.list.splice(index, 1) + this.total-- + }else{ + this.search('refresh') + } + }else{ + uni.showModal({ + title:"提示", + content:res.msg||"删除失败!", + showCancel:false, + }) + } + } } }) },