Browse Source

修改地块管理 页面跳转

master
邓宏 2 years ago
parent
commit
1267c1830e
  1. 6
      pages/massif/add_transaction.vue
  2. 12
      pages/massif/mana/farmRecord.vue
  3. 39
      pages/massif/mana/index.vue
  4. 2
      pages/massif/mana/plantPlan.vue
  5. 22
      pages/massif/mana/recovery.vue
  6. 1
      pages/massif/plant_info.vue
  7. 1
      pages/massif/plant_plan.vue

6
pages/massif/add_transaction.vue

@ -100,11 +100,12 @@ export default {
buyerType:{required:true,message:"交易类型必选!"}, buyerType:{required:true,message:"交易类型必选!"},
buyerAddress:{required:true,message:"收货地址必填!"}, buyerAddress:{required:true,message:"收货地址必填!"},
}, },
eventChannel:null,
} }
}, },
onLoad(options){ onLoad(options){
var eventChannel=this.getOpenerEventChannel() this.eventChannel=this.getOpenerEventChannel()
eventChannel.on("detail", e=>{ this.eventChannel.on("detail", e=>{
this.detail=e this.detail=e
this.formData.harvestId=e.id this.formData.harvestId=e.id
}) })
@ -151,6 +152,7 @@ export default {
}) })
if(res.statu){ if(res.statu){
uni.navigateBack() uni.navigateBack()
this.eventChannel.emit("update")
}else{ }else{
uni.showModal({ uni.showModal({
title:"提示", title:"提示",

12
pages/massif/mana/farmRecord.vue

@ -128,6 +128,10 @@ export default {
plotId:{ plotId:{
type:String, type:String,
default:"" default:""
},
plantId:{
type:String,
default:""
} }
}, },
data(){ data(){
@ -137,6 +141,7 @@ export default {
pageNo:1, pageNo:1,
pageSize:6, pageSize:6,
PlantBaseInfoId: this.$store.state.plantBaseInfoId, PlantBaseInfoId: this.$store.state.plantBaseInfoId,
plantScheduleId: "",
startTime:"", startTime:"",
endTime:"", endTime:"",
}, },
@ -159,12 +164,19 @@ export default {
}} }}
}) })
}, },
reSearch(){
this.list=[]
this.total=0
this.searchVal.pageNo=1
this.search()
},
async search(){ async search(){
if(this.total==0 || this.list.length<this.total){ if(this.total==0 || this.list.length<this.total){
var res=await request("/api/plantFarming/listFarmByPlotId",{ var res=await request("/api/plantFarming/listFarmByPlotId",{
params: { params: {
...this.searchVal, ...this.searchVal,
plotId: this.plotId, plotId: this.plotId,
plantScheduleId: this.plantId,
} }
}) })
if(res.statu){ if(res.statu){

39
pages/massif/mana/index.vue

@ -27,16 +27,19 @@
<swiper :current="tabIndex" @change="tabIndex=$event.detail.current"> <swiper :current="tabIndex" @change="tabIndex=$event.detail.current">
<swiper-item> <swiper-item>
<plant-plan :plotId="plotId" @trigger="$refs.recovery.reSearch($event.plantId);tabIndex=$event.tabIndex"/> <plant-plan
:plotId="plotId"
@trigger="plantId=$event"
@farm="farm_plantId=$event"/>
</swiper-item> </swiper-item>
<swiper-item> <swiper-item>
<farmRecord :plotId="plotId"/> <farmRecord :plantId="farm_plantId" :plotId="plotId" ref="farmRecord"/>
</swiper-item> </swiper-item>
<swiper-item> <swiper-item>
<recovery :plotId="plotId" ref="recovery"/> <recovery :plotId="plotId" :plantId="plantId" ref="recovery" @trigger="recoveryId=$event"/>
</swiper-item> </swiper-item>
<swiper-item> <swiper-item>
<transactions :plotId="plotId" ref="transactions"/> <transactions :recoveryId="recoveryId" :plotId="plotId" ref="transactions"/>
</swiper-item> </swiper-item>
</swiper> </swiper>
</view> </view>
@ -61,10 +64,38 @@ export default {
{name:"交易记录"}, {name:"交易记录"},
], ],
plotId:"", plotId:"",
plantId:"",
farm_plantId:"",
recoveryId:"",
maps:null, maps:null,
} }
}, },
watch:{
plantId(n){
this.$nextTick(()=>{
this.$refs.recovery.reSearch()
})
if(n)this.tabIndex=2;
},
farm_plantId(n){
this.$nextTick(()=>{
this.$refs.farmRecord.reSearch()
})
if(n)this.tabIndex=1;
},
recoveryId(n){
this.$nextTick(()=>{
this.$refs.transactions.reSearch()
})
if(n)this.tabIndex=3
},
tabIndex(n,o){
if(n!=2)this.plantId="";
if(n!=1)this.farm_plantId="";
if(n!=3)this.recoveryId="";
}
},
onLoad(options){ onLoad(options){
this.plotId=options.id this.plotId=options.id
}, },

2
pages/massif/mana/plantPlan.vue

@ -256,7 +256,7 @@ export default {
toAdd(plantId){ toAdd(plantId){
uni.navigateTo({ uni.navigateTo({
url:`/pages/massif/plant_info?plantId=${plantId}&plotId=${this.plotId}`, url:`/pages/massif/plant_info?plantId=${plantId}&plotId=${this.plotId}`,
events:{ toRecovery:()=> this.$emit("trigger",{tabIndex:2,plantId}) } events:{ toRecovery:()=> this.$emit("trigger", plantId) }
}) })
}, },
del(index){ del(index){

22
pages/massif/mana/recovery.vue

@ -144,8 +144,12 @@ export default {
props:{ props:{
plotId:{ plotId:{
type:String, type:String,
defaylt:"" default:""
}, },
plantId:{
type:String,
default:"",
}
}, },
data(){ data(){
return{ return{
@ -164,28 +168,25 @@ export default {
}, },
created(){ created(){
this.search() this.search()
}, },
methods:{ methods:{
reSearch(plantId){ reSearch(){
this.$nextTick(()=>{ this.clean()
this.list=[] this.search()
this.total=0
this.searchVal.pageNo=1
this.search(plantId)
})
}, },
clean(){ clean(){
this.list=[] this.list=[]
this.total=0 this.total=0
this.searchVal.pageNo=1 this.searchVal.pageNo=1
}, },
async search(plantId=''){ async search(){
if(this.total==0||this.list.length<this.total){ if(this.total==0||this.list.length<this.total){
var res=await request("/api/plantHarvest/list",{ var res=await request("/api/plantHarvest/list",{
params:{ params:{
...this.searchVal, ...this.searchVal,
plotId:this.plotId, plotId:this.plotId,
plantScheduleId: plantId, plantScheduleId: this.plantId,
} }
}) })
if(res.statu){ if(res.statu){
@ -205,6 +206,7 @@ export default {
toAddTransaction(e){ toAddTransaction(e){
uni.navigateTo({ uni.navigateTo({
url:"/pages/massif/add_transaction", url:"/pages/massif/add_transaction",
events:{update:()=>{this.$emit("trigger",e.id)}},
success(res){ success(res){
res.eventChannel.emit('detail',e) res.eventChannel.emit('detail',e)
} }

1
pages/massif/plant_info.vue

@ -53,6 +53,7 @@ export default {
principal:{required:true, message:"负责人必填!", trigger:"blur"}, principal:{required:true, message:"负责人必填!", trigger:"blur"},
harvestTime:{required:true, message:"采收时间必填!", trigger:"blur"}, harvestTime:{required:true, message:"采收时间必填!", trigger:"blur"},
status:{required:true, message:"采收状态必填!", trigger:"blur"}, status:{required:true, message:"采收状态必填!", trigger:"blur"},
warehouseId:{required:true, message:"仓库必选!"},
}, },
eventChannel:null, eventChannel:null,
} }

1
pages/massif/plant_plan.vue

@ -49,7 +49,6 @@ export default {
principal:{label:"负责人"}, principal:{label:"负责人"},
principalId:{label:"负责人身份证"}, principalId:{label:"负责人身份证"},
productIntroduce:{label:"产品介绍",type:"textarea"}, productIntroduce:{label:"产品介绍",type:"textarea"},
}, },
formData:{ formData:{
varietyName:"", varietyName:"",

Loading…
Cancel
Save