feat: 交班管理增加交班数据导出功能
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user