From 435f6e023163ccee35dda99e9c07c187c8f0b9c6 Mon Sep 17 00:00:00 2001
From: wzp <2040239371@qq.com>
Date: 星期四, 08 五月 2025 18:20:03 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-ui/src/views/system/gps/map.vue |   45 ++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/ruoyi-ui/src/views/system/gps/map.vue b/ruoyi-ui/src/views/system/gps/map.vue
index 972e902..bd09c70 100644
--- a/ruoyi-ui/src/views/system/gps/map.vue
+++ b/ruoyi-ui/src/views/system/gps/map.vue
@@ -169,10 +169,18 @@
     if (query.timestamp) {
       this.queryParams.timestamp = query.timestamp;
     }
-    // 璁剧疆鏃堕棿鑼冨洿
+    
+    // 璁剧疆榛樿鏃堕棿鑼冨洿
+    const today = new Date();
+    const startTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 0, 0, 0);
+    const endTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 23, 59, 59);
+    this.dateRange = [this.parseTime(startTime), this.parseTime(endTime)];
+    
+    // 濡傛灉URL涓湁鏃堕棿鍙傛暟锛屽垯浣跨敤URL涓殑鏃堕棿
     if (query.beginTime && query.endTime) {
       this.dateRange = [query.beginTime, query.endTime];
     }
+    
     this.getList();
   },
   mounted() {
@@ -220,10 +228,37 @@
         };
       });
     },
+    /** 鏍煎紡鍖栨椂闂� */
+    parseTime(time) {
+      const year = time.getFullYear();
+      const month = String(time.getMonth() + 1).padStart(2, '0');
+      const day = String(time.getDate()).padStart(2, '0');
+      const hours = String(time.getHours()).padStart(2, '0');
+      const minutes = String(time.getMinutes()).padStart(2, '0');
+      const seconds = String(time.getSeconds()).padStart(2, '0');
+      return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+    },
     /** 鏌ヨGPS鍒楄〃 */
     getList() {
       this.loading = true;      
-      anonymousList(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
+      // 鏋勫缓鏌ヨ鍙傛暟
+      const params = {
+        ...this.queryParams
+      };
+
+      // 濡傛灉娌℃湁閫夋嫨鏃堕棿鑼冨洿锛屽垯榛樿浣跨敤褰撳ぉ
+      if (!this.dateRange || this.dateRange.length === 0) {
+        const today = new Date();
+        const startTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 0, 0, 0);
+        const endTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 23, 59, 59);
+        params.beginTime = this.parseTime(startTime);
+        params.endTime = this.parseTime(endTime);
+      } else {
+        params.beginTime = this.dateRange[0];
+        params.endTime = this.dateRange[1];
+      }
+      
+      anonymousList(params).then(response => {
         this.gpsList = response.rows;
         this.total = response.total;
         this.loading = false;
@@ -252,7 +287,11 @@
     },
     /** 閲嶇疆鎸夐挳鎿嶄綔 */
     resetQuery() {
-      this.dateRange = [];
+      // 閲嶇疆涓哄綋澶╂椂闂磋寖鍥�
+      const today = new Date();
+      const startTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 0, 0, 0);
+      const endTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 23, 59, 59);
+      this.dateRange = [this.parseTime(startTime), this.parseTime(endTime)];
       this.resetForm("queryForm");
       this.handleQuery();
     },

--
Gitblit v1.9.1