From 5dd545ba5c51213297108fc1a69ef8690c674b29 Mon Sep 17 00:00:00 2001 From: zlwu <704541015@qq.com> Date: Thu, 8 Oct 2026 07:51:56 +0800 Subject: [PATCH] feat(web-admin): wire protocol sample freight batch UI 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 --- web-admin/src/api/sample-freight.ts | 75 +++ .../sample-transport-form-section/index.vue | 546 ++++++++++-------- .../protocol/ProtocolFormDialog.vue | 35 +- .../protocol/ProtocolViewDialog.vue | 112 +++- .../list/DonationFormDialog.vue | 13 +- .../list/DonationViewDialog.vue | 63 +- 6 files changed, 551 insertions(+), 293 deletions(-) create mode 100644 web-admin/src/api/sample-freight.ts 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 }} 个样本(可跨协议共用一笔)。

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