feat: P0-2 订单BOM计算单+Excel导出(openpyxl)

This commit is contained in:
HHY
2026-09-25 03:09:21 -07:00
parent 8c2bb5e12d
commit d5e3cdbede
10 changed files with 247 additions and 1 deletions
+10
View File
@@ -41,3 +41,13 @@ export async function api<T = any>(method: string, url: string, body?: object):
const res = await http.request({ method, url, data: body })
return res.data.data as T
}
/** 下载二进制文件(自动带 token),filename 为保存文件名 */
export async function apiDownload(url: string, filename: string): Promise<void> {
const res = await http.get(url, { responseType: 'blob' })
const link = document.createElement('a')
link.href = URL.createObjectURL(res.data)
link.download = filename
link.click()
URL.revokeObjectURL(link.href)
}