From ab3a90c3f5a61a0fa6a0bdc44dce6d4f5bbd6416 Mon Sep 17 00:00:00 2001 From: wuzilong <704541015@qq.com> Date: Sun, 13 Sep 2026 09:41:41 +0800 Subject: [PATCH] feat(web-admin): append pound QR links in copy-to-driver text Include multi-line public pound QR URLs after the driver link when dibang slips exist. Co-authored-by: Cursor --- web-admin/src/api/pl/index.ts | 2 ++ .../business/pl-plan-view-dialog/index.vue | 2 ++ .../business/pl-plan-view-tabs/index.vue | 13 ++++++-- .../composables/usePlPlanArrangeActions.ts | 13 ++++++-- web-admin/src/utils/pl-driver-summary.ts | 32 +++++++++++++++++++ 5 files changed, 58 insertions(+), 4 deletions(-) diff --git a/web-admin/src/api/pl/index.ts b/web-admin/src/api/pl/index.ts index 795e1fa04..4abcb84a8 100644 --- a/web-admin/src/api/pl/index.ts +++ b/web-admin/src/api/pl/index.ts @@ -1120,6 +1120,8 @@ export interface TransportInventoryLink { planNo: string stopType?: 'load' | 'delivery' stopId?: string + businessType?: string + partnerCompany?: string } export interface TransportSiteLink { diff --git a/web-admin/src/components/business/pl-plan-view-dialog/index.vue b/web-admin/src/components/business/pl-plan-view-dialog/index.vue index b8c01cc52..49ed4001e 100644 --- a/web-admin/src/components/business/pl-plan-view-dialog/index.vue +++ b/web-admin/src/components/business/pl-plan-view-dialog/index.vue @@ -35,6 +35,7 @@ :show-arrange-links="showArrangeActions" :arrange-driver-url="driverUrl" :arrange-site-records="siteRecords" + :arrange-inventory-records="inventoryRecords" :show-archive-io-fields="showArchiveIoFields" :show-archive-price-fields="showArchivePriceFields" :show-inbound-outbound-qty="showInboundOutboundQty" @@ -95,6 +96,7 @@ hasDibangInventoryRecords, driverUrl, siteRecords, + inventoryRecords, qrcodeVisible, selectedInventoryId, selectedInventoryUnit, diff --git a/web-admin/src/components/business/pl-plan-view-tabs/index.vue b/web-admin/src/components/business/pl-plan-view-tabs/index.vue index eae7cecf3..bd46ed76f 100644 --- a/web-admin/src/components/business/pl-plan-view-tabs/index.vue +++ b/web-admin/src/components/business/pl-plan-view-tabs/index.vue @@ -427,6 +427,7 @@ outboundOrderApi, planApi, type PlIoOrder, + type TransportInventoryLink, type TransportSiteLink } from '@/api/pl' import { @@ -462,7 +463,8 @@ } from '@/utils/db-site-summary' import { buildDriverSummaryFromPlan, - buildDriverStopBlocksFromPlan + buildDriverStopBlocksFromPlan, + buildPoundQrcodeLinksFromInventoryRecords } from '@/utils/pl-driver-summary' import { formatPlanProductListText, @@ -487,6 +489,7 @@ showArrangeLinks?: boolean arrangeDriverUrl?: string arrangeSiteRecords?: TransportSiteLink[] + arrangeInventoryRecords?: TransportInventoryLink[] feedbackEditable?: boolean /** 将司机/现场/地磅回传区块镜像渲染到归档左侧等目标节点 */ feedbackMirrorTo?: string | HTMLElement | null @@ -508,6 +511,7 @@ showArrangeLinks: false, arrangeDriverUrl: '', arrangeSiteRecords: () => [], + arrangeInventoryRecords: () => [], feedbackEditable: false, feedbackMirrorTo: null, hideNav: false, @@ -1166,6 +1170,10 @@ return } const getUnitLabel = (unit: string) => dictStore.getLabel('crm_product_unit', unit) || unit + const inventorySource = + props.arrangeInventoryRecords?.length + ? props.arrangeInventoryRecords + : dibangPlanRows.value.map((row) => row.link) const text = buildDriverSummaryFromPlan({ plan: plan.value || undefined, planNo: plan.value?.planNo, @@ -1176,7 +1184,8 @@ driverUrl: url, products: products.value, getUnitLabel, - stopBlocks: buildDriverStopBlocksFromPlan(plan.value, getUnitLabel) + stopBlocks: buildDriverStopBlocksFromPlan(plan.value, getUnitLabel), + poundQrcodeLinks: buildPoundQrcodeLinksFromInventoryRecords(inventorySource) }) await navigator.clipboard.writeText(text) ElMessage.success('已复制给司机') diff --git a/web-admin/src/composables/usePlPlanArrangeActions.ts b/web-admin/src/composables/usePlPlanArrangeActions.ts index 5d0058d9f..00dc1ba42 100644 --- a/web-admin/src/composables/usePlPlanArrangeActions.ts +++ b/web-admin/src/composables/usePlPlanArrangeActions.ts @@ -10,7 +10,11 @@ import DbPoundSlipQrcodeDialog from '@/components/business/db/DbPoundSlipQrcodeD import { useDictStore } from '@/store/modules/dict' import { pickBxData } from '@/utils/http/bx' import { formatPlanProductListText } from '@/utils/pl-display' -import { buildDriverSummaryFromPlan, buildDriverStopBlocksFromPlan } from '@/utils/pl-driver-summary' +import { + buildDriverSummaryFromPlan, + buildDriverStopBlocksFromPlan, + buildPoundQrcodeLinksFromInventoryRecords +} from '@/utils/pl-driver-summary' import { buildSiteSummaryFromInventoryLinks, buildSiteStopBlocksFromPlan } from '@/utils/db-site-summary' export function usePlPlanArrangeActions() { @@ -125,6 +129,7 @@ export function usePlPlanArrangeActions() { destinationNotes?: string licensePlate?: string driverUrl?: string + poundQrcodeLinks?: { label: string; url: string }[] }) { return buildDriverSummaryFromPlan({ plan: plan.value || undefined, @@ -137,7 +142,10 @@ export function usePlPlanArrangeActions() { products: products.value, getUnitLabel, stopBlocks: buildDriverStopBlocksFromPlan(plan.value, getUnitLabel), - ...options + ...options, + poundQrcodeLinks: + options?.poundQrcodeLinks ?? + buildPoundQrcodeLinksFromInventoryRecords(dibangInventoryRecords.value) }) } @@ -194,6 +202,7 @@ export function usePlPlanArrangeActions() { destinationNotes?: string licensePlate?: string driverUrl?: string + poundQrcodeLinks?: { label: string; url: string }[] }) { await navigator.clipboard.writeText(buildPlanSummaryText(options)) ElMessage.success('已复制给司机') diff --git a/web-admin/src/utils/pl-driver-summary.ts b/web-admin/src/utils/pl-driver-summary.ts index fb312b392..399a1691a 100644 --- a/web-admin/src/utils/pl-driver-summary.ts +++ b/web-admin/src/utils/pl-driver-summary.ts @@ -195,6 +195,29 @@ function buildLegacyDriverStopBlocks( return blocks } +export function buildPoundQrcodePublicUrl(inventoryId: string, origin = window.location.origin) { + return `${origin}/#/public/pl/pound-qrcode/${encodeURIComponent(inventoryId)}` +} + +export function buildPoundQrcodeLinksFromInventoryRecords( + records: { + dbInventoryId: string + dbPurchasePlanId?: string + businessType?: string + partnerCompany?: string + }[], + origin = window.location.origin +) { + return records + .filter((r) => r.dbPurchasePlanId?.trim() && r.dbInventoryId?.trim()) + .map((r) => { + const bt = (r.businessType || '').trim() + const pc = (r.partnerCompany || '').trim() + const label = bt && pc ? `${bt} · ${pc}` : bt || pc || '磅单' + return { label, url: buildPoundQrcodePublicUrl(r.dbInventoryId, origin) } + }) +} + export function buildDriverSummaryFromPlan(options: { plan?: DriverSummaryPlan | null planNo?: string @@ -218,6 +241,7 @@ export function buildDriverSummaryFromPlan(options: { destinationNotes?: string startPoint?: string endPoint?: string + poundQrcodeLinks?: { label: string; url: string }[] }) { const plan = options.plan || {} const plate = options.licensePlate || plan.licensePlate || '—' @@ -248,5 +272,13 @@ export function buildDriverSummaryFromPlan(options: { lines.push('') lines.push(`司机链接:${options.driverUrl || '—'}`) + const links = (options.poundQrcodeLinks || []).filter((x) => x?.url) + if (links.length) { + lines.push('') + lines.push('磅单二维码链接:') + for (const item of links) { + lines.push(`${item.label}:${item.url}`) + } + } return lines.join('\n') }