fix(outbound): map warehouse location field correctly and implement natural sorting by location path for picking route optimization
This commit is contained in:
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
<el-table
|
<el-table
|
||||||
v-else
|
v-else
|
||||||
:data="selectedItems"
|
:data="sortedSelectedItems"
|
||||||
border
|
border
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
row-key="uniqueKey"
|
row-key="uniqueKey"
|
||||||
@ -340,6 +340,16 @@ const userStore = useUserStore()
|
|||||||
|
|
||||||
// --- 状态变量 ---
|
// --- 状态变量 ---
|
||||||
const selectedItems = ref<any[]>([])
|
const selectedItems = ref<any[]>([])
|
||||||
|
|
||||||
|
// 按库位路径自然升序排序(优化拣货路径)
|
||||||
|
const sortedSelectedItems = computed(() => {
|
||||||
|
return [...selectedItems.value].sort((a, b) => {
|
||||||
|
const locA = a.warehouse_location || ''
|
||||||
|
const locB = b.warehouse_location || ''
|
||||||
|
return locA.localeCompare(locB, 'zh', { numeric: true })
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
const manualDialogVisible = ref(false)
|
const manualDialogVisible = ref(false)
|
||||||
const bomSelectVisible = ref(false)
|
const bomSelectVisible = ref(false)
|
||||||
const previewVisible = ref(false)
|
const previewVisible = ref(false)
|
||||||
@ -452,10 +462,11 @@ const loadStockList = async () => {
|
|||||||
pageSize: stockPageSize.value,
|
pageSize: stockPageSize.value,
|
||||||
keyword: searchKeyword.value.trim()
|
keyword: searchKeyword.value.trim()
|
||||||
})
|
})
|
||||||
// 为每个item添加uniqueKey,确保row-key唯一
|
// 为每个item添加uniqueKey和确保warehouse_location字段正确映射
|
||||||
stockList.value = (res.data?.list || []).map((item: any) => ({
|
stockList.value = (res.data?.list || []).map((item: any) => ({
|
||||||
...item,
|
...item,
|
||||||
uniqueKey: `${item.type}_${item.id}`
|
uniqueKey: `${item.type}_${item.id}`,
|
||||||
|
warehouse_location: item.warehouse_location || item.warehouse_loc || item.full_path || ''
|
||||||
}))
|
}))
|
||||||
stockTotal.value = res.data?.total || 0
|
stockTotal.value = res.data?.total || 0
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -484,7 +495,7 @@ const openManualSelect = async () => {
|
|||||||
...i,
|
...i,
|
||||||
name: i.name || i.material_name || i.product_name || '未知名称',
|
name: i.name || i.material_name || i.product_name || '未知名称',
|
||||||
standard: i.standard || i.spec_model || '',
|
standard: i.standard || i.spec_model || '',
|
||||||
warehouse_location: i.warehouse_location || (i.warehouse_loc) || '',
|
warehouse_location: i.warehouse_location || i.warehouse_loc || i.full_path || '',
|
||||||
uniqueKey: `${i.type}_${i.id}`,
|
uniqueKey: `${i.type}_${i.id}`,
|
||||||
available_quantity: parseFloat(i.available_quantity) || 0,
|
available_quantity: parseFloat(i.available_quantity) || 0,
|
||||||
export_quantity: 1
|
export_quantity: 1
|
||||||
|
|||||||
Reference in New Issue
Block a user