fix: 加固批量出库导入流程
This commit is contained in:
@@ -104,10 +104,16 @@ export const traceCodeApi = {
|
||||
export const outboundApi = {
|
||||
updateSingle: (id: string, data: object) => put(`/outbound/trace-codes/${id}`, data),
|
||||
templateUrl: '/api/outbound/import/template',
|
||||
preview: (data: FormData) => post('/outbound/import/preview', data),
|
||||
session: (id: string) => get(`/outbound/import-sessions/${id}`),
|
||||
rows: (id: string, params: object) => get<PageResult<any>>(`/outbound/import-sessions/${id}/rows`, params),
|
||||
commit: (id: string) => post(`/outbound/import-sessions/${id}/commit`, {}),
|
||||
preview: (data: FormData) => post('/outbound/import/preview', data, { timeout: 120000 }),
|
||||
requestSession: (requestId: string, silent = false) =>
|
||||
get(`/outbound/import-requests/${requestId}`, undefined, { silentError: silent }),
|
||||
session: (id: string, silent = false) =>
|
||||
get(`/outbound/import-sessions/${id}`, undefined, { silentError: silent }),
|
||||
rows: (id: string, params: object, silent = false) =>
|
||||
get<PageResult<any>>(`/outbound/import-sessions/${id}/rows`, params, { silentError: silent }),
|
||||
commit: (id: string, silent = false) =>
|
||||
post(`/outbound/import-sessions/${id}/commit`, {}, { silentError: silent }),
|
||||
result: (id: string) => download(`/outbound/import-sessions/${id}/result`),
|
||||
};
|
||||
|
||||
export const auditApi = {
|
||||
@@ -116,7 +122,7 @@ export const auditApi = {
|
||||
};
|
||||
|
||||
export const jobApi = {
|
||||
get: (id: string) => get(`/jobs/${id}`),
|
||||
get: (id: string, silent = false) => get(`/jobs/${id}`, undefined, { silentError: silent }),
|
||||
list: (params: object) => get<PageResult<any>>('/jobs', params),
|
||||
};
|
||||
|
||||
|
||||
@@ -4,6 +4,12 @@ import { i18n } from '@/locales';
|
||||
|
||||
const TOKEN_KEY = 'artveris_token';
|
||||
|
||||
export type RequestConfig = AxiosRequestConfig & { silentError?: boolean };
|
||||
|
||||
function isSilent(config?: AxiosRequestConfig): boolean {
|
||||
return Boolean((config as RequestConfig | undefined)?.silentError);
|
||||
}
|
||||
|
||||
export function getToken(): string | null {
|
||||
return localStorage.getItem(TOKEN_KEY);
|
||||
}
|
||||
@@ -58,7 +64,7 @@ instance.interceptors.response.use(
|
||||
if (body.code === 0) {
|
||||
return body.data;
|
||||
}
|
||||
message.error(resolveErrorMessage(body));
|
||||
if (!isSilent(response.config)) message.error(resolveErrorMessage(body));
|
||||
return Promise.reject(body);
|
||||
}
|
||||
return body;
|
||||
@@ -72,17 +78,17 @@ instance.interceptors.response.use(
|
||||
if (location.hash.indexOf('/login') === -1) {
|
||||
location.hash = '#/login';
|
||||
}
|
||||
} else {
|
||||
} else if (!isSilent(error?.config)) {
|
||||
message.error(resolveErrorMessage(body));
|
||||
}
|
||||
return Promise.reject(error);
|
||||
},
|
||||
);
|
||||
|
||||
export function get<T = unknown>(url: string, params?: object): Promise<T> {
|
||||
return instance.get(url, { params }) as unknown as Promise<T>;
|
||||
export function get<T = unknown>(url: string, params?: object, config?: RequestConfig): Promise<T> {
|
||||
return instance.get(url, { ...config, params }) as unknown as Promise<T>;
|
||||
}
|
||||
export function post<T = unknown>(url: string, data?: object, config?: AxiosRequestConfig): Promise<T> {
|
||||
export function post<T = unknown>(url: string, data?: object, config?: RequestConfig): Promise<T> {
|
||||
return instance.post(url, data, config) as unknown as Promise<T>;
|
||||
}
|
||||
export function put<T = unknown>(url: string, data?: object): Promise<T> {
|
||||
|
||||
@@ -207,6 +207,11 @@ onUnmounted(() => {
|
||||
height: 100vh;
|
||||
min-height: 0;
|
||||
}
|
||||
@media (max-width: 1119px) {
|
||||
.admin-layout {
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
.admin-main {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
@@ -459,8 +459,77 @@
|
||||
"rowNo": "Row",
|
||||
"errorReason": "Error",
|
||||
"previewReady": "Preview parsed",
|
||||
"uploadFailed": "Upload failed",
|
||||
"importDone": "Import completed",
|
||||
"previewHasErrors": "Preview completed with {count} invalid row(s)",
|
||||
"previewFailed": "Preview parsing failed. Check the error details.",
|
||||
"emptyZipFile": "Select a non-empty ZIP file",
|
||||
"zipFileOnly": "Only ZIP files are supported",
|
||||
"zipFileTooLarge": "The ZIP file must not exceed {size}MB",
|
||||
"backgroundProcessing": "Waiting timed out. The task is still running in the background; refresh this page later to continue.",
|
||||
"progressUnavailable": "Task progress is temporarily unavailable. Processing may still be running; refresh this page later.",
|
||||
"activeTaskPending": "The current import task has not finished. A new file cannot be uploaded yet.",
|
||||
"importSuccess": "Import completed: {success} row(s) succeeded",
|
||||
"importPartial": "Import partially completed: {success} succeeded, {fail} failed",
|
||||
"importCompletedWithWarning": "All {success} row(s) were processed, but the task ended with a warning. Review the result details.",
|
||||
"importFailed": "Import failed. Check the error details or result file.",
|
||||
"jobStatus": {
|
||||
"SUCCESS": "Import completed",
|
||||
"PARTIAL": "Partially completed",
|
||||
"FAILED": "Import failed",
|
||||
"SUCCESS_WITH_WARNING": "Imported with a warning"
|
||||
},
|
||||
"backendError": {
|
||||
"traceCodeEmpty": "Trace code is required",
|
||||
"traceCodeFormat": "Trace code must contain exactly 12 digits",
|
||||
"traceCodeMissing": "Trace code does not exist",
|
||||
"alreadyOutbound": "This trace code has already been registered as outbound",
|
||||
"batchNoTooLong": "Batch number cannot exceed 50 characters",
|
||||
"remarkTooLong": "Remark cannot exceed 191 characters",
|
||||
"outTimeEmpty": "Outbound time is required",
|
||||
"outTimeFormat": "Outbound time must use the format YYYY-MM-DD HH:mm",
|
||||
"sessionInvalid": "The import session is no longer valid",
|
||||
"noPendingRows": "The import session has no rows awaiting processing",
|
||||
"xlsxCount": "The ZIP must contain exactly one xlsx file",
|
||||
"xlsxRoot": "The xlsx file must be in the root of the ZIP",
|
||||
"xlsxTooLarge": "The xlsx file exceeds the 10MB limit",
|
||||
"zipExpandedTooLarge": "The expanded ZIP exceeds the allowed size",
|
||||
"worksheetMissing": "The xlsx file does not contain a worksheet",
|
||||
"noRows": "The xlsx file does not contain any importable rows",
|
||||
"previewExpired": "The import preview expired or its status changed",
|
||||
"duplicateTraceCode": "This trace code is duplicated in the import (first used on row {row})",
|
||||
"batchNoMismatch": "Batch number does not match; the actual value is {value}",
|
||||
"tooManyImages": "Each row can contain at most {count} outbound images",
|
||||
"duplicateZipImage": "The ZIP contains a duplicate image path: {path}",
|
||||
"imageTooLarge": "Image exceeds the 10MB limit: {path}",
|
||||
"tooManyRows": "The import exceeds the {count}-row limit",
|
||||
"tooManyColumns": "The xlsx file exceeds the {count}-column limit",
|
||||
"duplicateHeader": "The xlsx file contains a duplicate header: {value}",
|
||||
"unknownHeaders": "The xlsx file contains unknown headers: {value}",
|
||||
"missingHeaders": "The xlsx file is missing required headers: {value}",
|
||||
"unsafeImagePath": "Image path is unsafe: {path}",
|
||||
"imageOutsideDirectory": "Image must be inside the images directory: {path}",
|
||||
"unsupportedImage": "Unsupported image format: {path}",
|
||||
"duplicateImage": "The same image is referenced more than once in this row: {path}",
|
||||
"imageMissing": "Image not found: {path}",
|
||||
"imageFormat": "Image content does not match its file extension: {path}",
|
||||
"imagePixels": "Image dimensions exceed the allowed limit: {path}",
|
||||
"animatedImage": "Multi-frame images are not supported: {path}",
|
||||
"resultFileFailed": "Result file generation failed: {detail}",
|
||||
"taskAborted": "The import task stopped unexpectedly: {detail}",
|
||||
"xlsxExpandedTooLarge": "The xlsx file expands beyond the allowed size",
|
||||
"zipInvalidStructure": "The ZIP structure is invalid",
|
||||
"xlsxInvalidStructure": "The xlsx structure is invalid",
|
||||
"zipInvalidSize": "The ZIP contains an invalid file size",
|
||||
"xlsxInvalidSize": "The xlsx file contains an invalid file size",
|
||||
"zipEntryLimit": "The ZIP contains more than {count} entries",
|
||||
"xlsxEntryLimit": "The xlsx file contains more than {count} entries",
|
||||
"imageReferenceLimit": "The import contains more than {count} image references",
|
||||
"storedImageSizeLimit": "Referenced images exceed the {count}MB stored-output limit",
|
||||
"incompleteRows": "Import row states are incomplete: {success} succeeded, {fail} failed, {remaining} pending, {total} total",
|
||||
"previewSessionMissing": "The import preview session no longer exists",
|
||||
"previewJobMismatch": "The preview task does not match this import session",
|
||||
"importSessionMissing": "The import session no longer exists",
|
||||
"importJobMismatch": "The import task does not match this session"
|
||||
},
|
||||
"rowStatus": {
|
||||
"VALID": "Valid",
|
||||
"INVALID": "Invalid",
|
||||
@@ -472,6 +541,7 @@
|
||||
"READY": "Ready",
|
||||
"IMPORTING": "Importing",
|
||||
"IMPORTED": "Imported",
|
||||
"PARTIAL": "Partially completed",
|
||||
"FAILED": "Failed",
|
||||
"EXPIRED": "Expired"
|
||||
},
|
||||
@@ -652,6 +722,7 @@
|
||||
"paths": {
|
||||
"outboundPreview": "Outbound import preview",
|
||||
"outboundCommit": "Confirm outbound import",
|
||||
"outboundResult": "Download outbound import result",
|
||||
"outboundTemplate": "Download outbound import template",
|
||||
"traceExport": "Export trace codes and QR images",
|
||||
"traceBatchDelete": "Batch delete trace codes",
|
||||
|
||||
@@ -459,8 +459,77 @@
|
||||
"rowNo": "行号",
|
||||
"errorReason": "错误原因",
|
||||
"previewReady": "预览解析完成",
|
||||
"uploadFailed": "上传失败",
|
||||
"importDone": "导入完成",
|
||||
"previewHasErrors": "预览完成,发现 {count} 行错误",
|
||||
"previewFailed": "预览解析失败,请查看错误原因",
|
||||
"emptyZipFile": "请选择非空的 ZIP 文件",
|
||||
"zipFileOnly": "仅支持 ZIP 文件",
|
||||
"zipFileTooLarge": "ZIP 文件不能超过 {size}MB",
|
||||
"backgroundProcessing": "等待已超时,任务仍在后台处理,稍后刷新页面可继续查看",
|
||||
"progressUnavailable": "暂时无法获取任务进度,任务可能仍在后台处理,请稍后刷新查看",
|
||||
"activeTaskPending": "当前导入任务尚未结束,不能上传新的文件",
|
||||
"importSuccess": "导入完成,成功 {success} 行",
|
||||
"importPartial": "导入部分完成:成功 {success} 行,失败 {fail} 行",
|
||||
"importCompletedWithWarning": "数据已全部处理,共成功 {success} 行,但任务收尾出现异常,请核对结果明细",
|
||||
"importFailed": "导入失败,请查看错误原因或结果明细",
|
||||
"jobStatus": {
|
||||
"SUCCESS": "导入完成",
|
||||
"PARTIAL": "部分完成",
|
||||
"FAILED": "导入失败",
|
||||
"SUCCESS_WITH_WARNING": "已导入,任务有警告"
|
||||
},
|
||||
"backendError": {
|
||||
"traceCodeEmpty": "追溯码为空",
|
||||
"traceCodeFormat": "追溯码必须是 12 位数字",
|
||||
"traceCodeMissing": "追溯码不存在",
|
||||
"alreadyOutbound": "该追溯码已登记出库,不可重复出库",
|
||||
"batchNoTooLong": "批次编号不能超过 50 个字符",
|
||||
"remarkTooLong": "备注不能超过 191 个字符",
|
||||
"outTimeEmpty": "出库时间不能为空",
|
||||
"outTimeFormat": "出库时间格式不正确,请使用 YYYY-MM-DD HH:mm",
|
||||
"sessionInvalid": "导入会话状态无效",
|
||||
"noPendingRows": "导入会话中没有待处理数据",
|
||||
"xlsxCount": "ZIP 中必须且只能包含一个 xlsx 文件",
|
||||
"xlsxRoot": "xlsx 文件必须位于 ZIP 根目录",
|
||||
"xlsxTooLarge": "xlsx 文件超过 10MB",
|
||||
"zipExpandedTooLarge": "ZIP 解压后总大小超过限制",
|
||||
"worksheetMissing": "xlsx 中缺少工作表",
|
||||
"noRows": "xlsx 中没有可导入的数据",
|
||||
"previewExpired": "导入预览会话已过期或状态已变化",
|
||||
"duplicateTraceCode": "追溯码在本次导入中重复(首次出现于第 {row} 行)",
|
||||
"batchNoMismatch": "批次编号不匹配,实际为 {value}",
|
||||
"tooManyImages": "每行最多填写 {count} 张出库图",
|
||||
"duplicateZipImage": "ZIP 中存在重复图片路径:{path}",
|
||||
"imageTooLarge": "图片超过 10MB:{path}",
|
||||
"tooManyRows": "导入数据超过 {count} 行限制",
|
||||
"tooManyColumns": "xlsx 列数超过 {count} 列限制",
|
||||
"duplicateHeader": "xlsx 表头重复:{value}",
|
||||
"unknownHeaders": "xlsx 包含未知表头:{value}",
|
||||
"missingHeaders": "xlsx 缺少必填表头:{value}",
|
||||
"unsafeImagePath": "图片路径不安全:{path}",
|
||||
"imageOutsideDirectory": "图片必须位于 images 目录:{path}",
|
||||
"unsupportedImage": "不支持的图片格式:{path}",
|
||||
"duplicateImage": "同一行重复引用图片:{path}",
|
||||
"imageMissing": "图片不存在:{path}",
|
||||
"imageFormat": "图片实际格式与扩展名不一致:{path}",
|
||||
"imagePixels": "图片像素尺寸超过限制:{path}",
|
||||
"animatedImage": "不支持多帧图片:{path}",
|
||||
"resultFileFailed": "结果文件生成失败:{detail}",
|
||||
"taskAborted": "导入任务异常中止:{detail}",
|
||||
"xlsxExpandedTooLarge": "xlsx 解压后总大小超过限制",
|
||||
"zipInvalidStructure": "ZIP 文件结构无效",
|
||||
"xlsxInvalidStructure": "xlsx 文件结构无效",
|
||||
"zipInvalidSize": "ZIP 包含无效文件大小",
|
||||
"xlsxInvalidSize": "xlsx 包含无效文件大小",
|
||||
"zipEntryLimit": "ZIP 文件数量超过限制(最多 {count} 个)",
|
||||
"xlsxEntryLimit": "xlsx 文件数量超过限制(最多 {count} 个)",
|
||||
"imageReferenceLimit": "出库图片引用总数超过限制(最多 {count} 张)",
|
||||
"storedImageSizeLimit": "出库图片按引用累计大小超过限制(最多 {count}MB)",
|
||||
"incompleteRows": "导入行状态不完整:成功 {success},失败 {fail},待处理 {remaining},总数 {total}",
|
||||
"previewSessionMissing": "导入预览会话不存在",
|
||||
"previewJobMismatch": "导入预览任务与会话不匹配",
|
||||
"importSessionMissing": "导入会话不存在",
|
||||
"importJobMismatch": "导入任务与会话不匹配"
|
||||
},
|
||||
"rowStatus": {
|
||||
"VALID": "有效",
|
||||
"INVALID": "无效",
|
||||
@@ -472,6 +541,7 @@
|
||||
"READY": "待导入",
|
||||
"IMPORTING": "导入中",
|
||||
"IMPORTED": "已导入",
|
||||
"PARTIAL": "部分完成",
|
||||
"FAILED": "失败",
|
||||
"EXPIRED": "已过期"
|
||||
},
|
||||
@@ -652,6 +722,7 @@
|
||||
"paths": {
|
||||
"outboundPreview": "出库批量导入预览",
|
||||
"outboundCommit": "确认出库批量导入",
|
||||
"outboundResult": "下载出库导入结果",
|
||||
"outboundTemplate": "下载出库导入模板",
|
||||
"traceExport": "导出追溯码与二维码",
|
||||
"traceBatchDelete": "批量删除追溯码",
|
||||
|
||||
@@ -200,6 +200,7 @@ function effectiveAction(row: any) {
|
||||
if (path.includes('/trace-codes/batch/delete')) return 'delete';
|
||||
if (path.includes('/outbound/import/preview') || /\/outbound\/import\/?$/.test(cleanPath)) return 'upload';
|
||||
if (path.includes('/outbound/import-sessions') && path.includes('/commit')) return 'update';
|
||||
if (path.includes('/outbound/import-sessions') && path.includes('/result')) return 'download';
|
||||
if (path.includes('/storage/test') || path.includes('/storage/migrate') || path.includes('/storage/confirm')) return 'update';
|
||||
if ((path.includes('/blockchain-proofs') && (path.includes('/retry') || path.includes('/confirm'))) || path.includes('/trace-codes') && path.includes('/onchain')) return 'onchain';
|
||||
if (path.includes('/export')) return 'export';
|
||||
@@ -216,6 +217,7 @@ function pathLabel(path?: string, action?: string, method?: string) {
|
||||
if (path.includes('/auth/login')) return t('pages.operationLog.paths.login');
|
||||
if (path.includes('/outbound/import/preview')) return t('pages.operationLog.paths.outboundPreview');
|
||||
if (path.includes('/outbound/import-sessions') && path.includes('/commit')) return t('pages.operationLog.paths.outboundCommit');
|
||||
if (path.includes('/outbound/import-sessions') && path.includes('/result')) return t('pages.operationLog.paths.outboundResult');
|
||||
if (path.includes('/trace-codes/export')) return t('pages.operationLog.paths.traceExport');
|
||||
if (path.includes('/trace-codes/batch/delete')) return t('pages.operationLog.paths.traceBatchDelete');
|
||||
if (path.includes('/outbound/import/template')) return t('pages.operationLog.paths.outboundTemplate');
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user