29 lines
663 B
TypeScript
29 lines
663 B
TypeScript
/**
|
|
* @desc 导出物料列表
|
|
*/
|
|
import { defaultSuccess, defaultError, http } from '@/plugins/axios'
|
|
import type { AxiosResponse } from 'axios'
|
|
export interface Params {
|
|
/** 类型 */
|
|
type?: string
|
|
/** 搜索关键词 */
|
|
key?: string
|
|
}
|
|
|
|
export default async function (
|
|
params: Params,
|
|
success: (data: void) => void = defaultSuccess,
|
|
fail: (error: { code: string; error?: string }) => void = defaultError,
|
|
): Promise<void> {
|
|
return http({
|
|
method: 'get',
|
|
url: `/material/download-excel`,
|
|
|
|
params,
|
|
})
|
|
.then((data: AxiosResponse<void, unknown>) => {
|
|
success(data.data)
|
|
})
|
|
.catch((error: { code: string; error?: string }) => fail(error))
|
|
}
|