feat(expenses): backfill historical claims into expense cases
This commit is contained in:
@@ -26,6 +26,7 @@ const BUSINESS_STATUS_LABELS = {
|
||||
const EVENT_PRESENTATION = {
|
||||
claim_draft_created: { label: '报销草稿已创建', icon: 'mdi mdi-file-plus-outline', tone: 'info' },
|
||||
claim_draft_updated: { label: '报销草稿已更新', icon: 'mdi mdi-file-edit-outline', tone: 'info' },
|
||||
historical_claim_imported: { label: '历史单据已纳入统一费用事件', icon: 'mdi mdi-history', tone: 'info' },
|
||||
application_submitted: { label: '费用申请已提交', icon: 'mdi mdi-send-outline', tone: 'info' },
|
||||
claim_submitted: { label: '报销单已提交', icon: 'mdi mdi-send-outline', tone: 'info' },
|
||||
approval_stage_completed: { label: '审批节点已完成', icon: 'mdi mdi-account-check-outline', tone: 'success' },
|
||||
@@ -83,7 +84,30 @@ function buildStateTransitionSummary(payload) {
|
||||
return transition || (nextStage ? `当前节点:${nextStage}` : '')
|
||||
}
|
||||
|
||||
function buildHistoricalClaimImportSummary(payload) {
|
||||
const currentStatus = resolveStatusLabel(readField(payload, 'next_status', 'nextStatus'))
|
||||
const currentStage = compactText(readField(payload, 'next_approval_stage', 'nextApprovalStage'))
|
||||
const currentStateParts = []
|
||||
|
||||
if (currentStatus) {
|
||||
currentStateParts.push(`纳入时状态:${currentStatus}`)
|
||||
}
|
||||
if (currentStage) {
|
||||
currentStateParts.push(`纳入时节点:${currentStage}`)
|
||||
}
|
||||
|
||||
const currentStateSummary = currentStateParts.length
|
||||
? `${currentStateParts.join(' · ')}。`
|
||||
: ''
|
||||
|
||||
return `系统已根据原单据建立费用事件档案。${currentStateSummary}导入前办理记录以原单据为准,后续动作将在此持续记录。`
|
||||
}
|
||||
|
||||
function buildEventSummary(eventType, payload) {
|
||||
if (eventType === 'historical_claim_imported') {
|
||||
return buildHistoricalClaimImportSummary(payload)
|
||||
}
|
||||
|
||||
const reason = compactText(payload?.reason)
|
||||
if (reason) {
|
||||
return reason
|
||||
@@ -159,7 +183,7 @@ function normalizeEvent(event, index) {
|
||||
icon: presentation.icon,
|
||||
tone: presentation.tone,
|
||||
summary: buildEventSummary(eventType, payload),
|
||||
actorLabel: resolveActorLabel(event),
|
||||
actorLabel: eventType === 'historical_claim_imported' ? '系统' : resolveActorLabel(event),
|
||||
occurredAt: compactText(occurredAt),
|
||||
occurredAtLabel: formatOccurredAt(occurredAt),
|
||||
sortTimestamp: Number.isNaN(timestamp) ? null : timestamp,
|
||||
|
||||
Reference in New Issue
Block a user