Browse Source

联调接口

master
邓宏 2 years ago
parent
commit
3655c4f8a1
  1. 61
      pages/massif/add_farming.vue
  2. 82
      pages/massif/agrSpecs.vue
  3. 19
      pages/massif/plant_info.vue
  4. 15
      pages/stock/already.vue
  5. 8
      uni_modules/d-form/components/d-form/d-form.vue
  6. 5
      uni_modules/d-picker/components/d-picker/d-picker.vue
  7. 2
      uni_modules/d-search/components/d-search/d-search.vue

61
pages/massif/add_farming.vue

@ -27,6 +27,11 @@
margin:0 30rpx 20rpx 0; margin:0 30rpx 20rpx 0;
width:calc(100%/4 - 30rpx); width:calc(100%/4 - 30rpx);
text-align: center; text-align: center;
transition: all 0.3s;
&.active{
color:#fff;
background:#10C176;
}
} }
} }
} }
@ -106,22 +111,18 @@
<view class="type"> <view class="type">
<view class="title">农事类型</view> <view class="title">农事类型</view>
<view class="content"> <view class="content">
<text v-for="(v,k) in typeList" :key="k">{{v.label}}</text> <text :class="{active:formData.farmingType==v.value}" v-for="(v,k) in typeList" :key="k" @click="formData.farmingType=v.value">{{v.label}}</text>
<text>自定义+</text> <text>自定义+</text>
</view> </view>
</view> </view>
<view class="card"> <view class="card">
<view class="plant-dikuaimianji">{{massif.plotName}}</view> <view class="plant-dikuaimianji">{{massif.plotName}}</view>
<view class="plant-batch-add" @click="toCollectList"/> <view class="plant-batch-add" @click="toAdd"/>
</view>
<view class="card">
<view class="plant-dikuaimianji">阳光玫瑰种植1号地块</view>
<view class="info"> <view class="info">
<text>化肥</text> <text>中量元素水溶肥</text> <text>200kg</text> <text>化肥</text> <text>中量元素水溶肥</text> <text>200kg</text>
</view> </view>
<button class="cu-btn round bg-green shadow submit" @click="$u.route({url:'pages/massif/collectList'})">+继续添加农资</button> <button class="cu-btn round bg-green shadow submit" @click="toAdd">+继续添加农资</button>
</view> </view>
<view class="card"> <view class="card">
@ -132,7 +133,7 @@
v-bind="v" v-bind="v"
:field="k" :field="k"
:required="!!rules[k]" :required="!!rules[k]"
:value="[]"/> :value="formData[k]"/>
</u-form> </u-form>
</view> </view>
</view> </view>
@ -144,37 +145,26 @@ export default {
return{ return{
typeList:[], typeList:[],
fields:{ fields:{
people:{label:"操作人",styleType:"parallel"}, principal:{label:"操作人",styleType:"parallel", disabled:true},
date:{label:"操作日期",styleType:"parallel",type:"calendar"}, farmingTime:{label:"操作日期",styleType:"parallel",type:"calendar"},
imgs:{label:"农事图片",type:"upImg"}, images:{label:"农事图片",type:"upImg"},
intro:{label:"产品介绍",type:"textarea"}, farmingRemarks:{label:"产品介绍",type:"textarea"},
}, },
formData:{ formData:{
companyId: "", farmingType:"",
farmingId: "", principal: this.$store.getters['userInfo'].realname,
farmingMaterial: "", farmingTime:"",
farmingPlanId: "", images:[],
farmingRemarks: "",
farmingTime: "", plotId:"",
farmingType: "", plantBaseInfoId: this.$store.state.plantBaseInfoId,
inputName: "",
inputQuantity: 0,
inputTotal: 0,
inputType: "",
inventoryId: "",
plotId: this.$store.state.plantBaseInfoId,
principal: "",
principalId: "",
specificationDes: "",
specificationId: ""
},
rules:{
intro:{required:true},
}, },
rules:{ },
massif:{} massif:{}
} }
}, },
onLoad(options){ onLoad(options){
this.formData.plotId=options.plotId
this.init() this.init()
this.getMassifDetail(options.plotId) this.getMassifDetail(options.plotId)
}, },
@ -223,7 +213,12 @@ export default {
}) })
} }
}) })
} },
toAdd(){
uni.navigateTo({
url:"/pages/stock/already?intoPage=formRecord"
})
},
}, },
} }
</script> </script>

