Browse Source

联调添加农事类型

master
邓宏 2 years ago
parent
commit
5cc44d6075
  1. 2
      common/request.js
  2. 2
      pages.js
  3. 62
      pages/massif/add_farming.vue
  4. 52
      pages/stock/agrWarehouse.vue
  5. 97
      pages/stock/list.vue
  6. 26
      pages/stock/mana.vue
  7. 9
      router/stock.js
  8. 2
      uni_modules/d-navbar/components/d-navbar/d-navbar.vue

2
common/request.js

@ -2,7 +2,7 @@ import store from "@/store"
export function host(host='default',suffix='/plant_manage'){
var url=process.env.NODE_ENV === 'development'?{
// default:`http://dpe74u.natappfree.cc` //陈
// default:`http://e5ruv4.natappfree.cc` //陈
default:`http://nys8cm.natappfree.cc` //马
// default:`http://7r39sr.natappfree.cc` //何
// default:`http://192.168.0.116:8080` //孙

2
pages.js

@ -23,7 +23,7 @@ module.exports = hot((pagesJson)=>{
condition : {
current: 0,
list: [
{name:"测试页面",path:"pages/massif/add_farming"},
{name:"测试页面",path:"pages/stock/agrWarehouse"},
// {name: "地块管理",path: "pages/massif/mana/index","query": ""},
// {name: "地块基本信息",path: "pages/massif/info","query": ""},
{name: "登录",path: "pages/home/login","query": ""},

62
pages/massif/add_farming.vue

@ -124,11 +124,11 @@
<view class="card">
<view class="plant-dikuaimianji">{{massif.plotName}}</view>
<view class="plant-batch-add" @click="toAdd"/>
<view class="plant-batch-add" @click="toCollectList"/>
<view class="info">
<text>化肥</text> <text>中量元素水溶肥</text> <text>200kg</text>
</view>
<button class="cu-btn round bg-green shadow submit" @click="toAdd">+继续添加农资</button>
<button class="cu-btn round bg-green shadow submit" @click="toCollectList">+继续添加农资</button>
</view>
<view class="card">
@ -144,7 +144,7 @@
</u-form>
</view>
<u-popup :show="isShow" closeOnClickOverlay @close="isShow=false">
<input placeholder="请输入" :focus="isShow" confirm-type="done" v-model="tempType" @confirm=""/>
<input placeholder="请输入" :focus="isShow" confirm-type="done" v-model="tempType" @confirm="addType"/>
</u-popup>
</view>
</template>
@ -157,19 +157,29 @@ export default {
fields:{
principal:{label:"操作人",styleType:"parallel", disabled:true},
farmingTime:{label:"操作日期",styleType:"parallel",type:"calendar"},
images:{label:"农事图片",type:"upImg"},
farmingPlanId:{label:"种植计划",type:"select",columns:[],value:[]},
images:{label:"农事图片",type:"upImg",num:3},
farmingRemarks:{label:"产品介绍",type:"textarea"},
},
formData:{
farmingType:"",
principal: this.$store.getters['userInfo'].realname,
farmingPlanId:"",
farmingTime:"",
images:[],
farmingRemarks:"",
plotId:"",
plantBaseInfoId: this.$store.state.plantBaseInfoId,
},
rules:{ },
rules:{
farmingTime:{required:true,message:"操作日期必填!",trigger:'blur'},
farmingPlanId:{required:true,message:"种植计划必选!",trigger:'blur'},
images:{required:true,validator(rule,val,call){
if(!this.fields.images.value)call(new Error("请上传农事图片!"));
else call()
},trigger:'blur'},
},
massif:{},
tempType:"",
isShow:false,
@ -178,7 +188,7 @@ export default {
onLoad(options){
this.formData.plotId=options.plotId
this.init()
this.getMassifDetail(options.plotId)
this.getMassifDetail()
},
methods:{
async init(){
@ -192,10 +202,23 @@ export default {
showCancel:false,
})
}
//
var res=await request("/api/plantFarming/getPlantPlan",{
params:{plotId: this.formData.plotId}
})
if(res.statu){
this.farmingPlanId.columns=[res.data.map(v=>({}))]
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取种植计划选项失败!",
showCancel:false,
})
}
},
async getMassifDetail(id){
async getMassifDetail(){
var res=await request("/api/plantPlot/queryById",{
params:{id}
params:{id:this.formData.plotId}
})
if(res.statu){
this.massif=res.data
@ -226,10 +249,25 @@ export default {
}
})
},
toAdd(){
uni.navigateTo({
url:"/pages/stock/already?intoPage=formRecord"
})
async addType(){
if(this.tempType){
var res=await request("/api/plantFarming/addFarmType",{
params:{text: this.tempType}
})
if(res.statu){
this.isShow=false
this.tempType=''
this.typeList.push({label:v.itemText, value:v.itemValue})
}else{
uni.showModal({
title:"提示",
content:res.msg||"添加农资类型失败!",
showCancel:false,
})
}
}else{
uni.showToast({title:"请输入内容!",icon:"none"})
}
},
},
}

52
pages/stock/agrWarehouse.vue

@ -0,0 +1,52 @@
<style lang="scss">
.container{
min-height:100%;
background:#f6f6f6;
padding:30rpx 0;
}
</style>
<template>
<view class="container">
<d-navbar text="农资入库" isBack style="--bg:#10C176;--c:#fff;">
<button slot="right" class="cu-btn round" @click="submit">提交</button>
</d-navbar>
<u-form class="card inline" errorType="toast" :model="formData" ref="form" :rules="rules" labelWidth="auto">
<d-form
v-for="(v,k) in fields" :key="k"
v-bind="v"
:field="k"
:required="rules[k]"
:value="formData[k]"/>
</u-form>
</view>
</template>
<script>
export default{
data(){
return{
fields:{
type:{label:"入库类型"},
date:{label:"入库时间"},
imgs:{label:"单据、凭证图片",type:"upImg",columns:[[]],value:''},
remarks:{label:"备注"},
},
formData:{
type:"",
date:"",
imgs:[],
remarks:"",
},
rules:{
type:{required:true},
date:{required:true},
imgs:{required:true},
}
}
},
onLoad(){},
methods:{
submit(){},
},
}
</script>

97
pages/stock/list.vue

@ -107,6 +107,56 @@
}
}
}
.dPicker{
.stock-picker{
display:flex;
flex-direction: column;
justify-content: space-evenly;
padding:0 20rpx;
&>.info{
display:flex;
align-items: center;
text{
&:first-child{
color:#fff;
background:#10C176;
height:40rpx;
min-width:80rpx;
text-align: center;
line-height: 40rpx;
border-radius: 0 20rpx 0 20rpx;
margin-right:10rpx;
padding:0 6rpx;
font-size:24rpx;
}
&:nth-child(2){
&:after{
content:"("attr(data-unit)")";
color:#999;
font-size:18rpx;
line-height: 40rpx;
margin-left:6rpx;
}
}
&:nth-child(3){
margin-left:auto;
color:#F34848;
font-size:20rpx;
}
}
}
&>.company{
font-size:24rpx;
display: flex;
text{
color:var(--c);
&:first-child{
flex-shrink: 0;
}
}
}
}
}
}
</style>
<template>
@ -115,7 +165,7 @@
<view class="name">
<text>化肥</text>
<text>中量元素水溶肥</text>
<text class="plant-jiantou_zuoyouqiehuan"/>
<text class="plant-jiantou_zuoyouqiehuan" @click="$refs.dPicker.show=true"/>
</view>
<view class="company">
<text>云南云天化股份有限公司</text>
@ -125,10 +175,6 @@
<view class="card specs">
<view class="title_mast">规格</view>
<!-- <view class="select" style="margin-bottom:20rpx;">
<text>请添加规格</text>
<text class="plant-youbian"/>
</view> -->
<view style="display:flex;">
<view class="select">
<text>请添加规格</text>
@ -148,13 +194,29 @@
</view>
<button class="cu-btn round bg-green shadow submit">确定</button>
<d-picker ref="dPicker" :list="stockList">
<view slot-scope="{row}" class="stock-picker">
<view class="info">
<text>{{row.agriculturalGoods}}</text>
<text :data-unit="row.specDescribe">{{row.substanceName}}</text>
<text>补货量{{row.replenishment||0}}kg</text>
</view>
<view class="company">
<text style="--c:#FBA83C;margin-right:14rpx;">{{row.detailType}}</text>
<text style="--c:#999;" class="over">{{row.supplierName}}</text>
</view>
</view>
</d-picker>
</view>
</template>
<script>
import request from '@/common/request'
export default{
data(){
return{
mode:"",
stockList:[],
}
},
onLoad(options){
@ -162,6 +224,31 @@ export default{
uni.setNavigationBarTitle({
title:({out:"出库列表",in:"入库列表"})[this.mode]
})
this.getStore({
baseId: this.$store.state.plantBaseInfoId,
search:"",
substanceType: options.type,
pageNo:1,
pageSize:50,
warehouseId: options.warehouseId,
})
},
methods:{
async getStore(body){
var res=await request("/api/InventoryManageApi/queryInventoryList",{
method:"post",
body,
})
if(res.statu){
this.stockList=res.data.nz
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取库存列表失败!",
showCancel:false,
})
}
},
},
}
</script>

