index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <div class="">
  3. <toolbar @on-filter="filterData" @on-reset="filterData" />
  4. <base-table
  5. class="m-10 bg-w p-20 br-10"
  6. :columns="columns"
  7. :items="items"
  8. :pagination="pagination"
  9. :page-change="pageChange"
  10. >
  11. <template v-slot:batch-btn-box="{ selected }">
  12. <!-- <el-col :span="1.5">
  13. <el-button
  14. type="success"
  15. plain
  16. icon="el-icon-edit"
  17. size="mini"
  18. :disabled="selected | singleBatch"
  19. @click="handleUpdate(selected)"
  20. v-hasPermi="['car:brand:edit']"
  21. >修改</el-button
  22. >
  23. </el-col> -->
  24. <el-col :span="1.5">
  25. <el-button
  26. type="primary"
  27. plain
  28. size="mini"
  29. :disabled="selected | multipleBatch"
  30. @click="handleAudit(selected)"
  31. >批量审核</el-button
  32. >
  33. </el-col>
  34. </template>
  35. </base-table>
  36. </div>
  37. </template>
  38. <script>
  39. import toolbar from './toolbar';
  40. import mxFilterList from '@/mixins/filterList';
  41. import { getPage } from '@/api/photoWarehouse';
  42. const checkArr = (arr) => {
  43. if (Array.isArray(arr)) {
  44. if (arr.length === 0) {
  45. return 'null';
  46. } else if (arr.length === 1) {
  47. return 'single';
  48. } else {
  49. return 'multiple';
  50. }
  51. } else {
  52. throw new Error('ErrorType, we need Array', arr);
  53. }
  54. };
  55. export default {
  56. name: 'photoVerifyManagement',
  57. components: { toolbar },
  58. filters: {
  59. // 单选可用
  60. singleBatch: (arr) => {
  61. return checkArr(arr) !== 'single';
  62. },
  63. // 非空可用
  64. multipleBatch: (arr) => {
  65. return checkArr(arr) === 'null';
  66. },
  67. },
  68. mixins: [
  69. mxFilterList({
  70. fetchList: getPage // 在下方data再声明一个 fetchList: iGetList 同等效果
  71. })
  72. ],
  73. data() {
  74. return {
  75. columns: [
  76. {
  77. key: 'selection',
  78. },
  79. {
  80. key: 'id',
  81. name: '标识',
  82. width: this.$col.b
  83. },
  84. {
  85. key: 'kindergartenName',
  86. name: '场景名称',
  87. minWidth: this.$col.b
  88. },
  89. {
  90. key: 'activityName',
  91. name: '活动名称',
  92. minWidth: this.$col.b
  93. },
  94. {
  95. key: 'nickname',
  96. name: '账号昵称',
  97. minWidth: this.$col.b
  98. },
  99. {
  100. key: 'phonenumber',
  101. name: '账号手机号码',
  102. width: this.$col.m
  103. },
  104. {
  105. key: 'listPreview',
  106. name: '列表预览图',
  107. width: this.$col.b,
  108. render: (h, { row }) => {
  109. if (!row.listPreview) {
  110. return h('span', '图片正在处理中请稍等...');
  111. }
  112. return h('img', {
  113. style: {
  114. width: '160px',
  115. height: '90px'
  116. },
  117. class: 'pre-img',
  118. attrs: {
  119. src: row.listPreview
  120. },
  121. on: {
  122. click: () =>
  123. this.$AdvanceViewImageModal({
  124. items: [{ src: row.listPreview }]
  125. })
  126. }
  127. });
  128. }
  129. },
  130. {
  131. key: 'createAt',
  132. name: '上传时间',
  133. width: this.$col.b
  134. },
  135. {
  136. key: 'auditStatus',
  137. name: '审核状态',
  138. width: this.$col.s,
  139. type: 'tag',
  140. fetchTagType: val => {
  141. switch (val) {
  142. case 1:
  143. return 'success';
  144. case 0:
  145. return 'info';
  146. case -1:
  147. return 'danger';
  148. default:
  149. return 'info';
  150. }
  151. },
  152. tagName: row => {
  153. switch (row.auditStatus) {
  154. case 1:
  155. return '通过';
  156. case 0:
  157. return '待审核';
  158. case -1:
  159. return '拒绝';
  160. default:
  161. return '-';
  162. }
  163. }
  164. },
  165. {
  166. key: 'action',
  167. name: '操作',
  168. width: '120',
  169. render: (h, { row }) => {
  170. const action = [];
  171. row.auditStatus !== 1 &&
  172. action.push(
  173. h(
  174. 'el-button',
  175. {
  176. props: {
  177. type: 'text'
  178. },
  179. on: {
  180. click: () =>
  181. this.$PhotoVerifyItemModal({
  182. id: row.id,
  183. auditStatus: row.auditStatus
  184. })
  185. }
  186. },
  187. '审核'
  188. )
  189. );
  190. return h('div', action);
  191. }
  192. }
  193. ]
  194. };
  195. },
  196. created() {
  197. this.$g_on('photo_reload', this.reload);
  198. },
  199. beforeDestroy() {
  200. this.$g_off('photo_reload', this.reload);
  201. },
  202. methods: {
  203. handleAudit(arr) {
  204. this.$PhotoVerifyMultItemModal({
  205. ids: arr.map(x => x.id)
  206. })
  207. }
  208. }
  209. };
  210. </script>
  211. <style type="scss" scoped></style>