index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. <el-button type="primary" plain :icon="PlusOutlined" v-permission="'recycle:remindArea:add'"
  7. @click="handleAdd()">
  8. 新增
  9. </el-button>
  10. <el-button type="danger" plain :icon="DeleteOutlined" v-permission="'recycle:remindArea:batchDelete'"
  11. @click="handleBatchDelete()">
  12. 批量删除
  13. </el-button>
  14. </template>
  15. <template #cover="{ row }">
  16. <el-image :src="row.bookInfo?.cover" style="width: 70px; height: 90px" fit="cover" />
  17. </template>
  18. <template #action="{ row }">
  19. <el-button type="danger" link v-permission="'recycle:remindArea:delete'"
  20. @click="handleDelete(row)">
  21. 删除
  22. </el-button>
  23. </template>
  24. </common-table>
  25. <page-edit ref="editRef" @success="reload()"></page-edit>
  26. </ele-page>
  27. </template>
  28. <script setup>
  29. import { ref, reactive,getCurrentInstance } from 'vue';
  30. import { PlusOutlined, DeleteOutlined } from '@/components/icons';
  31. import CommonTable from '@/components/CommonPage/CommonTable.vue';
  32. import pageSearch from './components/page-search.vue';
  33. import pageEdit from './components/page-edit.vue';
  34. const { proxy } = getCurrentInstance();
  35. defineOptions({ name: 'remindBooks' });
  36. /** 表格列配置 */
  37. const columns = ref([
  38. { type: 'selection', columnKey: 'selection', width: 50, fixed: 'left' },
  39. { label: '图片', prop: 'cover', width: 100, slot: 'cover' },
  40. { label: 'isbn', prop: 'isbn' },
  41. { label: '书名', prop: 'bookInfo.bookName' },
  42. { label: '作者', prop: 'bookInfo.author' },
  43. { label: '出版社', prop: 'bookInfo.publish' },
  44. { label: '出版时间', prop: 'bookInfo.pubDate' },
  45. { label: '定价', prop: 'bookInfo.price', width: 100 },
  46. { label: '需提醒仓库', prop: 'godownName', width: 120 },
  47. { label: '添加时间', prop: 'createTime', width: 160 },
  48. { columnKey: 'action', label: '操作', width: 80, slot: 'action', fixed: 'right' }
  49. ]);
  50. /** 页面组件实例 */
  51. const pageRef = ref(null);
  52. const pageConfig = reactive({
  53. pageUrl: '/book/checkWarn/getBookPageList',
  54. exportUrl: '',
  55. fileName: '审核提醒书籍',
  56. cacheKey: 'remindBooksTable'
  57. });
  58. //刷新表格
  59. function reload(where) {
  60. delete where.time;
  61. pageRef.value?.reload(where);
  62. }
  63. //批量删除
  64. function handleBatchDelete(row) {
  65. let selections = row ? [row] : pageRef.value?.getSelections();
  66. let ids = selections.map((item) => item.id);
  67. let url = `/book/checkWarn/deleteBookCheck`;
  68. pageRef.value?.operatBatch({
  69. title: '确认删除?',
  70. method: 'post',
  71. url,
  72. row,
  73. data: {
  74. idList: ids
  75. }
  76. });
  77. }
  78. //删除
  79. function handleDelete(row) {
  80. pageRef.value?.messageBoxConfirm({
  81. message: '确认删除?',
  82. fetch: () => proxy.$http.post(`/book/checkWarn/deleteBookCheck`, { idList: [row.id] })
  83. });
  84. }
  85. //新增
  86. const editRef = ref(null);
  87. function handleAdd() {
  88. editRef.value?.handleOpen();
  89. }
  90. </script>