初始提交:实习工作日志系统(设计方案 + Vue3 应用 + Electron 打包)

This commit is contained in:
root
2026-10-15 23:55:27 +08:00
commit cfb984627d
50 changed files with 9223 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
function csvCell(v: string | number | null | undefined): string {
const s = v == null ? '' : String(v)
return '"' + s.replace(/"/g, '""') + '"'
}
// 导出 UTF-8 BOM 的 CSV,Excel 可直接打开中文不乱码
export function downloadCsv(filename: string, rows: (string | number | null | undefined)[][]): void {
const content = rows.map(r => r.map(csvCell).join(',')).join('\r\n')
const blob = new Blob(['\ufeff' + content], { type: 'text/csv;charset=utf-8' })
const url = URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
a.download = filename
a.click()
URL.revokeObjectURL(url)
}