diff --git a/inventory-web/src/views/outbound/Selection.vue b/inventory-web/src/views/outbound/Selection.vue
index 335ef23..8e20b68 100644
--- a/inventory-web/src/views/outbound/Selection.vue
+++ b/inventory-web/src/views/outbound/Selection.vue
@@ -268,7 +268,7 @@
BOM 出库清单
- BOM: {{ selectedBomNo }} | 套数: {{ bomSets }} 套 | 生成时间: {{ bomPrintTime }}
+ BOM: {{ selectedBomLabel }} | 套数: {{ bomSets }} 套 | 生成时间: {{ bomPrintTime }}
@@ -296,6 +296,9 @@
+
+ BOM: {{ selectedBomLabel }} | 套数: {{ bomSets }} 套 | 生成时间: {{ bomPrintTime }}
+
⚠️ 欠料待补清单(请补料后在此签字)
@@ -560,7 +563,8 @@ const treeData = computed(() => {
label: `${group.category} (${group.count})`,
disabled: true, // 禁止选中分类本身
children: (group.items || []).map((b: any) => ({
- value: b.bom_no,
+ // ★ 用 bom_no + version 组合作为唯一 value,避免同一产品多版本时回显错乱
+ value: `${b.bom_no}###${b.version}`,
label: `${b.bom_no} - ${b.parent_name} - ${b.version}`
}))
}))
@@ -635,6 +639,12 @@ const bomPrintTime = ref('')
const bomAvailableCount = computed(() => bomDetailList.value.filter(i => i.shortage === 0).length)
const bomShortageCount = computed(() => bomDetailList.value.filter(i => i.shortage > 0).length)
+// BOM 选择显示标签(bom_no###version → "bom_no (version)")
+const selectedBomLabel = computed(() => {
+ const [no, ver] = (selectedBomNo.value || '').split('###')
+ return ver ? `${no} (${ver})` : no
+})
+
// --- 辅助方法 ---
const getTypeTag = (type: string) => {
switch (type) {
@@ -808,35 +818,21 @@ const openBomSelect = async () => {
category, count: items.length, items
}))
- // ★ 提示有历史缺货记录的 BOM,防止下次重复出/漏出
- const pendingBoms = Object.keys(bomShortageRecords.value).filter(no =>
- flatItems.some(i => i.bom_no === no)
- )
- if (pendingBoms.length > 0) {
- ElMessageBox.confirm(
- `检测到以下 BOM 存在未完成的缺货记录(上次按 BOM 出库时缺货):\n\n` +
- pendingBoms.map(no => {
- const rec = bomShortageRecords.value[no]
- return `• ${no}(${rec.items.length} 种缺货,${rec.time})`
- }).join('\n') +
- `\n\n建议先补货后再出库,避免漏出。`,
- '存在未完成出库',
- { confirmButtonText: '知道了', cancelButtonText: '忽略', type: 'warning' }
- ).catch(() => {})
- }
} catch (e) {
ElMessage.error('加载 BOM 列表失败')
}
}
// 监听 BOM 选择变化,自动加载明细(含库存)并计算齐套性
-watch(selectedBomNo, async (newBomNo) => {
- if (!newBomNo) {
+watch(selectedBomNo, async (newKey) => {
+ if (!newKey) {
currentBomDetail.value = []
return
}
+ // ★ 组合 key 拆解为 bom_no + version,按选中版本精确拉取明细
+ const [bomNo, version] = newKey.split('###')
try {
- const detailRes: any = await getBomWithStock(newBomNo)
+ const detailRes: any = await getBomWithStock(bomNo, version)
currentBomDetail.value = detailRes.data?.children || []
} catch (e) {
ElMessage.error('加载 BOM 明细失败')
@@ -849,7 +845,9 @@ const confirmBomAdd = async () => {
if (currentBomDetail.value.length === 0) {
try {
- const detailRes: any = await getBomWithStock(selectedBomNo.value)
+ // ★ 组合 key 拆解为 bom_no + version,按选中版本精确拉取明细
+ const [bomNo, version] = (selectedBomNo.value || '').split('###')
+ const detailRes: any = await getBomWithStock(bomNo, version)
currentBomDetail.value = detailRes.data?.children || []
} catch (e) {
ElMessage.error('获取 BOM 详情失败')