fix(first-leg): identify and localize picking status in cabinet summary

This commit is contained in:
2026-10-03 11:53:50 +08:00
parent 5c53eba31b
commit 8e5fa0bebc
4 changed files with 26 additions and 2 deletions
@@ -8,6 +8,7 @@ import {
FIRST_LEG_PROGRESS_STAGES,
getFirstLegProgressIndex,
getFirstLegStatusLabel,
getFirstLegPickingStatusLabel,
getFirstLegStatusTone,
getFirstLegTransportModeLabel,
summarizeFirstLegCargo,
@@ -59,6 +60,15 @@ function validDraft() {
}
}
test('keeps picking states distinct from order completion and hides unknown internal codes', () => {
assert.equal(getFirstLegPickingStatusLabel('PENDING'), '待拣货')
assert.equal(getFirstLegPickingStatusLabel('IN_PROGRESS'), '拣货中')
assert.equal(getFirstLegPickingStatusLabel('COMPLETED'), '拣货完成')
assert.equal(getFirstLegPickingStatusLabel('NEW_INTERNAL_STATE'), '未知状态')
assert.equal(getFirstLegPickingStatusLabel(null), '待更新')
assert.equal(getFirstLegPickingStatusLabel(''), '待更新')
})
test('uses the confirmed status and transport labels', () => {
assert.equal(getFirstLegStatusLabel('CANCELLED'), '已取消')
assert.equal(getFirstLegStatusLabel('NOT_A_STATUS'), '未知状态')
@@ -19,6 +19,16 @@ export function getFirstLegStatusLabel(status: string) {
return statusLabels.get(canonicalStatus as FirstLegOrderStatus) ?? '未知状态'
}
export function getFirstLegPickingStatusLabel(status: string | null | undefined) {
if (!status) return '待更新'
const labels: Readonly<Record<string, string>> = {
PENDING: '待拣货',
IN_PROGRESS: '拣货中',
COMPLETED: '拣货完成',
}
return labels[status] ?? '未知状态'
}
export function getFirstLegTransportModeLabel(mode: FirstLegTransportMode | null) {
if (!mode) return '运输方式待更新'
return transportModeLabels.get(mode) ?? mode
@@ -231,6 +231,9 @@ test('shows one unified progress line and C02 business summaries without detail
assert.doesNotMatch(source, /<h3>报关回执<\/h3>/)
assert.match(source, /船期摘要/)
assert.match(source, /柜次明细/)
assert.match(source, /pickingStatusLabel: getFirstLegPickingStatusLabel\(summary\.loadingStatus\)/)
assert.match(source, /prop="pickingStatusLabel" label="拣货状态"/)
assert.doesNotMatch(source, /label="当前节点"/)
assert.match(source, /尚未分配柜次,后续柜次节点将在这里同步。/)
assert.doesNotMatch(source, /暂无柜次分配信息/)
assert.doesNotMatch(source, /summary\.sealNo \|\|/)
@@ -52,6 +52,7 @@ import {
canClientEditFirstLegOrder,
createEmptyCargoItem,
getFirstLegStatusLabel,
getFirstLegPickingStatusLabel,
getFirstLegStatusTone,
getFirstLegTransportModeLabel,
summarizeFirstLegCargo,
@@ -621,7 +622,7 @@ const progressSummaryItems = computed(() => {
const cabinetProgressItems = computed(() => {
const summary = detailOrder.value?.businessSummary
if (!summary || (!summary.cabinetNo && !summary.containerNo)) return []
return [{ cabinetId: summary.cabinetNo || summary.containerNo, cabinetNo: summary.cabinetNo || summary.containerNo, status: summary.loadingStatus || '待更新', vesselName: summary.vesselName, voyageNo: summary.voyageNo, estimatedSailingAt: summary.estimatedSailingAt }]
return [{ cabinetId: summary.cabinetNo || summary.containerNo, cabinetNo: summary.cabinetNo || summary.containerNo, pickingStatusLabel: getFirstLegPickingStatusLabel(summary.loadingStatus), vesselName: summary.vesselName, voyageNo: summary.voyageNo, estimatedSailingAt: summary.estimatedSailingAt }]
})
const selectedWarehouse = computed(() => availableWarehouses.value.find((item) => item.id === form.receivingWarehouseId))
const selectedDestinationWarehouse = computed(() => store.warehouses.find((item) => item.id === form.destinationWarehouseId && item.warehouseType === form.destinationType))
@@ -2475,7 +2476,7 @@ async function searchOrders(model: QueryModel) {
<el-table-column prop="cabinetNo" label="柜号 / 柜次" min-width="150"><template #default="{ row }"><span class="table-code">{{ row.cabinetNo || '—' }}</span></template></el-table-column>
<el-table-column label="船名 / 航次" min-width="180"><template #default="{ row }">{{ [row.vesselName, row.voyageNo].filter(Boolean).join(' · ') || '待更新' }}</template></el-table-column>
<el-table-column label="预计船期" width="170"><template #default="{ row }">{{ row.estimatedSailingAt ? formatDateTime(row.estimatedSailingAt) : '待更新' }}</template></el-table-column>
<el-table-column prop="status" label="当前节点" width="120"><template #default="{ row }"><el-tag size="small" effect="plain">{{ row.status || '待更新' }}</el-tag></template></el-table-column>
<el-table-column prop="pickingStatusLabel" label="拣货状态" width="120"><template #default="{ row }"><el-tag size="small" effect="plain">{{ row.pickingStatusLabel }}</el-tag></template></el-table-column>
</el-table>
<p v-else class="detail-inline-empty">尚未分配柜次,后续柜次节点将在这里同步。</p>
</div>