lrf 2 years ago
parent
commit
8ff54a0b6f
4 changed files with 8 additions and 6 deletions
  1. 1 0
      .env
  2. 5 4
      src/components/usual/c-table.vue
  3. 1 1
      src/main.js
  4. 1 1
      src/util/opera.js

+ 1 - 0
.env

@@ -1,4 +1,5 @@
 VUE_APP_AXIOS_BASE_URL = ''
 VUE_APP_ROUTER="shoppingAdmin"
 VUE_APP_HOST="https://broadcast.waityou24.cn"
+VUE_APP_PAGE_SIZE=50
 

+ 5 - 4
src/components/usual/c-table.vue

@@ -79,8 +79,8 @@
       <el-col :span="24" style="text-align: right">
         <el-pagination
           background
-          layout="total, prev, pager, next"
-          :page-sizes="[10, 15, 20, 50, 100]"
+          layout="sizes,total, prev, pager, next"
+          :page-sizes="[10, 50, 100, 150, 200]"
           :total="total"
           :page-size="limit"
           :current-page.sync="currentPage"
@@ -108,7 +108,7 @@ export default {
     useSum: { type: Boolean, default: false },
     sumcol: { type: Array, default: () => [] },
     sumres: { type: String, default: 'total' },
-    limit: { type: Number, default: 10 },
+    // limit: { type: Number, default: 10 },
     height: null,
     operaWidth: { type: Number, default: 200 },
     vOpera: { type: Boolean, default: false },
@@ -118,6 +118,7 @@ export default {
     return {
       pageSelected: [],
       currentPage: 1,
+      limit: this.$limit,
     };
   },
   created() {},
@@ -245,7 +246,7 @@ export default {
         // 整理出要计算的属性(只取出数字或者可以为数字的值)
         const resetList = data.map((i) => {
           const d = _.get(i, prop);
-          return d*1
+          return d * 1;
         });
         if (this.sumres === 'total') {
           res = this.totalComputed(resetList);

+ 1 - 1
src/main.js

@@ -12,7 +12,7 @@ import '@/assets/icon/iconfont.css';
 import '@/assets/css/main.css';
 Vue.config.productionTip = false;
 Vue.prototype.$dev_env = process.env.NODE_ENV === 'development';
-
+Vue.prototype.$limit = parseInt(process.env.VUE_APP_PAGE_SIZE) || 10;
 new Vue({
   router,
   store,

+ 1 - 1
src/util/opera.js

@@ -1,7 +1,7 @@
 const _ = require('lodash');
 export default {
   //执行查询
-  async search({ skip = 0, limit = this.limit || 10, ...others } = {}) {
+  async search({ skip = 0, limit = this.$limit || 10, ...others } = {}) {
     let query = { skip, limit, ...others };
     if (this.searchInfo && Object.keys(this.searchInfo).length > 0) query = { ...query, ...this.searchInfo };
     if (this.defaultSearch && Object.keys(this.defaultSearch).length > 0) query = { ...query, ...this.defaultSearch };