From 5a192b24bd4eda6fe9b9048fea77a2e5ecd83812 Mon Sep 17 00:00:00 2001 From: jokerxue <2509699647@qq.com> Date: Fri, 10 Jul 2026 14:16:10 +0800 Subject: [PATCH] 最新同步 --- 2026-07-09代码修改.md | 286 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6-26代码优化.md | 193 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 泰额版/Food Labeling Management App UniApp/.env.development | 2 ++ 泰额版/Food Labeling Management App UniApp/.env.example | 2 ++ 泰额版/Food Labeling Management App UniApp/.env.production | 2 ++ 泰额版/Food Labeling Management App UniApp/.hbuilderx/launch.json | 5 +++++ 泰额版/Food Labeling Management App UniApp/src/App.vue | 2 ++ 泰额版/Food Labeling Management App UniApp/src/components/AppDatePicker.vue | 2 ++ 泰额版/Food Labeling Management App UniApp/src/components/AppIcon.vue | 3 ++- 泰额版/Food Labeling Management App UniApp/src/env.d.ts | 2 +- 泰额版/Food Labeling Management App UniApp/src/pages/labels/bluetooth.vue | 286 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------- 泰额版/Food Labeling Management App UniApp/src/pages/labels/labels.vue | 654 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 泰额版/Food Labeling Management App UniApp/src/pages/labels/preview.vue | 634 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 泰额版/Food Labeling Management App UniApp/src/pages/more/print-log.vue | 246 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------ 泰额版/Food Labeling Management App UniApp/src/pages/more/printers.vue | 1 + 泰额版/Food Labeling Management App UniApp/src/services/usAppLabeling.ts | 21 ++++++++++++++------- 泰额版/Food Labeling Management App UniApp/src/types/usAppLabeling.ts | 14 +++++++++++++- 泰额版/Food Labeling Management App UniApp/src/utils/apiBase.ts | 35 ++++++++++++++++------------------- 泰额版/Food Labeling Management App UniApp/src/utils/deviceInfo.ts | 21 +++++++++++++++++++++ 泰额版/Food Labeling Management App UniApp/src/utils/imageScaleMode.ts | 34 ++++++++++++++++++++++++++++++++++ 泰额版/Food Labeling Management App UniApp/src/utils/invertColorsConfig.ts | 26 ++++++++++++++++++++++++++ 泰额版/Food Labeling Management App UniApp/src/utils/labelEditorFonts.ts | 234 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 泰额版/Food Labeling Management App UniApp/src/utils/labelPreview/employeeElement.ts | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 泰额版/Food Labeling Management App UniApp/src/utils/labelPreview/labelIdElement.ts | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 泰额版/Food Labeling Management App UniApp/src/utils/labelPreview/normalizePreviewTemplate.ts | 222 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------- 泰额版/Food Labeling Management App UniApp/src/utils/labelPreview/nutritionDefaultsMerge.ts | 283 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------- 泰额版/Food Labeling Management App UniApp/src/utils/labelPreview/printInputOffset.ts | 613 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------- 泰额版/Food Labeling Management App UniApp/src/utils/labelPreview/printInputOptions.ts | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 泰额版/Food Labeling Management App UniApp/src/utils/labelPreview/renderLabelPreviewCanvas.ts | 1246 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 泰额版/Food Labeling Management App UniApp/src/utils/nutritionFactsLayout.ts | 220 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 泰额版/Food Labeling Management App UniApp/src/utils/offlineSyncManager.ts | 22 +++++++++++++++++++++- 泰额版/Food Labeling Management App UniApp/src/utils/print/bleWriteModeRules.ts | 24 ++++++++++++++++-------- 泰额版/Food Labeling Management App UniApp/src/utils/print/bluetoothPrinterAllowlist.ts | 13 +++++++++++-- 泰额版/Food Labeling Management App UniApp/src/utils/print/bluetoothTool.js | 24 +++++++++++++++++++++++- 泰额版/Food Labeling Management App UniApp/src/utils/print/imageRaster.ts | 41 +++++++++++++++++++++++++++++++++++++++++ 泰额版/Food Labeling Management App UniApp/src/utils/print/manager/printerManager.ts | 265 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------ 泰额版/Food Labeling Management App UniApp/src/utils/print/nativeBitmapPatch.ts | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------- 泰额版/Food Labeling Management App UniApp/src/utils/print/nativeFastPrinter.ts | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------ 泰额版/Food Labeling Management App UniApp/src/utils/print/nativeTemplateElementSupport.ts | 175 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------- 泰额版/Food Labeling Management App UniApp/src/utils/print/printRunDiagnostics.ts | 27 +++++++++++++++++++++++++++ 泰额版/Food Labeling Management App UniApp/src/utils/print/printerConnection.ts | 454 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------- 泰额版/Food Labeling Management App UniApp/src/utils/print/systemTemplateAdapter.ts | 55 +++++++++++++++++++++++++++++++++++++++---------------- 泰额版/Food Labeling Management App UniApp/src/utils/print/templatePhysicalMm.ts | 37 +++++++++++++++++++++++++++++++++++++ 泰额版/Food Labeling Management App UniApp/src/utils/print/tscLabelBuilder.ts | 4 ++-- 泰额版/Food Labeling Management App UniApp/src/utils/print/types/printer.ts | 13 ++++++++++++- 泰额版/Food Labeling Management App UniApp/src/utils/printFromPrintDataList.ts | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------- 泰额版/Food Labeling Management App UniApp/src/utils/resolveMediaUrl.ts | 2 +- 泰额版/Food Labeling Management App UniApp/src/utils/smartScaleService.ts | 143 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 泰额版/Food Labeling Management App UniApp/src/utils/sqliteSync.ts | 30 ++++++++++++++++++++++++++++++ 泰额版/Food Labeling Management App UniApp/src/utils/textElementLayout.ts | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 泰额版/Food Labeling Management App UniApp/src/utils/weightElement.ts | 20 ++++++++++++++++++++ 泰额版/Food Labeling Management App UniApp/static/fonts/freight-sans-bold/FreightSans-Bold.ttf | Bin 0 -> 95556 bytes 泰额版/Food Labeling Management App UniApp/static/fonts/lato/lato-latin-400-italic.woff2 | Bin 0 -> 24408 bytes 泰额版/Food Labeling Management App UniApp/static/fonts/lato/lato-latin-400-normal.woff2 | Bin 0 -> 23580 bytes 泰额版/Food Labeling Management App UniApp/static/fonts/lato/lato-latin-700-normal.woff2 | Bin 0 -> 23040 bytes 泰额版/Food Labeling Management App UniApp/static/fonts/open-sans/open-sans-latin-400-italic.woff2 | Bin 0 -> 19280 bytes 泰额版/Food Labeling Management App UniApp/static/fonts/open-sans/open-sans-latin-400-normal.woff2 | Bin 0 -> 18668 bytes 泰额版/Food Labeling Management App UniApp/static/fonts/open-sans/open-sans-latin-700-normal.woff2 | Bin 0 -> 18260 bytes 泰额版/Food Labeling Management App UniApp/static/fonts/roboto-mono/roboto-mono-latin-400-italic.woff2 | Bin 0 -> 14052 bytes 泰额版/Food Labeling Management App UniApp/static/fonts/roboto-mono/roboto-mono-latin-400-normal.woff2 | Bin 0 -> 12764 bytes 泰额版/Food Labeling Management App UniApp/static/fonts/roboto-mono/roboto-mono-latin-700-normal.woff2 | Bin 0 -> 12740 bytes 泰额版/Food Labeling Management App UniApp/static/fonts/roboto/roboto-latin-400-italic.woff2 | Bin 0 -> 22384 bytes 泰额版/Food Labeling Management App UniApp/static/fonts/roboto/roboto-latin-400-normal.woff2 | Bin 0 -> 20612 bytes 泰额版/Food Labeling Management App UniApp/static/fonts/roboto/roboto-latin-700-normal.woff2 | Bin 0 -> 20996 bytes 泰额版/Food Labeling Management App UniApp/static/fonts/tinos/tinos-latin-400-italic.woff2 | Bin 0 -> 26644 bytes 泰额版/Food Labeling Management App UniApp/static/fonts/tinos/tinos-latin-400-normal.woff2 | Bin 0 -> 28080 bytes 泰额版/Food Labeling Management App UniApp/static/fonts/tinos/tinos-latin-700-normal.woff2 | Bin 0 -> 25136 bytes 泰额版/Food Labeling Management App UniApp/vite.config.ts | 15 +-------------- 泰额版/Food Labeling Management Code/Yi.Vben5.Vue3/apps/web-antd/src/views/food-labeling/labeling/label-templates/data-entry/index.vue | 430 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------- 泰额版/Food Labeling Management Code/Yi.Vben5.Vue3/apps/web-antd/src/views/food-labeling/labeling/label-templates/editor/canvas-utils.ts | 3 ++- 泰额版/Food Labeling Management Code/Yi.Vben5.Vue3/apps/web-antd/src/views/food-labeling/labeling/label-templates/editor/element-content.vue | 31 +++++++++++++++++++++++++------ 泰额版/Food Labeling Management Code/Yi.Vben5.Vue3/apps/web-antd/src/views/food-labeling/labeling/label-templates/editor/properties-panel.vue | 57 +++++++++++++++++++++++++++++++++++++++++++-------------- 泰额版/Food Labeling Management Code/Yi.Vben5.Vue3/apps/web-antd/src/views/food-labeling/shared/label-form-live-preview.ts | 13 +++++++++++-- 泰额版/Food Labeling Management Code/Yi.Vben5.Vue3/apps/web-antd/src/views/food-labeling/shared/label-template/label-template-model.ts | 4 ++-- 泰额版/Food Labeling Management Code/Yi.Vben5.Vue3/apps/web-antd/src/views/food-labeling/shared/text-element-layout.ts | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 美国版/Food Labeling Management App UniApp/.env.development | 2 +- 美国版/Food Labeling Management App UniApp/.env.example | 2 +- 美国版/Food Labeling Management App UniApp/src/pages/labels/bluetooth.vue | 2 +- 美国版/Food Labeling Management App UniApp/src/pages/more/printers.vue | 1 + 美国版/Food Labeling Management App UniApp/src/utils/apiBase.ts | 2 +- 美国版/Food Labeling Management App UniApp/src/utils/print/bluetoothTool.js | 24 +++++++++++++++++++++++- 美国版/Food Labeling Management App UniApp/src/utils/print/manager/printerManager.ts | 46 +++++++++++++++++++++++++++------------------- 美国版/Food Labeling Management Platform/.env.local | 2 +- 美国版/Food Labeling Management Platform/build/assets/index-CCZCnrrc.js | 526 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 美国版/Food Labeling Management Platform/build/index.html | 2 +- 85 files changed, 6829 insertions(+), 1585 deletions(-) create mode 100644 2026-07-09代码修改.md delete mode 100644 6-26代码优化.md create mode 100644 泰额版/Food Labeling Management App UniApp/.env.development create mode 100644 泰额版/Food Labeling Management App UniApp/.env.example create mode 100644 泰额版/Food Labeling Management App UniApp/.env.production create mode 100644 泰额版/Food Labeling Management App UniApp/src/utils/imageScaleMode.ts create mode 100644 泰额版/Food Labeling Management App UniApp/src/utils/invertColorsConfig.ts create mode 100644 泰额版/Food Labeling Management App UniApp/src/utils/labelEditorFonts.ts create mode 100644 泰额版/Food Labeling Management App UniApp/src/utils/labelPreview/employeeElement.ts create mode 100644 泰额版/Food Labeling Management App UniApp/src/utils/labelPreview/labelIdElement.ts create mode 100644 泰额版/Food Labeling Management App UniApp/src/utils/nutritionFactsLayout.ts create mode 100644 泰额版/Food Labeling Management App UniApp/src/utils/smartScaleService.ts create mode 100644 泰额版/Food Labeling Management App UniApp/src/utils/textElementLayout.ts create mode 100644 泰额版/Food Labeling Management App UniApp/src/utils/weightElement.ts create mode 100644 泰额版/Food Labeling Management App UniApp/static/fonts/freight-sans-bold/FreightSans-Bold.ttf create mode 100644 泰额版/Food Labeling Management App UniApp/static/fonts/lato/lato-latin-400-italic.woff2 create mode 100644 泰额版/Food Labeling Management App UniApp/static/fonts/lato/lato-latin-400-normal.woff2 create mode 100644 泰额版/Food Labeling Management App UniApp/static/fonts/lato/lato-latin-700-normal.woff2 create mode 100644 泰额版/Food Labeling Management App UniApp/static/fonts/open-sans/open-sans-latin-400-italic.woff2 create mode 100644 泰额版/Food Labeling Management App UniApp/static/fonts/open-sans/open-sans-latin-400-normal.woff2 create mode 100644 泰额版/Food Labeling Management App UniApp/static/fonts/open-sans/open-sans-latin-700-normal.woff2 create mode 100644 泰额版/Food Labeling Management App UniApp/static/fonts/roboto-mono/roboto-mono-latin-400-italic.woff2 create mode 100644 泰额版/Food Labeling Management App UniApp/static/fonts/roboto-mono/roboto-mono-latin-400-normal.woff2 create mode 100644 泰额版/Food Labeling Management App UniApp/static/fonts/roboto-mono/roboto-mono-latin-700-normal.woff2 create mode 100644 泰额版/Food Labeling Management App UniApp/static/fonts/roboto/roboto-latin-400-italic.woff2 create mode 100644 泰额版/Food Labeling Management App UniApp/static/fonts/roboto/roboto-latin-400-normal.woff2 create mode 100644 泰额版/Food Labeling Management App UniApp/static/fonts/roboto/roboto-latin-700-normal.woff2 create mode 100644 泰额版/Food Labeling Management App UniApp/static/fonts/tinos/tinos-latin-400-italic.woff2 create mode 100644 泰额版/Food Labeling Management App UniApp/static/fonts/tinos/tinos-latin-400-normal.woff2 create mode 100644 泰额版/Food Labeling Management App UniApp/static/fonts/tinos/tinos-latin-700-normal.woff2 create mode 100644 美国版/Food Labeling Management Platform/build/assets/index-CCZCnrrc.js diff --git a/2026-07-09代码修改.md b/2026-07-09代码修改.md new file mode 100644 index 0000000..c63fb8f --- /dev/null +++ b/2026-07-09代码修改.md @@ -0,0 +1,286 @@ +# 2026-07-09 代码修改 + +本文档说明 **2026-07-09** 对美国版标签(Label)模块的接口补充:**标签列表**与**批量导入**(Bulk Add Labels)。 + +--- + +## 一、背景与目标 + +| 项目 | 说明 | +|------|------| +| 业务场景 | Web 管理端 **Bulk Add Labels** 页面:同一模板下多行录入标签基本字段 + 模板数据字段后一次性保存 | +| 原行为 | 前端 `LabelsList.tsx` 对每行循环调用 `POST /api/app/label` 单条创建,模板数据再单独 `updateLabelTemplate` | +| 新行为 | 新增 `POST /api/app/label/batch-create`,一次提交多行;可选合并写入 `fl_label_template_product_default` | +| 列表接口 | `GET /api/app/label?SkipCount=1&MaxResultCount=10` 为标签分页列表(按标签维度分页,非 label-product 笛卡尔行) | + +--- + +## 二、标签列表 + +### 基本信息 + +| 项目 | 内容 | +|------|------| +| 方法 | `GET` | +| 路径 | `/api/app/label` | +| 鉴权 | Bearer Token | +| 示例 | `/api/app/label?SkipCount=1&MaxResultCount=10` | + +### 分页参数 + +| 参数 | 类型 | 说明 | +|------|------|------| +| `SkipCount` | `int` | 页码,**从 1 起**(非 0) | +| `MaxResultCount` | `int` | 每页条数 | + +### 筛选参数(Query) + +| 参数 | 说明 | +|------|------| +| `PartnerId` | 按 Company(`fl_partner.Id`)下门店集合筛选 | +| `GroupId` | 按 Region(`fl_group.Id`)筛选:命中 `fl_label_region`、`fl_label_location` 或 `AppliedRegionType=ALL` | +| `LocationId` | 按门店(`location.Id`)筛选;传则优先于 `GroupId` | +| `ProductId` | 按产品筛选(一个产品可对应多个标签) | +| `Keyword` | 关键词 | +| `LabelCategoryId` | 标签分类 | +| `LabelTypeId` | 标签类型(可选) | +| `TemplateCode` | 模板编码 | +| `State` | 启用状态 | + +### 出参结构 + +```json +{ + "pageIndex": 1, + "pageSize": 10, + "totalCount": 100, + "totalPages": 10, + "items": [ + { + "id": "LBL_xxx", + "labelName": "Turkey Breast", + "locationName": "Store A, Store B", + "locationIds": ["loc-id-1", "loc-id-2"], + "region": "Region A", + "regionIds": ["group-id-1"], + "groupIds": ["group-id-1"], + "appliedRegionType": "SPECIFIED", + "labelCategoryName": "Prep", + "productCategoryName": "Meat", + "products": "Turkey Breast", + "templateName": "3\"x6\" Nutrition Details", + "templateCode": "tpl_229mx5_mr05n3cq", + "labelTypeName": "Use By", + "state": true, + "lastEdited": "2026-07-09T10:00:00", + "hasError": false + } + ] +} +``` + +### 列表 curl 示例 + +```bash +# 登录(管理端) +curl -X POST "http://192.168.31.88:19001/api/app/account/login" \ + -H "Content-Type: application/json" \ + -d '{"userName":"sandi@123.com","password":"123456"}' + +# 标签列表第一页(10 条) +curl -G "http://192.168.31.88:19001/api/app/label" \ + -H "Authorization: Bearer {token}" \ + --data-urlencode "SkipCount=1" \ + --data-urlencode "MaxResultCount=10" +``` + +--- + +## 三、标签批量导入 + +### 基本信息 + +| 项目 | 内容 | +|------|------| +| 方法 | `POST` | +| 路径 | `/api/app/label/batch-create` | +| 鉴权 | Bearer Token | +| 对应页面 | Web 端 **Bulk Add Labels**(`LabelsList.tsx` → `LabelBulkAddPage`) | +| 单次上限 | 500 行 | + +### Body 顶层字段 + +| 字段 | 类型 | 必填 | 说明 | +|------|------|------|------| +| `templateCode` | `string` | 是 | 所有行共用的模板编码 | +| `items` | `array` | 是 | 导入行列表 | +| `saveTemplateProductDefaults` | `bool` | 否 | 是否合并写入模板 ProductDefaults,默认 `true` | + +### `items[]` 每行字段 + +#### 标签基本字段(与单条 `POST /api/app/label` 一致) + +| 字段 | 类型 | 必填 | 说明 | +|------|------|------|------| +| `labelName` | `string` | 是 | 标签名称 | +| `labelCategoryId` | `string` | 是 | 标签分类 Id | +| `labelTypeId` | `string` | 建议 | 标签类型 Id | +| `productIds` | `string[]` | 是 | 至少 1 个产品 | +| `locationIds` | `string[]` | 建议 | 适用门店(主字段) | +| `locationId` | `string` | 否 | 兼容单门店,与 `locationIds` 合并 | +| `appliedRegionType` | `string` | 否 | `ALL` / `SPECIFIED` | +| `regionIds` / `groupIds` | `string[]` | 条件 | `SPECIFIED` 时传 Region | +| `partnerId` / `partnerIds` | `string` / `string[]` | 否 | Company 范围 | +| `labelCode` | `string` | 否 | 不传则自动生成 `LBL_{guid}` | +| `labelInfoJson` | `object` | 否 | 标签级模板 JSON(通常走 ProductDefaults) | +| `state` | `bool` | 否 | 默认 `true` | + +#### 模板数据字段(对应 Bulk Add 表格列) + +| 字段 | 类型 | 说明 | +|------|------|------| +| `templateDefaultValues` | `object` | 已组装的 elementId → 值;**优先使用**,不再从下方字段推导 | +| `templateDataValues` | `object` | 文本类录入(如 Text、Barcode 手填值) | +| `templateDateOffsets` | `object` | 日期/时间/时长:`{ "el-id": { "unit": "Days", "value": "3" } }` | +| `nutritionByElementId` | `object` | 营养成分:`{ "el-nutrition": { "calories": "120" } }` | + +**模板数据落库规则** + +- `saveTemplateProductDefaults=true` 时:按 `productId + labelTypeId` 合并写入 `fl_label_template_product_default`(与前端 `saveTemplateDefaultsAfterLabels` 一致) +- 日期偏移存为 JSON 字符串:`{"unit":"Days","value":"3"}` +- Template 面板条码/二维码自动填充产品 `codeValue`;Label Name / Label Type 自动绑定行内 `labelName`、类型名 + +### 请求示例 + +```json +{ + "templateCode": "tpl_229mx5_mr05n3cq", + "saveTemplateProductDefaults": true, + "items": [ + { + "labelName": "Chicken Salad", + "labelCategoryId": "3a2228ca-42fa-5273-1105-3d8252ffdd99", + "labelTypeId": "3a2228e5-33c5-278e-a09f-47fd6e2ddbc7", + "locationIds": ["3a222878-b4c1-d27b-d437-93da14886350"], + "productIds": ["3a2228a8-6a51-6cc4-fee2-b77769766b33"], + "appliedRegionType": "SPECIFIED", + "regionIds": [], + "templateDataValues": { + "el-1782794752668-0gixa9y": "Fresh batch text", + "el-1782794771519-4360c0p": "123456789" + }, + "templateDateOffsets": { + "el-1782794481721-sdf7mvy": { "unit": "Days", "value": "3" } + }, + "state": true + }, + { + "labelName": "Turkey Wrap", + "labelCategoryId": "3a2228ca-42fa-5273-1105-3d8252ffdd99", + "labelTypeId": "3a2228e6-3ed0-b056-a08b-ea8b1eea46a0", + "locationIds": ["3a222878-b4c1-d27b-d437-93da14886350"], + "productIds": ["3a2228a8-6a51-6cc4-fee2-b77769766b33"], + "templateDataValues": { + "el-1782794752668-0gixa9y": "Ready to serve" + }, + "templateDateOffsets": { + "el-1782794481721-sdf7mvy": { "unit": "Days", "value": "5" } + } + } + ] +} +``` + +### 响应示例 + +```json +{ + "successCount": 2, + "failCount": 0, + "successItems": [ + { "rowNumber": 1, "labelCode": "LBL_abc...", "labelName": "Chicken Salad" }, + { "rowNumber": 2, "labelCode": "LBL_def...", "labelName": "Turkey Wrap" } + ], + "errors": [] +} +``` + +**部分成功示例**(第 2 行校验失败、第 1 行仍创建): + +```json +{ + "successCount": 1, + "failCount": 1, + "successItems": [ + { "rowNumber": 1, "labelCode": "LBL_abc...", "labelName": "Chicken Salad" } + ], + "errors": [ + { "rowNumber": 2, "labelName": "", "message": "标签名称不能为空" } + ] +} +``` + +### 批量导入 curl 示例 + +```bash +curl -X POST "http://192.168.31.88:19001/api/app/label/batch-create" \ + -H "Authorization: Bearer {token}" \ + -H "Content-Type: application/json" \ + -d '{ + "templateCode": "tpl_229mx5_mr05n3cq", + "saveTemplateProductDefaults": true, + "items": [ + { + "labelName": "Batch Test", + "labelCategoryId": "3a2228ca-42fa-5273-1105-3d8252ffdd99", + "labelTypeId": "3a2228e5-33c5-278e-a09f-47fd6e2ddbc7", + "locationIds": ["3a222878-b4c1-d27b-d437-93da14886350"], + "productIds": ["3a2228a8-6a51-6cc4-fee2-b77769766b33"], + "templateDataValues": { "el-1782794752668-0gixa9y": "Fresh" }, + "templateDateOffsets": { "el-1782794481721-sdf7mvy": { "unit": "Days", "value": "3" } } + } + ] + }' +``` + +--- + +## 四、与单条创建对比 + +| 能力 | `POST /api/app/label` | `POST /api/app/label/batch-create` | +|------|----------------------|-----------------------------------| +| 行数 | 1 条 | 最多 500 条 | +| 模板编码 | 每 Body 自带 | 顶层 `templateCode` 共用 | +| 模板数据 | 仅 `labelInfoJson` | 支持结构化模板字段 + ProductDefaults 合并 | +| 失败处理 | 整请求失败 | 行级错误收集,支持部分成功 | +| 返回值 | 标签详情 DTO | `successCount` / `failCount` / `errors` / `successItems` | + +--- + +## 五、代码改动摘要 + +| 文件 | 改动 | +|------|------| +| `ILabelAppService.cs` | 新增 `BatchCreateAsync` | +| `LabelAppService.cs` | 实现批量导入;逐行复用 `CreateAsync`;可选合并模板 ProductDefaults | +| `LabelBatchCreateInputVo.cs` | 批量入参 DTO | +| `LabelBatchCreateItemInputVo.cs` | 单行(基本字段 + 模板数据字段) | +| `LabelBatchDateOffsetInputVo.cs` | 日期偏移单位+数值 | +| `LabelBatchCreateResultDto.cs` | 批量结果 DTO | +| `LabelBatchTemplateDefaultsHelper.cs` | 组装/合并模板 ProductDefaults | + +--- + +## 六、部署与联调注意 + +1. `dotnet build` 编译 `FoodLabeling.Application` 与 `Yi.Abp.Web` 后**重启 API 进程**(未重启时 `batch-create` 会返回 405) +2. 管理端登录:`POST /api/app/account/login`(非 `/api/oauth/Login`) +3. 本地 Base URL 以 `appsettings.json` 中 `App:SelfUrl` 为准(当前示例为 `http://192.168.31.88:19001`) +4. 前端 `LabelsList.tsx` 的 `submit()` 仍循环调单条 `createLabel`;对接批量接口时需改为调用 `batch-create` + +--- + +## 七、相关文档 + +- 标签多门店 `locationIds`:`项目相关文档/6-23代码优化.md` +- 模板三维 scope:`项目相关文档/6-4代码优化.md` diff --git a/6-26代码优化.md b/6-26代码优化.md deleted file mode 100644 index 6259d1d..0000000 --- a/6-26代码优化.md +++ /dev/null @@ -1,193 +0,0 @@ -# 6-26 代码优化 - -本文档说明 **2026-06-26** 对美国版标签模板 `contents` 字段的**数据来源澄清**与**编辑不生效**修复。 - ---- - -## 一、问题现象 - -| 项目 | 说明 | -|------|------| -| 接口 | `GET/PUT /api/app/label-template/{id}`(如 `tpl_c23gov_mqri4g5a`) | -| 期望 | `contents` = `"Nutrition Facts, Text (For Template)"`(模板列表 Contents 列展示) | -| 实际 | 返回/展示 `"nutritionfacts, text"` | -| 用户反馈 | 在编辑器修改 Element name 后保存,列表 Contents **没有变化** | - ---- - -## 二、`contents` 取自哪个字段? - -### 结论(优先级) - -| 优先级 | 来源 | 字段 | 说明 | -|--------|------|------|------| -| 1 | 编辑器右侧 **Element name** | `elements[].elementName` | 用户可编辑;保存时写入 `fl_label_template_element.ElementName` | -| 2 | 旧数据兼容(slug) | `elements[].typeAdd` | 当 `elementName` 为旧 slug(如 `nutritionfacts`、`text`)时,按 typeAdd 推导展示名 | -| 3 | 持久化缓存 | `fl_label_template.Contents` | 保存时写入;**列表以 element 实时汇总为准**,避免旧缓存覆盖新编辑 | - -### typeAdd 推导规则 - -`typeAdd` 形如 `{分组前缀}_{面板控件英文名}`: - -| typeAdd 示例 | 推导展示名 | -|--------------|------------| -| `label_Nutrition Facts` | `Nutrition Facts (For Label)` | -| `template_Text` | `Text (For Template)` | -| `auto_Company` | `Company (Entered Automatically)` | -| `print_Multiple Options` | `Multiple Options (Entered When Printing)` | - -**拼接格式**:`{控件面板名称} ({分组标题})` -分组标题与左侧 Elements 面板一致:`For Template` / `For Label` / `Entered Automatically` / `Entered When Printing`。 - -### 与 elementName 的关系 - -| 场景 | elementName 示例 | contents 单项 | -|------|------------------|---------------| -| 新拖入控件(修复后) | `Text (For Template)` | `Text (For Template)` | -| 旧模板 slug | `text` | `Text (For Template)`(由 typeAdd 推导) | -| 用户手动改 Element name | `My Custom Field` | `My Custom Field`(以用户输入为准) | - -**注意**:`elementName` 同时用于录入表表头;`contents` 是各控件展示名的逗号拼接,**不是** slug 字段。 - ---- - -## 三、根因说明 - -1. **新建控件时** `allocateElementName` 把 Element name 默认成 slug(`nutritionfacts`),与 UI 期望的「Nutrition Facts (For Label)」不一致。 -2. **列表 contents** 曾优先读 `fl_label_template.Contents` 缓存,保存后 element 已变但缓存仍是旧 slug 串。 -3. **列表回退逻辑** 直接读 `ElementName` 原文,slug 原样展示为 `nutritionfacts, text`。 - ---- - -## 四、修复内容 - -### 后端 - -| 文件 | 改动 | -|------|------| -| `LabelTemplateContentsHelper.cs` | `ResolveElementContentsLabel`:Element name 优先;slug 则 typeAdd 推导 | -| `LabelTemplateContentsHelper.cs` | `ResolveContentsMapFromElementsAsync`:列表按 element 表**实时**汇总 | -| `LabelTemplateListItemsHelper.cs` | `items` / `itemNames` 与 contents 使用同一套展示名逻辑 | -| `LabelTemplateAppService.cs` | 列表/详情 **优先** element 汇总 contents;保存仍写入 `Contents` 列(若已迁移) | - -### 前端 - -| 文件 | 改动 | -|------|------| -| `labelTemplate.ts` | 新增 `allocateElementDisplayName`、`resolveElementContentsLabel`、`deriveContentsLabelFromTypeAdd` | -| `LabelTemplateEditor/index.tsx` | 新控件默认 Element name = `控件名 (For Template/For Label…)` | -| `LabelTemplateEditor/index.tsx` | 保存时 `contents: buildTemplateContentsFromElements(elements)` | - ---- - -## 五、接口说明 - -### 1. 模板详情 - -| 项目 | 内容 | -|------|------| -| 方法 | `GET` | -| 路径 | `/api/app/label-template/{id}` | -| 示例 | `/api/app/label-template/tpl_c23gov_mqri4g5a` | - -**出参(节选)** - -```json -{ - "id": "tpl_c23gov_mqri4g5a", - "templateName": "Unnamed template", - "contents": "Nutrition Facts (For Label), Text (For Template)", - "elements": [ - { - "elementName": "nutritionfacts", - "typeAdd": "label_Nutrition Facts", - "type": "NUTRITIONFACTS" - }, - { - "elementName": "text", - "typeAdd": "template_Text", - "type": "TEXT_STATIC" - } - ] -} -``` - -> 旧 slug 的 `elementName` 可保留;`contents` 按 typeAdd 展示。保存后新模板会直接写入展示型 Element name。 - -### 2. 模板列表 - -| 项目 | 内容 | -|------|------| -| 方法 | `GET` | -| 路径 | `/api/app/label-template` | -| 参数 | `SkipCount=1&MaxResultCount=10` | - -**出参 `items[]`** - -| 字段 | 说明 | -|------|------| -| `contents` | Contents 列文案,与详情一致 | -| `items` | 兼容字段,与 `contents` 相同 | -| `contentsCount` | 控件数量 | - -### 3. 新建 / 编辑 - -| 方法 | 路径 | -|------|------| -| `POST` | `/api/app/label-template` | -| `PUT` | `/api/app/label-template/{id}` | - -**Body 节选** - -```json -{ - "id": "tpl_c23gov_mqri4g5a", - "name": "Unnamed template", - "contents": "Nutrition Facts (For Label), Text (For Template)", - "elements": [ - { - "id": "el_1", - "elementName": "Nutrition Facts (For Label)", - "typeAdd": "label_Nutrition Facts", - "type": "NUTRITIONFACTS", - "orderNum": 1 - }, - { - "id": "el_2", - "elementName": "Text (For Template)", - "typeAdd": "template_Text", - "type": "TEXT_STATIC", - "orderNum": 2 - } - ] -} -``` - -| 字段 | 说明 | -|------|------| -| `contents` | 可选;不传则后端按 `elements` 推导 | -| `elements[].elementName` | **主数据源**(Element name) | -| `elements[].typeAdd` | slug 兼容推导用 | - ---- - -## 六、部署与验证 - -1. 重新编译并重启 `Yi.Abp.Web` -2. (可选)执行 `scripts/fl_label_template_contents.sql` 持久化 `Contents` 列 -3. 打开 `tpl_c23gov_mqri4g5a` 保存一次 → GET 详情/列表 `contents` 应为展示名,而非 `nutritionfacts, text` -4. 修改 Element name 后再保存 → 列表 Contents **立即**更新(不再被旧 `Contents` 缓存挡住) - -**curl 示例** - -```bash -curl -s "http://localhost:5000/api/app/label-template/tpl_c23gov_mqri4g5a" \ - -H "Authorization: Bearer " -``` - ---- - -## 七、与 6-25 文档关系 - -- **6-25**:引入 `contents` 字段、DB 迁移、未迁移列兼容 -- **6-26**:明确字段来源(Element name + typeAdd 推导)、修复 slug/缓存导致的展示与编辑不生效问题 diff --git a/泰额版/Food Labeling Management App UniApp/.env.development b/泰额版/Food Labeling Management App UniApp/.env.development new file mode 100644 index 0000000..03e1a64 --- /dev/null +++ b/泰额版/Food Labeling Management App UniApp/.env.development @@ -0,0 +1,2 @@ +# H5 / App 开发:直连本地后端(按本机 IP 与端口修改) +VITE_US_API_BASE=http://192.168.31.89:19001 diff --git a/泰额版/Food Labeling Management App UniApp/.env.example b/泰额版/Food Labeling Management App UniApp/.env.example new file mode 100644 index 0000000..4324ae4 --- /dev/null +++ b/泰额版/Food Labeling Management App UniApp/.env.example @@ -0,0 +1,2 @@ +# 复制为 .env.development(开发)或 .env.production(打包),按环境填写后端根地址(不含末尾 /) +VITE_US_API_BASE=http://192.168.31.89:19001 diff --git a/泰额版/Food Labeling Management App UniApp/.env.production b/泰额版/Food Labeling Management App UniApp/.env.production new file mode 100644 index 0000000..22e2ab5 --- /dev/null +++ b/泰额版/Food Labeling Management App UniApp/.env.production @@ -0,0 +1,2 @@ +# App / H5 正式打包:直连生产/测试服务器(打包前按部署环境修改) +VITE_US_API_BASE=http://flus-test.3ffoodsafety.com diff --git a/泰额版/Food Labeling Management App UniApp/.hbuilderx/launch.json b/泰额版/Food Labeling Management App UniApp/.hbuilderx/launch.json index 29998cf..0f8908c 100644 --- a/泰额版/Food Labeling Management App UniApp/.hbuilderx/launch.json +++ b/泰额版/Food Labeling Management App UniApp/.hbuilderx/launch.json @@ -5,6 +5,11 @@ "customPlaygroundType" : "local", "playground" : "custom", "type" : "uni-app:app-android" + }, + { + "customPlaygroundType" : "device", + "playground" : "standard", + "type" : "uni-app:app-ios" } ] } diff --git a/泰额版/Food Labeling Management App UniApp/src/App.vue b/泰额版/Food Labeling Management App UniApp/src/App.vue index 99d3ed3..21c0101 100644 --- a/泰额版/Food Labeling Management App UniApp/src/App.vue +++ b/泰额版/Food Labeling Management App UniApp/src/App.vue @@ -3,11 +3,13 @@ import { onLaunch, onShow, onHide } from "@dcloudio/uni-app"; import { initOfflineSqlite } from "./utils/sqliteSync"; import { syncNowAndRefreshCaches } from "./utils/offlineSyncManager"; import { isLoggedIn } from "./utils/authSession"; +import { preloadAllLabelEditorFonts } from "./utils/labelEditorFonts"; let networkSyncInFlight = false; onLaunch(() => { void initOfflineSqlite(); + void preloadAllLabelEditorFonts(); uni.onNetworkStatusChange((res) => { if (!res.isConnected || !isLoggedIn() || networkSyncInFlight) return; networkSyncInFlight = true; diff --git a/泰额版/Food Labeling Management App UniApp/src/components/AppDatePicker.vue b/泰额版/Food Labeling Management App UniApp/src/components/AppDatePicker.vue index 76043da..b111de8 100644 --- a/泰额版/Food Labeling Management App UniApp/src/components/AppDatePicker.vue +++ b/泰额版/Food Labeling Management App UniApp/src/components/AppDatePicker.vue @@ -64,6 +64,7 @@ const props = withDefaults( const emit = defineEmits<{ 'update:modelValue': [value: string] + cancel: [] }>() const dialogVisible = ref(false) @@ -173,6 +174,7 @@ function onPickerChange(e: { detail: { value: number[] } }) { function cancelDialog() { dialogVisible.value = false + emit('cancel') } function confirmDialog() { diff --git a/泰额版/Food Labeling Management App UniApp/src/components/AppIcon.vue b/泰额版/Food Labeling Management App UniApp/src/components/AppIcon.vue index b544b6c..c7bcaa5 100644 --- a/泰额版/Food Labeling Management App UniApp/src/components/AppIcon.vue +++ b/泰额版/Food Labeling Management App UniApp/src/components/AppIcon.vue @@ -10,7 +10,7 @@ import { computed } from 'vue' const props = withDefaults( defineProps<{ name: string - size?: 'sm' | 'md' | 'lg' + size?: 'xs' | 'sm' | 'md' | 'lg' color?: 'primary' | 'gray' | 'white' | 'blue' | 'orange' | 'green' | 'purple' | 'red' }>(), { size: 'md', color: 'gray' } @@ -80,6 +80,7 @@ const wrapStyle = computed(() => ({})) stroke-linejoin: round; } +.icon-xs { width: 30rpx; height: 30rpx; } .icon-sm { width: 40rpx; height: 40rpx; } .icon-md { width: 48rpx; height: 48rpx; } .icon-lg { width: 64rpx; height: 64rpx; } diff --git a/泰额版/Food Labeling Management App UniApp/src/env.d.ts b/泰额版/Food Labeling Management App UniApp/src/env.d.ts index ef70654..3206e84 100644 --- a/泰额版/Food Labeling Management App UniApp/src/env.d.ts +++ b/泰额版/Food Labeling Management App UniApp/src/env.d.ts @@ -1,7 +1,7 @@ /// interface ImportMetaEnv { - /** 美国版后端根地址,如 http://192.168.1.2:19001;H5 开发可留空走 Vite /api 代理 */ + /** 美国版后端根地址,如 http://192.168.1.2:19001;在 .env.development / .env.production 中配置 */ readonly VITE_US_API_BASE?: string } diff --git a/泰额版/Food Labeling Management App UniApp/src/pages/labels/bluetooth.vue b/泰额版/Food Labeling Management App UniApp/src/pages/labels/bluetooth.vue index ba8b132..61819b3 100644 --- a/泰额版/Food Labeling Management App UniApp/src/pages/labels/bluetooth.vue +++ b/泰额版/Food Labeling Management App UniApp/src/pages/labels/bluetooth.vue @@ -28,7 +28,7 @@ Bluetooth + + + + Print Route (Debug) + + Refresh + + + Send Channel: {{ printRouteDebug.sendChannel }} + Virtual BT: {{ printRouteDebug.virtualBt ? 'Yes' : 'No' }} + UPOS Supported: {{ printRouteDebug.uposSupported ? 'Yes' : 'No' }} + UPOS Will Try: {{ printRouteDebug.uposWillTry ? 'Yes' : 'No' }} + Native Stage: {{ printRouteDebug.nativeStage || '-' }} + Command Bytes: {{ printRouteDebug.commandBytes || 0 }} + Write Ms: {{ printRouteDebug.writeMs || 0 }} + {{ printRouteDebug.lastError }} + {{ lastPrintDiagAtLabel }} + + + View last print log + + + + D320FAX:Send Channel 应为 Gprinter SDK TSC (Virtual BT)。若显示 UPOS 或 printCommandBytes 且无 Write Ms,则不会出纸。 + + + -