26
pages/stock/mana.vue

@ -11,7 +11,7 @@
}
&>.btns{
flex-shrink: 0;
margin:0 30rpx;
margin:0 30rpx 30rpx;
display:flex;
border-radius: 30rpx;
button{
@ -33,6 +33,7 @@
flex-grow: 1;
height:1rpx;
.item{
margin-top:0;
&>.info{
display:flex;
align-items: center;
@ -99,26 +100,16 @@
color:#fff;
background:#10C176;
}
// background:transparent;
// border:2rpx solid transparent;
// color:var(--c);
// font-weight: bold;
// font-size:30rpx;
// height:50rpx;
// width:50rpx;
// &:first-child{
// border-radius: 30rpx 0 0 30rpx;
// border-color:var(--c);
// }
// &:nth-child(2){
// border-radius: 0 30rpx 30rpx 0;
// border-color:var(--c);
// }
}
}
}
}
}
&>button{
flex-shrink: 0;
height: 60rpx!important;
margin:15rpx auto!important;
}
}
</style>
<template>
@ -158,6 +149,7 @@
</view>
<u-empty v-if="list.length<=0" width="70%" icon="/static/noData.png"/>
</scroll-view>
<button class="cu-btn round bg-green shadow submit" @click="$u.route({url:'/pages/stock/agrWarehouse'})">+农资入库</button>
</view>
</template>
<script>
@ -209,7 +201,7 @@ export default {
},
toList(mode){
uni.navigateTo({
url:`/pages/stock/list?mode=${mode}`
url:`/pages/stock/list?mode=${mode}&type=${this.searchVal.substanceType}&warehouseId=${this.searchVal.warehouseId||''}`
})
},
}

9
router/stock.js

@ -52,4 +52,13 @@ module.exports=[
}
}
},
{
path:"pages/stock/agrWarehouse",
style:{
navigationBarTitleText:"农资入库",
"app-plus":{
titleNView:false
}
}
},
]

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

@ -33,6 +33,8 @@
font-size:30rpx;
padding:0;
color:#fff;
box-shadow: 4rpx 4rpx 6rpx rgba(0,0,0,0.1),
inset -4rpx -4rpx 6rpx rgba(255,255,255,0.3);
}
}
}

Loading…
Cancel
Save