index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <ele-page flex-table>
  3. <page-search @search="reload"></page-search>
  4. <common-table ref="pageRef" :pageConfig="pageConfig" :columns="columns">
  5. <template #toolbar>
  6. <div class="flex items-center mb-4">
  7. <el-button
  8. type="warning"
  9. plain
  10. @click="handleBatchPush"
  11. v-permission="'data:productPush:onePush'"
  12. >
  13. 一键推送
  14. </el-button>
  15. <el-button
  16. type="success"
  17. plain
  18. @click="handleExportExcel"
  19. :icon="DownloadOutlined"
  20. v-permission="'data:productPush:export'"
  21. >
  22. 导出
  23. </el-button>
  24. </div>
  25. </template>
  26. <template #isPush="{ row }">
  27. <dict-data
  28. code="book_stat_is_push"
  29. type="tag"
  30. :model-value="row.pushStatus"
  31. />
  32. </template>
  33. <template #pushStatus="{ row }">
  34. <dict-data
  35. code="book_stat_push_status"
  36. type="text"
  37. :model-value="row.pushRes"
  38. />
  39. </template>
  40. <template #action="{ row }">
  41. <div>
  42. <el-button
  43. type="primary"
  44. link
  45. @click="handleDelete(row)"
  46. v-permission="'data:productPush:delete'"
  47. >
  48. 删除
  49. </el-button>
  50. <el-button
  51. type="danger"
  52. link
  53. @click="handleBatchPush(row)"
  54. v-permission="'data:productPush:push'"
  55. >
  56. 推送
  57. </el-button>
  58. <el-button
  59. type="warning"
  60. link
  61. @click="handlePushLog(row)"
  62. v-permission="'data:productPush:pushLog'"
  63. >
  64. 推送日志
  65. </el-button>
  66. </div>
  67. </template>
  68. </common-table>
  69. <!-- 推送日志弹窗 -->
  70. <push-log ref="pushLogRef" />
  71. </ele-page>
  72. </template>
  73. <script setup>
  74. import { ref, reactive } from 'vue';
  75. import { DownloadOutlined } from '@/components/icons';
  76. import CommonTable from '@/components/CommonPage/CommonTable.vue';
  77. import pageSearch from './components/page-search.vue';
  78. import PushLog from './components/push-log.vue';
  79. import request from '@/utils/request';
  80. defineOptions({ name: 'productPush' });
  81. const useStatus = ref('');
  82. /** 表格列配置 */
  83. const columns = ref([
  84. { label: 'ID', prop: 'id', align: 'center', width: 70 },
  85. { label: 'ISBN', prop: 'bookIsbn', align: 'center', minWidth: 120 },
  86. {
  87. label: '是否推送',
  88. prop: 'pushStatus',
  89. align: 'center',
  90. slot: 'isPush'
  91. },
  92. { label: '创建时间', prop: 'createTime', align: 'center', width: 180 },
  93. { label: '推送时间', prop: 'pushTime', align: 'center', width: 180 },
  94. {
  95. label: '扫描提交人',
  96. prop: 'scanUserName',
  97. align: 'center',
  98. formatter: (row) => row.scanUserName || '-'
  99. },
  100. {
  101. label: '后台处理人',
  102. prop: 'operateUserName',
  103. align: 'center',
  104. formatter: (row) => row.operateUserName || '-'
  105. },
  106. {
  107. label: '推送状态',
  108. prop: 'pushRes',
  109. align: 'center',
  110. slot: 'pushStatus'
  111. },
  112. {
  113. label: '操作',
  114. width: 240,
  115. align: 'center',
  116. slot: 'action'
  117. }
  118. ]);
  119. /** 页面组件实例 */
  120. const pageRef = ref(null);
  121. /** 推送日志组件实例 */
  122. const pushLogRef = ref(null);
  123. const pageConfig = reactive({
  124. pageUrl: '/bookpush/pusherp/pagelist',
  125. exportUrl: '/bookpush/pusherp/export',
  126. fileName: '商品档案推送',
  127. cacheKey: 'productPushTable'
  128. });
  129. // 刷新表格
  130. function reload(where) {
  131. pageRef.value?.reload({ ...where });
  132. }
  133. // 导出excel
  134. function handleExportExcel() {
  135. pageRef.value?.exportData('商品档案推送');
  136. }
  137. //删除
  138. function handleDelete(row) {
  139. pageRef.value.messageBoxConfirm({
  140. message: '确认删除选中的商品档案?',
  141. fetch: () => {
  142. return request.post('/bookpush/pusherp/remove?id=' + row.id);
  143. }
  144. });
  145. }
  146. // 批量推送
  147. function handleBatchPush(row = null) {
  148. let selections = row == null ? pageRef.value.getSelection() : [row];
  149. pageRef.value.operatBatch({
  150. row,
  151. method: 'post',
  152. url: '/bookpush/pusherp/pushBatch',
  153. title: '确认批量推送选中的商品档案?',
  154. data: {
  155. ids: selections.map((item) => item.id)
  156. }
  157. });
  158. }
  159. // 查看推送日志
  160. function handlePushLog(row) {
  161. pushLogRef.value?.open(row);
  162. }
  163. </script>