Browse Source

联调 农事记录搜索

master
邓宏 2 years ago
parent
commit
4189fc2514
  1. 4
      common/request.js
  2. 13
      pages/baseMana/formReacord.vue
  3. 83
      pages/massif/add_farming.vue
  4. 2
      pages/massif/agrSpecs.vue
  5. 13
      uni_modules/d-search/components/d-search/d-search.vue

4
common/request.js

@ -3,8 +3,8 @@ import store from "@/store"
export function host(host='default',suffix='/plant_manage'){ 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://7xa7q2.natappfree.cc` //马
default:`http://7r39sr.natappfree.cc` //何 // default:`http://7r39sr.natappfree.cc` //何
// default:`http://192.168.0.116:8080` //孙 // default:`http://192.168.0.116:8080` //孙
}:{ }:{
default:`` default:``

13
pages/baseMana/formReacord.vue

@ -8,7 +8,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
color:#999; color:#999;
text{ picker{
width:50%; width:50%;
background:#fff; background:#fff;
margin:0 30rpx; margin:0 30rpx;
@ -75,13 +75,12 @@
</style> </style>
<template> <template>
<view class="container flex"> <view class="container flex">
<d-search v-model="searchVal.search" :list="['施肥','施肥','施肥','施肥','施肥','施肥','施肥','施肥','施肥','施肥']" @search="clean();search()"/> <d-search v-model="searchVal.search" :list="typeList" @search="clean();search()"/>
<view class="date-range"> <view class="date-range">
<text class="plant-youbian">请选择开始时间</text> ~ <text class="plant-youbian">请选择结束时间</text> <picker mode="date" class="plant-youbian">请选择开始时间</picker> ~ <picker mode="date" class="plant-youbian">请选择结束时间</picker>
</view> </view>
<scroll-view scroll-y @scrolltolower="search"> <scroll-view scroll-y @scrolltolower="search">
<view class="card" v-for="(v,k) in list" :key="k"> <view class="card" v-for="(v,k) in list" :key="k">
<view class="info"> <view class="info">
@ -92,7 +91,6 @@
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
</template> </template>
<script> <script>
@ -111,6 +109,7 @@ import request from '@/common/request.js'
}, },
total:0, total:0,
list:[], list:[],
typeList:[],
} }
}, },
onLoad(){ onLoad(){
@ -119,9 +118,9 @@ import request from '@/common/request.js'
}, },
methods:{ methods:{
async init(){ async init(){
var res=await reqeust("/api/plantFarming/listFarmName") var res=await request("/api/plantFarming/listFarmName")
if(res.statu){ if(res.statu){
this.typeList=res.data
} }
}, },
clean(){ clean(){

83
pages/massif/add_farming.vue

@ -4,6 +4,32 @@
background:#f6f6f6; background:#f6f6f6;
padding:30rpx 0; padding:30rpx 0;
&>.type{
margin:0 30rpx 30rpx;
.title{
color:#333;
margin-bottom:22rpx;
&:before{
content:"*";
color:#EE4949;
}
}
.content{
display:flex;
flex-wrap: wrap;
margin:0 -30rpx -20rpx 0;
text{
background:#EEEEEE;
color:#999;
height:54rpx;
line-height: 54rpx;
border-radius: 50rpx;
margin:0 30rpx 20rpx 0;
width:calc(100%/4 - 30rpx);
text-align: center;
}
}
}
.card{ .card{
margin-top:0; margin-top:0;
.plant-dikuaimianji{ .plant-dikuaimianji{
@ -68,30 +94,22 @@
} }
} }
} }
.item{
display:flex;
justify-content: space-between;
height:80rpx;
align-items: center;
border-bottom:2rpx solid rgba(216, 216, 216, 0.4);
text{
color:#777;
&.plant-youbian{
display: flex;
align-items: center;
flex-direction: row-reverse;
}
}
}
} }
} }
</style> </style>
<template> <template>
<view class="container"> <view class="container">
<d-navbar style="--bg:#10C176;--c:#fff;" isBack text="添加农事"> <d-navbar style="--bg:#10C176;--c:#fff;" isBack text="添加农事">
<button slot="right" class="cu-btn round">提交</button> <button slot="right" class="cu-btn round" @click="submit">提交</button>
</d-navbar> </d-navbar>
<view class="type">
<view class="title">农事类型</view>
<view class="content">
<text v-for="k in 8" :key="k">自定义+</text>
</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="toCollectList"/>
@ -106,8 +124,6 @@
</view> </view>
<view class="card"> <view class="card">
<view class="item"> <text>操作人</text><text>张召忠</text> </view>
<view class="item"> <text>操作日期</text><text class="plant-youbian">2022-12-23</text> </view>
<u-form class="inline" :model="formData" :rules="rules" ref="form" labelWidth="auto"> <u-form class="inline" :model="formData" :rules="rules" ref="form" labelWidth="auto">
<d-form <d-form
v-for="(v,k) in fields" v-for="(v,k) in fields"
@ -132,7 +148,23 @@ export default {
intro:{label:"产品介绍",type:"textarea"}, intro:{label:"产品介绍",type:"textarea"},
}, },
formData:{ formData:{
name:"", companyId: "",
farmingId: "",
farmingMaterial: "",
farmingPlanId: "",
farmingRemarks: "",
farmingTime: "",
farmingType: "",
inputName: "",
inputQuantity: 0,
inputTotal: 0,
inputType: "",
inventoryId: "",
plotId: this.$store.state.plantBaseInfoId,
principal: "",
principalId: "",
specificationDes: "",
specificationId: ""
}, },
rules:{ rules:{
intro:{required:true}, intro:{required:true},
@ -164,6 +196,19 @@ export default {
event:{ add:()=>{} } event:{ add:()=>{} }
}) })
}, },
submit(){
this.$refs.form.validoter().then(async valid=>{
if(valid){
var res=await request("/api/plantFarming/addOrUpdate",{
method:"post",
body:{
...this.formData,
}
})
}
})
}
}, },
} }
</script> </script>