82
pages/massif/agrSpecs.vue

@ -100,6 +100,49 @@
} }
} }
} }
.agr-picker{
padding:0 30rpx;
display:flex;
flex-direction: column;
justify-content: space-evenly;
.name{
display:flex;
align-items: center;
text{
font-size:16rpx;
&:first-child{
color:#fff;
background:#10C176;
border-radius:0 20rpx 0 20rpx;
width:80rpx;
height:34rpx;
text-align: center;
line-height: 34rpx;
margin-right:16rpx;
}
&:nth-child(2){
font-weight: bold;
font-size:20rpx;
}
&:nth-child(3){
color:#999;
margin-left:6rpx;
}
}
}
.company{
font-size:16rpx;
&:before{
content:attr(data-name);
color:#FBA83C;
margin-right:20rpx;
}
&:after{
content:attr(data-company);
color:#999999;
}
}
}
} }
</style> </style>
<template> <template>
@ -110,7 +153,7 @@
<view class="card info"> <view class="card info">
<view class="name"> <view class="name">
<text>化肥</text> <text>中量元素水溶肥</text> <text @click="show=true" class="plant-jiantou_zuoyouqiehuan"/> <text>化肥</text> <text>中量元素水溶肥</text> <text @click="$refs.dPicker.show=true" class="plant-jiantou_zuoyouqiehuan"/>
</view> </view>
<view style="color:#707070;font-size:20rpx;">云南云天化股份有限公司</view> <view style="color:#707070;font-size:20rpx;">云南云天化股份有限公司</view>
</view> </view>
@ -125,7 +168,7 @@
</u-form> </u-form>
</view> </view>
<u-popup :show="show" @close="show=false"> <!-- <u-popup :show="show" @close="show=false">
<view class="btns"> <view class="btns">
<button class="cu-btn sm" @click="show=false">取消</button> <button class="cu-btn sm" @click="show=false">取消</button>
<button class="cu-btn sm bg-green">确定</button> <button class="cu-btn sm bg-green">确定</button>
@ -138,10 +181,17 @@
</view> </view>
</picker-view-column> </picker-view-column>
</picker-view> </picker-view>
</u-popup> </u-popup> -->
<d-picker :list="agrList" ref="dPicker">
<view slot-scope="{row}" class="agr-picker">
<view class="name"><text>{{row.agriculturalGoods}}</text><text>{{row.substanceName}}</text><text>()</text></view>
<view class="company" :data-name="row.detailType" :data-company="row.supplierName"/>
</view>
</d-picker>
</view> </view>
</template> </template>
<script> <script>
import request from '@/common/request.js'
export default { export default {
data(){ data(){
return{ return{
@ -154,8 +204,34 @@ export default {
}, },
agrList:[],
show:false, show:false,
} }
},
onLoad(){
this.searchAgr()
},
methods:{
async searchAgr(){
var res=await request("/api/OutInManageApi/queryCollectingList",{
method:"post",
body:{
baseId: "1611250480973049857"||this.$store.state.plantBaseInfoId,
search:"",
pageNo:1,
pageSize:100,
}
})
if(res.statu){
this.agrList=res.data.list
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取已领用农资列表失败!",
showCancel:false,
})
}
},
} }
} }
</script> </script>

19
pages/massif/plant_info.vue

