Browse Source

修改日期搜索

master
邓宏 2 years ago
parent
commit
f1326d29a5
  1. 7
      pages/baseMana/formReacord.vue
  2. 20
      pages/massif/mana/recovery.vue
  3. 6
      pages/massif/mana/transactions.vue
  4. 0
      uni_modules/d-dateRange/changelog.md
  5. 109
      uni_modules/d-dateRange/components/d-dateRange/d-dateRange.vue
  6. 81
      uni_modules/d-dateRange/package.json
  7. 1
      uni_modules/d-dateRange/readme.md

7
pages/baseMana/formReacord.vue

@ -191,11 +191,8 @@
</view>
</d-search>
<view class="date-range">
<picker mode="date" class="plant-youbian" :class="{noData:!searchVal.startTime}" :end="searchVal.endTime" @change="searchVal.startTime=$event.detail.value;clean();search()" >{{searchVal.startTime||"请选择开始时间"}}</picker>
~
<picker mode="date" class="plant-youbian" :class="{noData:!searchVal.endTime}" :start="searchVal.startTime" @change="searchVal.endTime=$event.detail.value;clean();search()">{{searchVal.endTime||"请选择结束时间"}}</picker>
</view>
<d-dateRange @date="searchVal.startTime=$event[0];searchVal.endTime=$event[1];clean();search()"/>
<scroll-view scroll-y @scrolltolower="search">
<view class="card" v-for="(v,k) in list" :key="k" @click="v.growthProcess && toDetail(v)">

20
pages/massif/mana/recovery.vue

