提交
This commit is contained in:
1 parent
0e60b88cba
commit
87f7f6bf38
34 files changed
+18326
-6165
No files matched your search
@@ -21,7 +21,6 @@ export function isRequiredCertSlotComplete(
|
||||
): boolean {
|
||||
if (!cert) return false
|
||||
if (!matchRequiredCertName(cert.certName, requiredName)) return false
|
||||
if (!cert.certNo?.trim()) return false
|
||||
if (!cert.expireDate) return false
|
||||
if (!cert.attachmentUrls?.trim()) return false
|
||||
return true
|
||||
@@ -32,10 +31,9 @@ export function getMissingRequiredCertFieldLabels(
|
||||
requiredName: string
|
||||
): string[] {
|
||||
if (!cert || !matchRequiredCertName(cert.certName, requiredName)) {
|
||||
return ['证号', '有效期', '附件']
|
||||
return ['有效期', '附件']
|
||||
}
|
||||
const missing: string[] = []
|
||||
if (!cert.certNo?.trim()) missing.push('证号')
|
||||
if (!cert.expireDate) missing.push('有效期')
|
||||
if (!cert.attachmentUrls?.trim()) missing.push('附件')
|
||||
return missing
|
||||
@@ -133,12 +131,28 @@ function findCertIndexForRequired(
|
||||
export function mergeCertListWithRequiredSlots(
|
||||
existing: CertRowWithMeta[],
|
||||
requiredNames: readonly string[],
|
||||
options?: { vehiclePart?: string }
|
||||
options?: { vehiclePart?: string; stripManagedNames?: readonly string[] }
|
||||
): CertRowWithMeta[] {
|
||||
const vehiclePart = options?.vehiclePart
|
||||
const next = existing.map(cert => ({ ...cert }))
|
||||
const stripManagedNames = options?.stripManagedNames
|
||||
const normalizedPart = vehiclePart ? normalizeVehicleCertPart(vehiclePart) : null
|
||||
|
||||
let source = existing
|
||||
if (stripManagedNames?.length) {
|
||||
source = existing.filter(cert => {
|
||||
if (normalizedPart && normalizeVehicleCertPart(cert.vehiclePart) !== normalizedPart) {
|
||||
return true
|
||||
}
|
||||
if (requiredNames.some(name => matchRequiredCertName(cert.certName, name))) {
|
||||
return true
|
||||
}
|
||||
const isManaged = stripManagedNames.some(name => matchRequiredCertName(cert.certName, name))
|
||||
return !isManaged
|
||||
})
|
||||
}
|
||||
|
||||
const next = source.map(cert => ({ ...cert }))
|
||||
|
||||
const extras = next.filter(cert => {
|
||||
if (normalizedPart && normalizeVehicleCertPart(cert.vehiclePart) !== normalizedPart) {
|
||||
return false
|
||||
|
||||
Reference in new issue
Block a user