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. 54
      pages/massif/mana/farmRecord.vue
  5. 2
      pages/warehouse/info.vue
  6. 27
      uni_modules/d-form/components/d-form/d-form.vue
  7. 79
      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'?{
// default:`http://dpe74u.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:``

56
pages/baseMana/formReacord.vue

@ -75,22 +75,24 @@
</style>
<template>
<view class="container flex">
<d-search />
<d-search v-model="searchVal.search" :list="['施肥','施肥','施肥','施肥','施肥','施肥','施肥','施肥','施肥','施肥']" @search="clean();search()"/>
<view class="date-range">
<text class="plant-youbian">请选择开始时间</text> ~ <text class="plant-youbian">请选择结束时间</text>
</view>
<scroll-view scroll-y @scrolltolower="search">
<view class="card">
<view class="card" v-for="(v,k) in list" :key="k">
<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 class="people">
<text>负责人张召忠</text> <text>记录时间2022-12-12</text>
<text>负责人{{v.principal}}</text> <text>记录时间{{v.time}}</text>
</view>
</view>
</scroll-view>
</view>
</template>
<script>
@ -98,13 +100,53 @@ import request from '@/common/request.js'
export default {
data(){
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:{
async init(){
var res=await reqeust("/api/plantFarming/listFarmName")
if(res.statu){
}
},
clean(){
this.list=[]
this.total=0
this.searchVal.pageNo=1
},
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(){
return{
fields:{
// people:{label:"",},
// date:{label:""},
people:{label:"操作人",styleType:"parallel"},
date:{label:"操作日期",styleType:"parallel",type:"calendar"},
imgs:{label:"农事图片",type:"upImg"},
intro:{label:"产品介绍",type:"textarea"},
},

54
pages/massif/mana/farmRecord.vue

@ -1,6 +1,10 @@
<style lang="scss" scoped>
.farm-record{
display:flex;
flex-direction: column;
height: 100%;
&>.head{
flex-shrink: 0;
display:flex;
align-items: center;
margin:30rpx;
@ -20,7 +24,11 @@
}
}
}
scroll-view{
flex-grow: 1;
height:1rpx;
.card{
margin-top:0;
.name{
display:flex;
align-items: center;
@ -62,6 +70,7 @@
}
}
}
}
</style>
<template>
<view class="farm-record">
@ -70,17 +79,20 @@
<text class="title">农资使用情况</text>
<text class="add" @click="toAdd">+添加农事</text>
</view>
<view class="card">
<scroll-view scroll-y @scrollotower="search">
<view class="card" v-for="(v,k) in list" :key="k">
<view class="name">
<text>施肥</text> <text>中量元素水溶肥</text> <text>200kg</text>
<text>{{v.type}}</text> <text>{{v.inputName}}</text> <text>{{v.inputTotal}}{{v.unit}}</text>
</view>
<view class="info">
<text>负责人张召忠</text> <text>记录时间2022-12-12</text>
<text>负责人{{v.principal}}</text> <text>记录时间{{v.time}}</text>
</view>
</view>
</scroll-view>
</view>
</template>
<script>
import request from '@/common/request.js'
export default {
name:"farmRecord",
props:{
@ -91,14 +103,48 @@ export default {
},
data(){
return{
searchVal:{
search:"",
pageNo:1,
pageSize:6,
PlantBaseInfoId: this.$store.state.plantBaseInfoId,
startTime:"",
endTime:"",
},
total:0,
list:[],
}
},
created(){
this.search()
},
methods:{
toAdd(){
uni.navigateTo({
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:{
async init(){
var res=await request("/api/AddWarehouseApi/queryWarehouseType")
var res=await request("/api/WarehouseManageApi/queryWarehouseType")
if(res.statu){
this.fields.warehouseType.columns=[res.data.map(v=>({label:v,value:v}))]
}else{

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

@ -159,6 +159,27 @@
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{
position:fixed;
@ -184,7 +205,7 @@
</style>
<template>
<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">
<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>
@ -333,6 +354,10 @@ import {computeArea} from '@/common/utils'
type:Function,
default:()=>{}
},
styleType:{
type:String,
default:"",
},
startPlaceholder:"",
endPlaceholder:"",
},

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

@ -1,5 +1,9 @@
<style lang="scss" scoped>
.d-search{
position:relative;
&>.search{
position:relative;
z-index: 310;
flex-shrink: 0;
display:flex;
align-items: center;
@ -20,13 +24,75 @@
width:max-content;
}
}
&>.want_search{
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;
}
}
}
&>.mask{
position:fixed;
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>
<template>
<view class="d-search">
<view class="d-search" @click="isShow=false">
<view class="search" @click.stop="">
<u-icon name="search" color="#999999" size="20"/>
<input placeholder="请输入搜索内容" :value="value" @input="$emit('input',$event.detail.value)" @confirm="$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>
</template>
<script>
export default {
@ -34,12 +100,19 @@ export default {
value:{
type:String,
default:""
},
list:{
type:Array,
default:()=>[]
}
},
data(){
return{
isShow: false,
}
},
methods:{
}
}
</script>
Loading…
Cancel
Save