From 7ea6f819494d8d85087e9c933a905eb1cf8bac4f Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期三, 03 十二月 2025 13:28:14 +0800
Subject: [PATCH] 1、历史任务查询默认日期为当前 2、理片笼信息条件查询时只显示符合的数据

---
 UI-Project/src/views/hollow/hellowslicecagehistory.vue |   83 ++++++++++++++++++++++++++++-------------
 1 files changed, 56 insertions(+), 27 deletions(-)

diff --git a/UI-Project/src/views/hollow/hellowslicecagehistory.vue b/UI-Project/src/views/hollow/hellowslicecagehistory.vue
index ac5aa13..2dc38c0 100644
--- a/UI-Project/src/views/hollow/hellowslicecagehistory.vue
+++ b/UI-Project/src/views/hollow/hellowslicecagehistory.vue
@@ -3,7 +3,7 @@
 <div style="display: flex;width: 1770px;">
   <el-input v-model="glassId" clearable style="margin-left: 10px;margin-bottom: 10px;width: 200px;" :placeholder="$t('searchOrder.inglassID')" />
   <el-input v-model="startSlot" clearable style="margin-left: 10px;margin-bottom: 10px;width: 200px;" @input="handleInputa" :placeholder="$t('film.originateslot')" />
-  <el-input v-model="targetSlot" clearable style="margin-left: 10px;margin-bottom: 10px;width: 200px;" @input="handleInputb" :placeholder="$t('film.endslot')" />
+  <el-input v-model="targetSlot" clearable style="margin-left: 10px;margin-bottom: 10px;width: 200px;" @input="handleInputb" :placeholder="$t('film.endoriginateslot')" />
         <el-select v-model="selectValuesa[0]" filterable :placeholder="$t('searchOrder.taskstatus')" clearable
         style="width: 200px;margin-left: 10px;">
         <el-option :label="$t('searchOrder.begin')" value="0"></el-option>
@@ -17,10 +17,15 @@
         <el-option :label="$t('searchOrder.outfilm')" value="5"></el-option>
         <el-option :label="$t('film.dispatch')" value="6"></el-option>
       </el-select>
-          <el-date-picker v-model="timeRange" type="datetimerange" range-separator="鑷�" :start-placeholder="$t('reportmanage.starttime')" 
-           style="margin-left: 15px;" value-format = "YYYY-MM-DD hh:mm:ss"
-            :end-placeholder="$t('reportmanage.endtime')">
-          </el-date-picker>
+      <el-date-picker
+            style="margin-left: 15px;"
+             v-model="timeRange"
+             type="datetimerange"
+             :shortcuts="shortcuts"
+             range-separator="鑷�"
+             :start-placeholder="$t('reportmanage.starttime')"
+             :end-placeholder="$t('reportmanage.endtime')"
+           />
         <el-button type="primary" style="margin-left: 10px;margin-bottom: 10px;" @click="handleClick()">{{$t('reportmanage.inquire')}}</el-button>
    </div>
   <div style="margin-bottom: 10px;margin-top: 20px;margin-left: 20px;">
@@ -60,7 +65,7 @@
       <el-table ref="table" style="margin-top: 20px;height: 580px;width: 1770px;" :data="tableDatax" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
     <el-table-column prop="glassId" align="center" :label="$t('searchOrder.glassID')" min-width="80" />
     <el-table-column prop="startSlot" align="center" :label="$t('film.originateslot')" min-width="80" />
-        <el-table-column prop="targetSlot" align="center" :label="$t('film.endslot')" min-width="80" />
+        <el-table-column prop="targetSlot" align="center" :label="$t('film.endoriginateslot')" min-width="80" />
         <el-table-column
           align="center"
           :label="$t('film.taskstatus')"
@@ -169,7 +174,6 @@
   }
 }
 catch (error) {
-  console.error(error);
 }
 }
 const historical = async () => {
@@ -201,12 +205,10 @@
   }
 }
 catch (error) {
-  console.error(error);
 }
 }
 const handlePageChange2 = (newPage) => {
 currentPage2.value = newPage;
-console.log(currentPage2.value);
 window.localStorage.setItem('pagenumber', currentPage2.value)
 historicala(currentPage2.value);
 Dailya(currentPage2.value);
@@ -247,8 +249,8 @@
       targetSlot: ptargetSlot,
       taskStateList: celllist,
       taskTypeList: stateList,
-      beginDate: (timeRange.value && timeRange.value[0]) || '',
-      endDate: (timeRange.value && timeRange.value[1]) || '',
+      beginDate: (formatTimestamp(timeRange.value) && formatTimestamp(timeRange.value[0])) || '',
+      endDate: (formatTimestamp(timeRange.value) && formatTimestamp(timeRange.value[1])) || '',
   })
     if (response.code == 200) {
       ElMessage.success(response.message);
@@ -265,7 +267,6 @@
   }
 }
 catch (error) {
-  console.error(error);
 }
 }
 const Dailya = async (page) => {
@@ -304,8 +305,8 @@
       targetSlot: ptargetSlot,
       taskStateList: celllist,
       taskTypeList: stateList,
-      beginDate: (timeRange.value && timeRange.value[0]) || '',
-      endDate: (timeRange.value && timeRange.value[1]) || '',
+      beginDate: (formatTimestamp(timeRange.value) && formatTimestamp(timeRange.value[0])) || '',
+      endDate: (formatTimestamp(timeRange.value) && formatTimestamp(timeRange.value[1])) || '',
   })
     if (response.code == 200) {
       hollowCountOutOne.value = response.data.hollowCountOutOne
@@ -317,7 +318,6 @@
   }
 }
 catch (error) {
-  console.error(error);
 }
 }
 const handleClick = async () => {
@@ -361,8 +361,8 @@
       targetSlot: ptargetSlot,
       taskStateList: celllist,
       taskTypeList: stateList,
-      beginDate: (timeRange.value && timeRange.value[0]) || '',
-      endDate: (timeRange.value && timeRange.value[1]) || '',
+      beginDate: (formatTimestamp(timeRange.value) && formatTimestamp(timeRange.value[0])) || '',
+      endDate: (formatTimestamp(timeRange.value) && formatTimestamp(timeRange.value[1])) || '',
   })
     if (response.code == 200) {
         currentPage2.value = 1
@@ -372,17 +372,13 @@
         formattedCreateTime: formatTimestamp(record.createTime),
         formattedUpdateTime: formatTimestamp(record.updateTime),
       }));
