From e505a8c39e308918c51460e44885dc84a0ac5045 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 05 二月 2026 17:49:19 +0800
Subject: [PATCH] fix: 库存管理与入库报表页面建议都做下分页

---
 src/views/inventoryManagement/stockReport/index.vue |   45 +++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/src/views/inventoryManagement/stockReport/index.vue b/src/views/inventoryManagement/stockReport/index.vue
index ff1d901..9d3fc80 100644
--- a/src/views/inventoryManagement/stockReport/index.vue
+++ b/src/views/inventoryManagement/stockReport/index.vue
@@ -48,7 +48,7 @@
           style="width: 240px;"
         />
         
-        <el-button type="primary" @click="handleQuery" style="margin-left: 10px">
+        <el-button type="primary" @click="onSearch" style="margin-left: 10px">
           鏌ヨ
         </el-button>
         <el-button @click="handleReset">閲嶇疆</el-button>
@@ -230,15 +230,23 @@
              show-overflow-tooltip
            />
         </el-table>
+        <pagination
+          :total="total"
+          layout="total, sizes, prev, pager, next, jumper"
+          :page="page.current"
+          :limit="page.size"
+          @pagination="paginationChange"
+        />
       </el-card>
     </div>
   </div>
 </template>
 
 <script setup>
-import { ref, reactive, onMounted, nextTick } from 'vue'
+import { ref, reactive, onMounted, nextTick, getCurrentInstance } from 'vue'
 import { ElMessage } from 'element-plus'
 import * as echarts from 'echarts'
+import pagination from '@/components/PIMTable/Pagination.vue'
 import {
   getStockInventoryInAndOutReportList,
   getStockInventoryReportList
@@ -267,6 +275,13 @@
   tableData: []
 })
 
+const page = reactive({
+  current: 1,
+  size: 10,
+})
+
+const total = ref(0)
+
 const stockRecordTypeOptions = ref([])
 
 const getRecordType = (recordType) => {
@@ -293,6 +308,7 @@
 
 // 鎶ヨ〃绫诲瀷鏀瑰彉
 const handleReportTypeChange = () => {
+  page.current = 1
   reportData.value = {
     summary: null,
     chartData: null,
@@ -308,7 +324,12 @@
   
   tableLoading.value = true
   try {
-    const params = getQueryParams()
+    const baseParams = getQueryParams()
+    const params = {
+      ...baseParams,
+      current: page.current,
+      size: page.size,
+    }
     let response
 
     if (searchForm.reportType === 'inout') {
@@ -317,7 +338,8 @@
       response = await getStockInventoryReportList(params)
     }
     if (response.code === 200) {
-      reportData.value.tableData = response.data.records
+      reportData.value.tableData = response.data.records || []
+      total.value = response.data.total || 0
       // reportData.value.summary = response.data.summary
       // reportData.value.chartData = response.data.chartData
       // nextTick(() => {
@@ -330,6 +352,19 @@
   } finally {
     tableLoading.value = false
   }
+}
+
+// 鏌ヨ鎸夐挳锛氶噸缃埌绗竴椤靛苟鏌ヨ
+const onSearch = () => {
+  page.current = 1
+  handleQuery()
+}
+
+// 鍒嗛〉鍙樺寲
+const paginationChange = (obj) => {
+  page.current = obj.page
+  page.size = obj.limit
+  handleQuery()
 }
 // // 鐢熸垚鍋囨暟鎹�
 // const generateMockData = () => {
@@ -550,6 +585,8 @@
   ]
 
   fetchStockRecordTypeOptions()
+  // 鍒濆鍖栧姞杞戒竴娆℃暟鎹�
+  handleQuery()
 })
 </script>
 

--
Gitblit v1.9.3