Browse Source

添加农事 修改病虫害本地

master
邓宏 1 year ago
parent
commit
97f637845a
  1. 29
      pages/massif/add_farming.vue
  2. 1
      pages/massif/agrSpecs.vue
  3. 10
      pages/massif/pestType.vue

29
pages/massif/add_farming.vue

@ -203,15 +203,19 @@
</view> </view>
<view class="card"> <view class="card">
<view v-if="/^用药$|^施肥$/.test(formData.farmingType)" class="item" @click="toPestRecord"> <!-- <view v-if="/^用药$|^施肥$/.test(formData.farmingType)" class="item" @click="toPestRecord">
<view class="tabulation" :class="{mast:/^用药$/.test(formData.farmingType)}"> <view class="tabulation" :class="{mast:/^用药$/.test(formData.farmingType)}">
<text class="title">操作</text> <text class="record">病虫害记录</text><text class="plant-youbian"/> <text class="title">操作</text> <text class="record">病虫害记录</text><text class="plant-youbian"/>
</view> </view>
<view class="value" v-if="formData.farmPests"> <view class="value" v-if="formData.farmPests">
过程:{{formData.farmPests.growthProcess}}病虫害部位:{{formData.farmPests.pestSite}}症状{{formData.farmPests.symptom}}({{formData.farmPests.pestName.map(v=>v.name).join(',')}}) 过程:{{formData.farmPests.growthProcess}}病虫害部位:{{formData.farmPests.pestSite}}症状{{formData.farmPests.symptom}}({{formData.farmPests.pestName.map(v=>v.name).join(',')}})
</view> </view>
</view> </view> -->
<u-form class="inline" errorType="toast" :model="formData" :rules="rules" ref="form" labelWidth="auto"> <u-form class="inline" errorType="toast" :model="formData" :rules="rules" ref="form" labelWidth="auto">
<template v-if="/^用药$|^施肥$/.test(formData.farmingType)">
<d-form label="防治对象" type="select" :value="[formData.pestsType]" @select="formData.pestsType=$event.slice(-1)[0].value" :columns="[[{label:'病害',value:'病害'},{label:'虫害',value:'虫害'}]]"/>
<d-form :label="()=>`${formData.pestsType||'病虫害'}名称`" type="navigate" :value="formData.pests" :btnFun="pestsFun"/>
</template>
<d-form <d-form
v-for="(v,k) in fields" v-for="(v,k) in fields"
:key="k" :key="k"
@ -256,6 +260,8 @@ export default {
workTime:0, workTime:0,
inputList:[], inputList:[],
farmPests:null,// farmPests:null,//
pestsType:"",
pests:"",
plotId:"", plotId:"",
plantBaseInfoId: this.$store.state.baseInfo.id, plantBaseInfoId: this.$store.state.baseInfo.id,
}, },
@ -271,6 +277,13 @@ export default {
eventChannel:null, eventChannel:null,
} }
}, },
watch:{
'formData.pestsType'(n,o){
if(n){
this.formData.pests=''
}
}
},
onLoad(options){ onLoad(options){
this.eventChannel=this.getOpenerEventChannel() this.eventChannel=this.getOpenerEventChannel()
this.formData.plotId=options.plotId this.formData.plotId=options.plotId
@ -404,6 +417,18 @@ export default {
uni.showToast({title:"请输入内容!",icon:"none"}) uni.showToast({title:"请输入内容!",icon:"none"})
} }
}, },
//
pestsFun(){
uni.navigateTo({
url:`/pages/massif/pestType?type=${({"病害":"disease","虫害":"pestis"})[this.formData.pestsType]}`,
events:{type:e=>{
this.formData.pests=e.map(v=>v).join(',')
}},
success:res=>{
res.eventChannel.emit('ids',this.formData?.pests?.split?.(',')?.filter(v=>v)||[])
}
})
},
// //
toPestRecord(){ toPestRecord(){
uni.navigateTo({ uni.navigateTo({

1
pages/massif/agrSpecs.vue

@ -220,7 +220,6 @@ export default {
} }
}, },
async onLoad(options){ async onLoad(options){
window.the=this
this.eventChannel=this.getOpenerEventChannel() this.eventChannel=this.getOpenerEventChannel()
this.eventChannel.on("detail", e=>{ this.eventChannel.on("detail", e=>{
this.agrDetail=e this.agrDetail=e

10
pages/massif/pestType.vue

@ -91,7 +91,7 @@
</style> </style>
<template> <template>
<view class="container flex"> <view class="container flex">
<d-navbar style="--bg:#10C176;--c:#fff;" isBack :text="({pestis:'选择虫害',disease:'选择病害'})[type]"> <d-navbar style="--bg:#10C176;--c:#fff;" isBack :text="({pestis:'选择虫害',disease:'选择病害'})[type]||'选择病虫害'">
<button slot="right" class="cu-btn round" @click="submit">提交</button> <button slot="right" class="cu-btn round" @click="submit">提交</button>
</d-navbar> </d-navbar>
@ -114,7 +114,7 @@
<view class="title">{{({pestis:'虫害',disease:'病害'})[type]}}种类 <button class="cu-btn round sm" v-if="searchVal.value||type=='disease'" @click="show=true">自定义+</button></view> <view class="title">{{({pestis:'虫害',disease:'病害'})[type]}}种类 <button class="cu-btn round sm" v-if="searchVal.value||type=='disease'" @click="show=true">自定义+</button></view>
<scroll-view scroll-y> <scroll-view scroll-y>
<view class="items"> <view class="items">
<text :class="{active:select.some(i=>i.id==v.id)}" v-for="(v,k) in list" :key="k" @click="selectPest(v)">{{v.name}}</text> <text :class="{active:select.some(i=>i==v.name)}" v-for="(v,k) in list" :key="k" @click="selectPest(v)">{{v.name}}</text>
</view> </view>
<u-empty :show="list.length<=0" text="为查询到相关信息" width="70%" icon="/static/noData.png"/> <u-empty :show="list.length<=0" text="为查询到相关信息" width="70%" icon="/static/noData.png"/>
</scroll-view> </scroll-view>
@ -285,10 +285,10 @@ export default {
} }
}, },
selectPest(e){ selectPest(e){
if(this.select.some(v=>v.id==e.id)){ if(this.select.some(v=>v==e.name)){
this.select=this.select.filter(v=>v.id!=e.id) this.select=this.select.filter(v=>v!=e.name)
}else{ }else{
this.select.push(e) this.select.push(e.name)
} }
}, },
} }

Loading…
Cancel
Save