Keep users on the document reminder list by reusing vehicle/personnel form dialogs instead of navigating away to base-info pages. Co-authored-by: Cursor <cursoragent@cursor.com>
47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
export const DOCUMENT_REMINDER_JUMP_UNSUPPORTED = '暂不支持该主体类型的证件维护跳转'
|
|
|
|
export type ReminderJumpInput = {
|
|
ownerType?: string | null
|
|
vehicleType?: string | null
|
|
personnelAffiliation?: string | null
|
|
}
|
|
|
|
export type ReminderFormMode =
|
|
| { kind: 'vehicle'; vehicleType: 'self' | 'carrier' }
|
|
| { kind: 'personnel'; affiliation: 'self' | 'carrier' }
|
|
|
|
/** 提醒页本页弹窗:解析车辆/人员表单锁定类型。 */
|
|
export function resolveDocumentReminderFormMode(
|
|
input: ReminderJumpInput
|
|
): ReminderFormMode | null {
|
|
const ownerType = String(input.ownerType || '').trim()
|
|
if (ownerType === 'vehicle') {
|
|
return {
|
|
kind: 'vehicle',
|
|
vehicleType: String(input.vehicleType || '').trim() === 'self' ? 'self' : 'carrier'
|
|
}
|
|
}
|
|
if (ownerType === 'personnel') {
|
|
return {
|
|
kind: 'personnel',
|
|
affiliation:
|
|
String(input.personnelAffiliation || '').trim() === 'carrier' ? 'carrier' : 'self'
|
|
}
|
|
}
|
|
return null
|
|
}
|
|
|
|
/** 可选深链:档案页 path(提醒主流程已改为本页弹窗)。 */
|
|
export function resolveDocumentReminderEditPath(input: ReminderJumpInput): string | null {
|
|
const mode = resolveDocumentReminderFormMode(input)
|
|
if (!mode) return null
|
|
if (mode.kind === 'vehicle') {
|
|
return mode.vehicleType === 'self'
|
|
? '/vehicle-mgmt/base-info/self-vehicle'
|
|
: '/vehicle-mgmt/base-info/vehicle'
|
|
}
|
|
return mode.affiliation === 'carrier'
|
|
? '/vehicle-mgmt/base-info/personnel-carrier'
|
|
: '/vehicle-mgmt/base-info/personnel'
|
|
}
|