Ver Fonte

产品列表页优化:新增当前页码记录并优化表格刷新逻辑

yusheng há 9 meses atrás
pai
commit
37661f436c

+ 16 - 2
src/views/material/product/components/index-data.vue

@@ -384,7 +384,7 @@
         attributeList: [],
         exportLoading: false,
         moudleName: 'mainCategory',
-
+        currentPage: 1,
         errorData: [],
         exportErrorDioalogVisible: false,
         pagination: {
@@ -744,6 +744,7 @@
       },
       /* 表格数据源 */
       async datasource({ page, limit, where, order }) {
+        this.currentPage = page;
         let labs = getMaterialList({
           pageNum: page,
           size: limit,
@@ -776,7 +777,20 @@
           categoryLevelId: this.currentId
         });
       },
-
+      /* 刷新表格 */
+      reloadNew(where) {
+        let labs = {
+          page: 1,
+          where: where,
+          categoryLevelId: this.currentId
+        };
+        this.whereData = labs;
+        this.$refs.table.reload({
+          page: this.currentPage,
+          where: where,
+          categoryLevelId: this.currentId
+        });
+      },
       getFieldModel() {
         fieldModel({ relevance: 't_main_category' }).then((res) => {
           const privateColumn = [

+ 1 - 1
src/views/material/product/index.vue

@@ -160,7 +160,7 @@
     activated() {
       // this.getTreeData();
       this.$nextTick(() => {
-        this.reload(this.where);
+        this.$refs.listData.reloadNew(this.where);
       });
     },
     computed: {

+ 3 - 3
src/views/material/product/oneProduct.vue

@@ -161,9 +161,9 @@
     },
     activated() {
       // this.getTreeData();
-      this.$nextTick(()=>{
-        this.reload(this.where)
-      })
+      this.$nextTick(() => {
+        this.$refs.listData.reloadNew(this.where);
+      });
     },
     computed: {
       // 是否开启响应式布局