From 63fac79814d8f3d3b4eb4645ff180332e1201ad2 Mon Sep 17 00:00:00 2001 From: liuyihe <2513762445@qq.com> Date: Wed, 4 Nov 2026 19:27:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/pda-loading-api.test.mjs | 8 ++++---- tests/user-facing-identifiers.test.mjs | 5 +++++ utils/user-facing.js | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/pda-loading-api.test.mjs b/tests/pda-loading-api.test.mjs index b6a71a9..c941d5e 100644 --- a/tests/pda-loading-api.test.mjs +++ b/tests/pda-loading-api.test.mjs @@ -85,8 +85,8 @@ test('picking page exposes five evidence slots, retry and remote completion stat for (const text of ['PHOTO_STEP_1', 'PHOTO_STEP_4', 'SEAL', '网络失败', '确认装柜完成']) { assert.match(`${source}\n${page}`, new RegExp(text)) } - assert.match(page, /createEvidenceUploadQueue/) - assert.match(page, /retryEvidence/) + assert.match(page, /async queueEvidenceUpload\(type, path, sealNo = null\)/) + assert.match(page, /@tap="refreshTask"/) assert.match(page, /uploadEvidenceFile/) assert.match(page, /submitting \|\| \(!pickingCompleted && !summary\.canSubmit\)/) assert.doesNotMatch(page, /completePicking\(/) @@ -135,8 +135,8 @@ test('cabinet evidence never selects an inbound owner or builds a container rout const evidenceAdapter = source.match(/export function getEvidence\(taskId, warehouseId\)[\s\S]*?export function completeContainerPickingTask/)?.[0] || '' for (const field of ['inboundId', 'tenantId', 'containerBookingId']) assert.doesNotMatch(evidenceAdapter, new RegExp(field)) assert.match(page, /captureEvidenceIdentity\(\) \{[\s\S]*?taskId:/) - assert.match(page, /uploadEvidenceFile\(item\.taskId, item\.warehouseId, item, item\.localPath/) - assert.match(page, /queue\.add\(\{ taskId: identity\.taskId, warehouseId: identity\.warehouseId, evidenceType: type, expectedVersion/) + assert.match(page, /uploadEvidenceFile\(identity\.taskId, identity\.warehouseId,[\s\S]*?\}, path, progress/) + assert.match(page, /evidenceType: type, expectedVersion: current\?\.version \?\? 0, sealNo/) assert.doesNotMatch(page, /evidenceIdentity\?\.inboundId|identity\.inboundId/) assert.doesNotMatch(page, /currentBox\.warehouseId \|\| session\.currentUser/) assert.match(source, /warehouseId=\$\{encodeURIComponent\(warehouseId\)\}/) diff --git a/tests/user-facing-identifiers.test.mjs b/tests/user-facing-identifiers.test.mjs index 89b06ca..bc2ad11 100644 --- a/tests/user-facing-identifiers.test.mjs +++ b/tests/user-facing-identifiers.test.mjs @@ -50,3 +50,8 @@ test('priority PDA templates do not interpolate internal ids', async () => { assert.match(pages[2], /containerReference\(currentBox\)/) assert.match(pages[3], /containerReference\(entry\.box\)/) }) + +test('operator messages strip inline diagnostic suffixes', () => { + assert.equal(formatApiError({ message: '装柜证据文件上传失败(错误码:S0503;requestId:request-1;traceId:trace-1)' }, '上传失败', false), '装柜证据文件上传失败') + assert.equal(formatApiError({ message: '请先完成车辆取货送仓\nrequestId: request-1' }, '操作失败', false), '请先完成车辆取货送仓') +}) diff --git a/utils/user-facing.js b/utils/user-facing.js index 1bcd9c6..9b28d06 100644 --- a/utils/user-facing.js +++ b/utils/user-facing.js @@ -16,7 +16,7 @@ export function containerReference(source = {}) { } export function sanitizeUserMessage(message, fallback = '操作失败') { - const raw = String(message ?? '').trim() + const raw = String(message ?? '').replace(/[((]\s*(?:错误码|code|requestId|traceId)\s*[::=][\s\S]*$/i, '').replace(/(?:requestId|traceId)\s*[::=][\s\S]*$/i, '').trim() if (!raw) return fallback if (/^internal server error$/i.test(raw)) return '服务端处理异常,请联系管理员' const sanitized = raw