From 1de45b7263be17fd6327b67adb41c59d3096c236 Mon Sep 17 00:00:00 2001 From: ouyangxq <775153912@qq.com> Date: Sat, 15 Aug 2026 09:47:28 +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 --- AGENTS.md | 6 ++-- api/pda-loading.js | 15 +++++++-- pages/login/login.vue | 2 +- pages/picking/picking.vue | 61 ++++++++++++++++++++++++++++------ tests/pda-loading-api.test.mjs | 11 +++++- 5 files changed, 77 insertions(+), 18 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index fe18234..5385d3b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -63,6 +63,6 @@ ## 全量验收脚本 -- PDA 本地自动回归在本目录执行 `node --test tests/*.test.mjs`,覆盖页面契约、导航、在线会话、拣货状态、幂等、证据上传队列、扫码广播和声音反馈。 -- 自动化通过后仍需按真实 uni-app 页面完成样式、扫码输入、弱网/重试、草稿恢复、批量提交和窄屏验收;在线更新与真机验收按既定安排执行。 -- 测试环境 API 或真实数据写入仍需当前对话明确授权;不要把本地 store 测试通过视为服务端作业链路已通过。 +- PDA 不单独定义一套“全量 HTTP”入口;PDA 服务链路由 Admin 全量 HTTP 入口中的 `phase3-pda-convergence`、装柜、证据和出仓模块覆盖。 +- 本目录 `node --test tests/*.test.mjs` 仅是 PDA 本地页面/状态质量检查,不代表服务端作业链路已通过。 +- 服务 HTTP 通过后,再按真实 uni-app 页面完成扫码输入、网络阻断/恢复、草稿恢复、批量提交、窄屏和在线更新验收;真机检查属于最后的交互验收。 diff --git a/api/pda-loading.js b/api/pda-loading.js index 21f9074..534890b 100644 --- a/api/pda-loading.js +++ b/api/pda-loading.js @@ -19,6 +19,10 @@ const EVIDENCE_SLOTS = Object.freeze([ // inbound-scoped task and evidence operations. No local task is promoted to a // server success when any required identifier or version is absent. +function debugLog(event, payload = {}) { + try { console.info(`[PDA] ${event}`, payload) } catch (_) { /* console may be unavailable on a device */ } +} + function request(options) { requireOnline() const baseUrl = session.apiBase || '/api/platform/v1' @@ -27,6 +31,7 @@ function request(options) { if (session.requestId) headers['X-Request-Id'] = session.requestId return new Promise((resolve, reject) => { + debugLog('api.request', { method: options.method || 'GET', url: options.url }) uni.request({ ...options, url: `${baseUrl}${options.url}`, @@ -34,6 +39,12 @@ function request(options) { success(response) { const body = response.data || {} const code = String(body.code ?? response.statusCode) + debugLog('api.response', { + method: options.method || 'GET', url: options.url, statusCode: response.statusCode, code, + message: body.message || '', requestId: body.requestId || response.header?.['X-Request-Id'] || response.header?.['x-request-id'] || '', + traceId: body.traceId || response.header?.['X-Trace-Id'] || response.header?.['x-trace-id'] || '', + dataKeys: body.data && typeof body.data === 'object' ? Object.keys(body.data) : [] + }) if (code !== '200') { const error = new Error(body.message || '服务端请求失败') error.code = body.code || response.statusCode @@ -46,6 +57,7 @@ function request(options) { resolve(body.data) }, fail(error) { + debugLog('api.network-error', { method: options.method || 'GET', url: options.url, errMsg: error.errMsg || '' }) const next = new Error(error.errMsg || '网络连接失败') next.network = true reject(next) @@ -80,7 +92,7 @@ export function isRemoteReady(inboundId) { } export function getContainerPickingTask(identity, warehouseId) { - const selector = typeof identity === 'object' && identity !== null ? identity : { containerNo: identity } + const selector = typeof identity === 'object' && identity !== null ? identity : {} const taskId = selector.taskId ?? selector.id if (taskId) { if (!warehouseId) throw new Error('缺少作业仓库标识,无法请求现场任务') @@ -92,7 +104,6 @@ export function getContainerPickingTask(identity, warehouseId) { const query = [] if (selector.cabinetNo) query.push(`cabinetNo=${encodeURIComponent(selector.cabinetNo)}`) else if (selector.loadingPlanId) query.push(`loadingPlanId=${encodeURIComponent(selector.loadingPlanId)}`) - else if (selector.containerNo) query.push(`containerNo=${encodeURIComponent(selector.containerNo)}`) else throw new Error('缺少稳定柜次标识,无法请求现场任务') if (warehouseId) query.push(`warehouseId=${encodeURIComponent(warehouseId)}`) if (session.tenantId) query.push(`tenantId=${encodeURIComponent(session.tenantId)}`) diff --git a/pages/login/login.vue b/pages/login/login.vue index 7d5b5c6..adb5acf 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -18,7 +18,7 @@ import { session, restoreSession, signInWithTokens } from '@/stores/session.js' import { requireOnline } from '@/utils/network.js' export default { - data() { return { form: { userId: '', password: '' }, error: '', submitting: false } }, + data() { return { form: { userId: 'platform_admin', password: 'ChangeMe123!' }, error: '', submitting: false } }, onLoad() { if (session.currentUser || restoreSession()) uni.reLaunch({ url: '/pages/home/home' }) }, methods: { async login() { diff --git a/pages/picking/picking.vue b/pages/picking/picking.vue index dbd1bcf..b959307 100644 --- a/pages/picking/picking.vue +++ b/pages/picking/picking.vue @@ -153,7 +153,11 @@ {{ summary.pending }} 箱待拣 {{ submitStatusHint }} - + + @@ -320,7 +324,7 @@