From d3e8cdfe0ebe064ed1a98dd782e24beadec6402e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=A8=E5=A4=A9?= Date: Fri, 16 Oct 2026 15:23:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=85=A5=E5=BA=93:=20?= =?UTF-8?q?=E6=89=B9=E6=AC=A1=E6=8A=A5=E5=91=8A=E4=B8=8A=E4=BC=A0=E6=8A=8A?= =?UTF-8?q?=E3=80=8C=E6=8B=8D=E7=85=A7=E3=80=8D=E3=80=8C=E7=9B=B8=E5=86=8C?= =?UTF-8?q?=E3=80=8D=E6=8B=86=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 动作菜单原为「拍照/相册」合并项,改为三项分开:拍照 / 相册 / 聊天文件(PDF)。pickReportImages 按来源传 sourceType(camera / album),相册仍可多选;附契约断言与设计文档更新。 --- ...20261016-订单入库批量上传批次报告并落生产日期.md | 2 +- miniprogram/components/inspection-panel/index.js | 13 +++++++------ .../inspectionBatchReportProductionDate.test.ts | 7 +++++++ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/docs/design/20261016-订单入库批量上传批次报告并落生产日期.md b/docs/design/20261016-订单入库批量上传批次报告并落生产日期.md index d49f6ff..cdfbbd7 100644 --- a/docs/design/20261016-订单入库批量上传批次报告并落生产日期.md +++ b/docs/design/20261016-订单入库批量上传批次报告并落生产日期.md @@ -49,7 +49,7 @@ ### 3.1 小程序 UI - **按钮**:`inspection-panel` 底部操作区,在「一键全部合格入库」**下方**新增「**一键上传批次报告**」(同宽、次级样式,避免抢主按钮)。 -- **选择**:`wx.chooseMedia`(拍照/相册、多选);PDF 走 `wx.chooseMessageFile`(微信里能从聊天选到 PDF)。每次最多 N 张(建议 9,与既有拍照一致)。 +- **选择**:点按钮先弹动作菜单,**三项分开**:**「拍照」**(`wx.chooseMedia sourceType:['camera']`)/ **「相册」**(`sourceType:['album']`,可多选)/ **「聊天文件(PDF)」**(`wx.chooseMessageFile`,微信里能从聊天选到 PDF)。每次最多 N 张(建议 9,与既有拍照一致)。 - **上传+解析**:逐张上传到 `quality-reports` 桶(复用 F5),再调**新增的 mobile 端点**(§3.3)→ 返回每份报告 `{report_id, product_names, produced_at}`。 - **核对表(弹层)**:列出 `报告 → 品名 → 匹配到的待验收行 → 生产日期`,其中: - 生产日期**可编辑**(AI 只提取、人来改); diff --git a/miniprogram/components/inspection-panel/index.js b/miniprogram/components/inspection-panel/index.js index 2ab4fbc..c48065a 100644 --- a/miniprogram/components/inspection-panel/index.js +++ b/miniprogram/components/inspection-panel/index.js @@ -887,24 +887,25 @@ Component({ } }, - /** 批次报告:上传(拍照/相册 或 聊天里的 PDF)→ 解析 → 按商品名匹配待验收行 → 弹核对表 */ + /** 批次报告:上传(拍照 / 相册 / 聊天里的 PDF,三者分开)→ 解析 → 按商品名匹配待验收行 → 弹核对表 */ onUploadBatchReports() { if (this.data.reportBusy) return; wx.showActionSheet({ - itemList: ['拍照/相册', '聊天文件(PDF)'], + itemList: ['拍照', '相册', '聊天文件(PDF)'], success: (res) => { - if (res.tapIndex === 0) this.pickReportImages(); - else if (res.tapIndex === 1) this.pickReportFiles(); + if (res.tapIndex === 0) this.pickReportImages(['camera']); + else if (res.tapIndex === 1) this.pickReportImages(['album']); + else if (res.tapIndex === 2) this.pickReportFiles(); }, fail: () => undefined, }); }, - pickReportImages() { + pickReportImages(sourceType) { wx.chooseMedia({ count: 9, mediaType: ['image'], - sourceType: ['camera', 'album'], + sourceType: sourceType || ['camera', 'album'], success: (res) => { const files = (res.tempFiles || []).filter((f) => f && f.tempFilePath); if (files.length) { diff --git a/server/tests/inspectionBatchReportProductionDate.test.ts b/server/tests/inspectionBatchReportProductionDate.test.ts index e36e653..5c195f4 100644 --- a/server/tests/inspectionBatchReportProductionDate.test.ts +++ b/server/tests/inspectionBatchReportProductionDate.test.ts @@ -121,6 +121,13 @@ describe('小程序:按钮 / 核对表 / 两个提交路径都带上字段', ( expect(wrap).toContain('display: flex'); }); + it('上传入口:拍照 / 相册 / 聊天文件(PDF)三项分开,不合并', () => { + expect(mpPanelJs).toContain("itemList: ['拍照', '相册', '聊天文件(PDF)']"); + expect(mpPanelJs).not.toContain('拍照/相册'); + expect(mpPanelJs).toContain("this.pickReportImages(['camera'])"); + expect(mpPanelJs).toContain("this.pickReportImages(['album'])"); + }); + it('核对表:按商品名匹配 + 日期可改 + 确定才写入行', () => { expect(mpPanelJs).toContain('buildReportReview(reports)'); expect(mpPanelJs).toContain('match_label');