This commit is contained in:
yaojian
2026-03-09 10:38:05 +08:00
parent b352145e4f
commit f7dee0da5e
13 changed files with 164 additions and 157 deletions

View File

@@ -274,7 +274,8 @@
<script setup lang="ts" name="RewardStudent">
import { reactive, ref, onMounted, computed, nextTick } from 'vue'
import { useRoute } from 'vue-router'
import { fetchList, exportExcel, updateStuAward, getStuRewardList, getRewardRuleList } from "/@/api/stuwork/rewardstudent";
import { fetchList, updateStuAward, getStuRewardList, getRewardRuleList } from "/@/api/stuwork/rewardstudent";
import { makeExportStudentPraiseTask } from "/@/api/stuwork/file";
import { getDeptList } from "/@/api/basic/basicclass";
import { queryAllSchoolYear } from "/@/api/basic/basicyear";
import { getClassListByRole } from "/@/api/basic/basicclass";
@@ -407,31 +408,8 @@ const handleReset = () => {
const handleExport = async () => {
try {
loading.value = true
const res = await exportExcel(queryForm)
// 创建 blob
const blob = new Blob([res], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
})
// 创建下载链接
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
// 设置文件名
const fileName = `奖励学生_${new Date().getTime()}.xlsx`
link.setAttribute('download', fileName)
// 触发下载
document.body.appendChild(link)
link.click()
// 清理
document.body.removeChild(link)
window.URL.revokeObjectURL(url)
useMessage().success('导出成功')
await makeExportStudentPraiseTask(queryForm)
useMessage().success('导出任务已创建,请在文件管理中下载')
} catch (err: any) {
useMessage().error(err.msg || '导出失败')
} finally {