@ -114,11 +114,7 @@
</style>
<template>
<view class="recovery">
<view class="dateRange">
<text class="plant-youbian" :class="{noDate:!searchVal.startTime}" @click="dateType='startTime';show=true">{{searchVal.startTime||"请选择开始日期"}}</text>
<text>~</text>
<text class="plant-youbian" :class="{noDate:!searchVal.endTime}" @click="dateType='endTime';show=true">{{searchVal.endTime||"请选择结束日期"}}</text>
</view>
<d-dateRange @date="searchVal.startTime=$event[0];searchVal.endTime=$event[1];clean();search()"/>
<scroll-view scroll-y @scrolltolower="search">
<view class="card" v-for="(v,k) in list" :key="k">
@ -169,7 +165,6 @@ export default {
data(){
return{
show:false,
dateType:"startTime",
host:host("imgUrl"),
searchVal:{
pageNo:1,
@ -181,19 +176,6 @@ export default {
total:0,
}
},
computed:{
date(){
return [this.searchVal.startTime,this.searchVal.endTime]
}
},
watch:{
date(n){
if(n[0] && n[1]){
this.clean()
this.search()
}
}
},
created(){
this.search()

6
pages/massif/mana/transactions.vue

@ -83,11 +83,7 @@
</style>
<template>
<view class="transaction">
<view class="dateRange">
<text class="plant-youbian" :class="{noDate:!searchVal.startTime}" @click="dateType='startTime';show=true">{{searchVal.startTime||"请选择开始日期"}}</text>
<text>~</text>
<text class="plant-youbian" :class="{noDate:!searchVal.endTime}" @click="dateType='endTime';show=true">{{searchVal.endTime||"请选择结束日期"}}</text>
</view>
<d-dateRange @date="searchVal.startTime=$event[0];searchVal.endTime=$event[1];reSearch()"/>
<scroll-view scroll-y @scrolltolower="search">
<view class="card" v-for="(v,k) in list" :key="k">

0
uni_modules/d-dateRange/changelog.md

109
uni_modules/d-dateRange/components/d-dateRange/d-dateRange.vue

@ -0,0 +1,109 @@
<style lang="less">
.d-dateRange{
flex-shrink: 0;
display:flex;
align-items: center;
margin:20rpx 30rpx;
&>text{
display: flex;
align-items: center;
justify-content: space-between;
background:#fff;
font-size:24rpx;
color:#333;
height:48rpx;
position: relative;
padding:0 30rpx 0 10rpx;
min-width:220rpx;
box-sizing: border-box;
border-radius: 8rpx;
&:first-child{margin-right:28rpx;}
&:nth-child(2){margin-left:28rpx;}
&.noDate{
color:#999;
}
.plant-youbian,.plant-zengjia{
font-size:24rpx;
height:48rpx;
width:40rpx;
text-align: center;
line-height: 48rpx;
position:absolute;
top:0;
right:0;
&:before{
display: inline-block;
transform: rotate(90deg);
}
}
.plant-zengjia{
z-index: 100;
&:before{
transform: rotate(45deg);
}
}
}
}
</style>
<template>
<view class="d-dateRange">
<text :class="{noDate:!startTime}" @click="type='start';show=true">
{{startTime||"请选择开始日期"}}
<text v-if="startTime" class="plant-zengjia" @click.stop="startTime=''"/>
<text v-else class="plant-youbian"/>
</text>
~
<text :class="{noDate:!endTime}" @click="type='end';show=true">
{{endTime||"请选择结束日期"}}
<text class="plant-youbian"/>
<text v-if="endTime" class="plant-zengjia" @click.stop="endTime=''"/>
<text v-else class="plant-youbian"/>
</text>
<u-datetime-picker
:show="show"
mode="date"
style="flex:0;"
closeOnClickOverlay
@close="show=false"
@cancel="show=false"
:minDate="type=='end'&&startTime?new Date(startTime).getTime():new Date().set('y',-15).getTime()"
:maxDate="type=='start'&&endTime?new Date(endTime).getTime():new Date().set('y',15).getTime()"
:value=" type=='start'&&startTime|| type=='end'&&endTime || new Date().format('yyyy-MM-dd')"
@confirm="confirm"/>
</view>
</template>
<script>
export default{
data(){
return{
startTime:"",
endTime:"",
type:"start",
show:false,
}
},
computed:{
date(){
return[this.startTime,this.endTime]
}
},
watch:{
date(n){
if(n[0]&&n[1]||!n[0]&&!n[1]){
this.$emit("date",n)
}
}
},
methods:{
confirm(e){
if(this.type=='start'){
this.startTime=new Date(e.value).format('yyyy-MM-dd')
}else{
this.endTime=new Date(e.value).format('yyyy-MM-dd')
}
this.show=false
},
}
}
</script>

81
uni_modules/d-dateRange/package.json

@ -0,0 +1,81 @@
{
"id": "d-dateRange",
"displayName": "d-dateRange",
"version": "1.0.0",
"description": "d-dateRange",
"keywords": [
"d-dateRange"
],
"repository": "",
"engines": {
"HBuilderX": "^3.1.0"
},
"dcloudext": {
"type": "component-vue",
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "",
"data": "",
"permissions": ""
},
"npmurl": ""
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "u",
"aliyun": "u"
},
"client": {
"Vue": {
"vue2": "u",
"vue3": "u"
},
"App": {
"app-vue": "u",
"app-nvue": "u"
},
"H5-mobile": {
"Safari": "u",
"Android Browser": "u",
"微信浏览器(Android)": "u",
"QQ浏览器(Android)": "u"
},
"H5-pc": {
"Chrome": "u",
"IE": "u",
"Edge": "u",
"Firefox": "u",
"Safari": "u"
},
"小程序": {
"微信": "u",
"阿里": "u",
"百度": "u",
"字节跳动": "u",
"QQ": "u",
"钉钉": "u",
"快手": "u",
"飞书": "u",
"京东": "u"
},
"快应用": {
"华为": "u",
"联盟": "u"
}
}
}
}
}

1
uni_modules/d-dateRange/readme.md

@ -0,0 +1 @@
# d-dateRange
Loading…
Cancel
Save