生产/质检入库卡片展示样本状态并支持【样本废弃】;市场 Web 列表与移动市场部卡片补充样本状态及问号查看作废原因;样本表新增 void_desc,人工作废不联动接收但全部作废时自动作废协议(#131)。 Co-authored-by: Cursor <cursoragent@cursor.com>
116 lines
2.8 KiB
TypeScript
116 lines
2.8 KiB
TypeScript
import request from '@/utils/http'
|
||
|
||
export type SampleFreightItem = {
|
||
sampleSource: 'cell_storage' | 'research_donation'
|
||
sampleId: string
|
||
protocolId?: string
|
||
sampleCode?: string
|
||
sampleStatus?: string
|
||
voidDesc?: string
|
||
protocolNo?: string
|
||
sampleTypeName?: string
|
||
motherName?: string
|
||
newbornName?: string
|
||
freightId?: string
|
||
}
|
||
|
||
export type SampleFreight = {
|
||
id: string
|
||
/** 运费批次号,格式 YF+YYYYMMDD+001~999 */
|
||
freightNo?: string
|
||
transportMode: string
|
||
transportModeLabel?: string
|
||
freightAmount: number | null
|
||
waybillNo?: string
|
||
settleStatus?: string
|
||
settleTime?: string
|
||
freightAmountLabel?: string
|
||
linkedSampleCount?: number
|
||
createBy?: string
|
||
createByName?: string
|
||
createTime?: string
|
||
items?: SampleFreightItem[]
|
||
deleted?: boolean
|
||
}
|
||
|
||
type PageList<T> = { list: T[]; total: number; page: number; pageSize: number }
|
||
|
||
export function fetchSampleFreightList(params?: {
|
||
page?: number
|
||
pageSize?: number
|
||
keyword?: string
|
||
transportMode?: string
|
||
sampleSource?: string
|
||
createTimeFrom?: string
|
||
createTimeTo?: string
|
||
includeItems?: boolean
|
||
}) {
|
||
return request.get<PageList<SampleFreight>>({
|
||
url: '/web/admin/sample-freights',
|
||
params
|
||
})
|
||
}
|
||
|
||
export function fetchSampleFreightSampleOptions(params?: {
|
||
page?: number
|
||
pageSize?: number
|
||
keyword?: string
|
||
sampleSource?: string
|
||
}) {
|
||
return request.get<PageList<SampleFreightItem>>({
|
||
url: '/web/admin/sample-freights/sample-options',
|
||
params
|
||
})
|
||
}
|
||
|
||
export function fetchSampleFreightDetail(id: string) {
|
||
return request.get<SampleFreight>({ url: `/web/admin/sample-freights/${id}` })
|
||
}
|
||
|
||
export function fetchCreateSampleFreight(data: {
|
||
transportMode: string
|
||
freightAmount: number | null
|
||
waybillNo?: string
|
||
items: SampleFreightItem[]
|
||
}) {
|
||
return request.post<SampleFreight>({
|
||
url: '/web/admin/sample-freights',
|
||
data,
|
||
showSuccessMessage: true
|
||
})
|
||
}
|
||
|
||
export function fetchUpdateSampleFreight(
|
||
id: string,
|
||
data: { transportMode?: string; freightAmount?: number | null; waybillNo?: string }
|
||
) {
|
||
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
|
||
})
|
||
}
|
||
|
||
export function fetchDeleteSampleFreight(id: string) {
|
||
return request.del<{ id: string; deleted?: boolean; linkedSampleCount?: number }>({
|
||
url: `/web/admin/sample-freights/${id}`,
|
||
showSuccessMessage: true
|
||
})
|
||
}
|