Browse Source

联调接口

master
邓宏 2 years ago
parent
commit
aa2e2a695a
  1. 2
      common/request.js
  2. 56
      pages/baseMana/formReacord.vue
  3. 4
      pages/massif/add_farming.vue
  4. 134
      pages/massif/mana/farmRecord.vue
  5. 2
      pages/warehouse/info.vue
  6. 27
      uni_modules/d-form/components/d-form/d-form.vue
  7. 113
      uni_modules/d-search/components/d-search/d-search.vue

2
common/request.js

@ -4,7 +4,7 @@ export function host(host='default',suffix='/plant_manage'){
var url=process.env.NODE_ENV === 'development'?{ var url=process.env.NODE_ENV === 'development'?{
// default:`http://dpe74u.natappfree.cc` //陈 // default:`http://dpe74u.natappfree.cc` //陈
// default:`http://czixnn.natappfree.cc` //马 // default:`http://czixnn.natappfree.cc` //马
default:`http://spp799.natappfree.cc` //何 default:`http://7r39sr.natappfree.cc` //何
// default:`http://192.168.0.116:8080` //孙 // default:`http://192.168.0.116:8080` //孙
}:{ }:{
default:`` default:``

56
pages/baseMana/formReacord.vue

@ -75,22 +75,24 @@
</style> </style>
<template> <template>
<view class="container flex"> <view class="container flex">
<d-search /> <d-search v-model="searchVal.search" :list="['施肥','施肥','施肥','施肥','施肥','施肥','施肥','施肥','施肥','施肥']" @search="clean();search()"/>
<view class="date-range"> <view class="date-range">
<text class="plant-youbian">请选择开始时间</text> ~ <text class="plant-youbian">请选择结束时间</text> <text class="plant-youbian">请选择开始时间</text> ~ <text class="plant-youbian">请选择结束时间</text>
</view> </view>
<scroll-view scroll-y @scrolltolower="search"> <scroll-view scroll-y @scrolltolower="search">
<view class="card"> <view class="card" v-for="(v,k) in list" :key="k">
<view class="info"> <view class="info">
<text>施肥</text> <text class="over">中量元素水溶肥</text> <text>10kg</text> <text>{{v.type}}</text> <text class="over">{{v.inputName}}</text> <text>{{v.inputTotal}}{{v.unit}}</text>
</view> </view>
<view class="people"> <view class="people">
<text>负责人张召忠</text> <text>记录时间2022-12-12</text> <text>负责人{{v.principal}}</text> <text>记录时间{{v.time}}</text>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
</template> </template>
<script> <script>
@ -98,13 +100,53 @@ import request from '@/common/request.js'
export default { export default {
data(){ data(){
return{ return{
searchVal:{
search:"",
pageNo:1,
pageSize:6,
plotId:"",
PlantBaseInfoId: this.$store.state.plantBaseInfoId,
startTime:"",
endTime:"",
},
total:0,
list:[],
} }
}, },
onLoad(){}, onLoad(){
this.init()
this.search()
},
methods:{ methods:{
async init(){
var res=await reqeust("/api/plantFarming/listFarmName")
if(res.statu){
}
},
clean(){
this.list=[]
this.total=0
this.searchVal.pageNo=1
},
async search(){ async search(){
var res=await request() if(this.total==0 || this.list.length<this.total){
var res=await request("/api/plantFarming/listFarmByPlotId",{
params: this.searchVal
})
if(res.statu){
this.list=this.list.concat(res.data.list)
this.total=res.data.total
this.searchVal.pageNo++
if(this.list.length==this.total)uni.showToast({title:"加载完成!",icon:"none"})
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取农事记录列表失败!",
showCancel:false,
})
}
}
} }
} }
} }

4
pages/massif/add_farming.vue

@ -126,8 +126,8 @@ export default {
data(){ data(){
return{ return{
fields:{ fields:{
// people:{label:"",}, people:{label:"操作人",styleType:"parallel"},
// date:{label:""}, date:{label:"操作日期",styleType:"parallel",type:"calendar"},
imgs:{label:"农事图片",type:"upImg"}, imgs:{label:"农事图片",type:"upImg"},
intro:{label:"产品介绍",type:"textarea"}, intro:{label:"产品介绍",type:"textarea"},
}, },

134
pages/massif/mana/farmRecord.vue

@ -1,6 +1,10 @@
<style lang="scss" scoped> <style lang="scss" scoped>
.farm-record{ .farm-record{
display:flex;
flex-direction: column;
height: 100%;
&>.head{ &>.head{
flex-shrink: 0;
display:flex; display:flex;
align-items: center; align-items: center;
margin:30rpx; margin:30rpx;
@ -20,44 +24,49 @@
} }
} }
} }
.card{ scroll-view{
.name{ flex-grow: 1;
display:flex; height:1rpx;
align-items: center; .card{
text{ margin-top:0;
&:first-child{ .name{
flex-shrink: 0; display:flex;
color:#fff; align-items: center;
background:#10C176; text{
font-size:20rpx; &:first-child{
border-radius: 8rpx 40rpx 8rpx 40rpx; flex-shrink: 0;
width:80rpx; color:#fff;
text-align: center; background:#10C176;
height:40rpx; font-size:20rpx;
line-height: 40rpx; border-radius: 8rpx 40rpx 8rpx 40rpx;
margin-right:12rpx; width:80rpx;
} text-align: center;
&:nth-child(2){ height:40rpx;
flex-grow: 1; line-height: 40rpx;
} margin-right:12rpx;
&:nth-child(3){ }
flex-shrink: 0; &:nth-child(2){
color:#10C176; flex-grow: 1;
font-weight: bold; }
font-size:32rpx; &:nth-child(3){
margin-left:10rpx; flex-shrink: 0;
color:#10C176;
font-weight: bold;
font-size:32rpx;
margin-left:10rpx;
}
} }
} }
} .info{
.info{ margin-top:20rpx;
margin-top:20rpx; border-top:2rpx solid rgba(216, 216, 216, 0.4);
border-top:2rpx solid rgba(216, 216, 216, 0.4); padding-top:20rpx;
padding-top:20rpx; display:flex;
display:flex; justify-content: space-between;
justify-content: space-between; text{
text{ color:#999;
color:#999; font-size:24rpx;
font-size:24rpx; }
} }
} }
} }
@ -70,17 +79,20 @@
<text class="title">农资使用情况</text> <text class="title">农资使用情况</text>
<text class="add" @click="toAdd">+添加农事</text> <text class="add" @click="toAdd">+添加农事</text>
</view> </view>
<view class="card"> <scroll-view scroll-y @scrollotower="search">
<view class="name"> <view class="card" v-for="(v,k) in list" :key="k">
<text>施肥</text> <text>中量元素水溶肥</text> <text>200kg</text> <view class="name">
</view> <text>{{v.type}}</text> <text>{{v.inputName}}</text> <text>{{v.inputTotal}}{{v.unit}}</text>
<view class="info"> </view>
<text>负责人张召忠</text> <text>记录时间2022-12-12</text> <view class="info">
<text>负责人{{v.principal}}</text> <text>记录时间{{v.time}}</text>
</view>
</view> </view>
</view> </scroll-view>
</view> </view>
</template> </template>
<script> <script>
import request from '@/common/request.js'
export default { export default {
name:"farmRecord", name:"farmRecord",
props:{ props:{
@ -91,14 +103,48 @@ export default {
}, },
data(){ data(){
return{ return{
searchVal:{
search:"",
pageNo:1,
pageSize:6,
PlantBaseInfoId: this.$store.state.plantBaseInfoId,
startTime:"",
endTime:"",
},
total:0,
list:[],
} }
}, },
created(){
this.search()
},
methods:{ methods:{
toAdd(){ toAdd(){
uni.navigateTo({ uni.navigateTo({
url:`/pages/massif/add_farming?plotId=${this.plotId}` url:`/pages/massif/add_farming?plotId=${this.plotId}`
}) })
},
async search(){
if(this.total==0 || this.list.length<this.total){
var res=await request("/api/plantFarming/listFarmByPlotId",{
params: {
...this.searchVal,
plotId: this.plotId,
}
})
if(res.statu){
this.list=this.list.concat(res.data.list)
this.total=res.data.total
this.searchVal.pageNo++
if(this.list.length==this.total)uni.showToast({title:"加载完成!",icon:"none"})
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取农事记录列表失败!",
showCancel:false,
})
}
}
} }
} }
} }

2
pages/warehouse/info.vue

@ -73,7 +73,7 @@ import request from '@/common/request.js'
}, },
methods:{ methods:{
async init(){ async init(){
var res=await request("/api/AddWarehouseApi/queryWarehouseType") var res=await request("/api/WarehouseManageApi/queryWarehouseType")
if(res.statu){ if(res.statu){
this.fields.warehouseType.columns=[res.data.map(v=>({label:v,value:v}))] this.fields.warehouseType.columns=[res.data.map(v=>({label:v,value:v}))]
}else{ }else{

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

@ -159,6 +159,27 @@
margin-left:0!important; margin-left:0!important;
} }
} }
&.parallel{
&/deep/ .u-form-item__body{
flex-direction: row!important;
border-bottom:2rpx solid rgba(216, 216, 216, 0.4);
padding:0rpx 0;
&>.u-form-item__body__right{
.u-input{
margin:0;
background:transparent;
input{
text-align: right!important;
}
}
.calendar{
background:transparent;
margin:0;
height:80rpx;
}
}
}
}
} }
.amap{ .amap{
position:fixed; position:fixed;
@ -184,7 +205,7 @@
</style> </style>
<template> <template>
<view class="d-form"> <view class="d-form">
<u-form-item :class="{tip:!!tip}" :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" :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>
@ -333,6 +354,10 @@ import {computeArea} from '@/common/utils'
type:Function, type:Function,
default:()=>{} default:()=>{}
}, },
styleType:{
type:String,
default:"",
},
startPlaceholder:"", startPlaceholder:"",
endPlaceholder:"", endPlaceholder:"",
}, },

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

