From f4c6c3fa64a754040e6f2eee0235612205f89747 Mon Sep 17 00:00:00 2001
From: 祖安之光 <11848914+light-of-zuan@user.noreply.gitee.com>
Date: Fri, 13 Feb 2026 13:15:25 +0800
Subject: [PATCH] 添加状态
---
src/views/stock/cityEntryStatistics.vue | 61 ++++++++++++------------------
1 files changed, 25 insertions(+), 36 deletions(-)
diff --git a/src/views/stock/cityEntryStatistics.vue b/src/views/stock/cityEntryStatistics.vue
index e3e113e..94118eb 100644
--- a/src/views/stock/cityEntryStatistics.vue
+++ b/src/views/stock/cityEntryStatistics.vue
@@ -7,7 +7,7 @@
<el-date-picker
value-format="yyyy-MM-dd HH:mm:ss"
v-model="validTime"
- type="datetimerange"
+ type="daterange"
:default-time="['00:00:00','23:59:59']"
:picker-options="pickerOptions"
range-separator="-"
@@ -144,14 +144,6 @@
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
picker.$emit('pick', [start, end]);
}
- }, {
- text: '最近三个月',
- onClick(picker) {
- const end = new Date();
- const start = new Date();
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
- picker.$emit('pick', [start, end]);
- }
}]
},
}
@@ -191,11 +183,15 @@
}
this.listLoading = false
},
- refresh(){
- this.getPersonProductList()
- },
async exportToExcel(){
+ if( this.validTime !== null ){
+ this.listQuery.filter.starttime = this.validTime[0]
+ this.listQuery.filter.endtime = this.validTime[1]
+ }else{
+ this.listQuery.filter.starttime = ''
+ this.listQuery.filter.endtime = ''
+ }
let res = await exportCityEntryStatistics(this.listQuery)
if(res.data.code === '200'){
if(res.data.result === null ||res.data.result === [] || res.data.result.length === 0){
@@ -261,9 +257,24 @@
itemcode:'',
},
}
+ this.validTime = ['','']
+ this.initValidTime()
+ this.getPersonProductList()
},
searchProductSearch(){
+ this.listQuery.pageIndex = 1
+ // const date1 = new Date(this.validTime[0]);
+ // const date2 = new Date(this.validTime[1]);
+ // const differenceInMs = Math.abs(date2 - date1);
+ // const differenceInDays = differenceInMs / (1000 * 60 * 60 * 24)
+ // if(differenceInDays > 32){
+ // this.$message({
+ // type: 'warning',
+ // message: '时间跨度超过一个月的,请联系管理员查询数据'
+ // })
+ // return
+ // }
this.getPersonProductList()
},
@@ -277,30 +288,8 @@
},
initValidTime(){
const end = new Date();
- if(end.getDate() - 1 === 0){
- this.validTime[0] = [end.getFullYear(), end.getMonth() , this.returnDay(end.getMonth(),end.getFullYear())].join("-") + " 00:00:00" ;
- this.validTime[1] = [end.getFullYear(), end.getMonth() , this.returnDay(end.getMonth(),end.getFullYear())].join("-") +" 23:59:59";
- }else if(end.getDate() - 1 === 0 && end.getMonth() === 0){
- this.validTime[0] = [end.getFullYear() - 1, 12, 31].join("-") + " 00:00:00" ;
- this.validTime[1] = [end.getFullYear() - 1, 12, 31].join("-") +" 23:59:59";
- }
- else{
- this.validTime[0] = [end.getFullYear(), end.getMonth() + 1, end.getDate() - 1].join("-") + " 00:00:00" ;
- this.validTime[1] = [end.getFullYear(), end.getMonth() + 1, end.getDate() - 1].join("-") +" 23:59:59";
- }
- },
- returnDay(value,year){
- if(value === 1 || value === 3|| value === 5 || value === 7 || value === 8 || value === 10 || value === 12){
- return 31
- }else if(value === 2){
- if(year % 4 === 0){
- return 29
- }else{
- return 28
- }
- }else{
- return 30
- }
+ this.validTime[0] = end.toISOString().slice(0, 10) + " 00:00:00";
+ this.validTime[1] = end.toISOString().slice(0, 10) + " 23:59:59";
}
},
}
--
Gitblit v1.9.2