diff --git a/pages/massif/add_farming.vue b/pages/massif/add_farming.vue index bd5d3e2..3a19a7d 100644 --- a/pages/massif/add_farming.vue +++ b/pages/massif/add_farming.vue @@ -431,15 +431,19 @@ export default { }, //选择病虫害名称 pestsFun(){ - uni.navigateTo({ - url:`/pages/massif/pestType?type=${({"病害":"disease","虫害":"pestis"})[this.formData.pestsType]||''}&plantType=${this.massif.plantType}`, - events:{type:e=>{ - this.formData.pests=e.map(v=>v).join(',') - }}, - success:res=>{ - res.eventChannel.emit('ids',this.formData?.pests?.split?.(',')?.filter(v=>v)||[]) - } - }) + if(this.formData.pestsType){ + uni.navigateTo({ + url:`/pages/massif/pestType?type=${this.formData.pestsType}&plantType=${this.massif.plantType}`, + events:{type:e=>{ + this.formData.pests=e.map(v=>v).join(',') + }}, + success:res=>{ + res.eventChannel.emit('ids',this.formData?.pests?.split?.(',')?.filter(v=>v)||[]) + } + }) + }else{ + uni.showToast({title:"请选择病虫害类型!"}) + } }, //添加病虫害记录 toPestRecord(){ diff --git a/pages/massif/pestType.vue b/pages/massif/pestType.vue index 3a568d6..8b6b563 100644 --- a/pages/massif/pestType.vue +++ b/pages/massif/pestType.vue @@ -1,52 +1,6 @@