Parcourir la source

存货档案-列表分页

jingbb il y a 1 an
Parent
commit
2582616ec1
1 fichiers modifiés avec 28 ajouts et 4 suppressions
  1. 28 4
      src/views/production/Popup/inventoryPopup.vue

+ 28 - 4
src/views/production/Popup/inventoryPopup.vue

@@ -18,7 +18,7 @@
             :columns="columns"
             rowKey="rowIndex"
             :dataSource="dataSource"
-            :pagination="false"
+            :pagination="pagination"
             :scroll="{ x: 800, y: 300 }"
             :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
             @change="handleTableChange"
@@ -45,6 +45,20 @@
             selectedRowKeys:[],
             selectedRows:[],
             dataSource:[],
+            pagination:{
+                current: 1,
+                pageSize: 5,
+                pageSizeOptions: ['5', '10', '20'],
+                showTotal: (total, range) => {
+                    return range[0] + "-" + range[1] + " 共" + total + "条"
+                },
+                showQuickJumper: true,
+                showSizeChanger: true,
+                total: 0
+            },
+            queryParam:{
+                pageNo:1
+            },
             columns:[
                 {
                     title: '#',
@@ -94,15 +108,25 @@
                 }
             },
             getData(){
-                getAction('/production/safetyStock/selectItemMaster').then(res=>{
-                        if(res){
-                          this.dataSource = res
+                getAction('/production/safetyStock/selectItemMaster',this.queryParam).then(res=>{
+                        if(res.success){
+                          this.dataSource = res.result.records
+                          this.pagination = {
+                            total: res.result.total,
+                            current: res.result.current,
+                            pageSize: res.result.size
+                          }
                         }else{
                           this.$message.error(res.message);
                           
                         }
                 })
             },
+            handleTableChange(pagination, filters, sorter) {
+                this.queryParam.pageNo = pagination.current
+                this.queryParam.pageSize = pagination.pageSize
+                this.getData()
+            },
             onSelectChange(selectedRowKeys, selectionRows) {
               this.selectedRowKeys = selectedRowKeys;
               this.selectedRows = selectionRows;