index.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <ele-page flex-table>
  3. <page-search @search="reload" />
  4. <common-table
  5. ref="pageRef"
  6. :pageConfig="pageConfig"
  7. :columns="columns"
  8. :tools="false"
  9. :flex-table="false"
  10. >
  11. <template #toolbar="{ row }">
  12. <div>
  13. <el-button
  14. type="success"
  15. plain
  16. v-permission="'statistic:weight:export'"
  17. @click="handleExportExcel(row)"
  18. >
  19. 导出EXCEL
  20. </el-button>
  21. </div>
  22. </template>
  23. </common-table>
  24. </ele-page>
  25. </template>
  26. <script setup>
  27. import { ref, reactive } from 'vue';
  28. import CommonTable from '@/components/CommonPage/CommonTable.vue';
  29. import pageSearch from './components/page-search.vue';
  30. defineOptions({ name: 'WeightStatistic' });
  31. /** 表格列配置 */
  32. const columns = ref([
  33. { label: 'ISBN', prop: 'isbn', align: 'center' },
  34. { label: '重量(kg)', prop: 'weight', align: 'center' },
  35. { label: '操作员', prop: 'createName', align: 'center' },
  36. { label: '操作时间', prop: 'createTime', align: 'center' }
  37. ]);
  38. /** 页面组件实例 */
  39. const pageRef = ref(null);
  40. const pageConfig = reactive({
  41. pageUrl: '/book/weightchange/getChangeLogPage',
  42. exportUrl: '/book/weightchange/export',
  43. fileName: '重量统计',
  44. cacheKey: 'weightStatisticTable'
  45. });
  46. //刷新表格
  47. function reload(where) {
  48. pageRef.value?.reload(where);
  49. }
  50. //导出excel
  51. function handleExportExcel() {
  52. pageRef.value?.exportData('重量统计');
  53. }
  54. </script>