From 368298a29d2914cb196c07544645611605bba93e Mon Sep 17 00:00:00 2001 From: DXC Date: Fri, 13 Mar 2026 13:52:17 +0800 Subject: [PATCH] feat: sort outbound selection list by warehouse location to optimize pick path --- inventory-web/src/views/outbound/Selection.vue | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/inventory-web/src/views/outbound/Selection.vue b/inventory-web/src/views/outbound/Selection.vue index b08470e..a3a746d 100644 --- a/inventory-web/src/views/outbound/Selection.vue +++ b/inventory-web/src/views/outbound/Selection.vue @@ -314,8 +314,21 @@ const bomSets = ref(1) const currentTime = ref('') // --- 计算属性 --- +// ★ 优化:按库位排序,空库位排最后 const validSelectedItems = computed(() => { - return selectedItems.value.filter(item => item.export_quantity > 0) + const filtered = selectedItems.value.filter(item => item.export_quantity > 0) + return [...filtered].sort((a, b) => { + const locA = a.warehouse_location || a.warehouse_loc || ''; + const locB = b.warehouse_location || b.warehouse_loc || ''; + + // 空库位沉底 + if (!locA && locB) return 1; + if (locA && !locB) return -1; + if (!locA && !locB) return 0; + + // 自然排序(支持 A-10 排在 A-2 后面) + return locA.localeCompare(locB, 'zh-CN', { numeric: true }); + }); }) const totalExportCount = computed(() => {