2
pages/massif/agrSpecs.vue

@ -104,7 +104,7 @@
</style> </style>
<template> <template>
<view class="container"> <view class="container">
<d-navbar style="--bg:#10C176;--c:#fff;" isBack> <d-navbar style="--bg:#10C176;--c:#fff;" isBack text="农资规格">
<button slot="right" class="cu-btn round">确定</button> <button slot="right" class="cu-btn round">确定</button>
</d-navbar> </d-navbar>

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

@ -49,8 +49,6 @@
flex-wrap: wrap; flex-wrap: wrap;
margin:14rpx -20rpx -20rpx 0; margin:14rpx -20rpx -20rpx 0;
text{ text{
color:#fff;
background:#10C176;
height:48rpx; height:48rpx;
line-height: 48rpx; line-height: 48rpx;
border-radius: 30rpx; border-radius: 30rpx;
@ -58,6 +56,13 @@
text-align: center; text-align: center;
font-size:24rpx; font-size:24rpx;
margin:0 20rpx 20rpx 0; margin:0 20rpx 20rpx 0;
transition: all 0.3s;
color:#999;
background:#EEEEEE;
&.active{
color:#fff;
background:#10C176;
}
} }
} }
} }
@ -82,13 +87,13 @@
<view class="d-search" @click="isShow=false"> <view class="d-search" @click="isShow=false">
<view class="search" @click.stop=""> <view class="search" @click.stop="">
<u-icon name="search" color="#999999" size="20"/> <u-icon name="search" color="#999999" size="20"/>
<input placeholder="请输入搜索内容" :value="value" auto-blur @focus="isShow=true" @blur="isShow=false" @input="$emit('input',$event.detail.value)" @confirm="$emit('search')"/> <input placeholder="请输入搜索内容" :value="(list.find(v=>v.value==value)||{label:''}).label||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')"/> <u-button type="primary" shape="circle" color="#10C176" text="搜索" size="mini" @click="$emit('search')"/>
</view> </view>
<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" :key="k" @click="$emit('input',v);$emit('search')">{{v}}</text> <text v-for="(v,k) in list" :class="{active:false}" :key="k" @click="$emit('input', 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