Browse Source

农事操作 修改病虫害表单

master
邓宏 2 months ago
parent
commit
77186703dc
  1. 27
      pages/massif/add_farming.vue

27
pages/massif/add_farming.vue

@ -214,7 +214,7 @@
<u-form class="inline" errorType="toast" :model="formData" :rules="rules" ref="form" labelWidth="auto">
<template v-if="/^用药$/.test(formData.farmingType)">
<d-form label="防治类型" type="radio" v-model="formData.pestsType" @select="formData.pestsType=$event.slice(-1)[0].value" :columns="[{label:'病害',value:'病害'},{label:'虫害',value:'虫害'}]"/>
<d-form label="防治对象" type="select" :value="[formData.pests]" :columns="[pests]" @select="formData.pests=$event[0].value"/>
<d-form label="防治对象" type="navigate" :value="formData.pests" :btnFun="pestsFun"/>
<d-form label="农资作用面积" type="digit" v-model="formData.roleArea" suffix="亩"/>
</template>
<d-form
@ -240,7 +240,6 @@ export default {
data(){
return{
typeList:[],
pests:[],
fields:{
principal:{label:"操作人",styleType:"parallel", disabled:true},
farmingTime:{label:"操作日期",styleType:"parallel",type:"calendar"},
@ -281,27 +280,9 @@ export default {
}
},
watch:{
async 'formData.pestsType'(n,o){
'formData.pestsType'(n,o){
if(n){
// this.formData.pests=''
//
var res=await request("/suyuan/farmingApi/queryPestDetail",{
method:"post",
body:{
pestsType: n,
plantType: n=='病害'?this.massif.plantType:'',
detailName:'',
}
})
if(res.statu){
this.pests=res.data.map(v=>({value:v.label,label:v.label}))
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取农事类型失败!",
showCancel:false,
})
}
this.formData.pests=''
}
}
},
@ -451,7 +432,7 @@ export default {
//
pestsFun(){
uni.navigateTo({
url:`/pages/massif/pestType?type=${({"病害":"disease","虫害":"pestis"})[this.formData.pestsType]}`,
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(',')
}},

Loading…
Cancel
Save