This commit is contained in:
wujinliang
2026-09-18 11:41:27 +08:00
parent f2d5b2d8e4
commit 451663b6ff
24 changed files with 156 additions and 30 deletions
@@ -0,0 +1,16 @@
import type { DispatchPalletCandidateDto } from './api/dispatches'
export type SmartDispatchWarehouseTab = 'ALL' | 'LAX' | 'NYC'
export function matchesSmartDispatchWarehouseTab(
candidate: Pick<DispatchPalletCandidateDto, 'overseasWarehouseCode' | 'overseasWarehouseName'>,
tab: SmartDispatchWarehouseTab,
) {
if (tab === 'ALL') return true
const warehouse = [candidate.overseasWarehouseCode, candidate.overseasWarehouseName]
.map((value) => String(value || '').trim().toLowerCase())
.filter(Boolean)
.join(' ')
if (tab === 'LAX') return /lax|洛杉矶|los angeles/.test(warehouse)
return /nyc|jfk|(?:^|[^a-z])ny(?:[^a-z]|$)|纽约|new[ -]?york/.test(warehouse)
}