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 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)}">
<text class="title">操作</text> <text class="record">病虫害记录</text><text class="plant-youbian"/>
</view>
<view class="value" v-if="formData.farmPests">
过程:{{formData.farmPests.growthProcess}}病虫害部位:{{formData.farmPests.pestSite}}症状{{formData.farmPests.symptom}}({{formData.farmPests.pestName.map(v=>v.name).join(',')}})
</view>
</view>
</view> -->
<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
v-for="(v,k) in fields"
:key="k"
@ -256,6 +260,8 @@ export default {
workTime:0,
inputList:[],
farmPests:null,//
pestsType:"",
pests:"",
plotId:"",
plantBaseInfoId: this.$store.state.baseInfo.id,
},
@ -271,6 +277,13 @@ export default {
eventChannel:null,
}
},
watch:{
'formData.pestsType'(n,o){
if(n){
this.formData.pests=''
}
}
},
onLoad(options){
this.eventChannel=this.getOpenerEventChannel()
this.formData.plotId=options.plotId
@ -404,6 +417,18 @@ export default {
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(){
uni.navigateTo({

1
pages/massif/agrSpecs.vue

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

10
pages/massif/pestType.vue

@ -91,7 +91,7 @@
</style>
<template>
<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>
</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>
<scroll-view scroll-y>
<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>
<u-empty :show="list.length<=0" text="为查询到相关信息" width="70%" icon="/static/noData.png"/>
</scroll-view>
@ -285,10 +285,10 @@ export default {
}
},
selectPest(e){
if(this.select.some(v=>v.id==e.id)){
this.select=this.select.filter(v=>v.id!=e.id)
if(this.select.some(v=>v==e.name)){
this.select=this.select.filter(v=>v!=e.name)
}else{
this.select.push(e)
this.select.push(e.name)
}
},
}

Loading…
Cancel
Save