From 45574a93cd079e20662dd2717765918a0066984f Mon Sep 17 00:00:00 2001
From: 曹睿 <360930172@qq.com>
Date: 星期四, 03 七月 2025 10:53:46 +0800
Subject: [PATCH] fix: 修复设备,基础数据分页不显示

---
 src/views/equipmentManagement/upkeep/index.vue |  142 ++++++++++++++++++++++++++---------------------
 1 files changed, 79 insertions(+), 63 deletions(-)

diff --git a/src/views/equipmentManagement/upkeep/index.vue b/src/views/equipmentManagement/upkeep/index.vue
index 7f9e7de..b40da99 100644
--- a/src/views/equipmentManagement/upkeep/index.vue
+++ b/src/views/equipmentManagement/upkeep/index.vue
@@ -35,6 +35,7 @@
           total: pagination.total,
         }"
         @selection-change="handleSelectionChange"
+        @pagination="changePage"
       >
         <template #maintenanceResultRef="{ row }">
           <el-tag v-if="row.maintenanceResult === 1" type="success">
@@ -80,6 +81,7 @@
 import PlanModal from "./Modal/PlanModal.vue";
 import MaintenanceModal from "./Modal/MaintenanceModal.vue";
 import dayjs from "dayjs";
+import { ElMessageBox, ElMessage } from "element-plus";
 
 defineOptions({
   name: "璁惧淇濆吇",
@@ -99,69 +101,78 @@
 };
 
 // 琛ㄦ牸閽╁瓙
-const { filters, columns, dataList, pagination, getTableData, resetFilters } =
-  usePaginationApi(getUpkeepPage, {}, [
-    {
-      label: "璁惧鍚嶇О",
-      align: "center",
-      prop: "deviceName",
-    },
-    {
-      label: "瑙勬牸鍨嬪彿",
-      align: "center",
-      prop: "deviceModel",
-    },
-    {
-      label: "璁″垝淇濆吇鏃ユ湡",
-      align: "center",
-      prop: "maintenancePlanTime",
-      formatData: (cell) => dayjs(cell).format("YYYY-MM-DD"),
-    },
-    {
-      label: "褰曞叆浜�",
-      align: "center",
-      prop: "createUserName",
-    },
-    {
-      label: "褰曞叆鏃ユ湡",
-      align: "center",
-      prop: "createTime",
-      formatData: (cell) => dayjs(cell).format("YYYY-MM-DD HH:mm:ss"),
-      width: 200,
-    },
-    {
-      label: "瀹為檯淇濆吇浜�",
-      align: "center",
-      prop: "maintenanceActuallyName",
-    },
-    {
-      label: "瀹為檯淇濆吇鏃ユ湡",
-      align: "center",
-      prop: "maintenanceActuallyTime",
-    },
-    {
-      label: "淇濆吇缁撴灉",
-      align: "center",
-      prop: "maintenanceResult",
-      dataType: "slot",
-      slot: "maintenanceResultRef",
-    },
-    {
-      label: "鐘舵��",
-      align: "center",
-      prop: "status",
-      dataType: "slot",
-      slot: "statusRef",
-    },
-    {
-      fixed: "right",
-      label: "鎿嶄綔",
-      dataType: "slot",
-      slot: "operation",
-      align: "center",
-      width: "200px",
-    },
-  ]);
+const {
+  filters,
+  columns,
+  dataList,
+  pagination,
+  getTableData,
+  resetFilters,
+  onCurrentChange,
+} = usePaginationApi(getUpkeepPage, {}, [
+  {
+    label: "璁惧鍚嶇О",
+    align: "center",
+    prop: "deviceName",
+  },
+  {
+    label: "瑙勬牸鍨嬪彿",
+    align: "center",
+    prop: "deviceModel",
+  },
+  {
+    label: "璁″垝淇濆吇鏃ユ湡",
+    align: "center",
+    prop: "maintenancePlanTime",
+    formatData: (cell) => dayjs(cell).format("YYYY-MM-DD"),
+  },
+  {
+    label: "褰曞叆浜�",
+    align: "center",
+    prop: "createUserName",
+  },
+  {
+    label: "褰曞叆鏃ユ湡",
+    align: "center",
+    prop: "createTime",
+    formatData: (cell) => dayjs(cell).format("YYYY-MM-DD HH:mm:ss"),
+    width: 200,
+  },
+  {
+    label: "瀹為檯淇濆吇浜�",
+    align: "center",
+    prop: "maintenanceActuallyName",
+  },
+  {
+    label: "瀹為檯淇濆吇鏃ユ湡",
+    align: "center",
+    prop: "maintenanceActuallyTime",
+    formatData: (cell) =>
+      cell ? dayjs(cell).format("YYYY-MM-DD HH:mm:ss") : "-",
+  },
+  {
+    label: "淇濆吇缁撴灉",
+    align: "center",
+    prop: "maintenanceResult",
+    dataType: "slot",
+    slot: "maintenanceResultRef",
+  },
+  {
+    label: "鐘舵��",
+    align: "center",
+    prop: "status",
+    dataType: "slot",
+    slot: "statusRef",
+  },
+  {
+    fixed: "right",
+    label: "鎿嶄綔",
+    dataType: "slot",
+    slot: "operation",
+    align: "center",
+    width: "200px",
+  },
+]);
 
 // 鏂板淇濆吇
 const addMaintain = () => {
@@ -179,6 +190,11 @@
   planModalRef.value.openEdit(id);
 };
 
+const changePage = ({ page }) => {
+  pagination.currentPage = page;
+  onCurrentChange(page);
+};
+
 // 鍗曡鍒犻櫎
 const delRepairByIds = async (ids) => {
   ElMessageBox.confirm("纭鍒犻櫎鎶ヤ慨鏁版嵁, 姝ゆ搷浣滀笉鍙��?", "璀﹀憡", {

--
Gitblit v1.9.3