Browse Source

修改种植计划样式、联调害虫接口

master
邓宏 2 years ago
parent
commit
76b501bfff
  1. 2
      pages/massif/mana/plantPlan.vue
  2. 4
      pages/massif/pestRecord.vue
  3. 157
      pages/massif/pestType.vue
  4. 2
      uni_modules/d-form/components/d-form/d-form.vue

2
pages/massif/mana/plantPlan.vue

@ -150,7 +150,7 @@
<text>预估采收日期{{v.harvestTime}}</text>
<template v-if="v.status==1">
<button class="cu-btn" style="--c:255, 196, 87;" @click.stop="finishPlant(k)">结束种植</button>
<button class="cu-btn" style="--c:153, 153, 153;" @click.stop="toAdd(v.id)">采收</button>
<button class="cu-btn" style="color:#fff;background:#10C176;" @click.stop="toAdd(v.id)">采收</button>
</template>
<template v-else-if="v.status==2">
<button v-if="v.plantType=='水果'" class="cu-btn" style="--c:16, 193, 118;" @click.stop="copy(v.id)">复制当前计划</button>

4
pages/massif/pestRecord.vue

@ -32,7 +32,7 @@ export default {
pestSite:{label:"病虫害部位",type:"checkBox",value:[],columns:[{label:"根",value:"根"},{label:"茎",value:"茎"},{label:"叶",value:"叶"}]},
growthProcess:{label:"作物生长过程",type:"select-tab",dictCode:"growth_process"},
symptom:{label:"显著症状",type:"select-tab",dictCode:"symptom"},
type:{label:"害虫类型",type:"navigate",btnFun:()=>uni.navigateTo({url:"/pages/massif/pestType"})},
type:{label:"害虫类型",type:"navigate",btnFun:()=>uni.navigateTo({url:"/pages/massif/pestType",events:{type:e=>this.formData.type=e}})},
medicationArea:{label:"农资作用面积",type:"digit",suffix:"亩"},
pic:{label:"凭证",type:"upImg",value:""},
description:{label:"病虫害描述",type:"textarea"},
@ -41,6 +41,7 @@ export default {
growthProcess:'',
pestSite:'',
symptom:"",
type:"",
medicationArea:"",
pic:[],
description:"",
@ -49,6 +50,7 @@ export default {
growthProcess:{required:true,message:"请选择作物生长过程!",trigger:['blur','change']},
pestSite:{required:true,message:"请选择病虫害部位!",trigger:['blur','change']},
symptom:{required:true,message:"请选择显著症状!",trigger:['blur','change']},
type:{required:true,message:"请选择害虫类型!",trigger:['blur','change']},
medicationArea:{required:true,message:"请输入农资作用面积!",type:"number",trigger:['blur','change']},
pic:{required:true,validator:(rule,val,call)=>{
if(!this.fields.pic.value)call(new Error("请选择凭证!"));

157
pages/massif/pestType.vue

@ -7,11 +7,14 @@
}
}
&>.u-tabs{
margin:0 30rpx;
flex-shrink: 0;
&/deep/ .u-tabs__wrapper__nav__line{
box-shadow:0 4rpx 6rpx 2rpx rgba(16,193,118,0.1);
}
}
&>.tabs{
flex-shrink: 0;
margin:10rpx 30rpx 0;
background:#EEFBF5;
border-radius: 8rpx;
@ -27,27 +30,45 @@
}
}
&>.title{
flex-shrink: 0;
color:#333;
margin:30rpx;
display:flex;
align-items: center;
&:before{
content:"*";
color:#EE263A;
}
button{
margin-left:auto;
background:#10C176;
color:#fff;
box-shadow: 4rpx 4rpx 6rpx rgba(0,0,0,0.1);
font-size:24rpx;
}
}
&>.items{
scroll-view{
flex-grow: 1;
height:1rpx;
margin:0 30rpx;
width:calc(100% - 60rpx);
.items{
display:flex;
flex-wrap: wrap;
margin:30rpx;
margin-right:-30rpx;
text{
background:#eee;
background:rgba(238, 238, 238, 0.6);
color:#999;
height:54rpx;
line-height: 54rpx;
border-radius: 54rpx;
font-size:24rpx;
margin:0 30rpx 20rpx 0;
width:calc(100%/4 - 30rpx);
min-width:calc(100%/4 - 30rpx);
box-sizing: border-box;
padding:0 10rpx;
text-align: center;
transition: all 0.3s;
&.active{
background:#10C176;
color:#fff;
@ -55,44 +76,136 @@
}
}
}
}
</style>
<template>
<view class="container">
<view class="container flex">
<d-navbar style="--bg:#10C176;--c:#fff;" isBack text="添加农事">
<button slot="right" class="cu-btn round" @click="submit">提交</button>
</d-navbar>
<d-search background="#eee"/>
<u-tabs :list="cropList" activeStyle="color:#10C176" lineWidth="60rpx" lineHeight="8rpx" inactiveStyle="color:#333" lineColor="#10C176"></u-tabs>
<d-search background="#eee" v-model="searchVal.search" @search="inputSearch"/>
<u-tabs
:list="cropList"
:current="cropCurrent"
activeStyle="color:#10C176"
keyName="label"
lineWidth="60rpx"
lineHeight="8rpx"
inactiveStyle="color:#333"
lineColor="#10C176"
@change="cropCurrent=$event.index"/>
<view class="tabs">
<text>玉米</text>
<text class="active">水稻</text>
<text v-for="(v,k) in agrProd" :class="{active:searchVal.value==v.value}" :key="k" @click="agrSearch(v.value)">{{v.label}}</text>
</view>
<view class="title">害虫类型</view>
<view class="title">害虫种类 <button class="cu-btn round sm" v-if="searchVal.value">自定义+</button></view>
<scroll-view scroll-y>
<view class="items">
<text class="active">黄地老虎</text>
<text v-for="k in 20" :key="k">黄地老虎</text>
<text>自定义+</text>
<text :class="{active:select==v}" v-for="(v,k) in list" :key="k" @click="select=v">{{v}}</text>
</view>
<u-empty :show="list.length<=0" text=" " width="70%" icon="/static/noData.png"/>
</scroll-view>
</view>
</template>
<script>
import request from '@/common/request'
export default {
data(){
return{
cropList:[
{name:'粮食作物',},
{name:'油料作物',},
{name:'经济作物',},
{name:'药用作物',},
{name:'牧草',},
{name:'树林'},
]
cropList:[],
cropCurrent:0,
list:[],
searchVal:{
value:"",//
search:"",
},
select:"",
eventChannel:null,
}
},
computed:{
agrProd(){
return this.cropList?.[this.cropCurrent]?.children||[]
},
},
onLoad(){
this.eventChannel=this.getOpenerEventChannel()
this.init()
},
methods:{
submit(){
async init(){
var res=await request("/common/api/dict/categoryValue",{
method:"post",
params:{code:"B09"}
})
if(res.statu){
this.cropList=res.data.map(v=>({...v,children:v.children.length>0?v.children:[{label:"全部",value:'all'}]}))
this.agrSearch(res.data[0]?.children?.[0]?.value||"")
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取种植计划选项失败!",
showCancel:false,
})
}
},
async inputSearch(){
if(this.searchVal.search){
this.searchVal.value=""
this.select=""
var res=await request("/api/plantFarming/getPestByLike",{
params: {
value: '',//
search: this.searchVal.search,
}
})
if(res.statu){
this.list=res.data
}else{
this.list=[]
uni.showModal({
title:"提示",
content:res.msg||"获取种植计划选项失败!",
showCancel:false,
})
}
}
},
async agrSearch(id){
if(id){
this.searchVal={ value:id, search:"" }
this.select=""
var res=await request("/api/plantFarming/getPestByLike",{
params: {
value: id,//
search:"",
}
})
if(res.statu){
this.list=res.data
}else{
this.list=[]
uni.showModal({
title:"提示",
content:res.msg||"获取种植计划选项失败!",
showCancel:false,
})
}
}
},
submit(){
if(this.select){
this.eventChannel.emit("type", this.select)
uni.navigateBack()
}else{
uni.showModal({
title:"提示",
content:"请选择害虫类型!",
showCancel:false,
})
}
},
}
}

2
uni_modules/d-form/components/d-form/d-form.vue

@ -289,7 +289,7 @@
</view>
<view v-else-if="type=='map'" class="map plant-dingweixiao" :class="{noData:value.length<=0}" @click="openMap">{{value.length>0?Object.values(value[0]).join():"选择经纬度"}}</view>
<view v-else-if="type=='select'" class="plant-youbian" :class="{noData: !value[0]}" @click="show=true">{{pickerContent}}</view>
<view v-else-if="type=='navigate'" class="navigate plant-youbian noData" @click="btnFun">{{value||placeholder||`请选择${label}`}}</view>
<view v-else-if="type=='navigate'" class="navigate plant-youbian" :class="{noData:!value}" @click="btnFun">{{value||placeholder||`请选择${label}`}}</view>
<view v-else-if="type=='select-tab'" class="select-tab">
<text :class="{active:value==v.value}" v-for="(v,k) in dictCodeList" :key="k" @click="$emit('select',[v])">{{v.label}}</text>
<text @click="show=true">自定义+</text>

Loading…
Cancel
Save