对齐 Parent Group 前端展示与复核
This commit is contained in:
@@ -4,6 +4,7 @@ export interface ReservationTaskRouteLike {
|
||||
task_type?: string | null
|
||||
system_task_type?: string | null
|
||||
task_card_type?: string | null
|
||||
card_name?: string | null
|
||||
task_subtype?: string | null
|
||||
result_type?: string | null
|
||||
ai_task_type?: string | null
|
||||
@@ -19,6 +20,27 @@ export function formatReservationTaskCard(
|
||||
return translateStableCode(t, 'cardType', taskType, 'common.unknownTaskType', fallbackLabel)
|
||||
}
|
||||
|
||||
export function formatReservationTaskCardLabel(
|
||||
t: ReservationTranslator,
|
||||
input: ReservationTaskRouteLike,
|
||||
fallbackLabel?: string | null,
|
||||
): string {
|
||||
if (isReservationAdapterContractErrorTask(input)) {
|
||||
return t('resultType.ADAPTER_CONTRACT_ERROR')
|
||||
}
|
||||
if (isReservationUnhandledIntentTask(input)) {
|
||||
return t('resultType.UNHANDLED_CURRENT_INTENT')
|
||||
}
|
||||
if (isReservationParentGroupCancelAllotmentTask(input)) {
|
||||
return formatReservationTaskCard(t, 'CANCEL_ALLOTMENT')
|
||||
}
|
||||
return formatReservationTaskCard(
|
||||
t,
|
||||
input.task_card_type ?? input.task_type ?? input.system_task_type,
|
||||
fallbackLabel ?? input.card_name,
|
||||
)
|
||||
}
|
||||
|
||||
export function formatReservationTaskTypeSummary(
|
||||
t: ReservationTranslator,
|
||||
taskType: string | null | undefined,
|
||||
@@ -86,6 +108,18 @@ export function isReservationReadonlyDiagnosticTask(input: ReservationTaskRouteL
|
||||
)
|
||||
}
|
||||
|
||||
export function isReservationParentGroupCancelAllotmentTask(input: ReservationTaskRouteLike | null | undefined): boolean {
|
||||
const routeCode = normalizeStableCode(input?.route_code)
|
||||
const taskSubtype = normalizeStableCode(input?.task_subtype)
|
||||
const taskCardType = normalizeStableCode(input?.task_card_type ?? input?.card_name)
|
||||
return (
|
||||
routeCode === 'R08_CANCEL_ALLOTMENT_CONTROL_BLOCK_NORMAL' ||
|
||||
routeCode === 'R08_CANCEL_ALLOTMENT_CONTROL_BLOCK_REVIEW' ||
|
||||
taskSubtype === 'CANCEL_ALLOTMENT_CONTROL_BLOCK' ||
|
||||
taskCardType === 'CANCEL_ALLOTMENT'
|
||||
)
|
||||
}
|
||||
|
||||
export function isReservationTypeKnownManualReviewTask(input: ReservationTaskRouteLike | null | undefined): boolean {
|
||||
if (normalizeStableCode(input?.result_type) !== 'MANUAL_REVIEW') {
|
||||
return false
|
||||
@@ -121,6 +155,13 @@ export function formatReservationTaskRouteSummary(
|
||||
if (isReservationUnhandledIntentTask(input)) {
|
||||
return t('resultType.UNHANDLED_CURRENT_INTENT')
|
||||
}
|
||||
if (isReservationParentGroupCancelAllotmentTask(input)) {
|
||||
return [
|
||||
t('task.parentGroup'),
|
||||
formatReservationTaskCard(t, 'CANCEL_ALLOTMENT'),
|
||||
formatReservationRouteCode(t, 'cancel_allotment_control_block'),
|
||||
].join(' / ')
|
||||
}
|
||||
return formatReservationTaskTypeSummary(
|
||||
t,
|
||||
input.task_type ?? input.system_task_type ?? input.task_card_type,
|
||||
@@ -144,7 +185,7 @@ export function formatReservationRouteCode(t: ReservationTranslator, routeCode:
|
||||
if (['S10', 'S99', 'S000', 'S999'].includes(normalizedCode)) {
|
||||
return translateStableCode(t, 'taskSubtype', routeCode, 'common.unknownTaskSubtype')
|
||||
}
|
||||
return routeCode || t('common.unknownTaskSubtype')
|
||||
return translateStableCode(t, 'taskSubtype', routeCode, 'common.unknownTaskSubtype', routeCode)
|
||||
}
|
||||
|
||||
export function formatReservationReadonlyReason(
|
||||
|
||||
Reference in New Issue
Block a user