diff --git a/web-admin/src/api/sample-freight.ts b/web-admin/src/api/sample-freight.ts new file mode 100644 index 00000000..ca7707ad --- /dev/null +++ b/web-admin/src/api/sample-freight.ts @@ -0,0 +1,75 @@ +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 + }) +} diff --git a/web-admin/src/components/business/sample-transport-form-section/index.vue b/web-admin/src/components/business/sample-transport-form-section/index.vue index 225b7fb8..39cfe1a6 100644 --- a/web-admin/src/components/business/sample-transport-form-section/index.vue +++ b/web-admin/src/components/business/sample-transport-form-section/index.vue @@ -9,9 +9,18 @@ - 配置运输信息 + + 配置运费 + + + + 取消运费关联 @@ -86,25 +95,17 @@ — - - + + - - - - - - - - + + - +

- 将以下运输信息应用到已选中的 {{ selectedSamples.length }} 个样本。 + 将运费应用到已选中的 {{ selectedSamples.length }} 个样本(可跨协议共用一笔)。

- -
- + + 新建运费 + 关联已有 + + +
+ - - - - - - - - + + - -
+
+ + + + + + + + + + + + + + +