index.vue 4.3 KB

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