完善拼单状态与份额验收流程

This commit is contained in:
yml2213
2026-08-18 18:02:43 +08:00
parent 052b99b05f
commit ee79195f47
17 changed files with 1143 additions and 196 deletions
+6 -1
View File
@@ -333,7 +333,12 @@ function upsertById(items: unknown[], nextItem: unknown, idKey: string, insert =
(item) => Number((item as Record<string, unknown>)?.[idKey] || 0) === id,
)
if (index < 0) return insert ? [nextItem, ...items] : items
return items.map((item, itemIndex) => (itemIndex === index ? nextItem : item))
return items.map((item, itemIndex) => {
if (itemIndex !== index) return item
if (!isRecord(item) || !isRecord(nextItem)) return nextItem
// 大厅广播是公共快照,合并后保留当前打手私有的 myShare 等字段。
return { ...item, ...nextItem }
})
}
function isRecord(value: unknown): value is Record<string, unknown> {