From 976cee4892eec261f6c2927e788e476e5cc5028e Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期一, 10 三月 2025 08:32:27 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 UI-Project/src/views/GlassStorage/rawfilmstorage.vue |   37 ++++++++++++++++++++-----------------
 1 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/UI-Project/src/views/GlassStorage/rawfilmstorage.vue b/UI-Project/src/views/GlassStorage/rawfilmstorage.vue
index 61a8afc..715145f 100644
--- a/UI-Project/src/views/GlassStorage/rawfilmstorage.vue
+++ b/UI-Project/src/views/GlassStorage/rawfilmstorage.vue
@@ -7,6 +7,7 @@
 import dayjs from 'dayjs';
 import request from "@/utils/request"
 import {closeWebSocket, initializeWebSocket} from '@/utils/WebSocketService';
+import { inject } from 'vue';
 const router = useRouter()
 const tableDataa = ref([])
 const tableDatab = ref([])
@@ -28,6 +29,7 @@
 const leftingStation = ref('');
 const loadingline = ref('');
 let webSocket: WebSocket | null = null;  
+const globalDate = inject('globalDate');
 const value = ref('')
 const options = [
   {
@@ -44,27 +46,28 @@
   taskState: '',
 });
   let startTime = window.localStorage.getItem('startTime')
-  let endTime = window.localStorage.getItem('endTime')
   request.post("/glassStorage/rawGlassStorageTask/setRawGlassTaskRequest",{
   beginDate: startTime,
-  endDate: endTime,
+  endDate: globalDate,
 }).then((response) => {
           if (response.code == 200) {
-            tableDataa.value = response.data
-            console.log(tableDataa.value);
           } else {
           ElMessage.warning(response.msg)
-        
           }
           });
+// 鏍煎紡鍖栧悗绔椂闂村苟璁$畻涓�鍛ㄥ墠鐨勬椂闂�
+const defaultTime = ref<[Date, Date]>([new Date(), new Date()]);
+function parseAndSetTime() {
+  const backendTime = new Date(globalDate);
+  const oneWeekAgo = new Date(backendTime.getTime() - 7 * 24 * 60 * 60 * 1000); // 鍑忓幓7澶�
+  console.log(formatTimestamp(oneWeekAgo));
+  console.log(oneWeekAgo);
+  timeRange.value = [formatTimestamp(oneWeekAgo), formatTimestamp(backendTime)];
+  window.localStorage.setItem('startTime', formatTimestamp(oneWeekAgo))
+}
   onMounted(() => {
   socket = initializeWebSocket(socketUrl, handleMessage);
-  const endTime = dayjs().startOf('minute'); // 褰撳墠鏃堕棿锛岀簿纭埌鍒嗛挓
-  const startTime = endTime.subtract(7, 'day').startOf('minute'); // 褰撳墠鏃堕棿鐨勫墠涓�澶╋紝绮剧‘鍒板垎閽�
-  // 璁剧疆鏃堕棿鑼冨洿涓� [寮�濮嬫椂闂�, 缁撴潫鏃堕棿]
-  timeRange.value = [startTime.format('YYYY-MM-DD HH:mm:ss'), endTime.format('YYYY-MM-DD HH:mm:ss')];
-  window.localStorage.setItem('startTime', startTime.format('YYYY-MM-DD HH:mm:ss'))
-  window.localStorage.setItem('endTime', endTime.format('YYYY-MM-DD HH:mm:ss'))
+  parseAndSetTime();
 });
 let socket = null;
 const socketUrl = `ws://${WebSocketHost}:${host}/api/glassStorage/api/talk/rawGlass`;
@@ -292,14 +295,14 @@
   }
 };
 // 鏍煎紡鍖栨椂闂存埑涓哄勾鏈堟棩鏃堕棿瀛楃涓茬殑鍑芥暟
-function formatTimestamp(timestamp) {
+function formatTimestamp(timestamp: number | Date): string {
   const date = new Date(timestamp);
   const year = date.getFullYear();
-  const month = String(date.getMonth() + 1).padStart(2, '0'); // 鏈堜唤浠�0寮�濮嬶紝闇�瑕佸姞1锛屽苟琛ラ浂
-  const day = String(date.getDate()).padStart(2, '0'); // 琛ラ浂
-  const hours = String(date.getHours()).padStart(2, '0'); // 琛ラ浂锛堝鏋滈渶瑕佹樉绀烘椂闂达級
-  const minutes = String(date.getMinutes()).padStart(2, '0'); // 琛ラ浂锛堝鏋滈渶瑕佹樉绀烘椂闂达級
-  const seconds = String(date.getSeconds()).padStart(2, '0'); // 琛ラ浂锛堝鏋滈渶瑕佹樉绀烘椂闂达級
+  const month = String(date.getMonth() + 1).padStart(2, '0');
+  const day = String(date.getDate()).padStart(2, '0');
+  const hours = String(date.getHours()).padStart(2, '0');
+  const minutes = String(date.getMinutes()).padStart(2, '0');
+  const seconds = String(date.getSeconds()).padStart(2, '0');
   return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
 }
 function getStatusType1(taskType) {  

--
Gitblit v1.8.0