From 33ed65df13bad7156e87353820f0b3696282813e Mon Sep 17 00:00:00 2001 From: dingtalk_umvbsp Date: Tue, 28 Feb 2023 17:36:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=B3=E8=99=AB=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E9=A1=B5=E9=9D=A2=E6=95=B0=E6=8D=AE=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/massif/pestType.vue | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/pages/massif/pestType.vue b/pages/massif/pestType.vue index 9e38bad..6ae1286 100644 --- a/pages/massif/pestType.vue +++ b/pages/massif/pestType.vue @@ -139,7 +139,7 @@ export default { params:{code:"B09"} }) if(res.statu){ - this.cropList=res.data.map(v=>({...v,children:v?.children?.length>0?v.children:[{label:"全部",value:'all'}]})) + this.cropList=res.data.map(v=>({...v,children:v?.children?.length>0?v.children:[{label:"全部",value:v.pest}]})) this.agrSearch(res.data[0]?.children?.[0]?.value||"") }else{ uni.showModal({ @@ -172,26 +172,29 @@ export default { } } }, - async agrSearch(id){ - if(id){ - this.searchVal={ value:id, search:"" } + async agrSearch(e){ + if(e){ + this.searchVal={ value:e, search:"" } this.select="" - - var res=await request("/api/plantFarming/getPestByLike",{ - params: { - value: id,//选择的农产品 - search:"", + if(typeof e=='string'){ + var res=await request("/api/plantFarming/getPestByLike",{ + params: { + value: e,//选择的农产品 + search:"", + } + }) + if(res.statu){ + this.list=res.data + }else{ + this.list=[] + uni.showModal({ + title:"提示", + content:res.msg||"获取种植计划选项失败!", + showCancel:false, + }) } - }) - if(res.statu){ - this.list=res.data }else{ - this.list=[] - uni.showModal({ - title:"提示", - content:res.msg||"获取种植计划选项失败!", - showCancel:false, - }) + this.list=e } } },