From 62478e2cd6e941775c812941bef4a1e366367396 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 07 五月 2026 13:11:53 +0800
Subject: [PATCH] fix: 工序参数显示记录条数展示有误,分页展示也有问题

---
 src/views/productionManagement/productionProcess/index.vue |   43 +++++++++++++++++++++++++++----------------
 1 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/src/views/productionManagement/productionProcess/index.vue b/src/views/productionManagement/productionProcess/index.vue
index b759276..216e73b 100644
--- a/src/views/productionManagement/productionProcess/index.vue
+++ b/src/views/productionManagement/productionProcess/index.vue
@@ -285,7 +285,7 @@
 </template>
 
 <script setup>
-  import { ref, reactive, onMounted } from "vue";
+  import { ref, reactive, computed, onMounted } from "vue";
   import { ElMessage, ElMessageBox } from "element-plus";
   import { Plus, Edit, Delete, Search } from "@element-plus/icons-vue";
   import PIMTable from "@/components/PIMTable/PIMTable.vue";
@@ -310,8 +310,19 @@
   const processLoading = ref(false);
   const deviceOptions = ref([]);
 
-  // 鍙傛暟鍒楄〃鏁版嵁
-  const paramList = ref([]);
+  // 宸ュ簭宸查�夊弬鏁拌〃鏍煎垎椤碉紙鎺ュ彛涓�娆¤繑鍥炲叏閲忥級
+  const paramPage2 = ref({
+    current: 1,
+    size: 10,
+    total: 0,
+  });
+  const paramListRaw = ref([]);
+  const paramList = computed(() => {
+    const all = paramListRaw.value;
+    const { current, size } = paramPage2.value;
+    const start = (current - 1) * size;
+    return all.slice(start, start + size);
+  });
   const paramLoading = ref(false);
 
   // 鏁版嵁瀛楀吀
@@ -482,21 +493,21 @@
     }
   };
 
-  const paramPage2 = ref({
-    current: 1,
-    size: 10,
-    total: 0,
-  });
-
   // 鑾峰彇鍙傛暟鍒楄〃
   const getParamList = processId => {
     paramLoading.value = true;
-    console.log(paramPage2.value, "paramPage2.value");
     getProcessParamList({ technologyOperationId: processId })
       .then(res => {
-        console.log(res, "res");
-        paramList.value = res.data || [];
-        paramPage2.value.total = 0;
+        const list = res.data || [];
+        paramListRaw.value = Array.isArray(list) ? list : [];
+        paramPage2.value.total = paramListRaw.value.length;
+        const maxPage = Math.max(
+          1,
+          Math.ceil(paramPage2.value.total / paramPage2.value.size) || 1
+        );
+        if (paramPage2.value.current > maxPage) {
+          paramPage2.value.current = maxPage;
+        }
       })
       .catch(() => {
         ElMessage.error("鑾峰彇鍙傛暟鍒楄〃澶辫触");
@@ -509,6 +520,7 @@
   // 閫夋嫨宸ュ簭
   const selectProcess = process => {
     selectedProcess.value = process;
+    paramPage2.value.current = 1;
     getParamList(process.id);
   };
 
@@ -553,7 +565,8 @@
           getProcessList();
           if (selectedProcess.value?.id === process.id) {
             selectedProcess.value = null;
-            paramList.value = [];
+            paramListRaw.value = [];
+            paramPage2.value.total = 0;
           }
         })
         .catch(() => {
@@ -741,10 +754,8 @@
   };
 
   const handleParamPagination = obj => {
-    console.log(obj, "obj");
     paramPage2.value.current = obj.page;
     paramPage2.value.size = obj.limit;
-    getParamList(selectedProcess.value.id);
   };
 
   // 鑾峰彇鏁版嵁瀛楀吀

--
Gitblit v1.9.3