feat(waybill): 运单号统一操作组件(复制/二维码/轨迹)并接入全部列表

- 新增 WaybillCodeActions:悬停显示下拉菜单,复制仅走菜单项,取消点击运单号即复制的默认行为
- 新增 WaybillTraceFloat / WaybillTraceWindow / trace-window:轨迹悬浮窗改为全局单例,可拖动、无遮罩、换单号复用并重新拉取
- 新增 WaybillTraceList:轨迹时间线,支持复制轨迹(含运单号)与刷新;运单管理页轨迹标签页改为复用
- 二维码弹窗改为 Teleport+固定层级,避免嵌在表格单元格内层级错乱;z-index 约定见 waybill/z-index.ts(二维码 5000 > 轨迹窗 4000 > EP 弹层 2000+)
- UpperTable 默认渲染接入运单号列识别(waybill-column.ts),并支持 waybillCodes 取值器与多值解析
- 批量替换各处自定义表格的运单号列(送达/复核/工作台/转换弹窗/拆包/退件/波次物流单号等)
- 抽出 utils/clipboard 统一剪贴板降级逻辑

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
liufumingren 2026-11-12 00:34:31 +08:00
parent 3fa899d02d
commit d21839b99d
26 changed files with 1105 additions and 333 deletions

View File

@ -3,6 +3,7 @@ import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
import elementEnLocale from 'element-plus/es/locale/lang/en'
import elementZhLocale from 'element-plus/es/locale/lang/zh-cn'
import WaybillTraceWindow from '@/components/waybill/WaybillTraceWindow.vue'
const { locale } = useI18n()
@ -19,6 +20,8 @@ const currentLocale = computed(() => {
<div id="app">
<router-view />
</div>
<!-- 运单轨迹悬浮窗:全局单例,所有运单号共用 -->
<WaybillTraceWindow />
</el-config-provider>
</template>

View File

@ -1,28 +1,54 @@
<!--
二维码弹窗(运单号 / 快递单号)
与轨迹悬浮窗同一套层级方案:Teleport 到 body + 固定 z-index(见 waybill/z-index.ts)。
不使用 el-dialog —— el-dialog 默认不 append-to-body,嵌在表格单元格内会被表格的
层叠上下文 / overflow 干扰,多弹层叠加时 z-index 也不可控。
-->
<template>
<el-dialog
:model-value="visible"
title="快递单号二维码"
width="380px"
align-center
destroy-on-close
@close="handleClose"
>
<div class="qr-wrapper">
<canvas v-if="resolvedCode" ref="qrCanvasRef" class="qr-canvas" />
<el-empty v-else description="暂无快递单号" :image-size="120" />
<p v-if="resolvedCode" class="qr-code-text">{{ resolvedCode }}</p>
</div>
</el-dialog>
<Teleport to="body">
<transition name="qr-popup">
<div
v-if="visible"
class="qr-popup"
:style="{ zIndex }"
role="dialog"
aria-modal="true"
:aria-label="title"
@click.self="handleClose"
>
<div class="qr-popup__panel">
<header class="qr-popup__header">
<span class="qr-popup__title">{{ title }}</span>
<button type="button" class="qr-popup__close" aria-label="关闭" title="关闭" @click="handleClose">×</button>
</header>
<div class="qr-wrapper">
<canvas v-if="resolvedCode" ref="qrCanvasRef" class="qr-canvas" />
<div v-else class="qr-empty">暂无单号</div>
<p v-if="resolvedCode" class="qr-code-text">{{ resolvedCode }}</p>
</div>
</div>
</div>
</transition>
</Teleport>
</template>
<script setup lang="ts">
import { computed, nextTick, ref, watch } from 'vue'
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
import QRCode from 'qrcode'
import { WAYBILL_QR_Z_INDEX } from '@/components/waybill/z-index'
const props = defineProps<{
const props = withDefaults(defineProps<{
visible: boolean
code?: string | null
}>()
/** 弹窗标题 */
title?: string
/** 弹窗层级:默认高于轨迹悬浮窗,避免被遮挡 */
zIndex?: number
}>(), {
title: '快递单号二维码',
zIndex: WAYBILL_QR_Z_INDEX
})
const emit = defineEmits<{
(e: 'update:visible', value: boolean): void
@ -48,14 +74,80 @@ async function renderQrCode() {
watch(() => [props.visible, resolvedCode.value], () => {
renderQrCode()
}, { immediate: true })
/** Esc 关闭 */
function handleKeydown(event: KeyboardEvent) {
if (event.key === 'Escape' && props.visible) handleClose()
}
onMounted(() => {
window.addEventListener('keydown', handleKeydown)
})
onBeforeUnmount(() => {
window.removeEventListener('keydown', handleKeydown)
})
</script>
<style scoped lang="scss">
.qr-popup {
position: fixed;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
background: rgba(0, 0, 0, 0.45);
}
.qr-popup__panel {
width: 380px;
max-width: calc(100vw - 32px);
background: #fff;
border-radius: 8px;
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
overflow: hidden;
}
.qr-popup__header {
display: flex;
align-items: center;
gap: 8px;
padding: 12px 14px;
border-bottom: 1px solid #ebeef5;
}
.qr-popup__title {
flex: 1;
font-size: 15px;
font-weight: 600;
color: #303133;
}
.qr-popup__close {
flex: 0 0 auto;
width: 22px;
height: 22px;
padding: 0;
border: none;
border-radius: 4px;
background: transparent;
color: #909399;
font-size: 18px;
line-height: 20px;
cursor: pointer;
&:hover {
background: #f0f2f5;
color: #303133;
}
}
.qr-wrapper {
display: flex;
flex-direction: column;
align-items: center;
gap: 10px;
padding: 18px 16px 20px;
}
.qr-canvas {
@ -63,10 +155,26 @@ watch(() => [props.visible, resolvedCode.value], () => {
height: 260px;
}
.qr-empty {
padding: 60px 0;
font-size: 13px;
color: #909399;
}
.qr-code-text {
margin: 0;
color: #606266;
word-break: break-all;
text-align: center;
}
.qr-popup-enter-active,
.qr-popup-leave-active {
transition: opacity 0.15s ease;
}
.qr-popup-enter-from,
.qr-popup-leave-to {
opacity: 0;
}
</style>

View File

@ -103,7 +103,20 @@
</template>
<template v-else>
<slot :name="`column-${column.prop}`" :row="scope.row" :index="scope.$index">
<template v-if="column.copyAction">
<template v-if="isWaybillCodeColumn(column) && !column.template">
<WaybillCodeActions
v-if="getWaybillCellCodes(scope.row, column).length"
:codes="getWaybillCellCodes(scope.row, column)"
:label="column.label || '运单号'"
:collapse="column.copyMultiCollapse === true"
/>
<span
v-else-if="column.formatter"
v-html="getFormattedCell(scope.row, column, scope.row[column.prop], scope.$index)"
></span>
<span v-else style="color:#909399">—</span>
</template>
<template v-else-if="column.copyAction">
<div v-if="getCopyActionCodes(scope.row, column).length" class="click-copy-list">
<template
v-for="(code, codeIndex) in getVisibleCopyActionCodes(scope.row, column)"
@ -379,6 +392,8 @@ import { useExperimentalStore } from '@/stores/modules/experimental'
import { useTableColumnConfigStore } from '@/stores/modules/tableColumnConfig'
import type { ColumnConfigItem, TableColumnProfile } from '@/utils/table-column-config'
import QrcodeDialog from '@/components/QR/qrcode.vue'
import WaybillCodeActions from '@/components/waybill/WaybillCodeActions.vue'
import { isWaybillCodeColumn } from '@/components/waybill/waybill-column'
import SettingsDialog from '@/components/settings/SettingsDialog.vue'
defineOptions({
@ -653,6 +668,8 @@ let renderRowsCache: {
const rowKeyCache = new WeakMap<object, unknown>()
/** 多值单号解析缓存(copyAction 列每单元格会被多次求值) */
const copyCodesCache = new WeakMap<object, Map<string, string[]>>()
/** 运单号列解析缓存(统一操作菜单每单元格会被多次求值) */
const waybillCodesCache = new WeakMap<object, Map<string, string[]>>()
/** 超长文本收起结果的完整文本缓存(避免重复 formatter + 去标签正则) */
const textCollapseCache = new WeakMap<object, Map<string, string>>()
/** 虚拟滚动高度抖动兜底(见 enableFixedRowHeightFallback) */
@ -1247,6 +1264,44 @@ function getCopyActionTitle(column: ColumnItem) {
return `点击复制${column.label || ''}`
}
/** 运单号列取多个单号(waybillCodes 取值器 → copyValue → 字段值按逗号 / JSON 数组拆分) */
function getWaybillCellCodes(row: any, column: ColumnItem): string[] {
const prop = String(column.prop || '')
const cacheable = !!row && typeof row === 'object'
if (cacheable) {
const cached = waybillCodesCache.get(row)?.get(prop)
if (cached) return cached
}
let codes: string[]
if (typeof column.waybillCodes === 'function') {
const result = column.waybillCodes(row)
codes = Array.isArray(result)
? result.map((item: unknown) => String(item ?? '').trim()).filter(Boolean)
: (getCopyableCellText(result) ? [getCopyableCellText(result)] : [])
} else if (typeof column.copyValue === 'function') {
const result = column.copyValue(row)
if (Array.isArray(result)) {
codes = result.map((item) => String(item ?? '').trim()).filter(Boolean)
} else {
const text = getCopyableCellText(result)
codes = text ? [text] : []
}
} else {
codes = parseMultiValueCodes(row?.[prop])
}
if (cacheable) {
let rowCache = waybillCodesCache.get(row)
if (!rowCache) {
rowCache = new Map()
waybillCodesCache.set(row, rowCache)
}
rowCache.set(prop, codes)
}
return codes
}
async function handleCopyActionClick(code: string, column: ColumnItem) {
const label = String(column.label || '内容').trim() || '内容'
await copyCellText(code, label)

View File

@ -0,0 +1,156 @@
<!--
WaybillCodeActions — 运单号统一操作菜单
鼠标移入运单号显示下拉菜单:复制 / 生成二维码 / 查看轨迹。
· 复制:直接写入剪贴板(点击运单号本身也复制)
· 生成二维码:弹窗仅展示运单号与二维码
· 查看轨迹:打开可拖动的悬浮窗(无遮罩、层级最高),按运单号查询轨迹
-->
<template>
<div class="waybill-code-actions">
<template v-for="(code, index) in visibleCodes" :key="`${code}-${index}`">
<el-dropdown
trigger="hover"
placement="bottom-start"
:show-timeout="80"
:hide-timeout="120"
@command="handleCommand($event, code)"
>
<span
class="waybill-code-link"
role="button"
tabindex="0"
:title="`${label}:${code}(悬停操作:复制 / 二维码 / 轨迹)`"
@click.stop
>{{ code }}</span>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="copy" :icon="CopyDocument">复制</el-dropdown-item>
<el-dropdown-item command="qrcode" :icon="FullScreen">生成二维码</el-dropdown-item>
<el-dropdown-item command="trace" :icon="Position">查看轨迹</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
<button
v-if="isMultiValue"
type="button"
class="waybill-code-toggle"
:title="expanded ? '收起' : '展开查看全部'"
@click.stop="expanded = !expanded"
>
{{ expanded ? '收起' : `+${codes.length - 1}` }}
</button>
<span v-if="!visibleCodes.length" class="waybill-code-empty">{{ emptyText }}</span>
<QrcodeDialog v-model:visible="qrVisible" :code="qrCode" title="运单号二维码" />
</div>
</template>
<script setup lang="ts">
import { computed, ref } from 'vue'
import { ElMessage } from 'element-plus'
import { CopyDocument, FullScreen, Position } from '@element-plus/icons-vue'
import QrcodeDialog from '@/components/QR/qrcode.vue'
import { copyText } from '@/utils/clipboard'
import { openTraceWindow } from './trace-window'
defineOptions({ name: 'WaybillCodeActions' })
const props = withDefaults(defineProps<{
/** 运单号(单元格可能含多个:主/子单) */
codes: string[]
/** 字段名,用于复制提示 */
label?: string
/** 多值时是否折叠为「首条 + N」,默认展开全部 */
collapse?: boolean
/** 无运单号时的占位文案 */
emptyText?: string
}>(), {
label: '运单号',
collapse: false,
emptyText: '—'
})
const expanded = ref(false)
const isMultiValue = computed(() => props.collapse && props.codes.length > 1)
const visibleCodes = computed(() => {
if (!isMultiValue.value || expanded.value) return props.codes
return props.codes.slice(0, 1)
})
const qrVisible = ref(false)
const qrCode = ref('')
function copyCode(code: string) {
const text = String(code ?? '').trim()
if (!text) {
ElMessage.warning(`当前行无${props.label}可复制`)
return
}
copyText(text).then((ok) => {
if (ok) ElMessage.success(`${props.label}已复制到剪贴板`)
else ElMessage.error('复制失败,请手动复制')
})
}
function handleCommand(command: string, code: string) {
if (command === 'copy') {
copyCode(code)
return
}
if (command === 'qrcode') {
qrCode.value = String(code ?? '').trim()
qrVisible.value = true
return
}
if (command === 'trace') {
// 全局单例轨迹窗:切换运单号即复用同一个窗口
openTraceWindow(code)
}
}
</script>
<style lang="scss" scoped>
.waybill-code-actions {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 2px 6px;
min-width: 0;
}
.waybill-code-link {
cursor: pointer;
color: #409eff;
border-bottom: 1px dashed transparent;
word-break: break-all;
&:hover,
&:focus-visible {
border-bottom-color: currentColor;
outline: none;
}
}
.waybill-code-toggle {
padding: 0 2px;
border: none;
background: transparent;
color: #909399;
font-size: 12px;
cursor: pointer;
&:hover {
color: #409eff;
}
}
.waybill-code-empty {
color: #909399;
}
</style>

View File

@ -0,0 +1,232 @@
<!--
WaybillTraceFloat — 运单轨迹悬浮窗(可拖动、无遮罩、层级最高)
· 全局单例:由 WaybillTraceWindow 在 App.vue 中挂载一次,列表通过 openTraceWindow() 复用
· Teleport 到 body,z-index 高于 el-dialog / el-dropdown / loading
· 无遮罩层,背景页面仍可操作(不挡背后的操作)
· 按住标题栏拖动,位置自动限制在可视区域内
-->
<template>
<Teleport to="body">
<transition name="waybill-float">
<section
v-if="modelValue"
ref="panelRef"
class="waybill-trace-float"
:style="panelStyle"
role="dialog"
aria-label="运单轨迹"
>
<header class="wb-float-header" @pointerdown="startDrag">
<span class="wb-float-title">运单轨迹</span>
<span class="wb-float-code" :title="waybillCode || ''">{{ waybillCode || '—' }}</span>
<button
type="button"
class="wb-float-close"
aria-label="关闭"
title="关闭"
@pointerdown.stop
@click="close"
>
×
</button>
</header>
<div class="wb-float-body">
<WaybillTraceList :waybill-code="waybillCode" :api-method="apiMethod" />
</div>
</section>
</transition>
</Teleport>
</template>
<script setup lang="ts">
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'
import WaybillTraceList from './WaybillTraceList.vue'
import { WAYBILL_FLOAT_Z_INDEX } from './z-index'
defineOptions({ name: 'WaybillTraceFloat' })
const props = defineProps<{
modelValue: boolean
waybillCode?: string | null
apiMethod?: (params: { waybillCode: string }) => Promise<any>
}>()
const emit = defineEmits<{
(e: 'update:modelValue', value: boolean): void
}>()
/** 面板尺寸:与样式保持一致,用于拖动边界计算 */
const PANEL_WIDTH = 360
const PANEL_HEIGHT = 420
const VIEWPORT_GAP = 12
const panelRef = ref<HTMLElement | null>(null)
const position = ref({ x: 0, y: 0 })
const panelStyle = computed(() => ({
left: `${position.value.x}px`,
top: `${position.value.y}px`,
width: `${PANEL_WIDTH}px`,
height: `${PANEL_HEIGHT}px`,
zIndex: WAYBILL_FLOAT_Z_INDEX
}))
function clampPosition(x: number, y: number) {
const maxX = Math.max(VIEWPORT_GAP, window.innerWidth - PANEL_WIDTH - VIEWPORT_GAP)
const maxY = Math.max(VIEWPORT_GAP, window.innerHeight - PANEL_HEIGHT - VIEWPORT_GAP)
return {
x: Math.min(Math.max(x, VIEWPORT_GAP), maxX),
y: Math.min(Math.max(y, VIEWPORT_GAP), maxY)
}
}
/** 首次打开定位到右侧偏上,避免遮挡列表左侧的操作区 */
function resetPosition() {
const initialX = window.innerWidth - PANEL_WIDTH - VIEWPORT_GAP * 2
position.value = clampPosition(initialX, 96)
}
let dragging = false
function startDrag(event: PointerEvent) {
if (event.button !== 0) return
dragging = true
const startX = event.clientX
const startY = event.clientY
const origin = { ...position.value }
const handleMove = (moveEvent: PointerEvent) => {
if (!dragging) return
moveEvent.preventDefault()
position.value = clampPosition(
origin.x + moveEvent.clientX - startX,
origin.y + moveEvent.clientY - startY
)
}
const handleUp = () => {
dragging = false
window.removeEventListener('pointermove', handleMove)
window.removeEventListener('pointerup', handleUp)
window.removeEventListener('pointercancel', handleUp)
}
window.addEventListener('pointermove', handleMove)
window.addEventListener('pointerup', handleUp)
window.addEventListener('pointercancel', handleUp)
}
function handleResize() {
if (!props.modelValue) return
position.value = clampPosition(position.value.x, position.value.y)
}
function close() {
emit('update:modelValue', false)
}
watch(
() => props.modelValue,
(visible) => {
if (visible) resetPosition()
},
{ immediate: true }
)
/** Esc 关闭(避免遮挡且免去精准点关闭按钮) */
function handleKeydown(event: KeyboardEvent) {
if (event.key === 'Escape' && props.modelValue) close()
}
onMounted(() => {
window.addEventListener('resize', handleResize)
window.addEventListener('keydown', handleKeydown)
})
onBeforeUnmount(() => {
window.removeEventListener('resize', handleResize)
window.removeEventListener('keydown', handleKeydown)
})
</script>
<style lang="scss" scoped>
.waybill-trace-float {
position: fixed;
/* 层级:二维码弹窗(5000) > 本悬浮窗(4000) > el-dialog/el-dropdown(2000+);
具体数值见 ./z-index.ts,避免被盖住或盖住二维码 */
display: flex;
flex-direction: column;
background: #fff;
border: 1px solid #dcdfe6;
border-radius: 8px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
overflow: hidden;
}
.wb-float-header {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 10px;
background: #f5f7fa;
border-bottom: 1px solid #ebeef5;
cursor: move;
user-select: none;
touch-action: none;
}
.wb-float-title {
flex: 0 0 auto;
font-size: 13px;
font-weight: 600;
color: #303133;
}
.wb-float-code {
flex: 1 1 auto;
min-width: 0;
font-size: 12px;
color: #909399;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.wb-float-close {
flex: 0 0 auto;
width: 20px;
height: 20px;
padding: 0;
border: none;
border-radius: 4px;
background: transparent;
color: #909399;
font-size: 16px;
line-height: 18px;
cursor: pointer;
&:hover {
background: #e4e7ed;
color: #303133;
}
}
.wb-float-body {
flex: 1;
min-height: 0;
padding: 8px 10px 10px;
overflow: hidden;
}
.waybill-float-enter-active,
.waybill-float-leave-active {
transition: opacity 0.15s ease, transform 0.15s ease;
}
.waybill-float-enter-from,
.waybill-float-leave-to {
opacity: 0;
transform: translateY(-6px);
}
</style>

View File

@ -0,0 +1,246 @@
<!--
WaybillTraceList — 运单物流轨迹列表(通用)
数据来源:默认走 waybill.warehouse.getTrace(只读、不分页、按操作时间倒序);
页面可通过 apiMethod 覆盖查询实现。
-->
<template>
<div class="waybill-trace-list">
<div class="trace-toolbar">
<span class="trace-count">{{ total > 0 ? `共 ${total} 条` : '物流轨迹' }}</span>
<span class="trace-toolbar-actions">
<el-button
size="small"
link
type="primary"
:disabled="!traceList.length"
@click="copyTrace"
>复制轨迹</el-button>
<el-button size="small" link type="primary" :loading="loading" @click="refresh">刷新</el-button>
</span>
</div>
<div v-if="loading && !traceList.length" class="trace-state">加载中…</div>
<div v-else-if="error" class="trace-state is-error">{{ error }}</div>
<div v-else-if="!traceList.length" class="trace-state">暂无轨迹数据</div>
<div v-else class="trace-timeline">
<div
v-for="(item, index) in traceList"
:key="item.id ?? `${item.op_time}-${index}`"
class="trace-item"
:class="{ 'is-latest': index === 0 }"
>
<div class="trace-dot" />
<div class="trace-content">
<div class="trace-memo">{{ item.memo || item.out_biz_code || '—' }}</div>
<div class="trace-meta">
<span v-if="item.scan_type" class="trace-tag">{{ item.scan_type }}</span>
<span v-if="item.op_org_city_name" class="trace-city">{{ item.op_org_city_name }}</span>
<span class="trace-time">{{ item.op_time || '—' }}</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import { waybillWarehouseGetTrace, type WaybillWarehouseTraceItem } from '@/api/waybill.warehouse'
import { copyText } from '@/utils/clipboard'
defineOptions({ name: 'WaybillTraceList' })
const props = defineProps<{
/** 运单号 */
waybillCode?: string | null
/** 可选的自定义查询实现(默认 waybill.warehouse.getTrace) */
apiMethod?: (params: { waybillCode: string }) => Promise<any>
}>()
const traceList = ref<WaybillWarehouseTraceItem[]>([])
const total = ref(0)
const loading = ref(false)
const error = ref('')
/** 请求序号:运单号切换较快时丢弃过期响应 */
let requestSeq = 0
async function loadTraces() {
const seq = ++requestSeq
const waybillCode = String(props.waybillCode ?? '').trim()
traceList.value = []
total.value = 0
error.value = ''
if (!waybillCode) {
error.value = '缺少运单号,无法查询轨迹'
return
}
loading.value = true
try {
const res = await (props.apiMethod ?? waybillWarehouseGetTrace)({ waybillCode })
if (seq !== requestSeq) return
if (res && (res.code === 1 || res.code === 200)) {
const data = res.data ?? res
const list = Array.isArray(data?.list) ? data.list : []
traceList.value = list
total.value = Number(data?.total ?? list.length) || list.length
} else {
error.value = res?.message || '获取轨迹失败'
}
} catch (e: any) {
if (seq !== requestSeq) return
error.value = e?.message || '获取轨迹失败'
} finally {
if (seq === requestSeq) loading.value = false
}
}
function refresh() {
void loadTraces()
}
/** 轨迹文本:首行带运单号,便于粘贴到聊天/工单中直接对应 */
function buildTraceText(): string {
const waybillCode = String(props.waybillCode ?? '').trim()
const lines = traceList.value.map((item, index) => {
const parts = [item.op_time || '—']
if (item.scan_type) parts.push(`【${item.scan_type}】`)
if (item.op_org_city_name) parts.push(item.op_org_city_name)
parts.push(item.memo || item.out_biz_code || '—')
return `${index + 1}. ${parts.join(' ')}`
})
return [
`运单号:${waybillCode}`,
`共 ${traceList.value.length} 条轨迹`,
...lines
].join('\n')
}
async function copyTrace() {
if (!traceList.value.length) {
ElMessage.warning('当前运单暂无轨迹可复制')
return
}
const ok = await copyText(buildTraceText())
if (ok) {
ElMessage.success('轨迹已复制到剪贴板')
} else {
ElMessage.error('复制失败,请手动复制')
}
}
watch(() => String(props.waybillCode ?? '').trim(), () => {
void loadTraces()
}, { immediate: true })
defineExpose({ refresh, copyTrace })
</script>
<style lang="scss" scoped>
.waybill-trace-list {
display: flex;
flex-direction: column;
min-height: 0;
height: 100%;
}
.trace-toolbar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
padding-bottom: 6px;
border-bottom: 1px solid #f0f2f5;
font-size: 12px;
color: #909399;
}
.trace-toolbar-actions {
display: inline-flex;
align-items: center;
gap: 8px;
}
.trace-state {
padding: 24px 0;
text-align: center;
font-size: 13px;
color: #909399;
&.is-error {
color: #f56c6c;
}
}
.trace-timeline {
position: relative;
padding: 10px 0 0 6px;
overflow: auto;
.trace-item {
position: relative;
padding: 0 0 14px 18px;
border-left: 1px solid #e4e7ed;
&:last-child {
border-left-color: transparent;
padding-bottom: 0;
}
}
.trace-dot {
position: absolute;
left: -4px;
top: 4px;
width: 7px;
height: 7px;
border-radius: 50%;
background: #c0c4cc;
}
.trace-item.is-latest {
.trace-dot {
background: #409eff;
box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.15);
}
.trace-memo {
color: #303133;
font-weight: 600;
}
}
.trace-memo {
font-size: 13px;
line-height: 1.5;
color: #606266;
word-break: break-all;
}
.trace-meta {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
margin-top: 4px;
font-size: 12px;
color: #909399;
}
.trace-tag {
padding: 0 6px;
border-radius: 3px;
background: #f0f2f5;
color: #606266;
line-height: 18px;
}
.trace-time {
font-variant-numeric: tabular-nums;
}
}
</style>

View File

@ -0,0 +1,24 @@
<!--
WaybillTraceWindow — 运单轨迹悬浮窗的全局宿主(单例)
在 App.vue 中挂载一次;列表里的运单号通过 openTraceWindow(code) 打开,
切换运单号时复用同一个窗口并重新拉取轨迹,不会出现多个轨迹窗。
-->
<template>
<WaybillTraceFloat
:model-value="traceWindowState.visible"
:waybill-code="traceWindowState.waybillCode"
@update:model-value="handleVisibleChange"
/>
</template>
<script setup lang="ts">
import WaybillTraceFloat from './WaybillTraceFloat.vue'
import { closeTraceWindow, traceWindowState } from './trace-window'
defineOptions({ name: 'WaybillTraceWindow' })
function handleVisibleChange(visible: boolean) {
if (!visible) closeTraceWindow()
}
</script>

View File

@ -0,0 +1,24 @@
import { reactive } from 'vue'
/**
* 运单轨迹悬浮窗的全局单例状态
*
* 整个应用只挂载一个轨迹窗(见 WaybillTraceWindow,在 App.vue 中挂载),
* 列表里任何运单号都通过 openTraceWindow() 复用它,不会按单元格重复创建窗口。
*/
export const traceWindowState = reactive({
visible: false,
waybillCode: ''
})
/** 打开(或复用)轨迹窗并切换到指定运单号 */
export function openTraceWindow(waybillCode: string) {
const code = String(waybillCode ?? '').trim()
if (!code) return
traceWindowState.waybillCode = code
traceWindowState.visible = true
}
export function closeTraceWindow() {
traceWindowState.visible = false
}

View File

@ -0,0 +1,64 @@
/**
* 运单号列识别(列表通用)
*
* 用于 UpperTable 等列表组件判断某列是否为「运单号」,从而挂载统一操作菜单
* (复制 / 生成二维码 / 查看轨迹)。
*
* 识别规则:
* 1. 列上显式 waybillActions: true / false 优先;
* 2. 其余按 prop 命中常见运单号字段名,或 label 含「运单号 / 快递单号 / 面单号」判定。
*/
const WAYBILL_PROP_RE =
/^(waybill(_codes?|_nos?)?|main_waybill_code|express_codes|express_numbers)$/i
const WAYBILL_LABEL_RE = /运单号|快递单号|面单号|物流单号/
export interface WaybillColumnLike {
prop?: string
label?: string
/** 显式开关:false 关闭(如该列虽叫运单号但非真实运单号) */
waybillActions?: boolean
}
export function isWaybillCodeColumn(column?: WaybillColumnLike | null): boolean {
if (!column) return false
if (column.waybillActions === false) return false
if (column.waybillActions === true) return true
const prop = String(column.prop ?? '').trim()
if (prop && WAYBILL_PROP_RE.test(prop)) return true
return WAYBILL_LABEL_RE.test(String(column.label ?? ''))
}
/**
* 把单元格原始运单号值解析为单号数组。
*
* 兼容:数组、JSON 数组字符串、逗号/中文逗号/分号/换行分隔的字符串。
*/
export function toWaybillCodes(value: unknown): string[] {
if (value === undefined || value === null) return []
if (Array.isArray(value)) {
return value.map((item) => String(item ?? '').trim()).filter(Boolean)
}
const text = String(value).trim()
if (!text) return []
if (text.startsWith('[') && text.endsWith(']')) {
try {
const parsed = JSON.parse(text)
if (Array.isArray(parsed)) {
return parsed.map((item) => String(item ?? '').trim()).filter(Boolean)
}
} catch {
// 非法 JSON:按分隔符继续解析
}
}
return text
.split(/[,,;;\r\n\t]+/)
.map((item) => item.trim())
.filter(Boolean)
}

View File

@ -0,0 +1,11 @@
/**
* 运单号相关浮层的层级约定
*
* Element Plus 弹层默认从 2000 起自增(dialog / dropdown / message),
* 因此这里用固定区间,保证:
* 二维码弹窗(5000) > 轨迹悬浮窗(4000) > 其它 EP 弹层(2000+)
* 避免「先打开轨迹窗、再打开二维码」时二维码被悬浮窗盖住。
*/
export const WAYBILL_FLOAT_Z_INDEX = 4000
export const WAYBILL_QR_Z_INDEX = 5000

33
src/utils/clipboard.ts Normal file
View File

@ -0,0 +1,33 @@
/**
* 剪贴板工具(统一下载/降级逻辑)
*
* 优先使用 navigator.clipboard;不可用时降级为隐藏 textarea + execCommand。
*/
export async function copyText(text: string): Promise<boolean> {
const value = String(text ?? '')
if (!value) return false
try {
if (navigator.clipboard?.writeText) {
await navigator.clipboard.writeText(value)
return true
}
} catch {
// 降级处理
}
try {
const textarea = document.createElement('textarea')
textarea.value = value
textarea.setAttribute('readonly', 'readonly')
textarea.style.position = 'fixed'
textarea.style.left = '-9999px'
document.body.appendChild(textarea)
textarea.select()
const ok = document.execCommand('copy')
document.body.removeChild(textarea)
return ok
} catch {
return false
}
}

View File

@ -1,4 +1,4 @@
<template>
<template>
<div class="order-sub-container">
<scan-box
ref="scanBox"
@ -100,13 +100,11 @@
<el-descriptions title="登记信息" :column="3" border size="small" class="detail-section">
<el-descriptions-item label="登记ID">{{ detailData.record?.id ?? '-' }}</el-descriptions-item>
<el-descriptions-item label="退回运单号">
<span
<WaybillCodeActions
v-if="detailData.record?.waybill_code"
class="waybill-copyable"
role="button"
title="点击复制"
@click="copyWaybillCode(detailData.record.waybill_code)"
>{{ detailData.record.waybill_code }}</span>
:codes="toWaybillCodes(detailData.record.waybill_code)"
label="退回运单号"
/>
<span v-else>-</span>
</el-descriptions-item>
<el-descriptions-item label="扫描日期">{{ formatTime(detailData.record?.scan_date) }}</el-descriptions-item>
@ -180,6 +178,8 @@
import { computed, onMounted, reactive, ref, watch } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { returnReceivedList, returnReceivedDetail, returnReceivedDelete, returnReceivedExport, returnReceivedExportTaskProgress } from '@/api/returnreceived'
import WaybillCodeActions from '@/components/waybill/WaybillCodeActions.vue'
import { toWaybillCodes } from '@/components/waybill/waybill-column'
import { loadStores } from '@/api/index/index'
import { extractStoreListFromResponse, fillStoreScanFieldOptions } from '@/utils/storeScanOptions'
import { getStatusTextClass } from '@/utils/statusText'
@ -224,36 +224,6 @@ function formatFlag(val: any): string {
return val == null || val === '' ? '-' : String(val)
}
async function copyWaybillCode(text: string) {
if (!text) {
ElMessage.warning('当前无退回收件运单号可复制')
return
}
try {
if (navigator.clipboard?.writeText) {
await navigator.clipboard.writeText(text)
} else {
throw new Error('no clipboard api')
}
ElMessage.success('退回收件运单号已复制到剪贴板')
} catch {
try {
const textarea = document.createElement('textarea')
textarea.value = text
textarea.setAttribute('readonly', 'readonly')
textarea.style.position = 'fixed'
textarea.style.left = '-9999px'
document.body.appendChild(textarea)
textarea.select()
document.execCommand('copy')
document.body.removeChild(textarea)
ElMessage.success('退回收件运单号已复制到剪贴板')
} catch {
ElMessage.error('复制失败,请手动复制')
}
}
}
// ==================== 配置 ====================
const availableFields = returnReceivedAvailableFields
@ -717,16 +687,6 @@ watch(
}
}
.waybill-copyable {
cursor: pointer;
color: #409eff;
user-select: none;
&:hover {
text-decoration: underline;
}
}
.empty-tip {
color: #909399;
font-size: 13px;

View File

@ -165,13 +165,11 @@
<span v-else>-</span>
</el-descriptions-item>
<el-descriptions-item label="退回运单号">
<span
<WaybillCodeActions
v-if="detailRecord.waybill_code"
class="copyable"
role="button"
title="点击复制"
@click="copyText(detailRecord.waybill_code)"
>{{ detailRecord.waybill_code }}</span>
:codes="toWaybillCodes(detailRecord.waybill_code)"
label="退回运单号"
/>
<span v-else>-</span>
</el-descriptions-item>
<el-descriptions-item label="拆包状态">
@ -365,6 +363,8 @@ import type { ToolbarButtonConfig } from '@/components/ToolbarButtonGroup/types'
import { returnUnpackAvailableFields, returnUnpackColumns, returnUnpackToolbarButtons } from './returnUnpack-config'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import WaybillCodeActions from '@/components/waybill/WaybillCodeActions.vue'
import { toWaybillCodes } from '@/components/waybill/waybill-column'
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
import UnpackDetailTable from './components/UnpackDetailTable.vue'

View File

@ -445,7 +445,11 @@
>
<el-table-column prop="id" label="ID" width="80" />
<el-table-column prop="unpack_no" label="拆包单号" min-width="150" show-overflow-tooltip />
<el-table-column prop="waybill_code" label="运单号" min-width="140" show-overflow-tooltip />
<el-table-column prop="waybill_code" label="运单号" min-width="140">
<template #default="{ row }">
<WaybillCodeActions :codes="toWaybillCodes(row.waybill_code)" />
</template>
</el-table-column>
<el-table-column prop="status" label="状态" width="90">
<template #default="{ row }">
<el-tag :type="row.status === 'unpacking' ? 'warning' : row.status === 'completed' ? 'success' : 'info'" size="small">
@ -669,6 +673,8 @@ import CameraLivePreview, { type CameraLiveItem } from './CameraLivePreview.vue'
import JsBarcode from 'jsbarcode'
import { CMD, CMD_LABEL, CMD_TAG_TYPE, SCAN_COMMANDS, resolveScanCommand, type ScanCommand } from './scan-commands'
import StockPickerDialog from '@/views/express/returnUnpack/components/StockPickerDialog.vue'
import WaybillCodeActions from '@/components/waybill/WaybillCodeActions.vue'
import { toWaybillCodes } from '@/components/waybill/waybill-column'
import { queryStockProducts, mapStockPickerItem, getStockStoreId } from '@/views/stock/utils/stockPickerHelpers'
import { orderDetail, orderList } from '@/api/order.index/orderindex'
import { parseOrderDetailPayload, normalizeOrderDetailItems } from '@/views/order/shared/orderListExport'

View File

@ -138,13 +138,10 @@
<el-descriptions v-if="detailRecord" title="登记信息" :column="2" border size="small">
<el-descriptions-item label="登记ID">{{ detailRecord.id ?? '-' }}</el-descriptions-item>
<el-descriptions-item label="运单号">
<span
<WaybillCodeActions
v-if="detailRecord.waybill_code"
class="copyable"
role="button"
title="点击复制"
@click="copyText(detailRecord.waybill_code)"
>{{ detailRecord.waybill_code }}</span>
:codes="toWaybillCodes(detailRecord.waybill_code)"
/>
<span v-else>-</span>
</el-descriptions-item>
<el-descriptions-item label="货主ID">{{ detailRecord.store_id ?? '-' }}</el-descriptions-item>
@ -303,6 +300,8 @@ import {
returnWaybillDelete,
} from '@/api/returnwaybill'
import { loadStores } from '@/api/index/index'
import WaybillCodeActions from '@/components/waybill/WaybillCodeActions.vue'
import { toWaybillCodes } from '@/components/waybill/waybill-column'
import { extractStoreListFromResponse, mapStoreListToSelectOptions, fillStoreScanFieldOptions } from '@/utils/storeScanOptions'
import { getStatusTextClass } from '@/utils/statusText'
import type { ToolbarButtonConfig } from '@/components/ToolbarButtonGroup/types'
@ -324,36 +323,6 @@ function isOk(res: any): boolean {
return Boolean(res && (res.code === 1 || res.code === 200 || res.code === 20000))
}
async function copyText(text: string) {
if (!text) {
ElMessage.warning('无可复制内容')
return
}
try {
if (navigator.clipboard?.writeText) {
await navigator.clipboard.writeText(text)
} else {
throw new Error('no clipboard api')
}
ElMessage.success('已复制到剪贴板')
} catch {
try {
const textarea = document.createElement('textarea')
textarea.value = text
textarea.setAttribute('readonly', 'readonly')
textarea.style.position = 'fixed'
textarea.style.left = '-9999px'
document.body.appendChild(textarea)
textarea.select()
document.execCommand('copy')
document.body.removeChild(textarea)
ElMessage.success('已复制到剪贴板')
} catch {
ElMessage.error('复制失败,请手动复制')
}
}
}
// ==================== 配置 ====================
const availableFields = returnWaybillAvailableFields
@ -769,15 +738,6 @@ onMounted(() => {
.detail-content {
min-height: 120px;
.copyable {
cursor: pointer;
color: #409eff;
&:hover {
text-decoration: underline;
}
}
}
/* 编辑未退登记:面板结构 / 尺寸对齐「手工录入运单号」(ManualWaybillForm) */

View File

@ -62,11 +62,15 @@
<el-table-column label="运单ID" width="100" align="center">
<template #default="{ row }">{{ row.waybill_id ?? '-' }}</template>
</el-table-column>
<el-table-column label="运单号" min-width="170" align="center" show-overflow-tooltip>
<template #default="{ row }">{{ row.waybill_code || '-' }}</template>
<el-table-column label="运单号" min-width="170" align="center">
<template #default="{ row }">
<WaybillCodeActions :codes="toWaybillCodes(row.waybill_code)" />
</template>
</el-table-column>
<el-table-column label="主单号" min-width="170" align="center" show-overflow-tooltip>
<template #default="{ row }">{{ row.main_waybill_code || '-' }}</template>
<el-table-column label="主单号" min-width="170" align="center">
<template #default="{ row }">
<WaybillCodeActions :codes="toWaybillCodes(row.main_waybill_code)" label="主单号" />
</template>
</el-table-column>
<el-table-column label="业务键" width="90" align="center">
<template #default="{ row }">{{ row.business_key ?? '-' }}</template>
@ -101,7 +105,11 @@
<el-tab-pane :label="`成功 (${successList.length})`" name="success">
<el-table :data="successList" size="small" border max-height="220" empty-text="无">
<el-table-column prop="waybill_id" label="运单ID" width="100" align="center" />
<el-table-column prop="waybill_code" label="退回运单号" min-width="170" align="center" show-overflow-tooltip />
<el-table-column prop="waybill_code" label="退回运单号" min-width="170" align="center">
<template #default="{ row }">
<WaybillCodeActions :codes="toWaybillCodes(row.waybill_code)" label="退回运单号" />
</template>
</el-table-column>
<el-table-column prop="unpack_id" label="拆包单ID" width="100" align="center" />
<el-table-column prop="unpack_no" label="拆包单号" min-width="170" align="center" show-overflow-tooltip />
<el-table-column prop="detail_count" label="明细行数" width="95" align="center" />
@ -123,8 +131,10 @@
<el-table-column label="运单ID" width="100" align="center">
<template #default="{ row }">{{ row.waybill_id ?? '-' }}</template>
</el-table-column>
<el-table-column label="退回运单号" min-width="170" align="center" show-overflow-tooltip>
<template #default="{ row }">{{ row.waybill_code || '-' }}</template>
<el-table-column label="退回运单号" min-width="170" align="center">
<template #default="{ row }">
<WaybillCodeActions :codes="toWaybillCodes(row.waybill_code)" label="退回运单号" />
</template>
</el-table-column>
<el-table-column prop="reason" label="失败原因" min-width="260" align="center" show-overflow-tooltip />
</el-table>
@ -162,6 +172,8 @@
import { computed, ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import SelectedTags from '@/components/task-progress/SelectedTags.vue'
import WaybillCodeActions from '@/components/waybill/WaybillCodeActions.vue'
import { toWaybillCodes } from '@/components/waybill/waybill-column'
import { returnUnpackTransferByWaybills } from '@/api/returnunpack'
import type {
ReturnUnpackTransferByWaybillsResponse,

View File

@ -1,140 +1,46 @@
<!--
TracePanel — 运单物流轨迹面板
TracePanel — 运单物流轨迹面板(运单管理页底部「轨迹」标签页)
数据来源:waybill.warehouse.getTrace(只读,返回已落库的全部轨迹,不分页,按操作时间倒序)。
取数入参:当前行的运单号(waybill_code / waybillCode)。
轨迹渲染复用通用组件 WaybillTraceList(waybill.warehouse.getTrace)。
-->
<template>
<div class="trace-panel">
<div class="section-title">
<span>物流轨迹</span>
<span v-if="total > 0" class="trace-count">共 {{ total }} 条</span>
<el-button
class="trace-refresh"
size="small"
link
type="primary"
:loading="loading"
@click="refresh"
>
刷新
</el-button>
</div>
<div v-if="loading" class="empty-tip">加载中…</div>
<div v-else-if="error" class="empty-tip">{{ error }}</div>
<div v-else-if="!traceList.length" class="empty-tip">暂无轨迹数据</div>
<div v-else class="trace-timeline">
<div
v-for="(item, index) in traceList"
:key="item.id ?? `${item.op_time}-${index}`"
class="trace-item"
:class="{ 'is-latest': index === 0 }"
>
<div class="trace-dot" />
<div class="trace-content">
<div class="trace-memo">{{ item.memo || item.out_biz_code || '—' }}</div>
<div class="trace-meta">
<span v-if="item.scan_type" class="trace-tag">{{ item.scan_type }}</span>
<span v-if="item.op_org_city_name" class="trace-city">{{ item.op_org_city_name }}</span>
<span class="trace-time">{{ item.op_time || '—' }}</span>
</div>
</div>
</div>
</div>
<div class="section-title">物流轨迹</div>
<WaybillTraceList :waybill-code="waybillCode" :api-method="apiMethod" />
</div>
</template>
<script setup lang="ts">
import { ref, watch } from 'vue'
import type { WaybillWarehouseTraceItem } from '@/api/waybill.warehouse'
import { computed } from 'vue'
import WaybillTraceList from '@/components/waybill/WaybillTraceList.vue'
defineOptions({ name: 'TracePanel', inheritAttrs: false })
const props = defineProps<{
/** 当前选中行数据(取其中的运单号查询轨迹) */
row: Record<string, any> | null
/** 轨迹查询接口(waybill.warehouse.getTrace) */
apiMethod?: (...args: any[]) => Promise<any>
/** 轨迹查询接口(默认 waybill.warehouse.getTrace) */
apiMethod?: (params: { waybillCode: string }) => Promise<any>
}>()
const traceList = ref<WaybillWarehouseTraceItem[]>([])
const total = ref(0)
const loading = ref(false)
const error = ref('')
/** 请求序号:行切换较快时丢弃过期响应 */
let requestSeq = 0
function resolveWaybillCode(row: Record<string, any> | null): string {
return String(row?.waybill_code ?? row?.waybillCode ?? '').trim()
}
async function loadTraces(row: Record<string, any> | null) {
const seq = ++requestSeq
traceList.value = []
total.value = 0
error.value = ''
if (!row) return
const waybillCode = resolveWaybillCode(row)
if (!waybillCode) {
error.value = '缺少运单号,无法查询轨迹'
return
}
const apiMethod = props.apiMethod
if (!apiMethod) {
error.value = '轨迹接口未配置'
return
}
loading.value = true
try {
const res = await apiMethod({ waybillCode })
if (seq !== requestSeq) return
if (res && (res.code === 1 || res.code === 200)) {
const data = res.data ?? res
const list = Array.isArray(data?.list) ? data.list : []
traceList.value = list
total.value = Number(data?.total ?? list.length) || list.length
} else {
error.value = res?.message || '获取轨迹失败'
}
} catch (e: any) {
if (seq !== requestSeq) return
error.value = e?.message || '获取轨迹失败'
} finally {
if (seq === requestSeq) loading.value = false
}
}
watch(
() => resolveWaybillCode(props.row) || null,
() => {
void loadTraces(props.row)
},
{ immediate: true }
const waybillCode = computed(() =>
String(props.row?.waybill_code ?? props.row?.waybillCode ?? '').trim()
)
function refresh() {
void loadTraces(props.row)
}
</script>
<style lang="scss" scoped>
.trace-panel {
height: 100%;
overflow-y: auto;
overflow: hidden;
padding: 6px 10px 8px;
box-sizing: border-box;
display: flex;
flex-direction: column;
.section-title {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 10px;
flex: 0 0 auto;
margin-bottom: 8px;
padding-left: 8px;
border-left: 3px solid #409eff;
line-height: 1.4;
@ -143,90 +49,9 @@ function refresh() {
color: #303133;
}
.trace-count {
font-weight: 400;
font-size: 12px;
color: #909399;
}
.trace-refresh {
margin-left: auto;
font-size: 12px;
font-weight: 400;
}
.empty-tip {
padding: 40px 0;
text-align: center;
font-size: 13px;
color: #909399;
}
}
.trace-timeline {
position: relative;
padding-left: 6px;
.trace-item {
position: relative;
padding: 0 0 14px 18px;
border-left: 1px solid #e4e7ed;
&:last-child {
border-left-color: transparent;
padding-bottom: 0;
}
}
.trace-dot {
position: absolute;
left: -4px;
top: 4px;
width: 7px;
height: 7px;
border-radius: 50%;
background: #c0c4cc;
}
.trace-item.is-latest {
.trace-dot {
background: #409eff;
box-shadow: 0 0 0 3px rgba(64, 158, 255, 0.15);
}
.trace-memo {
color: #303133;
font-weight: 600;
}
}
.trace-memo {
font-size: 13px;
line-height: 1.5;
color: #606266;
word-break: break-all;
}
.trace-meta {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
margin-top: 4px;
font-size: 12px;
color: #909399;
}
.trace-tag {
padding: 0 6px;
border-radius: 3px;
background: #f0f2f5;
color: #606266;
line-height: 18px;
}
.trace-time {
font-variant-numeric: tabular-nums;
:deep(.waybill-trace-list) {
flex: 1;
min-height: 0;
}
}
</style>

View File

@ -8,10 +8,12 @@
</div>
<el-table :data="expressRows" border stripe size="small" empty-text="暂无运单信息" align="center">
<el-table-column prop="waybill_code" label="运单号" min-width="160" align="center" show-overflow-tooltip>
<el-table-column prop="waybill_code" label="运单号" min-width="160" align="center">
<template #default="{ row }">
<span>{{ row.waybill_code }}</span>
<el-tag v-if="row.is_main" size="small" type="danger" effect="dark" style="margin-left:4px">主</el-tag>
<div class="express-waybill-cell">
<WaybillCodeActions :codes="toWaybillCodes(row.waybill_code)" />
<el-tag v-if="row.is_main" size="small" type="danger" effect="dark" style="margin-left:4px">主</el-tag>
</div>
</template>
</el-table-column>
<el-table-column prop="logistics_name" label="物流公司" min-width="120" align="center" show-overflow-tooltip />
@ -117,6 +119,8 @@ import { orderDetail, orderUpdateExpressWeighingWeight } from '@/api/order.index
import { interceptScan } from '@/api/order.recheckorder/recheckOrder'
import { isOrderIndexApiSuccess, parseOrderDetailPayload, normalizeOrderExpressList } from '@/views/order/shared/orderListExport'
import BindPackageMaterialByWaybillDialog from './BindPackageMaterialByWaybillDialog.vue'
import WaybillCodeActions from '@/components/waybill/WaybillCodeActions.vue'
import { toWaybillCodes } from '@/components/waybill/waybill-column'
const props = defineProps<{
row: Record<string, any> | null

View File

@ -56,8 +56,10 @@
<el-table-column label="发货单号" min-width="170" align="center" show-overflow-tooltip>
<template #default="{ row }">{{ row.delivery_order_code || '-' }}</template>
</el-table-column>
<el-table-column label="运单号" min-width="170" align="center" show-overflow-tooltip>
<template #default="{ row }">{{ row.waybill_codes || '-' }}</template>
<el-table-column label="运单号" min-width="170" align="center">
<template #default="{ row }">
<WaybillCodeActions :codes="toWaybillCodes(row.waybill_codes)" />
</template>
</el-table-column>
<el-table-column label="拦截状态" width="130" align="center">
<template #default="{ row }">{{ row.intercept_status_label }}</template>
@ -132,7 +134,11 @@
<div class="task-panel__table-wrap">
<el-table :data="successList" size="small" border max-height="200" empty-text="无">
<el-table-column prop="order_id" label="订单ID" width="100" align="center" />
<el-table-column prop="waybill_code" label="运单号" min-width="170" show-overflow-tooltip />
<el-table-column prop="waybill_code" label="运单号" min-width="170">
<template #default="{ row }">
<WaybillCodeActions :codes="toWaybillCodes(row.waybill_code)" />
</template>
</el-table-column>
<el-table-column prop="unpack_id" label="拆包单ID" width="100" align="center" />
<el-table-column prop="unpack_no" label="拆包单号" min-width="170" show-overflow-tooltip />
<el-table-column prop="detail_count" label="明细行数" width="95" align="center" />
@ -209,6 +215,8 @@
import { computed, ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import SelectedTags from '@/components/task-progress/SelectedTags.vue'
import WaybillCodeActions from '@/components/waybill/WaybillCodeActions.vue'
import { toWaybillCodes } from '@/components/waybill/waybill-column'
import { returnUnpackTransferByOrders } from '@/api/returnunpack'
import type {
ReturnUnpackTransferByOrdersResponse,

View File

@ -41,7 +41,11 @@
<div v-if="showOrderSummary" class="detail-section">
<div class="section-title">运单信息</div>
<el-table :data="expresses" border stripe size="small" empty-text="暂无运单信息">
<el-table-column prop="waybill_code" label="运单号" min-width="180" show-overflow-tooltip />
<el-table-column prop="waybill_code" label="运单号" min-width="180">
<template #default="{ row }">
<WaybillCodeActions :codes="toWaybillCodes(row.waybill_code)" />
</template>
</el-table-column>
<el-table-column prop="logistics_name" label="物流公司" min-width="140" show-overflow-tooltip />
<el-table-column label="称重(g)" width="100" align="right">
<template #default="{ row }">
@ -67,6 +71,8 @@
import { computed, ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import { orderDetail } from '@/api/order.index/orderindex'
import WaybillCodeActions from '@/components/waybill/WaybillCodeActions.vue'
import { toWaybillCodes } from '@/components/waybill/waybill-column'
import { isOrderIndexApiSuccess, parseOrderDetailPayload, normalizeOrderDetailItems, normalizeOrderExpressList, normalizeOrderWaybillCodes } from '@/views/order/shared/orderListExport'
const props = defineProps<{

View File

@ -271,7 +271,11 @@
@selection-change="onSubWaybillSelectChange"
>
<el-table-column type="selection" width="48" align="center" />
<el-table-column prop="waybill_code" label="运单号" min-width="190" align="center" show-overflow-tooltip />
<el-table-column prop="waybill_code" label="运单号" min-width="190" align="center">
<template #default="{ row }">
<WaybillCodeActions :codes="toWaybillCodes(row.waybill_code)" />
</template>
</el-table-column>
<el-table-column label="类型" width="80" align="center">
<template #default="{ row }">
<span :class="row.is_main ? 'ut-status-text ut-status-text--info' : 'ut-status-text ut-status-text--success'">
@ -374,6 +378,8 @@ import PendingOrderDetailPanel from './component/PendingOrderDetailPanel.vue'
import OrderItemsDetailPanel from './component/OrderItemsDetailPanel.vue'
import OrderDetailDisplayToggle, { type OrderDetailDisplayMode } from './component/OrderDetailDisplayToggle.vue'
import ExpressWaybillPanel from './component/ExpressWaybillPanel.vue'
import WaybillCodeActions from '@/components/waybill/WaybillCodeActions.vue'
import { toWaybillCodes } from '@/components/waybill/waybill-column'
import log from './component/log.vue'
import OrderExportProgressDialog from '@/views/order/shared/component/OrderExportProgressDialog.vue'
import OrderExportColumnsDialog from './component/OrderExportColumnsDialog.vue'

View File

@ -79,14 +79,22 @@
<el-tab-pane :label="`成功 (${result.success.length})`" name="success">
<el-table :data="normalizeResultRows(result.success)" border size="small" max-height="220" empty-text="无">
<el-table-column prop="order_id" label="订单 ID" width="100" align="center" />
<el-table-column prop="waybill_no" label="运单号" min-width="140" align="center" show-overflow-tooltip />
<el-table-column prop="waybill_no" label="运单号" min-width="140" align="center">
<template #default="{ row }">
<WaybillCodeActions :codes="toWaybillCodes(row.waybill_no)" />
</template>
</el-table-column>
<el-table-column prop="message" label="说明" min-width="160" align="center" show-overflow-tooltip />
</el-table>
</el-tab-pane>
<el-tab-pane :label="`失败 (${result.failed.length})`" name="failed">
<el-table :data="normalizeResultRows(result.failed)" border size="small" max-height="220" empty-text="无">
<el-table-column prop="order_id" label="订单 ID" width="100" align="center" />
<el-table-column prop="waybill_no" label="运单号" min-width="140" align="center" show-overflow-tooltip />
<el-table-column prop="waybill_no" label="运单号" min-width="140" align="center">
<template #default="{ row }">
<WaybillCodeActions :codes="toWaybillCodes(row.waybill_no)" />
</template>
</el-table-column>
<el-table-column prop="reason" label="原因" min-width="180" align="center" show-overflow-tooltip />
<el-table-column prop="message" label="说明" min-width="160" align="center" show-overflow-tooltip />
</el-table>
@ -111,6 +119,8 @@ import { computed, reactive, ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import type { FormInstance, FormRules } from 'element-plus'
import SelectedTags from '@/components/task-progress/SelectedTags.vue'
import WaybillCodeActions from '@/components/waybill/WaybillCodeActions.vue'
import { toWaybillCodes } from '@/components/waybill/waybill-column'
import {
batchQuickRecheck,
type BatchQuickRecheckResponse

View File

@ -50,14 +50,22 @@
<el-tab-pane :label="`成功 (${result.success.length})`" name="success">
<el-table :data="normalizeResultRows(result.success)" border size="small" max-height="220" empty-text="无">
<el-table-column prop="order_id" label="订单 ID" width="100" />
<el-table-column prop="waybill_no" label="运单号" min-width="140" show-overflow-tooltip />
<el-table-column prop="waybill_no" label="运单号" min-width="140">
<template #default="{ row }">
<WaybillCodeActions :codes="toWaybillCodes(row.waybill_no)" />
</template>
</el-table-column>
<el-table-column prop="message" label="说明" min-width="160" show-overflow-tooltip />
</el-table>
</el-tab-pane>
<el-tab-pane :label="`失败 (${result.failed.length})`" name="failed">
<el-table :data="normalizeResultRows(result.failed)" border size="small" max-height="220" empty-text="无">
<el-table-column prop="order_id" label="订单 ID" width="100" />
<el-table-column prop="waybill_no" label="运单号" min-width="140" show-overflow-tooltip />
<el-table-column prop="waybill_no" label="运单号" min-width="140">
<template #default="{ row }">
<WaybillCodeActions :codes="toWaybillCodes(row.waybill_no)" />
</template>
</el-table-column>
<el-table-column prop="reason" label="原因" min-width="180" show-overflow-tooltip />
<el-table-column prop="message" label="说明" min-width="160" show-overflow-tooltip />
</el-table>
@ -75,6 +83,8 @@
<script setup lang="ts">
import { computed, reactive, ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import WaybillCodeActions from '@/components/waybill/WaybillCodeActions.vue'
import { toWaybillCodes } from '@/components/waybill/waybill-column'
import type { FormInstance, FormRules } from 'element-plus'
import {
batchQuickRecheck,

View File

@ -154,7 +154,9 @@
</template>
<template #column-waybill_no="{ row }">
<span class="order-waybill-text">{{ row.waybill_no || '—' }}</span>
<div class="order-waybill-text">
<WaybillCodeActions :codes="toWaybillCodes(row.waybill_no)" />
</div>
</template>
<template #column-recheck_status="{ row }">
@ -303,6 +305,8 @@ import type { ToolbarButtonConfig } from '@/components/ToolbarButtonGroup/types'
import { getStatusTextClass } from '@/utils/statusText'
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
import BatchQuickRecheckDialog from './component/BatchQuickRecheckDialog.vue'
import WaybillCodeActions from '@/components/waybill/WaybillCodeActions.vue'
import { toWaybillCodes } from '@/components/waybill/waybill-column'
import RecheckOrderSingleListForm from './form/RecheckOrderSingleListForm.vue'
import * as stationApi from '@/api/print/print'
import { getOrderPrintData } from '@/api/order.print/orderprint'

View File

@ -483,9 +483,12 @@
{{ row.delivery_no || row.delivery_order_code || row.order_sn || '—' }}
</template>
</el-table-column>
<el-table-column label="物流单号" min-width="160" show-overflow-tooltip>
<el-table-column label="物流单号" min-width="160">
<template #default="{ row }">
{{ row.tracking_no || row.tracking_number || '—' }}
<WaybillCodeActions
:codes="toWaybillCodes(row.tracking_no || row.tracking_number)"
label="物流单号"
/>
</template>
</el-table-column>
<el-table-column label="店铺" min-width="140" show-overflow-tooltip>
@ -919,6 +922,8 @@ import { useRoute, useRouter } from 'vue-router'
import { ElMessage, ElMessageBox } from 'element-plus'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import WaybillCodeActions from '@/components/waybill/WaybillCodeActions.vue'
import { toWaybillCodes } from '@/components/waybill/waybill-column'
import OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
import type { ToolbarButtonConfig } from '@/components/ToolbarButtonGroup/types'
import { getStatusTextClass } from '@/utils/statusText'

View File

@ -227,7 +227,7 @@ export const entryColums = [
{ prop: 'extend_props', label: '转单订单号', width: '180', formatter: (row: any) => formatTransferredOrderCode(row) },
// { prop: 'qimen_owner_code', label: '奇门货主编码', width: '140' },
// { prop: 'qimen_warehouse_code', label: '奇门仓库编码', width: '140' },
{ prop: 'express_codes', label: '运单号', width: '140', formatter: (row: any) => formatExpressCodes(row) },
{ prop: 'express_codes', label: '运单号', width: '140', formatter: (row: any) => formatExpressCodes(row), waybillCodes: (row: any) => normalizeStockoutWaybillCodes(row, { includeLegacy: true }) },
// { prop: 'express_code', label: '快递编码', width: '110' },
{ prop: 'express_name', label: '快递名称', width: '110' },
{ prop: 'total_order_lines', label: '订单行数', width: '90' },