From 35592d8efd855dbf625321ba1f9aa70dd65c0d2f Mon Sep 17 00:00:00 2001
From: wangfei <3597712270@qq.com>
Date: 星期一, 17 二月 2025 16:13:06 +0800
Subject: [PATCH] 解决bug
---
UI-Project/src/views/Caching/cachingbefore.vue | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/UI-Project/src/views/Caching/cachingbefore.vue b/UI-Project/src/views/Caching/cachingbefore.vue
index 34211b4..3a69e5c 100644
--- a/UI-Project/src/views/Caching/cachingbefore.vue
+++ b/UI-Project/src/views/Caching/cachingbefore.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'
@@ -37,9 +38,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) => {
@@ -66,8 +70,8 @@
try {
const params = {
deviceId: 1,
- startTime: timeRange.value[0] || '',
- endTime: timeRange.value[1] || '',
+ startTime: (timeRange.value && timeRange.value[0]) || '',
+ endTime: (timeRange.value && timeRange.value[1]) || '',
glassId: glassId.value || '',
taskState: taskStat.value,
taskType: taskType.value || ''
@@ -280,8 +284,7 @@
const hours = String(date.getHours()).padStart(2, '0'); // 琛ラ浂锛堝鏋滈渶瑕佹樉绀烘椂闂达級
const minutes = String(date.getMinutes()).padStart(2, '0'); // 琛ラ浂锛堝鏋滈渶瑕佹樉绀烘椂闂达級
const seconds = String(date.getSeconds()).padStart(2, '0'); // 琛ラ浂锛堝鏋滈渶瑕佹樉绀烘椂闂达級
- // 鍙樉绀哄勾鏈堟棩锛屽鏋滈渶瑕佹樉绀烘椂闂达紝鍒欐嫾鎺� hours + ':' + minutes + ':' + seconds
- return `${year}-${month}-${day}`;
+ return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
onUnmounted(() => {
if (socket) {
--
Gitblit v1.8.0