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 <cursoragent@cursor.com>
This commit is contained in:
1 parent
5b4c1bc991
commit
ab3a90c3f5
5 files changed
+58
-4
No files matched your search
@@ -1120,6 +1120,8 @@ export interface TransportInventoryLink {
|
||||
planNo: string
|
||||
stopType?: 'load' | 'delivery'
|
||||
stopId?: string
|
||||
businessType?: string
|
||||
partnerCompany?: string
|
||||
}
|
||||
|
||||
export interface TransportSiteLink {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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('已复制给司机')
|
||||
|
||||
@@ -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('已复制给司机')
|
||||
|
||||
@@ -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')
|
||||
}
|
||||
Reference in new issue
Block a user