import request from '@/utils/http' export type SampleFreightItem = { sampleSource: 'cell_storage' | 'research_donation' sampleId: string protocolId?: string sampleCode?: string } export type SampleFreight = { id: string transportMode: string transportModeLabel?: string freightAmount: number linkedSampleCount?: number createTime?: string items?: Array deleted?: boolean } type PageList = { list: T[]; total: number; page: number; pageSize: number } export function fetchSampleFreightList(params?: { page?: number pageSize?: number keyword?: string }) { return request.get>({ url: '/web/admin/sample-freights', params }) } export function fetchSampleFreightDetail(id: string) { return request.get({ url: `/web/admin/sample-freights/${id}` }) } export function fetchCreateSampleFreight(data: { transportMode: string freightAmount: number items: SampleFreightItem[] }) { return request.post({ url: '/web/admin/sample-freights', data, showSuccessMessage: true }) } export function fetchUpdateSampleFreight( id: string, data: { transportMode?: string; freightAmount?: number } ) { return request.put({ url: `/web/admin/sample-freights/${id}`, data, showSuccessMessage: true }) } export function fetchLinkSampleFreight(id: string, items: SampleFreightItem[]) { return request.post({ url: `/web/admin/sample-freights/${id}/link`, data: { items }, showSuccessMessage: true }) } export function fetchUnlinkSampleFreight(id: string, items: SampleFreightItem[]) { return request.post({ url: `/web/admin/sample-freights/${id}/unlink`, data: { items }, showSuccessMessage: true }) }