index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <div class="">
  3. <div class="m-10 bg-w p-20 br-10">
  4. <div class="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;">
  8. {{ statistics.all }}
  9. </div>
  10. </div>
  11. <div class="f-fs-c f-col">
  12. <div style="font-size: 16px;">月新增</div>
  13. <div class="mt-4" style="font-weight: bold; font-size: 18px;">
  14. {{ statistics.month }}
  15. </div>
  16. </div>
  17. <div class="f-fs-c f-col">
  18. <div style="font-size: 16px;">周新增</div>
  19. <div class="mt-4" style="font-weight: bold; font-size: 18px;">
  20. {{ statistics.week }}
  21. </div>
  22. </div>
  23. </div>
  24. </div>
  25. <toolbar @on-filter="filterData" @on-reset="filterData" />
  26. <div class="m-10 bg-w p-20 br-10">
  27. <el-button type="primary" icon="el-icon-plus" @click="$AliOssMultiModal()"
  28. >批量上传照片</el-button
  29. >
  30. <base-table
  31. :columns="columns"
  32. :items="items"
  33. :pagination="pagination"
  34. :page-change="pageChange"
  35. />
  36. </div>
  37. </div>
  38. </template>
  39. <script>
  40. import toolbar from './toolbar';
  41. import mxFilterList from '@/mixins/filterList';
  42. import { getPage, getCount, delItem } from '@/api/photoWarehouse';
  43. export default {
  44. name: 'PhotoVerify',
  45. components: { toolbar },
  46. mixins: [
  47. mxFilterList({
  48. fetchList: getPage // 在下方data再声明一个 fetchList: iGetList 同等效果
  49. })
  50. ],
  51. data() {
  52. return {
  53. statistics: {},
  54. columns: [
  55. {
  56. key: 'id',
  57. name: '标识',
  58. width: this.$col.b
  59. },
  60. {
  61. key: 'activityName',
  62. name: '活动',
  63. minWidth: this.$col.b
  64. },
  65. {
  66. key: 'nickname',
  67. name: '账号昵称',
  68. minWidth: this.$col.b
  69. },
  70. {
  71. key: 'nickname',
  72. name: '账号昵称',
  73. minWidth: this.$col.b
  74. },
  75. {
  76. key: 'phonenumber',
  77. name: '账号手机号码',
  78. width: this.$col.m
  79. },
  80. {
  81. key: 'listPreview',
  82. name: '列表预览图',
  83. width: this.$col.b,
  84. render: (h, { row }) => {
  85. if (!row.listPreview) {
  86. return h('span', '图片正在处理中请稍等...');
  87. }
  88. return h('img', {
  89. style: {
  90. width: '160px',
  91. height: '90px'
  92. },
  93. class: 'pre-img',
  94. attrs: {
  95. src: row.listPreview
  96. },
  97. on: {
  98. click: () =>
  99. this.$AdvanceViewImageModal({
  100. items: [{ src: row.listPreview }]
  101. })
  102. }
  103. });
  104. }
  105. },
  106. {
  107. key: 'createAt',
  108. name: '上传时间',
  109. width: this.$col.b
  110. },
  111. {
  112. key: 'auditStatus',
  113. name: '状态',
  114. width: this.$col.s,
  115. type: 'tag',
  116. fetchTagType: val => {
  117. switch (val) {
  118. case 1:
  119. return 'success';
  120. case 0:
  121. return 'info';
  122. case -1:
  123. return 'danger';
  124. default:
  125. return 'info';
  126. }
  127. },
  128. tagName: row => {
  129. switch (row.auditStatus) {
  130. case 1:
  131. return '通过';
  132. case 0:
  133. return '待审核';
  134. case -1:
  135. return '拒绝';
  136. default:
  137. return '-';
  138. }
  139. }
  140. },
  141. {
  142. key: 'action',
  143. name: '操作',
  144. width: '120',
  145. render: (h, { row }) => {
  146. const action = [];
  147. action.push(
  148. h(
  149. 'BaseBtn',
  150. {
  151. props: {
  152. popip: true,
  153. txt: '删除',
  154. type: 'text'
  155. },
  156. class: 'ml-10',
  157. on: {
  158. ok: () => this.handleDelItem(row)
  159. }
  160. },
  161. '删除'
  162. )
  163. );
  164. return h('div', action);
  165. }
  166. }
  167. ]
  168. };
  169. },
  170. created() {
  171. this.$g_on('photo_reload', this.reload);
  172. },
  173. beforeDestroy() {
  174. this.$g_off('photo_reload', this.reload);
  175. },
  176. methods: {
  177. async handleDelItem(item) {
  178. const { success, msg } = await delItem({
  179. id: item.id
  180. });
  181. if (success) {
  182. this.$success('删除成功!');
  183. this.$g_emit('photo_reload');
  184. }
  185. },
  186. async pageChange(page) {
  187. this.pagination.page = page;
  188. const inParams = {
  189. ...this.filter,
  190. ...this.internalFilterObj,
  191. start: this.pagination.page,
  192. limit: this.pagination.pageSize
  193. };
  194. const { data, msg } = await this.apiList(inParams);
  195. const res2 = await getCount(inParams);
  196. this.statistics = res2.data;
  197. if ('data' in data) {
  198. const items = data.data;
  199. if (items.length === 0 && this.pagination.page > 1) {
  200. this.pageChange(1);
  201. } else {
  202. this.items = items;
  203. this.pagination.total = data.total;
  204. }
  205. this.loadCallBack(data);
  206. }
  207. }
  208. }
  209. };
  210. </script>
  211. <style type="scss" scoped></style>