index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <div class="">
  3. <div
  4. class="m-10 bg-w p-20 br-10 f-sa-s">
  5. <div class="f-fs-c f-col">
  6. <div style="font-size: 16px;">总量</div>
  7. <div class="mt-4" style="font-weight: bold; font-size: 18px;">{{statistics.all}}</div>
  8. </div>
  9. <div class="f-fs-c f-col">
  10. <div style="font-size: 16px;">月新增</div>
  11. <div class="mt-4" style="font-weight: bold; font-size: 18px;">{{statistics.month}}</div>
  12. </div>
  13. <div class="f-fs-c f-col">
  14. <div style="font-size: 16px;">周新增</div>
  15. <div class="mt-4" style="font-weight: bold; font-size: 18px;">{{statistics.week}}</div>
  16. </div>
  17. </div>
  18. <toolbar @on-filter="filterData" @on-reset="filterData" />
  19. <base-table
  20. class="m-10 bg-w p-20 br-10"
  21. :columns="columns"
  22. :items="items"
  23. :pagination="pagination"
  24. :page-change="pageChange"
  25. />
  26. </div>
  27. </template>
  28. <script>
  29. import toolbar from './toolbar';
  30. import mxFilterList from '@/mixins/filterList';
  31. import { getUploadPage, getUploadCount } from '@/api/statistics';
  32. export default {
  33. name: 'UploadImage',
  34. components: { toolbar },
  35. mixins: [
  36. mxFilterList({
  37. fetchList: getUploadPage // 在下方data再声明一个 fetchList: iGetList 同等效果
  38. })
  39. ],
  40. data() {
  41. return {
  42. statistics: {},
  43. columns: [
  44. {
  45. key: 'kindergartenName',
  46. name: '场景',
  47. minWidth: this.$col.b
  48. },
  49. {
  50. key: 'activityName',
  51. name: '活动',
  52. minWidth: this.$col.b
  53. },
  54. {
  55. key: 'nickname',
  56. name: '账号昵称',
  57. minWidth: this.$col.b
  58. },
  59. {
  60. key: 'phonenumber',
  61. name: '账号手机号码',
  62. width: this.$col.m
  63. },
  64. {
  65. key: 'isTakeTrue',
  66. name: '手机上传数',
  67. minWidth: '120'
  68. },
  69. {
  70. key: 'isTakeFalse',
  71. name: '电脑上传数',
  72. minWidth: '120'
  73. },
  74. {
  75. key: 'isTake',
  76. name: '总上传数',
  77. width: '140',
  78. render:(h, {row}) => h('span', `${row.isTakeTrue+row.isTakeFalse}`)
  79. },
  80. {
  81. key: 'createAt',
  82. name: '上传时间',
  83. minWidth: this.$col.b
  84. },
  85. ]
  86. };
  87. },
  88. methods:{
  89. async pageChange(page) {
  90. this.pagination.page = page;
  91. const inParams = {
  92. ...this.filter,
  93. ...this.internalFilterObj,
  94. page: this.pagination.page,
  95. size: this.pagination.pageSize
  96. };
  97. const { data, msg } = await this.apiList(inParams, {
  98. limit: this.pagination.pageSize,
  99. start: this.pagination.page
  100. });
  101. const res2 = await getUploadCount(inParams)
  102. this.statistics = res2.data
  103. if ('data' in data) {
  104. const items = data.data;
  105. if (items.length === 0 && this.pagination.page > 1) {
  106. this.pageChange(1);
  107. } else {
  108. this.items = items;
  109. this.pagination.total = data.total;
  110. }
  111. this.loadCallBack(data);
  112. }
  113. }
  114. }
  115. };
  116. </script>
  117. <style type="scss" scoped></style>