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

@@ -291,7 +291,12 @@
import { reactive, ref, onMounted, computed, nextTick } from 'vue'
import { useRoute } from 'vue-router'
import { BasicTableProps, useTable } from "/@/hooks/table";
import { fetchList, delObjs, exportEmptyPeopleRoomExcel } from "/@/api/stuwork/dormroomstudent";
import { fetchList, delObjs } from "/@/api/stuwork/dormroomstudent";
import {
makeExportDormStudentTask,
makeExportDormStudentAbnormalTask,
makeExportDormStatisticsTask
} from "/@/api/stuwork/file";
import { getDeptList } from "/@/api/basic/basicclass";
import { getBuildingList } from "/@/api/stuwork/dormbuilding";
import { fetchDormRoomTreeList } from "/@/api/stuwork/dormroom";
@@ -471,23 +476,14 @@ const handleExport = async () => {
stuNo: searchForm.stuNo,
realName: searchForm.realName
}
const res = await exportEmptyPeopleRoomExcel(params)
const blob = res instanceof Blob ? res : new Blob([res as BlobPart], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = `空宿舍导出_${Date.now()}.xlsx`
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
window.URL.revokeObjectURL(url)
useMessage().success('导出成功')
await makeExportDormStatisticsTask(params)
useMessage().success('导出任务已创建,请在文件管理中下载')
} catch (err: any) {
useMessage().error(err?.msg || '导出失败')
}
}
// 名单导出:与导出共用空 n 人宿舍导出接口,文件名区分
// 名单导出:住宿学生名单导出
const handleExportList = async () => {
try {
const params = {
@@ -500,17 +496,8 @@ const handleExportList = async () => {
stuNo: searchForm.stuNo,
realName: searchForm.realName
}
const res = await exportEmptyPeopleRoomExcel(params)
const blob = res instanceof Blob ? res : new Blob([res as BlobPart], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = `住宿学生名单_${Date.now()}.xlsx`
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
window.URL.revokeObjectURL(url)
useMessage().success('导出成功')
await makeExportDormStudentTask(params)
useMessage().success('导出任务已创建,请在文件管理中下载')
} catch (err: any) {
useMessage().error(err?.msg || '导出失败')
}