feat(admin): simplify truck payable currency

This commit is contained in:
2026-09-01 10:36:49 +08:00
parent 62a016a2f8
commit 0cf4a93f9c
12 changed files with 74 additions and 30 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
import { http, unwrapApiResponse, type ApiEnvelope } from '@/shared/api/http'
import { TRUCK_APPOINTMENT_SAVE_FIELDS } from '../types'
import { TRUCK_APPOINTMENT_SAVE_FIELDS, normalizeTruckAppointmentCurrency } from '../types'
import type {
SaveTruckAppointmentRequest,
TruckAppointmentPage,
@@ -17,7 +17,7 @@ function operationId(action: string, id: string | number) {
function dtoPayload(payload: SaveTruckAppointmentRequest) {
return Object.fromEntries(TRUCK_APPOINTMENT_SAVE_FIELDS.flatMap((key) => {
const value = payload[key]
const value = key === 'currency' ? normalizeTruckAppointmentCurrency(payload[key]) : payload[key]
return value === undefined ? [] : [[key, value === '' ? null : value]]
})) as unknown as SaveTruckAppointmentRequest
}