dingxin 6 лет назад
Родитель
Сommit
71439c7ab3
2 измененных файлов: 16 добавлений и 7 удалений
  1. 15
    6
      src/views/goodsManager/goodManager/index.vue
  2. 1
    1
      src/views/index.js

+ 15
- 6
src/views/goodsManager/goodManager/index.vue Просмотреть файл

@@ -1,6 +1,6 @@
1 1
 <template>
2 2
   <r-layout class="subPage">
3
-    <xm-search>
3
+    <xm-search @submit="search">
4 4
       <el-form-item>
5 5
         <el-button type="success" @click='addGoods'>新增商品</el-button>
6 6
       </el-form-item>
@@ -47,7 +47,8 @@
47 47
     </div>
48 48
     <el-pagination
49 49
     @current-change="handleCurrentChange"
50
-    :current-page="postData.page"
50
+    @size-change="handleSizeChange"
51
+    :current-page="postData.pageNum"
51 52
     :page-size="postData.pagesize"
52 53
     layout="prev, pager, next, jumper"
53 54
     :total="pageTotal">
@@ -70,7 +71,7 @@ export default {
70 71
       postData: {
71 72
         goodsName: '',
72 73
         typeId: '',
73
-        page: 1,
74
+        pageNum: 1,
74 75
         pagesize: 10,
75 76
       },
76 77
     }
@@ -87,22 +88,27 @@ export default {
87 88
       return (this.goodsTypes.filter(x => x.typeId === typeid)[0] || {}).typeName
88 89
     },
89 90
     search () { // 搜索
90
-      this.postData.page = 1
91
+      this.postData.pageNum = 1
91 92
       this.currentList = []
92 93
       this.getList()
93 94
     },
94 95
     getList () {
95 96
       this.getGoodsList({ ...this.postData }).then((dt) => {
96 97
         this.currentList = dt.records
97
-        this.postData.page = dt.current
98
+        this.postData.pageNum = dt.current
98 99
         this.postData.pagesize = dt.size
99 100
         this.pageTotal = dt.total
100 101
       })
101 102
     },
102 103
     handleCurrentChange (val) {
103
-      this.postData.page = val
104
+      this.postData.pageNum = val
104 105
       this.getList()
105 106
     },
107
+    handleSizeChange(val) {
108
+      this.postData.pageSize = val
109
+      this.getPage()
110
+    },
111
+
106 112
     handleEdit (index, row) {
107 113
       // 编辑
108 114
       this.$router.push({ name: 'goodsedit', query: { id: row.goodsId } })
@@ -142,6 +148,9 @@ export default {
142 148
 
143 149
     this.getList()
144 150
   },
151
+  created (){
152
+    this.getList()
153
+  }
145 154
 }
146 155
 </script>
147 156
 

+ 1
- 1
src/views/index.js Просмотреть файл

@@ -244,7 +244,7 @@ const pages = [
244 244
                 name: 'goodsedit',
245 245
                 component: () => import('./goodsManager/goodManager/edit.vue'),
246 246
                 meta: {
247
-                  menuShow: true,
247
+                  menuShow: false,
248 248
                   title: '商品编辑',
249 249
                 },
250 250
               },