Replace per-sample transport fee entry with shared freight batch config in storage and donation protocol dialogs, and show mode/amount in view dialogs. Co-authored-by: Cursor <cursoragent@cursor.com>
76 lines
1.8 KiB
TypeScript
76 lines
1.8 KiB
TypeScript
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<SampleFreightItem & { protocolNo?: string }>
|
|
deleted?: boolean
|
|
}
|
|
|
|
type PageList<T> = { list: T[]; total: number; page: number; pageSize: number }
|
|
|
|
export function fetchSampleFreightList(params?: {
|
|
page?: number
|
|
pageSize?: number
|
|
keyword?: string
|
|
}) {
|
|
return request.get<PageList<SampleFreight>>({
|
|
url: '/web/admin/sample-freights',
|
|
params
|
|
})
|
|
}
|
|
|
|
export function fetchSampleFreightDetail(id: string) {
|
|
return request.get<SampleFreight>({ url: `/web/admin/sample-freights/${id}` })
|
|
}
|
|
|
|
export function fetchCreateSampleFreight(data: {
|
|
transportMode: string
|
|
freightAmount: number
|
|
items: SampleFreightItem[]
|
|
}) {
|
|
return request.post<SampleFreight>({
|
|
url: '/web/admin/sample-freights',
|
|
data,
|
|
showSuccessMessage: true
|
|
})
|
|
}
|
|
|
|
export function fetchUpdateSampleFreight(
|
|
id: string,
|
|
data: { transportMode?: string; freightAmount?: number }
|
|
) {
|
|
return request.put<SampleFreight>({
|
|
url: `/web/admin/sample-freights/${id}`,
|
|
data,
|
|
showSuccessMessage: true
|
|
})
|
|
}
|
|
|
|
export function fetchLinkSampleFreight(id: string, items: SampleFreightItem[]) {
|
|
return request.post<SampleFreight>({
|
|
url: `/web/admin/sample-freights/${id}/link`,
|
|
data: { items },
|
|
showSuccessMessage: true
|
|
})
|
|
}
|
|
|
|
export function fetchUnlinkSampleFreight(id: string, items: SampleFreightItem[]) {
|
|
return request.post<SampleFreight>({
|
|
url: `/web/admin/sample-freights/${id}/unlink`,
|
|
data: { items },
|
|
showSuccessMessage: true
|
|
})
|
|
}
|