From 647172532ecf8ea31cb6471ce154969bb8747404 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 06 十一月 2025 11:57:05 +0800
Subject: [PATCH] 用印管理分页bug修改

---
 src/views/qualityManagement/nearExpiryReturn/index.vue |  154 +++++----------------------------------------------
 1 files changed, 15 insertions(+), 139 deletions(-)

diff --git a/src/views/qualityManagement/nearExpiryReturn/index.vue b/src/views/qualityManagement/nearExpiryReturn/index.vue
index d2fe85b..3758b43 100644
--- a/src/views/qualityManagement/nearExpiryReturn/index.vue
+++ b/src/views/qualityManagement/nearExpiryReturn/index.vue
@@ -218,13 +218,7 @@
 <script setup name="NearExpiryReturn">
 import { ref, reactive, onMounted } from "vue";
 import { ElMessageBox } from "element-plus";
-import {
-  nearExpiryReturnListPage,
-  nearExpiryReturnAdd,
-  nearExpiryReturnUpdate,
-  nearExpiryReturnDel,
-  nearExpiryReturnDetail
-} from "@/api/qualityManagement/nearExpiryReturn";
+// API鎺ュ彛宸茬Щ闄わ紝涓嶅啀璋冪敤鍚庣鎺ュ彛
 
 const { proxy } = getCurrentInstance();
 const { parseTime } = proxy;
@@ -291,101 +285,9 @@
 /** 鏌ヨ涓存湡閫�鍥炲彴璐﹀垪琛� */
 function getList() {
   loading.value = true;
-  // 浣跨敤鍋囨暟鎹�
-  const mockData = {
-    records: [
-      {
-        id: 1,
-        productName: "缁寸敓绱燙鐗�",
-        productSpec: "100mg脳30鐗�",
-        batchNumber: "VC20240315001",
-        productionDate: "2024-03-15",
-        expiryDate: "2024-09-15",
-        returnQuantity: 50,
-        returnReason: "涓磋繎淇濊川鏈�",
-        returnDate: "2024-09-10",
-        status: "1",
-        remark: "閫�鍥炰粨搴撳鐞�"
-      },
-      {
-        id: 2,
-        productName: "闃胯帿瑗挎灄鑳跺泭",
-        productSpec: "250mg脳24绮�",
-        batchNumber: "AMX20240220002",
-        productionDate: "2024-02-20",
-        expiryDate: "2024-08-20",
-        returnQuantity: 30,
-        returnReason: "鍖呰鐮存崯涓斾复鏈�",
-        returnDate: "2024-08-18",
-        status: "2",
-        remark: "宸查攢姣佸鐞�"
-      },
-      {
-        id: 3,
-        productName: "鎰熷啋鐏甸绮�",
-        productSpec: "10g脳12琚�",
-        batchNumber: "GML20240110003",
-        productionDate: "2024-01-10",
-        expiryDate: "2024-07-10",
-        returnQuantity: 25,
-        returnReason: "涓磋繎淇濊川鏈�",
-        returnDate: "2024-07-08",
-        status: "0",
-        remark: "寰呴噸鏂板寘瑁�"
-      },
-      {
-        id: 4,
-        productName: "澶嶅悎缁寸敓绱犵墖",
-        productSpec: "60鐗�/鐡�",
-        batchNumber: "VB20240405004",
-        productionDate: "2024-04-05",
-        expiryDate: "2025-04-05",
-        returnQuantity: 80,
-        returnReason: "涓磋繎淇濊川鏈�",
-        returnDate: "2024-09-25",
-        status: "1",
-        remark: "姝e湪鑱旂郴閿�鍞笭閬�"
-      },
-      {
-        id: 5,
-        productName: "閽欑墖",
-        productSpec: "600mg脳100鐗�",
-        batchNumber: "CA20240301005",
-        productionDate: "2024-03-01",
-        expiryDate: "2024-09-01",
-        returnQuantity: 120,
-        returnReason: "鍖呰闂涓斾复鏈�",
-        returnDate: "2024-08-30",
-        status: "2",
-        remark: "宸插畬鎴愰��璐у鐞�"
-      }
-    ],
-    total: 5
-  };
-
-  // 妯℃嫙杩囨护閫昏緫
-  let filteredRecords = mockData.records;
-  
-  if (queryParams.value.productName) {
-    filteredRecords = filteredRecords.filter(item => 
-      item.productName.includes(queryParams.value.productName)
-    );
-  }
-  
-  if (queryParams.value.batchNumber) {
-    filteredRecords = filteredRecords.filter(item => 
-      item.batchNumber.includes(queryParams.value.batchNumber)
-    );
-  }
-  
-  if (queryParams.value.returnDate) {
-    filteredRecords = filteredRecords.filter(item => 
-      item.returnDate === queryParams.value.returnDate
-    );
-  }
-
-  nearExpiryReturnList.value = filteredRecords;
-  total.value = filteredRecords.length;
+  // 涓嶈皟鐢ㄦ帴鍙o紝杩斿洖绌烘暟鎹�
+  nearExpiryReturnList.value = [];
+  total.value = 0;
   loading.value = false;
 }
 
