index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <ele-page flex-table>
  3. <book-search @search="reload" />
  4. <common-table
  5. ref="pageRef"
  6. :pageConfig="pageConfig"
  7. :columns="columns"
  8. :tools="false"
  9. >
  10. <template #cover="{ row }">
  11. <el-image
  12. style="width: 90px; height: 120px; border-radius: 4px"
  13. fit="cover"
  14. :src="row.coverUrl"
  15. :preview-src-list="[row.coverUrl]"
  16. :initial-index="0"
  17. preview-teleported
  18. />
  19. </template>
  20. <template #feedbackTime="{ row }">
  21. <div
  22. style="
  23. display: flex;
  24. flex-direction: column;
  25. justify-content: center;
  26. "
  27. ><el-text>反馈时间:</el-text>
  28. <el-text>{{ row.feenbackTime }}</el-text>
  29. </div>
  30. <div
  31. style="
  32. display: flex;
  33. flex-direction: column;
  34. justify-content: center;
  35. "
  36. ><el-text>处理时间:</el-text>
  37. <el-text>{{ row.handTime || '-' }}</el-text>
  38. </div>
  39. </template>
  40. <template #baseInfo="{ row }">
  41. <book-info :row="row" :showFormat="false" @refresh="reload" />
  42. </template>
  43. <template #action="{ row }">
  44. <el-button
  45. type="primary"
  46. link
  47. v-permission="'recycle:fallbackLog:updateBook'"
  48. @click="handleUpdateBook(row)"
  49. >
  50. [编辑]
  51. </el-button>
  52. <el-button
  53. type="success"
  54. link
  55. v-permission="'recycle:fallbackLog:viewPic'"
  56. @click="handleViewPic(row)"
  57. >
  58. [查看图片]
  59. </el-button>
  60. <el-button
  61. type="primary"
  62. v-if="row.handStatus == 0"
  63. link
  64. v-permission="'recycle:fallbackLog:completed'"
  65. @click="handleComleted(row)"
  66. >
  67. [处理完成]
  68. </el-button>
  69. </template>
  70. </common-table>
  71. <books-edit ref="editRef" @success="reload()" />
  72. </ele-page>
  73. </template>
  74. <script setup>
  75. import { ref, reactive, getCurrentInstance } from 'vue';
  76. import CommonTable from '@/components/CommonPage/CommonTable.vue';
  77. import booksEdit from '@/views/data/books/components/books-edit.vue';
  78. import bookSearch from './components/book-search.vue';
  79. import bookInfo from '@/views/recycle/components/book-info.vue';
  80. import bookOtherInfo from '@/views/recycle/components/book-other-info.vue';
  81. import { useDictData } from '@/utils/use-dict-data';
  82. import request from '@/utils/request';
  83. import { ElMessage } from 'element-plus';
  84. defineOptions({ name: 'FallbackLog' });
  85. let { proxy } = getCurrentInstance();
  86. const [useStatusDicts] = useDictData(['use_status']);
  87. /** 表格列配置 */
  88. const columns = ref([
  89. {
  90. type: 'selection',
  91. columnKey: 'selection',
  92. width: 50,
  93. align: 'center',
  94. fixed: 'left'
  95. },
  96. { label: '图片', prop: 'cover', width: 120, slot: 'cover' },
  97. { label: '信息', prop: 'baseInfo', slot: 'baseInfo', minWidth: 500 },
  98. { label: '推送人', prop: 'feedbackUserName', width: 100 },
  99. { label: '反馈内容', prop: 'feedbackContent', minWidth: 200 },
  100. {
  101. label: '处理状态',
  102. prop: 'handStatus',
  103. width: 100,
  104. formatter: (row) => (row.handStatus == 1 ? '已处理' : '未处理')
  105. },
  106. {
  107. label: '时间',
  108. prop: 'feedbackTime',
  109. width: 160,
  110. slot: 'feedbackTime'
  111. },
  112. {
  113. columnKey: 'action',
  114. label: '操作',
  115. width: 120,
  116. slot: 'action',
  117. fixed: 'right'
  118. }
  119. ]);
  120. /** 页面组件实例 */
  121. const pageRef = ref(null);
  122. const pageConfig = reactive({
  123. pageUrl: '/book/feedback/list',
  124. fileName: '图书反馈记录',
  125. cacheKey: 'fallbackLogTable'
  126. });
  127. //刷新表格
  128. function reload(where) {
  129. pageRef.value?.reload(where);
  130. }
  131. //编辑
  132. const editRef = ref(null);
  133. function handleUpdateBook(row) {
  134. let params = { id: row.bookId };
  135. editRef.value?.handleOpen(params);
  136. }
  137. //查看图片
  138. function handleViewPic(row) {
  139. if (!row.imgUrl) return ElMessage.warning('暂无图片');
  140. console.log(proxy, 'xxxx');
  141. if (row.imgUrl) {
  142. proxy.$viewerApi({ images: [row.imgUrl] });
  143. }
  144. }
  145. //处理完成
  146. function handleComleted(row) {
  147. pageRef.value?.messageBoxConfirm({
  148. message: '确认处理完成?',
  149. fetch: () => request.post('/book/feedback/complete', { id: row.id })
  150. });
  151. }
  152. </script>