This commit is contained in:
zlwu committed 2026-07-05 14:01:19 +08:00
1 parent 54b27a3f0e
commit 31be9bfd95
41 files changed
+8981 -5121

No files matched your search

+34
View File
@@ -24,6 +24,40 @@ export function getPlVehicleTypeTagType(type: string) {
return type === 'self' ? 'success' : 'warning'
}
type VehicleTrailerLookup = ReadonlyMap<string, string> | Record<string, string | undefined | null>
function resolveTrailerFromLookup(plate: string, lookup?: VehicleTrailerLookup) {
if (!lookup || !plate) return ''
if (lookup instanceof Map) return lookup.get(plate)?.trim() || ''
return lookup[plate]?.trim() || ''
}
/** 按车牌构建挂车号查找表(仅 licensePlate 的业务列表用) */
export function buildVehicleTrailerLookup(
vehicles: Array<{ licensePlate?: string | null; trailerNo?: string | null }> = []
) {
const map = new Map<string, string>()
for (const vehicle of vehicles) {
const plate = vehicle.licensePlate?.trim()
const trailer = vehicle.trailerNo?.trim()
if (plate && trailer) map.set(plate, trailer)
}
return map
}
/** 列表/摘要:车牌号(挂车号) */
export function formatPlVehiclePlateDisplay(
licensePlate?: string | null,
trailerNo?: string | null,
trailerLookup?: VehicleTrailerLookup
) {
const plate = licensePlate?.trim() || ''
const trailer = trailerNo?.trim() || resolveTrailerFromLookup(plate, trailerLookup)
if (!plate && !trailer) return '—'
if (plate && trailer) return `${plate}(${trailer})`
return plate || trailer
}
export function getPlCarrierStatusLabel(status: string) {
return status === '1' ? '合作中' : '已终止'
}
File diff suppressed because it is too large. Load diff