From 4cfbfd1b425f7b22b876ae6cae95c4fc29ae6bfb Mon Sep 17 00:00:00 2001 From: 马宇豪 <978517621@qq.com> Date: 星期五, 23 二月 2024 09:25:33 +0800 Subject: [PATCH] 盘库修改 --- src/views/purchase/cityESS.vue | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 43 insertions(+), 2 deletions(-) diff --git a/src/views/purchase/cityESS.vue b/src/views/purchase/cityESS.vue index ec5d856..9c7f438 100644 --- a/src/views/purchase/cityESS.vue +++ b/src/views/purchase/cityESS.vue @@ -38,7 +38,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']" range-separator="-" start-placeholder="开始日期" @@ -51,7 +51,7 @@ <el-date-picker value-format="yyyy-MM-dd HH:mm:ss" v-model="validTime2" - type="datetimerange" + type="daterange" :default-time="['00:00:00','23:59:59']" range-separator="-" start-placeholder="开始日期" @@ -157,8 +157,10 @@ }, created() { // this.getProductList() + this.initValidTime() this.getProvince() this.changeArea("province"); + // this.getProductList() }, watch: { }, @@ -193,6 +195,17 @@ }, async exportToExcel(){ + if( this.validTime !== null ){ + this.listQuery.filter.starttime = this.validTime[0] + this.listQuery.filter.endtime = this.validTime[1] + this.listQuery.filter.starttime2 = this.validTime2[0] + this.listQuery.filter.endtime2 = this.validTime2[1] + }else{ + this.listQuery.filter.starttime = '' + this.listQuery.filter.endtime = '' + this.listQuery.filter.starttime2 = '' + this.listQuery.filter.endtime2 = '' + } let res = await getCityESSListData(this.listQuery) if(res.data.code === '200'){ if(res.data.result === null ||res.data.result === [] || res.data.result.length === 0){ @@ -240,6 +253,14 @@ formatJson(filterVal, jsonData) { return jsonData.map(v => filterVal.map(j => v[j])) + }, + + initValidTime(){ + const end = new Date(); + this.validTime[0] = end.toISOString().slice(0, 10) + " 00:00:00"; + this.validTime[1] = end.toISOString().slice(0, 10) + " 23:59:59"; + this.validTime2[0] = end.toISOString().slice(0, 10) + " 00:00:00"; + this.validTime2[1] = end.toISOString().slice(0, 10) + " 23:59:59"; }, async getProvince(){ @@ -316,9 +337,29 @@ endtime2: '', }, } + this.validTime = ['',''] + this.validTime2 = ['',''] + this.initValidTime() + this.getProductList() }, searchProductSearch(){ + this.listQuery.pageIndex = 1 + const date1 = new Date(this.validTime[0]); + const date2 = new Date(this.validTime[1]); + const date3 = new Date(this.validTime2[0]); + const date4 = new Date(this.validTime2[1]); + const differenceInMs = Math.abs(date2 - date1); + const differenceInDays = differenceInMs / (1000 * 60 * 60 * 24) + const differenceInMs2 = Math.abs(date4 - date3); + const differenceInDays2 = differenceInMs2 / (1000 * 60 * 60 * 24) + if(differenceInDays > 32 || differenceInDays2 > 32){ + this.$message({ + type: 'warning', + message: '查询时间或对比时间跨度超过一个月的,请联系管理员查询数据' + }) + return + } this.getProductList() }, -- Gitblit v1.9.2