feat: 交班管理增加交班数据导出功能

This commit is contained in:
2025-03-17 11:38:03 +08:00
parent 2fe360bcb2
commit 8ea8c257d2
4 changed files with 53 additions and 16 deletions

View File

@@ -105,12 +105,12 @@ export function parseTime(time: string | number | Date | null, cFormat: string |
}
// 下载文件
export function downloadFile(obj: BlobPart, name: string, suffix: string) {
export function downloadFile(obj: BlobPart, name: string, suffix: string, useUnix = true) {
const url = window.URL.createObjectURL(new Blob([obj]));
const link = document.createElement("a");
link.style.display = "none";
link.href = url;
const fileName = parseTime(new Date(), undefined) + "-" + name + "." + suffix;
const fileName = useUnix ? (parseTime(new Date(), undefined) + "-") : '' + name.trim() + "." + suffix;
link.setAttribute("download", fileName);
document.body.appendChild(link);
link.click();