fix(procurement): preserve correction drafts separately from pending commands
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
export interface ProcurementCorrectionDraft {
|
||||
feeId: string
|
||||
targetOriginalAmount: string
|
||||
reason: string
|
||||
voucherFileId: string
|
||||
orderVersion: number
|
||||
}
|
||||
|
||||
export function readCorrectionDraft(raw: string | null): ProcurementCorrectionDraft | null {
|
||||
if (!raw) return null
|
||||
const value: unknown = JSON.parse(raw)
|
||||
if (!value || typeof value !== 'object') throw new Error('费用更正草稿无法读取')
|
||||
const draft = value as Record<string, unknown>
|
||||
if (!['feeId', 'targetOriginalAmount', 'reason', 'voucherFileId'].every(key => typeof draft[key] === 'string') || !Number.isSafeInteger(draft.orderVersion)) throw new Error('费用更正草稿无法读取')
|
||||
return { feeId: draft.feeId as string, targetOriginalAmount: draft.targetOriginalAmount as string, reason: draft.reason as string, voucherFileId: draft.voucherFileId as string, orderVersion: draft.orderVersion as number }
|
||||
}
|
||||
Reference in New Issue
Block a user