@ -32,9 +32,10 @@ export default {
fields:{ fields:{
harvestNum:{label:"采收数量",suffix:'kg',type:"digit"}, harvestNum:{label:"采收数量",suffix:'kg',type:"digit"},
harvestBatch:{label:"收获批次号",btnText:"生成", btnFun:()=>this.formData.harvestBatch=`CS${new Date().format('yyyyMMdd')}${new Date().getTime()}`}, harvestBatch:{label:"收获批次号",btnText:"生成", btnFun:()=>this.formData.harvestBatch=`CS${new Date().format('yyyyMMdd')}${new Date().getTime()}`},
principal:{label:"负责人",type:"select",columns:[],value:[null]}, principal:{label:"负责人",type:"select",columns:[],value:[]},
harvestTime:{label:"采收时间",type:"calendar"}, harvestTime:{label:"采收时间",type:"calendar"},
status:{label:"采收状态",type:"select",columns:[[{label:"本次采收完后续还会采收",value:"1"},{label:"已全部采收完",value:"2"}]],value:[null]}, status:{label:"采收状态",type:"select",columns:[[{label:"本次采收完后续还会采收",value:"1"},{label:"已全部采收完",value:"2"}]],value:[]},
warehouseId:{label:"仓库",type:"select",columns:[],value:[]},
}, },
formData:{ formData:{
harvestNum:"", harvestNum:"",
@ -42,6 +43,7 @@ export default {
principal:"", principal:"",
harvestTime:"", harvestTime:"",
status:"", status:"",
warehouseId:"",
plantSchedulId:"",//id plantSchedulId:"",//id
plotId:"",//id plotId:"",//id
}, },
@ -73,6 +75,19 @@ export default {
showCancel:false, showCancel:false,
}) })
} }
//
var res=await request("/api/plantHarvest/getWarehouse",{
params:{plantBaseId:this.$store.state.plantBaseInfoId}
})
if(res.statu){
this.fields.warehouseId.columns=[res.data.map(v=>({label:v.warehouseName,value:v.id}))]
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取仓库选项失败!",
showCancel:false,
})
}
}, },
submit(){ submit(){
this.$refs.form.validate().then(async valid=>{ this.$refs.form.validate().then(async valid=>{

15
pages/stock/already.vue

@ -76,7 +76,7 @@
<d-search v-model="searchVal.search" @search="clean();search()"/> <d-search v-model="searchVal.search" @search="clean();search()"/>
<scroll-view scroll-y @scrollotower="search"> <scroll-view scroll-y @scrollotower="search">
<view class="card" v-for="(v,k) in list" :key="k"> <view class="card" v-for="(v,k) in list" :key="k" @click="toAddSpecs(v.id)">
<view class="info"> <view class="info">
<text>{{v.agriculturalGoods}}</text> <text>{{v.substanceName}}</text> <text>({{v.specDescribe}})</text> <text>{{v.agriculturalGoods}}</text> <text>{{v.substanceName}}</text> <text>({{v.specDescribe}})</text>
</view> </view>
@ -104,9 +104,11 @@ export default {
}, },
list:[], list:[],
total:0, total:0,
intoPage:"",//formRecord
} }
}, },
onLoad(){ onLoad(options){
this.intoPage=options.intoPage
this.search() this.search()
}, },
methods:{ methods:{
@ -122,8 +124,6 @@ export default {
body: this.searchVal body: this.searchVal
}) })
if(res.statu){ if(res.statu){
this.list=this.list.concat(res.data.list)
this.list=this.list.concat(res.data.list)
this.list=this.list.concat(res.data.list) this.list=this.list.concat(res.data.list)
this.total=res.data.total this.total=res.data.total
this.searchVal.pageNo++ this.searchVal.pageNo++
@ -137,6 +137,13 @@ export default {
} }
} }
}, },
toAddSpecs(id){
if(this.intoPage=='formRecord'){
uni.navigateTo({
url:`/pages/massif/agrSpecs?id=${id}`
})
}
},
} }
} }
</script> </script>

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

