index.vue 5.4 KB

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