import { request } from '@eciol/request'; import { replaceVariables } from '@eciol/shared'; import { useUserStoreWithOut } from '@/store/modules/user'; import type { DownloadInvoiceService } from './typing'; enum Api { GetDownloadInvoiceList = '/api/InvoiceDownload/QueryPage', submitDownload = '/api/InvoiceDownload/{ids}/{procInstId}/Submit', DirectDownload = '/api/InvoiceDownload/{orgId}/InvoiceDirectDownload', } /** * 申请下载Invoice文件列表 * @param data */ function getDownloadInvoiceList(data: DownloadInvoiceService.GetDownloadInvoiceListParams) { const { getCompanyId } = useUserStoreWithOut(); return request.post( { url: Api.GetDownloadInvoiceList, data: { ...data, orgId: getCompanyId }, }, { showLoading: true, }, ); } /** * 下载 */ function submitDownload(ids: string, procInstId: string) { return request.put( { url: replaceVariables(Api.submitDownload, { ids, procInstId }), }, { showLoading: true, loadingTip: 'EMPTY', successMessage: '提交下载成功', successMessageMode: 'message', }, ); } function directDownload(data: number[]) { const { getCompanyId } = useUserStoreWithOut(); return request.post( { url: replaceVariables(Api.DirectDownload, { orgId: getCompanyId }), data, }, { showLoading: true, loadingTip: 'EMPTY', successMessage: '下载成功', successMessageMode: 'message', }, ); } export { directDownload, getDownloadInvoiceList, submitDownload }; export type { DownloadInvoiceService } from './typing';