From 73fe3c5574c8fbb7b18fa9b76d53b918f6f921e1 Mon Sep 17 00:00:00 2001
From: wangfei <3597712270@qq.com>
Date: 星期三, 12 十一月 2025 11:09:04 +0800
Subject: [PATCH] 更换前端打包方式,将ip地址配置提取到public

---
 UI-Project/src/views/ReportWork/reportWork.vue |  102 +++++++++++++++++++++++++++++++--------------------
 1 files changed, 62 insertions(+), 40 deletions(-)

diff --git a/UI-Project/src/views/ReportWork/reportWork.vue b/UI-Project/src/views/ReportWork/reportWork.vue
index 8c0fd2f..7a6ed85 100644
--- a/UI-Project/src/views/ReportWork/reportWork.vue
+++ b/UI-Project/src/views/ReportWork/reportWork.vue
@@ -27,13 +27,13 @@
       </el-select>
       <el-button type="primary" style="margin-left: 10px;" @click="selectReportData()">{{ $t('reportmanage.inquire')
         }}</el-button>
-      <el-button type="success" style="margin-left: 10px;" :disabled="(!selectedStatus)" @click="handleConfirm">{{
+      <el-button type="success" style="margin-left: 10px;" :disabled="isConfirmDisabled" @click="handleConfirm">{{
         $t('reportmanage.signingwork')
         }}</el-button>
     </div>
     <el-card style="flex: 1;margin-left: 10px;margin-top: 20px;" >
       <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;">
-        <el-table height="740" ref="table" :data="reportData"
+        <el-table height="700" ref="table" :data="reportData"
           :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129' }">
           <el-table-column prop="teamsGroupsName" align="center" :label="$t('reportmanage.reporteam')"
             min-width="135" />
@@ -137,6 +137,18 @@
             </template>
           </el-table-column>
         </el-table>
+      <div style="margin-top: 20px;margin-left: 40%;">
+      <el-pagination
+        v-model:current-page="currentPage"
+        :page-size="pageSize"
+        :size="large"
+        :disabled="disabled"
+        layout="prev, pager, next, jumper"
+        :total="totalRecords"
+        @current-change="handlePageChange"
+        style="margin-top: 10px;"
+    />
+    </div>
       </div>
     </el-card>
   </div>
@@ -151,33 +163,12 @@
 import { useI18n } from 'vue-i18n'
 import { inject } from 'vue';
 const globalDate = inject('globalDate');
-const timeRange = ref([])
+const totalRecords = ref(0)
+const pageSize = ref(20)
+const currentPage = ref(1)
 const { t } = useI18n()
-const report = ref({
-  type: '8',
-  status: '1',
-  workingProcedure: '0',
-});
+const timeRange = ref([])
 const reportData = ref([])
-function formatTimestamp(timestamp) {
-  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'); // 琛ラ浂锛堝鏋滈渶瑕佹樉绀烘椂闂达級
-  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
-}
-// 鏍煎紡鍖栧悗绔椂闂村苟璁$畻涓�鍛ㄥ墠鐨勬椂闂�
-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澶�
-  oneWeekAgo.setHours(0, 0, 0, 0);
-  timeRange.value = [formatTimestamp(oneWeekAgo), formatTimestamp(backendTime)];
-  window.localStorage.setItem('startTime', formatTimestamp(oneWeekAgo))
-}
 // const timeRange = ref([formatTimestamp(startDate), formatTimestamp(globalDate)]);
 const selectOptionsa = ref([]);
 const selectOptionsb = ref([]);
@@ -192,9 +183,19 @@
 const inputValuesb = reactive({});
 const selectedType = ref(true);
 const selectedStatus = ref(false);
+const report = ref({
+  type: '8',
+  status: '1',
+  workingProcedure: '0',
+});
+const isConfirmDisabled = computed(() => {
+  return report.value.type === '1' || !selectedStatus.value;
+});
 // 鏌ヨ鏁版嵁
 const selectReportData = async () => {
   const response = await request.post("/cacheVerticalGlass/damage/selectDamage", {
+    pageNo: currentPage.value,
+    pageSize: pageSize.value,
     startTime: (timeRange.value && timeRange.value[0]) || '',
     endTime: (timeRange.value && timeRange.value[1]) || '',
     type: report.value.type,
@@ -212,23 +213,16 @@
     selectedStatus.value = false;
   }
   if (response.code === 200) {
-    const formattedData = response.data.map(record => ({
+    const formattedData = response.data.records.map(record => ({
         ...record,
         formattedCreateTime: formatTimestamp(record.damageTime),
       }));
     reportData.value = formattedData;
     ElMessage.success(response.message);
-
+    totalRecords.value = response.data.total || 0
   } else {
     ElMessage.error(response.message);
   }
-  // const responses = await request.post("/cacheVerticalGlass/damage/insertDamage", {
-  //   glassId:"P24081502|1|1",
-  //   line:"1001",
-  //   workingProcedure:"鍒囧壊",
-  //   remark:"",
-  //   status:"0"
-  // })
 };
 // 鎶ュ伐
 const handleConfirm = async () => {
@@ -271,6 +265,10 @@
     console.error('Error fetching options:', error);
   }
 };
+const handlePageChange = (newPage) => {
+  currentPage.value = newPage;
+  selectReportData();
+};
 const handleInputChangea = (value, rowId) => {
   // 鏇存柊瀵瑰簲琛岀殑 select 鍊�  
   selectValuesa[rowId] = value;
@@ -281,17 +279,21 @@
   inputValuesa[rowId] = value;
   inputValuesb[rowId] = value;
 };
-fetchTableData();
+// fetchTableData();
 function gettypeType(type: number) {  
   switch (type) {
-    case 9: 
+    case 1: 
       return 'success';  
-    case 8: 
+    case 9: 
       return 'danger';  
+    case 8: 
+      return 'warning';  
   }
 }  
 function gettypeText(type: number) {
   switch (type) {
+    case 1:  
+      return t('reportmanage.completed'); 
     case 9:  
       return t('reportmanage.takeout'); 
     case 8:  
@@ -323,7 +325,7 @@
   }  
 }
 let socket = null;
-// const socketUrl = `ws://${WebSocketHost}:${host}/api/temperingGlass/api/talk/screen`;
+// const socketUrl = `ws://${window.ipConfig.serverUrl}/api/temperingGlass/api/talk/screen`;
 // const handleMessage = (data) => {
 // adjustedRects.value = data.device[0].map(rect => ({  
 //       ...rect, 
@@ -333,12 +335,32 @@
 //     })); 
 // };
 // let socket;
+function formatTimestamp(timestamp) {
+  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'); // 琛ラ浂锛堝鏋滈渶瑕佹樉绀烘椂闂达級
+  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+}
+// 鏍煎紡鍖栧悗绔椂闂村苟璁$畻涓�鍛ㄥ墠鐨勬椂闂�
+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澶�
+  oneWeekAgo.setHours(0, 0, 0, 0);
+  timeRange.value = [formatTimestamp(oneWeekAgo), formatTimestamp(backendTime)];
+  window.localStorage.setItem('startTime', formatTimestamp(oneWeekAgo))
+}
 onUnmounted(() => {
   socket.close();
 });
 onMounted(() => {
   fetchTableData();
   parseAndSetTime();
+  selectReportData()
   // socket = initializeWebSocket(socketUrl, handleMessage);
 });
 onUnmounted(() => {

--
Gitblit v1.8.0