Kaynağa Gözat

feat(system): 添加核销记录导出功能

在核销记录页面中新增导出按钮,支持将当前查询条件下的数据导出为 Excel 文件。导出文件名使用“核销记录”前缀,并包含格式化的时间戳以避免文件名冲突。调整了导出方法的位置并优化其实现方式,确保时间格式统一且易于维护。
fugui001 2 ay önce
ebeveyn
işleme
c1b6de0082
1 değiştirilmiş dosya ile 17 ekleme ve 10 silme
  1. 17 10
      src/views/system/business/checkRecord/index.vue

+ 17 - 10
src/views/system/business/checkRecord/index.vue

@@ -75,6 +75,11 @@
         </transition>
 
         <el-card shadow="never">
+          <!-- 在这里添加导出按钮 -->
+          <div class="mb-3 flex justify-start">
+            <el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['business:checkRecord:export']">导出</el-button>
+          </div>
+
           <el-table v-loading="loading" border :data="checkRecordList" @selection-change="handleSelectionChange">
             <el-table-column label="序号" width="60" align="center">
               <template #default="{ $index }">
@@ -261,16 +266,7 @@ const handleDelete = async (row?: CheckRecordVO) => {
   await getList();
 };
 
-/** 导出按钮操作 */
-const handleExport = () => {
-  proxy?.download(
-    'business/checkRecord/export',
-    {
-      ...queryParams.value
-    },
-    `checkRecord_${new Date().getTime()}.xlsx`
-  );
-};
+
 
 onMounted(() => {
   getList();
@@ -412,6 +408,17 @@ const dealDedution = async (row?: UserItemVO) => {
     ElMessage.info('已取消核销');
   }
 };
+import { parseTime } from '@/utils/dateUtils';
+/** 导出按钮操作 */
+const handleExport = () => {
+  proxy?.download(
+    'business/checkRecord/export',
+    {
+      ...queryParams.value
+    },
+    `核销记录${parseTime(new Date(), '{y}{m}{d}{h}{i}{s}')}.xlsx`
+  );
+};
 </script>
 <style>
 /* 在全局样式文件或当前组件的 <style> 中添加 */