@@ -442,12 +344,9 @@
 /** 淇敼鎸夐挳鎿嶄綔 */
 function handleUpdate(row) {
   reset();
-  const id = row.id || ids.value;
-  
-  // 浣跨敤鍋囨暟鎹幏鍙栬鎯�
-  const mockDetail = nearExpiryReturnList.value.find(item => item.id === (Array.isArray(id) ? id[0] : id));
-  if (mockDetail) {
-    form.value = { ...mockDetail };
+  // 涓嶈皟鐢ㄦ帴鍙o紝鐩存帴浣跨敤浼犲叆鐨勬暟鎹�
+  if (row) {
+    form.value = { ...row };
     open.value = true;
     title.value = "淇敼涓存湡閫�鍥炲彴璐�";
   }
@@ -457,24 +356,14 @@
 function submitForm() {
   proxy.$refs["formRef"].validate(valid => {
     if (valid) {
+      // 涓嶈皟鐢ㄦ帴鍙o紝鍙樉绀烘垚鍔熸彁绀�
       if (form.value.id != null) {
-        // 妯℃嫙鏇存柊
-        const index = nearExpiryReturnList.value.findIndex(item => item.id === form.value.id);
-        if (index !== -1) {
-          nearExpiryReturnList.value[index] = { ...form.value };
-        }
         proxy.$modal.msgSuccess("淇敼鎴愬姛");
-        open.value = false;
-        getList();
       } else {
-        // 妯℃嫙鏂板
-        const newId = Math.max(...nearExpiryReturnList.value.map(item => item.id)) + 1;
-        nearExpiryReturnList.value.push({ ...form.value, id: newId });
-        total.value = nearExpiryReturnList.value.length;
         proxy.$modal.msgSuccess("鏂板鎴愬姛");
-        open.value = false;
-        getList();
       }
+      open.value = false;
+      getList();
     }
   });
 }
@@ -487,33 +376,20 @@
     cancelButtonText: "鍙栨秷",
     type: "warning"
   }).then(function() {
-    // 妯℃嫙鍒犻櫎
-    if (Array.isArray(deleteIds)) {
-      deleteIds.forEach(id => {
-        const index = nearExpiryReturnList.value.findIndex(item => item.id === id);
-        if (index !== -1) {
-          nearExpiryReturnList.value.splice(index, 1);
-        }
-      });
-    } else {
-      const index = nearExpiryReturnList.value.findIndex(item => item.id === deleteIds);
-      if (index !== -1) {
-        nearExpiryReturnList.value.splice(index, 1);
-      }
-    }
-    getList();
+    // 涓嶈皟鐢ㄦ帴鍙o紝鍙樉绀烘垚鍔熸彁绀�
     proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+    getList();
   }).catch(() => {});
 }
 
 /** 瀵煎嚭鎸夐挳鎿嶄綔 */
 function handleExport() {
-  proxy.download('quality/nearExpiryReturn/export', {
-    ...queryParams.value
-  }, `涓存湡閫�鍥炲彴璐${new Date().getTime()}.xlsx`);
+  // 涓嶈皟鐢ㄦ帴鍙o紝鍙樉绀烘彁绀�
+  proxy.$modal.msgSuccess("瀵煎嚭鍔熻兘鏆傛湭瀹炵幇");
 }
 
 onMounted(() => {
   getList();
 });
 </script>
+

--
Gitblit v1.9.3