17 lines
895 B
TypeScript
17 lines
895 B
TypeScript
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 }
|
|
}
|