@ -1,31 +1,97 @@
<style lang="scss" scoped> <style lang="scss" scoped>
.d-search{ .d-search{
flex-shrink: 0; position:relative;
display:flex; &>.search{
align-items: center; position:relative;
background:#fff; z-index: 310;
margin:30rpx;
border-radius: 40rpx;
padding:6rpx;
height:60rpx;
.u-icon{
margin:0 14rpx;
flex-shrink: 0; flex-shrink: 0;
display:flex;
align-items: center;
background:#fff;
margin:30rpx;
border-radius: 40rpx;
padding:6rpx;
height:60rpx;
.u-icon{
margin:0 14rpx;
flex-shrink: 0;
}
input{
flex-grow: 1;
}
.u-button{
flex-shrink: 0;
width:max-content;
}
} }
input{ &>.want_search{
flex-grow: 1; position:absolute;
margin:0rpx 30rpx 0;
top:100%;
background:#fff;
width:calc(100% - 60rpx);
z-index: -1;
transform: scale(0.8);
transition: all 0.2s;
opacity:0;
&.show{
z-index: 320;
transform: scale(1);
opacity:1;
}
.title{
color:#999;
font-size:24rpx;
font-weight: normal;
}
.content{
display:flex;
flex-wrap: wrap;
margin:14rpx -20rpx -20rpx 0;
text{
color:#fff;
background:#10C176;
height:48rpx;
line-height: 48rpx;
border-radius: 30rpx;
width:calc(100%/5 - 20rpx);
text-align: center;
font-size:24rpx;
margin:0 20rpx 20rpx 0;
}
}
} }
.u-button{ &>.mask{
flex-shrink: 0; position:fixed;
width:max-content; top:0;
left:0;
width:100%;
height:100%;
background:rgba(0, 0, 0, 0.2);
z-index: -1;
transition: all 0.4s;
opacity:0;
&.show{
z-index: 300;
opacity:1;
}
} }
} }
</style> </style>
<template> <template>
<view class="d-search"> <view class="d-search" @click="isShow=false">
<u-icon name="search" color="#999999" size="20"/> <view class="search" @click.stop="">
<input placeholder="请输入搜索内容" :value="value" @input="$emit('input',$event.detail.value)" @confirm="$emit('search')"/> <u-icon name="search" color="#999999" size="20"/>
<u-button type="primary" shape="circle" color="#10C176" text="搜索" size="mini" @click="$emit('search')"/> <input placeholder="请输入搜索内容" :value="value" auto-blur @focus="isShow=true" @blur="isShow=false" @input="$emit('input',$event.detail.value)" @confirm="$emit('search')"/>
<u-button type="primary" shape="circle" color="#10C176" text="搜索" size="mini" @click="$emit('search')"/>
</view>
<view v-if="list.length>0" @click.stop="" class="want_search card" :class="{show:isShow}">
<text class="title">猜你想搜</text>
<view class="content">
<text v-for="(v,k) in list" :key="k" @click="$emit('input',v);$emit('search')">{{v}}</text>
</view>
</view>
<view class="mask" :class="{show:isShow}" v-if="list.length>0"/>
</view> </view>
</template> </template>
<script> <script>
@ -34,12 +100,19 @@ export default {
value:{ value:{
type:String, type:String,
default:"" default:""
},
list:{
type:Array,
default:()=>[]
} }
}, },
data(){ data(){
return{ return{
isShow: false,
} }
},
methods:{
} }
} }
</script> </script>
Loading…
Cancel
Save