From 8152ad92d3aebbac4ee66a14a318bbac19e57d8d Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期五, 14 二月 2025 17:27:21 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/YiWuProject

---
 UI-Project/src/views/Caching/cachingun.vue |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/UI-Project/src/views/Caching/cachingun.vue b/UI-Project/src/views/Caching/cachingun.vue
index 8b0cd7e..b83b1af 100644
--- a/UI-Project/src/views/Caching/cachingun.vue
+++ b/UI-Project/src/views/Caching/cachingun.vue
@@ -2,6 +2,7 @@
 import {onBeforeUnmount, onMounted, onUnmounted, ref, reactive} from "vue";
 import {useRouter} from "vue-router"
 import {host, WebSocketHost} from '@/utils/constants'
+import dayjs from 'dayjs';
 import request from "@/utils/request"
 import {closeWebSocket, initializeWebSocket} from '@/utils/WebSocketService';
 import {ElMessage, ElMessageBox} from 'element-plus'
@@ -36,9 +37,12 @@
   //     id: rect.id * 10,
   //   })); 
 };
-// 鍒濆鍖� WebSocket锛屽苟浼犻�掓秷鎭鐞嗗嚱鏁�
 onMounted(() => {
   socket = initializeWebSocket(socketUrl, handleMessage);
+  const endTime = dayjs().startOf('minute'); // 褰撳墠鏃堕棿锛岀簿纭埌鍒嗛挓
+  const startTime = endTime.subtract(1, 'day').startOf('minute'); // 褰撳墠鏃堕棿鐨勫墠涓�澶╋紝绮剧‘鍒板垎閽�
+  // 璁剧疆鏃堕棿鑼冨洿涓� [寮�濮嬫椂闂�, 缁撴潫鏃堕棿]
+  timeRange.value = [startTime.format('YYYY-MM-DD HH:mm:ss'), endTime.format('YYYY-MM-DD HH:mm:ss')];
 });
 // 鍘嗗彶浠诲姟
 const handlehistorical = (row) => {
@@ -65,8 +69,8 @@
   try { 
     const params = {
       deviceId: 2,
-      startTime: timeRange.value[0] || '',
-      endTime: timeRange.value[1] || '',
+      startTime: (timeRange.value && timeRange.value[0]) || '',
+      endTime: (timeRange.value && timeRange.value[1]) || '',
       glassId: glassId.value || '',
       taskState: taskState.value,
       taskType: taskType.value || ''

--
Gitblit v1.8.0