1
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user