Browse Source

联调新增采收接口

master
邓宏 2 years ago
parent
commit
9a2178dbad
  1. 2
      pages/massif/info.vue
  2. 25
      pages/massif/mana/plantPlan.vue
  3. 44
      pages/massif/plant_info.vue
  4. 6
      pages/massif/plant_plan.vue

2
pages/massif/info.vue

@ -17,7 +17,7 @@
:value="(/^dateRange$|^select$/.test(v.type)?fields[k].value:formData[k])"
@input="formData[k]=$event"
@selectRDate="selectDate"
@select="fields[k].value=[$event];formData[k]=fields[k].columns[0][$event].value"
@select="fields[k].value=$event;formData[k]=fields[k].columns[0][$event[0]].value"
@imgs="fields[k].value=$event"/>
</u-form>
<button class="cu-btn round bg-green shadow submit" @click="sumbit">保存</button>

25
pages/massif/mana/plantPlan.vue

@ -89,12 +89,12 @@
</style>
<template>
<view class="plant_plan">
<view class="card" v-for="(v,k) in list" :key="k" @click="reDetail(v.id)">
<view class="info">
<view class="card" v-for="(v,k) in list" :key="k">
<view class="info" @click="reDetail(v.id)">
<image :src="`${host}/${v.images}`" :data-type="v.plantType"/>
<view class="detail">
<view class="name">
<text>{{v.plantStandard}}</text> <text>{{v.varietyName}}</text> <text class="plant-youbian"/>
<text>{{v.plantStandard}}</text> <text class="over">{{v.varietyName}}</text> <text class="plant-youbian"/>
</view>
<view class="batch" style="--c:#999;">种植批次号{{v.plantBatch}}</view>
<view class="recovery" style="--c:#FFC760;">已采收{{v.harvested}}kg</view>
@ -103,8 +103,8 @@
</view>
<view class="date">
<text>本次预估采收时间{{v.harvestTime}}</text>
<button class="cu-btn" style="--c:255, 196, 87;">结束种植</button>
<button class="cu-btn" style="--c:153, 153, 153;" @click.stop="$u.route({url:'pages/massif/plant_info'})">采收</button>
<button class="cu-btn" style="--c:255, 196, 87;" @click.stop="finishPlant(v.id)">结束种植</button>
<button class="cu-btn" style="--c:153, 153, 153;" @click.stop="$u.route({url:'pages/massif/plant_info',params:{plantId:v.id,plotId:id}})">采收</button>
</view>
</view>
<u-empty v-if="list.length==0" icon="http://cdn.uviewui.com/uview/empty/data.png"/>
@ -173,6 +173,21 @@ export default {
event:{update:()=> {this.clean();this.search()} }
})
},
//
async finishPlant(plantPlanId){
var res=await request("/api/plantPlan/finishPlant",{
params:{plantPlanId}
})
if(res.statu){
}else{
uni.showModal({
title:"提示",
content:res.msg||"结束种植失败!",
showCancel:false,
})
}
},
}
}
</script>

44
pages/massif/plant_info.vue

@ -1,5 +1,9 @@
<style lang="scss">
.container{
min-height:100%;
background:#f6f6f6;
padding:30rpx 0;
.cu-navbar{
.action>button{
background:rgba(255, 255, 255, 0.1);
@ -17,7 +21,7 @@
<template>
<view class="container">
<cu-navbar text="采收信息" style="--bg:#10C176;--c:#fff;" isBack>
<button slot="right" class="cu-btn round">提交</button>
<button slot="right" class="cu-btn round" @click="submit">提交</button>
</cu-navbar>
<u-form class="card inline" :model="formData" :rules="rules" ref="form" labelWidth="auto">
@ -26,28 +30,48 @@
:key="k"
v-bind="v"
:field="k"
:required="!!rules[k]"/>
:required="!!rules[k]"
:value="/^select$/.test(v.type)?fields[k].value:formData[k]"/>
</u-form>
</view>
</template>
<script>
import request from '@/common/request'
export default {
data(){
return{
fields:{
num:{label:"采收数量",suffix:'kg'},
batch:{label:"收获批次号",btnText:"生成", btnFun(){console.log('asdfafd')}},
director:{label:"负责人",type:"select"},
recoveryDate:{label:"采收时间",type:"calendar"},
recoveryType:{label:"采收状态",type:"select"},
harvestNum:{label:"采收数量",suffix:'kg'},
harvestBatch:{label:"收获批次号",btnText:"生成", btnFun:()=>this.formData.harvestBatch=`CS${new Date().format('yyyyMMdd')}${new Date().getTime()}`},
principal:{label:"负责人",type:"select"},
harvestTime:{label:"采收时间",type:"calendar"},
status:{label:"采收状态",type:"select",columns:[[{label:"本次采收完后续还会采收",value:"1"},{label:"已全部采收完",value:"2"}]],value:[null]},
},
formData:{
name:"",
harvestNum:"",
harvestBatch:"",
principal:"",
harvestTime:"",
status:"",
plantSchedulId:"",//id
plotId:"",
},
rules:{
harvestNum: {required:true, message:"必填!", trigger:"blur"},
harvestBatch:{required:true, message:"必填!", trigger:"blur"},
principal:{required:true, message:"必填!", trigger:"blur"},
harvestTime:{required:true, message:"必填!", trigger:"blur"},
status:{required:true, message:"必填!", trigger:"blur"},
plantSchedulId:{required:true, message:"必填!", trigger:"blur"},
}
}
}
},
onLoad(options){
this.formData.plantSchedulId=options.plantId
this.formData.plotId=options.plotId
},
methods:{
submit(){},
},
}
</script>

6
pages/massif/plant_plan.vue

@ -81,9 +81,9 @@ export default {
eventChannel:null,
}
},
onLoad(options){
async onLoad(options){
this.eventChannel=this.getOpenerEventChannel()
this.init()
await this.init()
options.plotId && (this.formData.plotId=options.plotId)
options.id && this.getDetail(options.id)
@ -131,6 +131,8 @@ export default {
if(res.statu){
this.formData=res.data
this.fields.images.value=res.data.images.join(',')
this.fields.plantType.value=[this.fields.plantType.columns[0].findIndex(v=>v.value==res.data.plantType[0])]
this.fields.plantType.value[1]=this.fields.plantType.columns[0][this.fields.plantType.value[0]].children.findIndex(v=>v.value==res.data.plantType[1])
}else{
uni.showModal({
title:"提示",

Loading…
Cancel
Save