From b3cdd002a336718632da6c4341d7cdbe48c5d165 Mon Sep 17 00:00:00 2001
From: TanYibin <5491541@qq.com>
Date: Tue, 10 Oct 2023 18:04:05 +0800
Subject: [PATCH] 盘点问题修正

---
 ant-design-vue-jeecg/src/views/system/stocktaking/modules/CycleCountDetailModal.vue | 37 ++++++++++++++++++-------------------
 1 file changed, 18 insertions(+), 19 deletions(-)

diff --git a/ant-design-vue-jeecg/src/views/system/stocktaking/modules/CycleCountDetailModal.vue b/ant-design-vue-jeecg/src/views/system/stocktaking/modules/CycleCountDetailModal.vue
index 17dac10..2d82f68 100644
--- a/ant-design-vue-jeecg/src/views/system/stocktaking/modules/CycleCountDetailModal.vue
+++ b/ant-design-vue-jeecg/src/views/system/stocktaking/modules/CycleCountDetailModal.vue
@@ -232,7 +232,7 @@ export default {
     },
     onSelectChange(selectedRowKeys, selectionRows) {
       this.selectedRowKeys = selectedRowKeys;
-      // 解决翻页后 selectionRows 没记录上一页数据的问题
+      // 解决翻页后 selectionRows 没记录上一页的问题
       if (selectedRowKeys.length === selectionRows.length) {
         this.selectionRows = selectionRows;
       } else {
@@ -241,17 +241,8 @@ export default {
         ))
       }
       this.selectedTable.dataSource = this.selectionRows;
-      this.selectedRowIds = selectionRows.map(x => x.id)
-      this.getDetailDataSource()
-    },
-    handleDetailTableChange(pagination, filters, sorter) {
-      //分页、排序、筛选变化时触发
-      if (Object.keys(sorter).length > 0) {
-        this.isorter.column = sorter.field;
-        this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
-      }
-      this.detailIpagination = pagination;
-      this.getDetailDataSource(this.detailIpagination.current);
+      this.selectedRowIds = this.selectionRows.map(x => x.id)
+      this.loadDetailDataSource(1)
     },
     customRowFn(record) {
       return {
@@ -263,7 +254,7 @@ export default {
               this.selectedRowKeys.push(key)
               this.selectedTable.dataSource.push(record)
               this.selectedRowIds.push(record.id)
-              this.getDetailDataSource();
+              this.loadDetailDataSource(1);
             } else {
               this.handleDeleteSelected(record, index)
             }
@@ -275,16 +266,24 @@ export default {
       this.selectedRowKeys.splice(this.selectedRowKeys.indexOf(record[this.rowKey]), 1)
       this.selectedRowIds.splice(this.selectedRowIds.indexOf(record.id), 1)
       this.selectedTable.dataSource.splice(this.selectedTable.dataSource.indexOf(record), 1)
-      this.getDetailDataSource();
+      this.loadDetailDataSource(1);
     },
-    getDetailDataSource(current) {
-      this.loading = true;
-      if (current == undefined) {
-        this.detailIpagination.current = 1;
+    handleDetailTableChange(pagination, filters, sorter) {
+      if (Object.keys(sorter).length > 0) {
+        this.isorter.column = sorter.field;
+        this.isorter.order = "ascend" === sorter.order ? "asc" : "desc"
       }
+      this.detailIpagination = pagination;
+      this.loadDetailDataSource();
+    },
+    loadDetailDataSource(pageCurrent) {
+      if (pageCurrent && typeof pageCurrent == 'number') {
+        this.detailIpagination.current =  pageCurrent;
+      }
+      this.loading = true;
       let params = {
         inventoryHeaderIds: this.selectedRowIds.join(","),
-        pageNo: this.detailIpagination.current,
+        pageNo:  this.detailIpagination.current,
         pageSize: this.detailIpagination.pageSize
       }
       getAction(this.url.pageByMainIds, params).then((res) => {
--
libgit2 0.22.2