From dc45b51430411d3ace5540b0344ace700414f102 Mon Sep 17 00:00:00 2001 From: zhangyan Date: Tue, 16 Jun 2026 16:32:38 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=8E=BB=E9=99=A4=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E7=BB=B4=E5=BA=A6=EF=BC=8C=E4=BB=BB=E5=8A=A1=E4=B8=8E?= =?UTF-8?q?=E9=A4=90=E5=93=81=E5=87=80=E8=8F=9C=E5=8C=85=E4=B8=80=E5=AF=B9?= =?UTF-8?q?=E5=A4=9A=EF=BC=8C=E7=A7=B0=E9=87=8D=E9=A1=B5=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E6=89=93=E5=8C=85=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 --- .../ratio-scale/01-packing-tasks.html | 225 +++++++++--------- .../ratio-scale/02-weighing-packing.html | 201 ++-------------- .../ratio-scale/doc/CHANGELOG.md | 13 + 3 files changed, 145 insertions(+), 294 deletions(-) diff --git a/other-module/canteen-device/ratio-scale/01-packing-tasks.html b/other-module/canteen-device/ratio-scale/01-packing-tasks.html index 341258c..1d0e4a9 100644 --- a/other-module/canteen-device/ratio-scale/01-packing-tasks.html +++ b/other-module/canteen-device/ratio-scale/01-packing-tasks.html @@ -166,67 +166,62 @@ /* 当前 Tab 筛选 */ var currentFilter = 'pending'; - /* 模拟数据:每任务只有1个餐品净菜包 */ + /* 模拟数据:一个任务包含多个餐品净菜包 */ var mockData = [ { - orderNo: 'PO-20260616-001', - expectedArrival: '11:30', taskNo: 'T-001', - mealPack: { - packName: '宫保鸡丁套餐', - packSize: 3, - notes: '少辣', - ingredients: [ - { name: '土豆丝', icon: '🥔', iconClass: 'child-icon--potato', weightPerPack: 500, weighed: 750 }, - { name: '胡萝卜丝', icon: '🥕', iconClass: 'child-icon--carrot', weightPerPack: 500, weighed: 1500 }, - { name: '黄瓜片', icon: '🥒', iconClass: 'child-icon--cucumber', weightPerPack: 500, weighed: 0 }, - { name: '大葱丝', icon: '🧅', iconClass: 'child-icon--green-onion', weightPerPack: 500, weighed: 0 }, - { name: '紫洋葱丝', icon: '🧅', iconClass: 'child-icon--onion', weightPerPack: 500, weighed: 0 } - ] - } + mealPacks: [ + { + packName: '宫保鸡丁套餐', + packSize: 3, + notes: '少辣', + ingredients: [ + { name: '土豆丝', icon: '🥔', iconClass: 'child-icon--potato', weightPerPack: 500, weighed: 750 }, + { name: '胡萝卜丝', icon: '🥕', iconClass: 'child-icon--carrot', weightPerPack: 500, weighed: 1500 }, + { name: '黄瓜片', icon: '🥒', iconClass: 'child-icon--cucumber', weightPerPack: 500, weighed: 0 }, + { name: '大葱丝', icon: '🧅', iconClass: 'child-icon--green-onion', weightPerPack: 500, weighed: 0 }, + { name: '紫洋葱丝', icon: '🧅', iconClass: 'child-icon--onion', weightPerPack: 500, weighed: 0 } + ] + }, + { + packName: '鱼香肉丝套餐', + packSize: 2, + notes: '', + ingredients: [ + { name: '胡萝卜丝', icon: '🥕', iconClass: 'child-icon--carrot', weightPerPack: 750, weighed: 0 }, + { name: '白菜丝', icon: '🥬', iconClass: 'child-icon--cabbage', weightPerPack: 1000, weighed: 0 }, + { name: '土豆丝', icon: '🥔', iconClass: 'child-icon--potato', weightPerPack: 500, weighed: 0 } + ] + } + ] }, { - orderNo: 'PO-20260616-002', - expectedArrival: '12:00', taskNo: 'T-002', - mealPack: { - packName: '鱼香肉丝套餐', - packSize: 2, - notes: '', - ingredients: [ - { name: '胡萝卜丝', icon: '🥕', iconClass: 'child-icon--carrot', weightPerPack: 750, weighed: 0 }, - { name: '白菜丝', icon: '🥬', iconClass: 'child-icon--cabbage', weightPerPack: 1000, weighed: 0 }, - { name: '土豆丝', icon: '🥔', iconClass: 'child-icon--potato', weightPerPack: 500, weighed: 0 } - ] - } + mealPacks: [ + { + packName: '番茄炒蛋套餐', + packSize: 4, + notes: '', + ingredients: [ + { name: '西红柿块', icon: '🍅', iconClass: 'child-icon--tomato', weightPerPack: 750, weighed: 3000 }, + { name: '鸡蛋', icon: '🥚', iconClass: 'child-icon--egg', weightPerPack: 500, weighed: 2000 } + ] + } + ] }, { - orderNo: 'PO-20260616-003', - expectedArrival: '14:30', taskNo: 'T-003', - mealPack: { - packName: '番茄炒蛋套餐', - packSize: 4, - notes: '', - ingredients: [ - { name: '西红柿块', icon: '🍅', iconClass: 'child-icon--tomato', weightPerPack: 750, weighed: 3000 }, - { name: '鸡蛋', icon: '🥚', iconClass: 'child-icon--egg', weightPerPack: 500, weighed: 2000 } - ] - } - }, - { - orderNo: 'PO-20260616-004', - expectedArrival: '16:00', - taskNo: 'T-004', - mealPack: { - packName: '凉拌黄瓜套餐', - packSize: 5, - notes: '多放蒜', - ingredients: [ - { name: '黄瓜条', icon: '🥒', iconClass: 'child-icon--cucumber', weightPerPack: 750, weighed: 3750 }, - { name: '小番茄', icon: '🍅', iconClass: 'child-icon--tomato', weightPerPack: 250, weighed: 1250 } - ] - } + mealPacks: [ + { + packName: '凉拌黄瓜套餐', + packSize: 5, + notes: '多放蒜', + ingredients: [ + { name: '黄瓜条', icon: '🥒', iconClass: 'child-icon--cucumber', weightPerPack: 750, weighed: 3750 }, + { name: '小番茄', icon: '🍅', iconClass: 'child-icon--tomato', weightPerPack: 250, weighed: 1250 } + ] + } + ] } ]; @@ -246,6 +241,13 @@ }); } + /* 判断任务是否有待称重项 */ + function hasPendingTask(task) { + return task.mealPacks.some(function(pack) { + return hasPendingPack(pack); + }); + } + /* 渲染任务列表 */ function renderTaskList() { var container = document.getElementById('taskListContainer'); @@ -254,79 +256,69 @@ var pendingCount = 0; var doneCount = 0; - mockData.forEach(function(order) { - var pack = order.mealPack; - var hasPending = hasPendingPack(pack); - if (hasPending) pendingCount++; else doneCount++; + mockData.forEach(function(task) { + var taskHasPending = hasPendingTask(task); + if (taskHasPending) pendingCount++; else doneCount++; var taskCard = document.createElement('div'); taskCard.className = 'task-card'; - /* 合并行:订单号 + 任务号 + 期望到货 + 状态 + 去称重 */ + /* 任务头部:任务号 + 状态 */ var header = document.createElement('div'); header.className = 'task-card__header'; header.innerHTML = - '订单号:' + order.orderNo + '' + - '任务号:' + order.taskNo + '' + - '⏰ 期望到货:' + order.expectedArrival + '' + - '' + (hasPending ? '待称重' : '已完成') + '' + - (hasPending - ? '' - : ''); + '任务号' + task.taskNo + '' + + '' + (taskHasPending ? '待称重' : '已完成') + ''; taskCard.appendChild(header); - /* 表格头(6列) */ - var tableHead = document.createElement('div'); - tableHead.className = 'item-table__head'; - tableHead.innerHTML = '
名称
每份用量
打包规格
所需总重
已称
状态
'; - taskCard.appendChild(tableHead); + /* 每个餐品净菜包为独立区块 */ + task.mealPacks.forEach(function(pack) { + var packHasPending = hasPendingPack(pack); + var packStatus = getPackStatus(pack); - /* 表格体 */ - var tableBody = document.createElement('div'); - tableBody.className = 'item-table__body'; + /* 包标题行 */ + var packHeader = document.createElement('div'); + packHeader.className = 'item-parent-row'; + packHeader.style.borderTop = '1px solid rgba(255,255,255,0.06)'; + var totalNeed = 0; + var totalWeighed = 0; + pack.ingredients.forEach(function(ing) { + totalNeed += ing.weightPerPack * pack.packSize; + totalWeighed += ing.weighed; + }); + totalNeed = Math.round(totalNeed * 100) / 100; + totalWeighed = Math.round(totalWeighed * 100) / 100; + var weightClass = totalWeighed >= totalNeed ? 'parent-weight--done' : ''; + var hasPendingBtn = packHasPending ? '' : ' disabled'; + packHeader.innerHTML = + '
📦
' + pack.packName + '
' + + '
' + + '
' + pack.packSize + ' 份
' + + '
需 ' + totalNeed + ' 克
' + + '
已 ' + totalWeighed + ' 克
' + + '
' + packStatus.text + '' + + '
'; + taskCard.appendChild(packHeader); - var packStatus = getPackStatus(pack); - var totalNeed = 0; - var totalWeighed = 0; - pack.ingredients.forEach(function(ing) { - totalNeed += ing.weightPerPack * pack.packSize; - totalWeighed += ing.weighed; - }); - totalNeed = Math.round(totalNeed * 100) / 100; - totalWeighed = Math.round(totalWeighed * 100) / 100; - var weightClass = totalWeighed >= totalNeed ? 'parent-weight--done' : ''; + /* 食材子行 */ + pack.ingredients.forEach(function(ing) { + var need = Math.round(ing.weightPerPack * pack.packSize * 100) / 100; + var isDone = ing.weighed >= need; + var childWeightClass = isDone ? 'child-weight--done' : ''; - /* 主行:餐品净菜包 */ - var parentRow = document.createElement('div'); - parentRow.className = 'item-parent-row'; - parentRow.innerHTML = - '
📦
' + pack.packName + '
' + - '
' + - '
' + pack.packSize + ' 份
' + - '
需 ' + totalNeed + ' 克
' + - '
已 ' + totalWeighed + ' 克
' + - '
' + packStatus.text + '
'; - tableBody.appendChild(parentRow); - - /* 子行:每种食材 */ - pack.ingredients.forEach(function(ing) { - var need = Math.round(ing.weightPerPack * pack.packSize * 100) / 100; - var isDone = ing.weighed >= need; - var childWeightClass = isDone ? 'child-weight--done' : ''; - - var childRow = document.createElement('div'); - childRow.className = 'item-child-row'; - childRow.innerHTML = - '
' + ing.icon + '
' + ing.name + '
' + - '
' + ing.weightPerPack + ' 克
' + - '
×
' + - '
' + need + ' 克
' + - '
' + ing.weighed + ' 克
' + - '
' + (isDone ? '已完成' : '待称重') + '
'; - tableBody.appendChild(childRow); + var childRow = document.createElement('div'); + childRow.className = 'item-child-row'; + childRow.innerHTML = + '
' + ing.icon + '
' + ing.name + '
' + + '
' + ing.weightPerPack + ' 克
' + + '
×
' + + '
' + need + ' 克
' + + '
' + ing.weighed + ' 克
' + + '
' + (isDone ? '已完成' : '待称重') + '
'; + taskCard.appendChild(childRow); + }); }); - taskCard.appendChild(tableBody); container.appendChild(taskCard); }); @@ -342,19 +334,18 @@ el.classList.add('active'); document.querySelectorAll('.task-card').forEach(function(card) { - var packBtn = card.querySelector('.task-card__pack-btn'); - var hasPending = packBtn && !packBtn.disabled; + var anyEnabled = card.querySelector('.task-card__pack-btn:not([disabled])'); if (filter === 'pending') { - card.style.display = hasPending ? 'block' : 'none'; + card.style.display = anyEnabled ? 'block' : 'none'; } else { - card.style.display = hasPending ? 'none' : 'block'; + card.style.display = anyEnabled ? 'none' : 'block'; } }); } /* 去称重 */ - function handleWeigh(taskNo, orderNo, packName) { - var target = '02-weighing-packing.html?task=' + taskNo + '&pack=' + encodeURIComponent(packName) + '&order=' + encodeURIComponent(orderNo); + function handleWeigh(taskNo, packName) { + var target = '02-weighing-packing.html?task=' + taskNo + '&pack=' + encodeURIComponent(packName); if (userName) target += '&user=' + encodeURIComponent(userName); window.location.href = target; } diff --git a/other-module/canteen-device/ratio-scale/02-weighing-packing.html b/other-module/canteen-device/ratio-scale/02-weighing-packing.html index 87ed460..7d9cc46 100644 --- a/other-module/canteen-device/ratio-scale/02-weighing-packing.html +++ b/other-module/canteen-device/ratio-scale/02-weighing-packing.html @@ -266,53 +266,14 @@ cursor: not-allowed; box-shadow: none; } - /* 弹窗遮罩 */ - .modal-overlay { - position: fixed; inset: 0; background: rgba(0,0,0,0.65); - display: none; align-items: center; justify-content: center; - z-index: 999; + /* 任务下餐品净菜包列表 */ + .task-packs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; } + .task-pack-tag { + font-size: 11px; padding: 3px 10px; border-radius: 4px; + background: rgba(114,46,209,0.1); color: rgba(255,255,255,0.6); + border: 1px solid rgba(114,46,209,0.2); } - .modal-overlay.show { display: flex; } - - /* 弹窗卡片 */ - .modal { - background: #1a2b4a; border-radius: 14px; border: 1px solid rgba(255,255,255,0.08); - width: 580px; padding: 24px 28px 20px; - box-shadow: 0 16px 48px rgba(0,0,0,0.5); - } - .modal__title { font-size: 16px; font-weight: 600; margin-bottom: 18px; color: #fff; } - .modal__form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; } - .modal__form-group { display: flex; flex-direction: column; gap: 4px; } - .modal__form-group--full { grid-column: 1 / -1; } - .modal__label { font-size: 11px; color: rgba(255,255,255,0.5); } - .modal__label .required { color: #ff4d4f; margin-left: 2px; } - .modal__input, .modal__select { - padding: 8px 12px; background: #121832; - border: 1px solid rgba(255,255,255,0.1); border-radius: 6px; - color: #fff; font-size: 13px; outline: none; - transition: border-color 0.2s; - } - .modal__input:focus, .modal__select:focus { border-color: #4a90d9; } - .modal__input::placeholder { color: rgba(255,255,255,0.2); } - /* 自定义日期选择器(三列下拉) */ - .date-picker { display: flex; gap: 6px; } - .date-picker .modal__select { flex: 1; } - .modal__select option { background: #1a2b4a; color: #fff; } - .modal__actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; } - .modal__btn { - padding: 8px 24px; border-radius: 8px; font-size: 13px; font-weight: 500; - cursor: pointer; border: none; transition: all 0.2s; - } - .modal__btn--cancel { - background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.6); - } - .modal__btn--cancel:hover { background: rgba(255,255,255,0.1); color: #fff; } - .modal__btn--confirm { - background: #4a90d9; color: #fff; - } - .modal__btn--confirm:hover { background: #3a7bc8; } - - /* Toast 提示 */ + .task-pack-tag--current { color: #722ed1; background: rgba(114,46,209,0.2); border-color: rgba(114,46,209,0.4); } .toast { position: fixed; top: 60px; left: 50%; transform: translateX(-50%) translateY(-20px); background: rgba(0,0,0,0.85); color: #fff; padding: 12px 28px; border-radius: 8px; @@ -399,21 +360,13 @@
-
-
订单号
-
--
-
任务号
--
-
+
餐品净菜包
-
--
-
-
-
打包规格
-
--
+
@@ -436,7 +389,7 @@
- +
@@ -444,48 +397,6 @@
- - - diff --git a/other-module/canteen-device/ratio-scale/doc/CHANGELOG.md b/other-module/canteen-device/ratio-scale/doc/CHANGELOG.md index 344d0bc..14bb078 100644 --- a/other-module/canteen-device/ratio-scale/doc/CHANGELOG.md +++ b/other-module/canteen-device/ratio-scale/doc/CHANGELOG.md @@ -1,5 +1,18 @@ # 净菜配比秤 CHANGELOG +## [1.3.0] - 2026-06-16 + +### 重构 +- 去除订单维度:任务列表和称重页不再包含订单号/期望到货等订单信息 +- 任务与餐品净菜包一对多:一个任务可包含多个餐品净菜包,列表页按任务+多包展示 +- 称重页任务信息区改为显示任务号 + 该任务下所有餐品包列表(名称×份数) +- 称重页「下一步」按钮改为「打包完成」,点击直接返回列表(移除包装信息弹窗) + +### 删除 +- 称重页包装信息弹窗及其相关样式/JS(弹窗表单、日期选择器、校验逻辑) + +--- + ## [1.2.0] - 2026-06-16 ### 新增