-        // tableDatax.value = response.data.records;
         tableDatax.value = formattedData;
-      console.log(tableDatax.value);
-      console.log(formattedData);
       totalRecords.value = response.data.total/2 || 0
     } else {
       ElMessage.error(response.message);
   }
 }
 catch (error) {
-  console.error(error);
 }
 }
 const Dailyhistorical = async () => {
@@ -421,8 +417,8 @@
       targetSlot: ptargetSlot,
       taskStateList: celllist,
       taskTypeList: stateList,
-      beginDate: (timeRange.value && timeRange.value[0]) || '',
-      endDate: (timeRange.value && timeRange.value[1]) || '',
+      beginDate: (formatTimestamp(timeRange.value) && formatTimestamp(timeRange.value[0])) || '',
+      endDate: (formatTimestamp(timeRange.value) && formatTimestamp(timeRange.value[1])) || '',
   })
     if (response.code == 200) {
       hollowCountOutOne.value = response.data.hollowCountOutOne
@@ -434,7 +430,6 @@
   }
 }
 catch (error) {
-  console.error(error);
 }
 }
 
@@ -449,13 +444,47 @@
 const seconds = String(date.getSeconds()).padStart(2, '0'); // 琛ラ浂锛堝鏋滈渶瑕佹樉绀烘椂闂达級
 return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
 }
+const shortcuts = [
+  {
+    text: '鏈�杩戜竴鍛�',
+    value: () => {
+      const backendTime = new Date(getglobalDate)
+      const oneWeekAgo = new Date(getglobalDate)
+      oneWeekAgo.setHours(0, 0, 0, 0);
+      oneWeekAgo.setDate(oneWeekAgo.getDate() - 7)
+      timeRange.value = [formatTimestamp(oneWeekAgo), formatTimestamp(backendTime)]
+      window.localStorage.setItem('startTime', formatTimestamp(oneWeekAgo))
+    },
+  },
+  {
+    text: '鏈�杩戜竴涓湀',
+    value: () => {
+      const backendTime = new Date(getglobalDate)
+      const oneWeekAgo = new Date(getglobalDate)
+      oneWeekAgo.setHours(0, 0, 0, 0);
+      oneWeekAgo.setMonth(oneWeekAgo.getMonth() - 1)
+      timeRange.value = [formatTimestamp(oneWeekAgo), formatTimestamp(backendTime)]
+      window.localStorage.setItem('startTime', formatTimestamp(oneWeekAgo))
+    },
+  },
+  {
+    text: '鏈�杩戜笁涓湀',
+    value: () => {
+      const backendTime = new Date(getglobalDate)
+      const oneWeekAgo = new Date(getglobalDate)
+      oneWeekAgo.setHours(0, 0, 0, 0);
+      oneWeekAgo.setMonth(oneWeekAgo.getMonth() - 3)
+      timeRange.value = [formatTimestamp(oneWeekAgo), formatTimestamp(backendTime)]
+      window.localStorage.setItem('startTime', formatTimestamp(oneWeekAgo))
+},
+  },
+]
 // 鏍煎紡鍖栧悗绔椂闂村苟璁$畻涓�鍛ㄥ墠鐨勬椂闂�
 const defaultTime = ref<[Date, Date]>([new Date(), new Date()]);
 function parseAndSetTime() {
 const backendTime = new Date(getglobalDate);
-const oneWeekAgo = new Date(backendTime.getTime() - 7 * 24 * 60 * 60 * 1000); // 鍑忓幓7澶�
-console.log(formatTimestamp(oneWeekAgo));
-console.log(oneWeekAgo);
+const oneWeekAgo = new Date(backendTime.getTime() - 0 * 24 * 60 * 60 * 1000); // 鍑忓幓7澶�
+oneWeekAgo.setHours(0, 0, 0, 0);
 timeRange.value = [formatTimestamp(oneWeekAgo), formatTimestamp(backendTime)];
 window.localStorage.setItem('startTime', formatTimestamp(oneWeekAgo))
 }

--
Gitblit v1.8.0