فهرست منبع

feat(record): add export functionality for activation codes

- Introduced an export button in the record view to allow users to download activation code data as an Excel file.
- Updated the page configuration to include an export URL and implemented the `handleExportExcel` method for data export.
- Enhanced the toolbar layout for better user experience.
ylong 4 روز پیش
والد
کامیت
f725b64647
1فایلهای تغییر یافته به همراه16 افزوده شده و 1 حذف شده
  1. 16 1
      src/views/code/record/index.vue

+ 16 - 1
src/views/code/record/index.vue

@@ -4,7 +4,16 @@
 
         <common-table ref="pageRef" :pageConfig="pageConfig" :columns="columns">
             <template #toolbar>
-                <div class="flex items-center mb-4">
+                <el-button
+                    type="primary"
+                    plain
+                    v-permission="'code:activation:export'"
+                    @click="handleExportExcel"
+                    :icon="DownloadOutlined"
+                >
+                    导出
+                </el-button>
+                <div class="flex items-center mb-4 mt-4">
                     <el-statistic
                         :value="statistics.totalStockNum || 0"
                         title="累计激活码数量"
@@ -94,6 +103,7 @@
 <script setup>
     import { ref, reactive, onMounted } from 'vue';
     import CommonTable from '@/components/CommonPage/CommonTable.vue';
+    import { DownloadOutlined } from '@/components/icons';
     import pageSearch from './page-search.vue';
     import OutDetailModal from './components/out-detail-modal.vue';
     import InDetailModal from './components/in-detail-modal.vue';
@@ -222,11 +232,16 @@
 
     const pageConfig = reactive({
         pageUrl: '/activation/bookActivationInfo/inOutList',
+        exportUrl: '/activation/bookActivationInfo/exportInOutList',
         fileName: '出入库记录',
         cacheKey: 'codeRecord',
         rowKey: 'id'
     });
 
+    function handleExportExcel() {
+        pageRef.value?.exportData('出入库记录');
+    }
+
     //刷新表格
     const whereCache = ref({});
     function reload(where) {