Browse Source

合作方产品部分分页实现

zishan-an 1 year ago
parent
commit
66aebeb1c4
3 changed files with 107 additions and 33 deletions
  1. 12 10
      src/api/index.js
  2. 57 10
      src/views/system/cooperatorDetailed.vue
  3. 38 13
      src/views/system/cooperatorProductApply.vue

+ 12 - 10
src/api/index.js

@@ -67,18 +67,20 @@ export function findCooperatorListByName(name) {
     return request.get('/cooperator/findCooperatorListByName?name=' + name);
 }
 
-export function findCooperatorFieldByNum(cooperatorNum){
-    return request({
-        url: '/cooperator/findCooperatorFieldByNum/'+ cooperatorNum ,
-        method: 'get',
-      })  
+export function findCooperatorFieldByNum(cooperatorNum,pageNum,pageSize){
+    return request.post('/cooperator/findCooperatorFieldByNum/',{
+        cooperatorNum:cooperatorNum,
+        pageNum:pageNum,
+        pageSize:pageSize,
+      })  ;
 }
 
-export function findCooperatorProductByNum(cooperatorNum){
-    return request({
-        url: '/cooperator/findCooperatorProductByNum/'+ cooperatorNum ,
-        method: 'get',
-      })  
+export function findCooperatorProductByNum(cooperatorNum,pageNum,pageSize){
+    return request.post('/cooperator/findCooperatorProductByNum/',{
+        cooperatorNum:cooperatorNum,
+        pageNum:pageNum,
+        pageSize:pageSize,
+    })  ;
 }
 
 export function fieldTemplateList(pageNum,pageSize) {

+ 57 - 10
src/views/system/cooperatorDetailed.vue

@@ -82,7 +82,7 @@
 
         <el-tabs v-model="activeName2" @tab-click="handleClick1"  stretch>
         <el-tab-pane label="合作方字段列表" name="first">
-          <el-table :data="cooperatorField.slice((currentPage1-1)*pagesize1,currentPage1*pagesize1)" style="width: 100%;">
+          <el-table :data="cooperatorFieldShow" style="width: 100%;">
           <el-table-column align="center" label="字段类型" >
             <template v-slot="{row}">
               <span>{{ row.type}}</span>
@@ -123,11 +123,11 @@
                           :page-sizes="[5,10,15]"
                           :page-size="pagesize1"
                           layout="total,jumper,prev, pager, next,sizes"
-                          :total="cooperatorField.length" >
+                          :total=showFieldTotal >
           </el-pagination>
         </el-tab-pane>
         <el-tab-pane label="合作产品列表" name="second">
-          <el-table :data="cooperatorProduct.slice((currentPage2-1)*pagesize2,currentPage2*pagesize2)" style="width: 100%;" @row-click="onButtonClick">
+          <el-table :data="cooperatorProductShow" style="width: 100%;" @row-click="onButtonClick">
           <el-table-column align="center" label="产品编号" >
             <template v-slot="{row}">
               <span>{{ row.productNum}}</span>
@@ -166,7 +166,7 @@
                           :page-sizes="[5,10,15]"
                           :page-size="pagesize2"
                           layout="total,jumper,prev, pager, next,sizes"
-                          :total="cooperatorProduct.length" >
+                          :total=showProductTotal >
           </el-pagination>
         </el-tab-pane>
         <el-tab-pane label="历史记录" name="third">历史记录</el-tab-pane>
@@ -217,9 +217,9 @@ export default {
       activeKey: 1,
       activeName2: "first",
       currentPage1: 1,
-      pagesize1:5,
+      pagesize1:10,
       currentPage2: 1,
-      pagesize2:5,
+      pagesize2:10,
       // cooperatorName : this.$route.query.cooperatorName,
       cooperatorId : this.$route.query.cooperatorId,
       cooperatorName : this.$route.query.cooperatorName,
@@ -238,8 +238,16 @@ export default {
       selected6: false,
       input:'',
       cooperatorField : [],
+      cooperatorFieldShow : [],
+
       cooperatorProduct : [],
+      cooperatorProductShow : [],
+
       productStatus : "",
+      fieldTotal:'',
+      showFieldTotal:'',
+      productTotal:'',
+      showProductTotal:'',
     }
   },
   watch: {},
@@ -260,16 +268,26 @@ export default {
     if (this.cooperatorNum==""){
       this.cooperatorNum=null
     }
-    findCooperatorFieldByNum(this.cooperatorNum).then(
+    findCooperatorFieldByNum(this.cooperatorNum,this.currentPage1,this.pagesize1).then(
       res=>
       {
-        this.cooperatorField=res.data.cooperator_field;
+        this.cooperatorField=res.data.cooperator_field.list;
+        this.cooperatorFieldShow = this.cooperatorField
+
+        var j = parseInt(res.data.cooperator_field.total)
+        this.fieldTotal = j
+        this.showFieldTotal = this.fieldTotal
       }
     ),
-    findCooperatorProductByNum(this.cooperatorNum).then(
+    findCooperatorProductByNum(this.cooperatorNum,this.currentPage2,this.pagesize2).then(
       res=>
       {
-        this.cooperatorProduct=res.data.cooperator_product;
+        this.cooperatorProduct=res.data.cooperator_product.list;
+        this.cooperatorProductShow = this.cooperatorProduct
+
+        var j = parseInt(res.data.cooperator_product.total)
+        this.productTotal = j
+        this.showProductTotal = this.productTotal
       }
     )
 
@@ -317,15 +335,44 @@ export default {
     },
     handleCurrentChange1:function(currentPage){
       this.currentPage1=currentPage;
+      findCooperatorFieldByNum(this.cooperatorNum,this.currentPage1,this.pagesize1).then(
+          res=>
+          {
+            this.cooperatorField=res.data.cooperator_field.list;
+            this.cooperatorFieldShow = this.cooperatorField
+
+          }
+      );
     },
     handleSizeChange1:function(size){
       this.pagesize1=size;
+      findCooperatorFieldByNum(this.cooperatorNum,this.currentPage1,this.pagesize1).then(
+          res=>
+          {
+            this.cooperatorField=res.data.cooperator_field.list;
+            this.cooperatorFieldShow = this.cooperatorField
+          }
+      )
     },
     handleCurrentChange2:function(currentPage){
       this.currentPage2=currentPage;
+      findCooperatorProductByNum(this.cooperatorNum,this.currentPage2,this.pagesize2).then(
+          res=>
+          {
+            this.cooperatorProduct=res.data.cooperator_product.list;
+            this.cooperatorProductShow = this.cooperatorProduct
+          }
+      )
     },
     handleSizeChange2:function(size){
       this.pagesize2=size;
+      findCooperatorProductByNum(this.cooperatorNum,this.currentPage2,this.pagesize2).then(
+          res=>
+          {
+            this.cooperatorProduct=res.data.cooperator_product.list;
+            this.cooperatorProductShow = this.cooperatorProduct
+          }
+      )
     },
 
     gotolink2()

+ 38 - 13
src/views/system/cooperatorProductApply.vue

@@ -44,7 +44,7 @@
             </el-tab-pane>
 
             <el-tab-pane label="合作方产品字段信息" name="second">
-              <el-table :data="cooperatorField" style="width: 100%;" ref="cooperatorFields"
+              <el-table :data="cooperatorFieldShow" style="width: 100%;" ref="cooperatorFields"
                         @select="handleSelectionChange" :row-key="rowKey" stripe>
                 <el-table-column type="selection" :reserve-selection=true  width="55" />
 
@@ -82,7 +82,7 @@
                              :page-sizes="[5,10,15]"
 
                              layout="total,jumper,prev, pager, next,sizes"
-                             :total=baseTotal >
+                             :total=showFieldTotal >
               </el-pagination>
               <el-button class="model_add_button " size="small" round type="primary" @click="paneNext2()">下一步</el-button>
               <el-button class="model_add_button " size="small" round type="danger" style="margin-left: 50px" @click="paneClose1()">关闭</el-button>
@@ -173,6 +173,8 @@ export default {
       selected6: false,
       input:'',
       cooperatorField : [],
+      cooperatorFieldShow : [],
+
       cooperatorProduct : [],
       productStatus : "",
       activeName2 : "first",
@@ -182,6 +184,8 @@ export default {
       modelId:"",
       cooperatorFields : [],
       fieldSelected:[],
+      fieldTotal:'',
+      showFieldTotal:'',
       modelData:"",
       templateSelection: '',
         templateRadio: null,
@@ -194,18 +198,18 @@ export default {
   beforeMount() {},
   mounted() 
   {
-    findCooperatorFieldByNum(this.cooperatorNum).then(
-      res=>
-      {
-        this.cooperatorField=res.data.cooperator_field;
-      }
-    ),
-    findCooperatorProductByNum(this.cooperatorNum).then(
-      res=>
-      {
-        this.cooperatorProduct=res.data.cooperator_product;
-      }
+    findCooperatorFieldByNum(this.cooperatorNum,this.currentPage1,this.pagesize1).then(
+        res=>
+        {
+          this.cooperatorField=res.data.cooperator_field.list;
+          this.cooperatorFieldShow = this.cooperatorField
+
+          var j = parseInt(res.data.cooperator_field.total)
+          this.fieldTotal = j
+          this.showFieldTotal = this.fieldTotal
+        }
     ),
+
     modelInfo(1,100).then(res=>
     {
       this.modelData = res.data.modelData.list;
@@ -268,6 +272,27 @@ export default {
     },
     handleCurrentChange() {},
     handleSizeChange() {},
+    handleCurrentChange1:function(currentPage){
+      this.currentPage1=currentPage;
+      findCooperatorFieldByNum(this.cooperatorNum,this.currentPage1,this.pagesize1).then(
+          res=>
+          {
+            this.cooperatorField=res.data.cooperator_field.list;
+            this.cooperatorFieldShow = this.cooperatorField
+
+          }
+      );
+    },
+    handleSizeChange1:function(size){
+      this.pagesize1=size;
+      findCooperatorFieldByNum(this.cooperatorNum,this.currentPage1,this.pagesize1).then(
+          res=>
+          {
+            this.cooperatorField=res.data.cooperator_field.list;
+            this.cooperatorFieldShow = this.cooperatorField
+          }
+      )
+    },
     async getTableData(){
         try {