@ -167,7 +167,7 @@
&>.u-form-item__body__right{ &>.u-form-item__body__right{
.u-input{ .u-input{
margin:0; margin:0;
background:transparent; background:transparent!important;
input{ input{
text-align: right!important; text-align: right!important;
} }
@ -207,7 +207,7 @@
<view class="d-form"> <view class="d-form">
<u-form-item :class="{tip:!!tip, parallel:styleType=='parallel'}" :label="label" :prop="field" :required="required"> <u-form-item :class="{tip:!!tip, parallel:styleType=='parallel'}" :label="label" :prop="field" :required="required">
<view v-if="/^text$|^number$|^digit$|^password$/.test(type)" class="textinput"> <view v-if="/^text$|^number$|^digit$|^password$/.test(type)" class="textinput">
<u-input :placeholder="placeholder||`请输入${label}`" :type="type" :value="value" @input="$emit('input',$event)" @blur="/^number$|^digit$/.test(type) && $emit('input',parseFloat(value)||'')"> <u-input :placeholder="placeholder||`请输入${label}`" :type="type" :disabled="disabled" :value="value" @input="$emit('input',$event)" @blur="/^number$|^digit$/.test(type) && $emit('input',parseFloat(value)||'')">
<text v-if="suffix" slot="suffix">{{suffix}}</text> <text v-if="suffix" slot="suffix">{{suffix}}</text>
</u-input> </u-input>
<button v-if="btnText" @click="btnFun" class="cu-btn bg-green shadow">{{btnText}}</button> <button v-if="btnText" @click="btnFun" class="cu-btn bg-green shadow">{{btnText}}</button>
@ -358,6 +358,10 @@ import {computeArea} from '@/common/utils'
type:String, type:String,
default:"", default:"",
}, },
disabled:{
type:Boolean,
default:false,
},
startPlaceholder:"", startPlaceholder:"",
endPlaceholder:"", endPlaceholder:"",
}, },

5
uni_modules/d-picker/components/d-picker/d-picker.vue

@ -66,10 +66,11 @@
</view> </view>
<picker-view :value="[value]" indicator-style="height:90rpx;" @change="changeVal=$event.detail.value[0]"> <picker-view :value="[value]" indicator-style="height:90rpx;" @change="changeVal=$event.detail.value[0]">
<picker-view-column> <picker-view-column>
<view v-for="(v,k) in list" :key="k" class="item" style="height:90rpx;"> <slot v-for="(v,k) in list" :row="v"/>
<!-- <view v-for="(v,k) in list" :key="k" class="item" style="height:90rpx;">
<view class="name"><text>{{v.detailedParentName}}</text> <text>{{v.goodsName}}</text></view> <view class="name"><text>{{v.detailedParentName}}</text> <text>{{v.goodsName}}</text></view>
<view class="company" :data-name="v.detailedType" :data-company="v.supplier"/> <view class="company" :data-name="v.detailedType" :data-company="v.supplier"/>
</view> </view> -->
</picker-view-column> </picker-view-column>
</picker-view> </picker-view>
</u-popup> </u-popup>

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

@ -93,7 +93,7 @@
<view v-if="list.length>0" @click.stop="" class="want_search card" :class="{show:isShow}"> <view v-if="list.length>0" @click.stop="" class="want_search card" :class="{show:isShow}">
<text class="title">猜你想搜</text> <text class="title">猜你想搜</text>
<view class="content"> <view class="content">
<text v-for="(v,k) in list" :class="{active:v.value==selectVal}" :key="k" @click="$emit('select', v.value==selectVal?'':v.value);">{{v.label}}</text> <text v-for="(v,k) in list" :class="{active:v.value==selectVal}" :key="k" @click="$emit('select', v.value==selectVal?'':v.value);$emit('search')">{{v.label}}</text>
</view> </view>
</view> </view>
<view class="mask" :class="{show:isShow}" v-if="list.length>0"/> <view class="mask" :class="{show:isShow}" v-if="list.length>0"/>

Loading…
Cancel
Save