feat(consignment): 苏尔南手枪按枪型/钻石/璀璨分层匹配并过滤跨枪型

排序:完美匹配 > 同钻高璀 > 高钻同璀 > 高钻高璀 > 低配;跨枪型不展示不参与;高配仍需填人工原因。
This commit is contained in:
2026-11-15 16:58:42 +08:00
parent 68fa2a575f
commit e2c27bc7a9
12 changed files with 877 additions and 127 deletions
@@ -13,6 +13,7 @@ import {
describeConsignmentMatch,
resolveMatchCoverage,
} from '@/utils/consignment-match-coverage'
import { resolveConsignmentPriorityTagColor } from '@/utils/consignment-match-priority'
function money(fen: number) {
return `¥${((Number(fen || 0) || 0) / 100).toFixed(2)}`
@@ -93,16 +94,11 @@ export default function ConsignmentWorkOrderMatchModal({
: totalQuantity
const normalizedKeyword = keyword.trim().toLowerCase()
// 默认展示全部候选,按匹配打分降序;关键词只做过滤,不改变排序口径。
// 后端已按「枪型 → 钻石 → 璀璨」排好序;这里只做关键词过滤,必须保持原顺序。
const visibleOptions = useMemo(() => {
const filtered = normalizedKeyword
return normalizedKeyword
? options.filter((item) => buildCandidateHaystack(item).includes(normalizedKeyword))
: options
return [...filtered].sort((left, right) => {
const scoreDiff = computeConsignmentMatchScore(right) - computeConsignmentMatchScore(left)
if (scoreDiff !== 0) return scoreDiff
return Number(right.remainingQuantity || 0) - Number(left.remainingQuantity || 0)
})
}, [normalizedKeyword, options])
const selectedOptions = useMemo(
@@ -314,7 +310,7 @@ export default function ConsignmentWorkOrderMatchModal({
type={remainingNeeded <= 0 ? 'warning' : 'info'}
showIcon
message={infoMessage}
description="默认按匹配打分从高到低展示全部候选;非精确/冲突必须填写人工原因;拼单必须一次拼满,失败不会占用任何库存。"
description="默认按 枪型 → 钻石 → 璀璨 排序:完美匹配在前,同钻高璀/高钻同璀/高钻高璀次之,低配靠后;非精确/冲突必须填写人工原因;拼单必须一次拼满,失败不会占用任何库存。"
/>
<Space wrap size={8}>
<Tag color="blue">
@@ -356,6 +352,22 @@ export default function ConsignmentWorkOrderMatchModal({
)
},
},
{
title: '匹配层级',
key: 'priority',
width: 105,
render: (_, item) =>
item.priorityLabel ? (
<Tag
color={resolveConsignmentPriorityTagColor(item.priorityLabel)}
style={{ marginInlineEnd: 0 }}
>
{item.priorityLabel}
</Tag>
) : (
<Typography.Text type="secondary">-</Typography.Text>
),
},
{
title: '寄卖单号',
key: 'consignmentNo',