云
2 天以前 fbc58d6280a811f3c36696c530961f44c6491bb2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import { requestClient } from '#/api/request';
 
export type QrExportBizType =
  | 'BAG_LABEL'
  | 'BAG_BUSINESS'
  | 'PALLET_LABEL'
  | 'PALLET_BUSINESS'
  | 'BATCH_LABEL'
  | 'BATCH_BUSINESS';
 
export interface QrExportParams {
  bizType: QrExportBizType;
  uuid?: string;
  batchId?: number;
}
 
export interface QrExportCount {
  totalCount: number;
  syncThreshold: number;
  mode: 'SYNC' | 'ASYNC';
}
 
export interface QrExportTask {
  id: number;
  bizType: QrExportBizType;
  taskName: string;
  status: number;
  statusName: string;
  totalCount: number;
  finishedCount: number;
  progress: number;
  fileSize?: number;
  errorMsg?: string;
  downloadable: boolean;
}
 
/** 兼容现有导出进度组件使用的类型名称。 */
export namespace MesProQrExportApi {
  export type BizType = QrExportBizType;
  export type ExportParams = QrExportParams;
  export type ExportCount = QrExportCount;
  export type ExportTask = QrExportTask;
}
 
export function countQrExport(params: QrExportParams) {
  return requestClient.get<QrExportCount>('/mes/pro/qr-export/count', { params });
}
 
export const getQrExportCount = countQrExport;
 
export function submitQrExport(params: QrExportParams) {
  return requestClient.post<QrExportTask>('/mes/pro/qr-export/task', params);
}
 
export const submitQrExportTask = submitQrExport;
 
export function getQrExportDownloadPath(id: number) {
  return `/mes/pro/qr-export/task/download?id=${encodeURIComponent(id)}`;
}
 
export function getQrExportTask(id: number) {
  return requestClient.get<QrExportTask>('/mes/pro/qr-export/task/get', { params: { id } });
}
 
export function cancelQrExportTask(id: number) {
  return requestClient.post<boolean>(`/mes/pro/qr-export/task/cancel?id=${id}`);
}