From 8f6a8545c3cf50ff0feac85f7b3c57db8fc3a0b4 Mon Sep 17 00:00:00 2001
From: 祖安之光 <11848914+light-of-zuan@user.noreply.gitee.com>
Date: Thu, 12 Mar 2026 09:35:13 +0800
Subject: [PATCH] 修改

---
 src/views/purchase/cityESS.vue |   49 +++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 45 insertions(+), 4 deletions(-)

diff --git a/src/views/purchase/cityESS.vue b/src/views/purchase/cityESS.vue
index ec5d856..a5a998e 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="开始日期"
@@ -139,7 +139,7 @@
                 pageSize:20,
                 pageIndex:1,
                 filter: {
-                    province: '新疆维吾尔自治区',
+                    province: '盐城市',
                     city: '',
                     starttime: '',
                     endtime: '',
@@ -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(){
@@ -308,7 +329,7 @@
                 pageSize: 10,
                 pageIndex: 1,
                 filter: {
-                    province: '新疆维吾尔自治区',
+                    province: '盐城市',
                     city: '',
                     starttime: '',
                     endtime: '',
@@ -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