feat: P0-6 Excel导入导出全套(客户/合同/库存/统计, 自动表头探测)
This commit is contained in:
@@ -51,3 +51,11 @@ export async function apiDownload(url: string, filename: string): Promise<void>
|
||||
link.click()
|
||||
URL.revokeObjectURL(link.href)
|
||||
}
|
||||
|
||||
/** 上传文件(multipart,自动带 token),返回 envelope data */
|
||||
export async function apiUpload<T = any>(url: string, file: File): Promise<T> {
|
||||
const fd = new FormData()
|
||||
fd.append('file', file)
|
||||
const res = await http.post(url, fd, { headers: { 'Content-Type': 'multipart/form-data' } })
|
||||
return res.data.data as T
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user