Compare commits
3 Commits
6838d69788
...
d21839b99d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d21839b99d | ||
|
|
3fa899d02d | ||
|
|
b2d53e3b72 |
@ -3,6 +3,7 @@ import { computed } from 'vue'
|
|||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import elementEnLocale from 'element-plus/es/locale/lang/en'
|
import elementEnLocale from 'element-plus/es/locale/lang/en'
|
||||||
import elementZhLocale from 'element-plus/es/locale/lang/zh-cn'
|
import elementZhLocale from 'element-plus/es/locale/lang/zh-cn'
|
||||||
|
import WaybillTraceWindow from '@/components/waybill/WaybillTraceWindow.vue'
|
||||||
|
|
||||||
const { locale } = useI18n()
|
const { locale } = useI18n()
|
||||||
|
|
||||||
@ -19,6 +20,8 @@ const currentLocale = computed(() => {
|
|||||||
<div id="app">
|
<div id="app">
|
||||||
<router-view />
|
<router-view />
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 运单轨迹悬浮窗:全局单例,所有运单号共用 -->
|
||||||
|
<WaybillTraceWindow />
|
||||||
</el-config-provider>
|
</el-config-provider>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@ -247,6 +247,58 @@ export function waybillWarehouseUpdateReceiveTaskProgress(
|
|||||||
} as any)
|
} as any)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ============ waybill.warehouse.getTrace ============
|
||||||
|
|
||||||
|
/** waybill.warehouse.getTrace 请求参数 */
|
||||||
|
export type WaybillWarehouseGetTraceParams = {
|
||||||
|
/** 运单号(必填) */
|
||||||
|
waybillCode?: string
|
||||||
|
/** waybillCode 的下划线别名 */
|
||||||
|
waybill_code?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 单条物流轨迹 */
|
||||||
|
export type WaybillWarehouseTraceItem = {
|
||||||
|
id?: number
|
||||||
|
express_id?: number
|
||||||
|
order_id?: number
|
||||||
|
/** 节点时间,格式 YYYY-MM-DD HH:mm:ss */
|
||||||
|
op_time?: string
|
||||||
|
/** 外部业务码(幂等键之一) */
|
||||||
|
out_biz_code?: string
|
||||||
|
/** 轨迹描述文案 */
|
||||||
|
memo?: string
|
||||||
|
/** 操作网点城市 */
|
||||||
|
op_org_city_name?: string
|
||||||
|
/** 重量(部分快递返回) */
|
||||||
|
weight?: number
|
||||||
|
/** 扫描类型 */
|
||||||
|
scan_type?: string
|
||||||
|
raw_data?: Record<string, any> | null
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* waybill.warehouse.getTrace:查询单个运单的全部物流轨迹-仓库侧
|
||||||
|
*
|
||||||
|
* 只读接口:仅查 wms_order_express_trace 中已落库的轨迹数据,不调外部接口。
|
||||||
|
* 不分页,按 op_time DESC, id DESC 返回;无数据时返回空列表(不报错)。
|
||||||
|
*/
|
||||||
|
export function waybillWarehouseGetTrace(
|
||||||
|
data: WaybillWarehouseGetTraceParams
|
||||||
|
): Promise<any> {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'waybill.warehouse.getTrace',
|
||||||
|
v,
|
||||||
|
timestamp: Date.now()
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
// ============ 模块导出 ============
|
// ============ 模块导出 ============
|
||||||
|
|
||||||
export const waybillWarehouseModule = {
|
export const waybillWarehouseModule = {
|
||||||
@ -255,5 +307,6 @@ export const waybillWarehouseModule = {
|
|||||||
export: waybillWarehouseExport,
|
export: waybillWarehouseExport,
|
||||||
exportTaskProgress: waybillWarehouseExportTaskProgress,
|
exportTaskProgress: waybillWarehouseExportTaskProgress,
|
||||||
updateReceive: waybillWarehouseUpdateReceive,
|
updateReceive: waybillWarehouseUpdateReceive,
|
||||||
updateReceiveTaskProgress: waybillWarehouseUpdateReceiveTaskProgress
|
updateReceiveTaskProgress: waybillWarehouseUpdateReceiveTaskProgress,
|
||||||
|
getTrace: waybillWarehouseGetTrace
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,28 +1,54 @@
|
|||||||
|
<!--
|
||||||
|
二维码弹窗(运单号 / 快递单号)
|
||||||
|
|
||||||
|
与轨迹悬浮窗同一套层级方案:Teleport 到 body + 固定 z-index(见 waybill/z-index.ts)。
|
||||||
|
不使用 el-dialog —— el-dialog 默认不 append-to-body,嵌在表格单元格内会被表格的
|
||||||
|
层叠上下文 / overflow 干扰,多弹层叠加时 z-index 也不可控。
|
||||||
|
-->
|
||||||
<template>
|
<template>
|
||||||
<el-dialog
|
<Teleport to="body">
|
||||||
:model-value="visible"
|
<transition name="qr-popup">
|
||||||
title="快递单号二维码"
|
<div
|
||||||
width="380px"
|
v-if="visible"
|
||||||
align-center
|
class="qr-popup"
|
||||||
destroy-on-close
|
:style="{ zIndex }"
|
||||||
@close="handleClose"
|
role="dialog"
|
||||||
>
|
aria-modal="true"
|
||||||
<div class="qr-wrapper">
|
:aria-label="title"
|
||||||
<canvas v-if="resolvedCode" ref="qrCanvasRef" class="qr-canvas" />
|
@click.self="handleClose"
|
||||||
<el-empty v-else description="暂无快递单号" :image-size="120" />
|
>
|
||||||
<p v-if="resolvedCode" class="qr-code-text">{{ resolvedCode }}</p>
|
<div class="qr-popup__panel">
|
||||||
</div>
|
<header class="qr-popup__header">
|
||||||
</el-dialog>
|
<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>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<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 QRCode from 'qrcode'
|
||||||
|
import { WAYBILL_QR_Z_INDEX } from '@/components/waybill/z-index'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
visible: boolean
|
visible: boolean
|
||||||
code?: string | null
|
code?: string | null
|
||||||
}>()
|
/** 弹窗标题 */
|
||||||
|
title?: string
|
||||||
|
/** 弹窗层级:默认高于轨迹悬浮窗,避免被遮挡 */
|
||||||
|
zIndex?: number
|
||||||
|
}>(), {
|
||||||
|
title: '快递单号二维码',
|
||||||
|
zIndex: WAYBILL_QR_Z_INDEX
|
||||||
|
})
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'update:visible', value: boolean): void
|
(e: 'update:visible', value: boolean): void
|
||||||
@ -48,14 +74,80 @@ async function renderQrCode() {
|
|||||||
watch(() => [props.visible, resolvedCode.value], () => {
|
watch(() => [props.visible, resolvedCode.value], () => {
|
||||||
renderQrCode()
|
renderQrCode()
|
||||||
}, { immediate: true })
|
}, { 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>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<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 {
|
.qr-wrapper {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
|
padding: 18px 16px 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.qr-canvas {
|
.qr-canvas {
|
||||||
@ -63,10 +155,26 @@ watch(() => [props.visible, resolvedCode.value], () => {
|
|||||||
height: 260px;
|
height: 260px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.qr-empty {
|
||||||
|
padding: 60px 0;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #909399;
|
||||||
|
}
|
||||||
|
|
||||||
.qr-code-text {
|
.qr-code-text {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
color: #606266;
|
color: #606266;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
text-align: center;
|
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>
|
</style>
|
||||||
|
|||||||
@ -103,7 +103,20 @@
|
|||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<slot :name="`column-${column.prop}`" :row="scope.row" :index="scope.$index">
|
<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">
|
<div v-if="getCopyActionCodes(scope.row, column).length" class="click-copy-list">
|
||||||
<template
|
<template
|
||||||
v-for="(code, codeIndex) in getVisibleCopyActionCodes(scope.row, column)"
|
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 { useTableColumnConfigStore } from '@/stores/modules/tableColumnConfig'
|
||||||
import type { ColumnConfigItem, TableColumnProfile } from '@/utils/table-column-config'
|
import type { ColumnConfigItem, TableColumnProfile } from '@/utils/table-column-config'
|
||||||
import QrcodeDialog from '@/components/QR/qrcode.vue'
|
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'
|
import SettingsDialog from '@/components/settings/SettingsDialog.vue'
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
@ -653,6 +668,8 @@ let renderRowsCache: {
|
|||||||
const rowKeyCache = new WeakMap<object, unknown>()
|
const rowKeyCache = new WeakMap<object, unknown>()
|
||||||
/** 多值单号解析缓存(copyAction 列每单元格会被多次求值) */
|
/** 多值单号解析缓存(copyAction 列每单元格会被多次求值) */
|
||||||
const copyCodesCache = new WeakMap<object, Map<string, string[]>>()
|
const copyCodesCache = new WeakMap<object, Map<string, string[]>>()
|
||||||
|
/** 运单号列解析缓存(统一操作菜单每单元格会被多次求值) */
|
||||||
|
const waybillCodesCache = new WeakMap<object, Map<string, string[]>>()
|
||||||
/** 超长文本收起结果的完整文本缓存(避免重复 formatter + 去标签正则) */
|
/** 超长文本收起结果的完整文本缓存(避免重复 formatter + 去标签正则) */
|
||||||
const textCollapseCache = new WeakMap<object, Map<string, string>>()
|
const textCollapseCache = new WeakMap<object, Map<string, string>>()
|
||||||
/** 虚拟滚动高度抖动兜底(见 enableFixedRowHeightFallback) */
|
/** 虚拟滚动高度抖动兜底(见 enableFixedRowHeightFallback) */
|
||||||
@ -1247,6 +1264,44 @@ function getCopyActionTitle(column: ColumnItem) {
|
|||||||
return `点击复制${column.label || ''}`
|
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) {
|
async function handleCopyActionClick(code: string, column: ColumnItem) {
|
||||||
const label = String(column.label || '内容').trim() || '内容'
|
const label = String(column.label || '内容').trim() || '内容'
|
||||||
await copyCellText(code, label)
|
await copyCellText(code, label)
|
||||||
|
|||||||
156
src/components/waybill/WaybillCodeActions.vue
Normal file
156
src/components/waybill/WaybillCodeActions.vue
Normal 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>
|
||||||
232
src/components/waybill/WaybillTraceFloat.vue
Normal file
232
src/components/waybill/WaybillTraceFloat.vue
Normal 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>
|
||||||
246
src/components/waybill/WaybillTraceList.vue
Normal file
246
src/components/waybill/WaybillTraceList.vue
Normal 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>
|
||||||
24
src/components/waybill/WaybillTraceWindow.vue
Normal file
24
src/components/waybill/WaybillTraceWindow.vue
Normal 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>
|
||||||
24
src/components/waybill/trace-window.ts
Normal file
24
src/components/waybill/trace-window.ts
Normal 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
|
||||||
|
}
|
||||||
64
src/components/waybill/waybill-column.ts
Normal file
64
src/components/waybill/waybill-column.ts
Normal 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)
|
||||||
|
}
|
||||||
11
src/components/waybill/z-index.ts
Normal file
11
src/components/waybill/z-index.ts
Normal 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
33
src/utils/clipboard.ts
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="order-sub-container">
|
<div class="order-sub-container">
|
||||||
<scan-box
|
<scan-box
|
||||||
ref="scanBox"
|
ref="scanBox"
|
||||||
@ -100,13 +100,11 @@
|
|||||||
<el-descriptions title="登记信息" :column="3" border size="small" class="detail-section">
|
<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="登记ID">{{ detailData.record?.id ?? '-' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="退回运单号">
|
<el-descriptions-item label="退回运单号">
|
||||||
<span
|
<WaybillCodeActions
|
||||||
v-if="detailData.record?.waybill_code"
|
v-if="detailData.record?.waybill_code"
|
||||||
class="waybill-copyable"
|
:codes="toWaybillCodes(detailData.record.waybill_code)"
|
||||||
role="button"
|
label="退回运单号"
|
||||||
title="点击复制"
|
/>
|
||||||
@click="copyWaybillCode(detailData.record.waybill_code)"
|
|
||||||
>{{ detailData.record.waybill_code }}</span>
|
|
||||||
<span v-else>-</span>
|
<span v-else>-</span>
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="扫描日期">{{ formatTime(detailData.record?.scan_date) }}</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 { computed, onMounted, reactive, ref, watch } from 'vue'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import { returnReceivedList, returnReceivedDetail, returnReceivedDelete, returnReceivedExport, returnReceivedExportTaskProgress } from '@/api/returnreceived'
|
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 { loadStores } from '@/api/index/index'
|
||||||
import { extractStoreListFromResponse, fillStoreScanFieldOptions } from '@/utils/storeScanOptions'
|
import { extractStoreListFromResponse, fillStoreScanFieldOptions } from '@/utils/storeScanOptions'
|
||||||
import { getStatusTextClass } from '@/utils/statusText'
|
import { getStatusTextClass } from '@/utils/statusText'
|
||||||
@ -224,36 +224,6 @@ function formatFlag(val: any): string {
|
|||||||
return val == null || val === '' ? '-' : String(val)
|
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
|
const availableFields = returnReceivedAvailableFields
|
||||||
@ -717,16 +687,6 @@ watch(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.waybill-copyable {
|
|
||||||
cursor: pointer;
|
|
||||||
color: #409eff;
|
|
||||||
user-select: none;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.empty-tip {
|
.empty-tip {
|
||||||
color: #909399;
|
color: #909399;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
|
|||||||
@ -165,13 +165,11 @@
|
|||||||
<span v-else>-</span>
|
<span v-else>-</span>
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="退回运单号">
|
<el-descriptions-item label="退回运单号">
|
||||||
<span
|
<WaybillCodeActions
|
||||||
v-if="detailRecord.waybill_code"
|
v-if="detailRecord.waybill_code"
|
||||||
class="copyable"
|
:codes="toWaybillCodes(detailRecord.waybill_code)"
|
||||||
role="button"
|
label="退回运单号"
|
||||||
title="点击复制"
|
/>
|
||||||
@click="copyText(detailRecord.waybill_code)"
|
|
||||||
>{{ detailRecord.waybill_code }}</span>
|
|
||||||
<span v-else>-</span>
|
<span v-else>-</span>
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="拆包状态">
|
<el-descriptions-item label="拆包状态">
|
||||||
@ -365,6 +363,8 @@ import type { ToolbarButtonConfig } from '@/components/ToolbarButtonGroup/types'
|
|||||||
import { returnUnpackAvailableFields, returnUnpackColumns, returnUnpackToolbarButtons } from './returnUnpack-config'
|
import { returnUnpackAvailableFields, returnUnpackColumns, returnUnpackToolbarButtons } from './returnUnpack-config'
|
||||||
import ScanBox from '@/components/ScanBox/index.vue'
|
import ScanBox from '@/components/ScanBox/index.vue'
|
||||||
import UpperTable from '@/components/UpperTable/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 OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||||
import UnpackDetailTable from './components/UnpackDetailTable.vue'
|
import UnpackDetailTable from './components/UnpackDetailTable.vue'
|
||||||
|
|||||||
@ -445,7 +445,11 @@
|
|||||||
>
|
>
|
||||||
<el-table-column prop="id" label="ID" width="80" />
|
<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="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">
|
<el-table-column prop="status" label="状态" width="90">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-tag :type="row.status === 'unpacking' ? 'warning' : row.status === 'completed' ? 'success' : 'info'" size="small">
|
<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 JsBarcode from 'jsbarcode'
|
||||||
import { CMD, CMD_LABEL, CMD_TAG_TYPE, SCAN_COMMANDS, resolveScanCommand, type ScanCommand } from './scan-commands'
|
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 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 { queryStockProducts, mapStockPickerItem, getStockStoreId } from '@/views/stock/utils/stockPickerHelpers'
|
||||||
import { orderDetail, orderList } from '@/api/order.index/orderindex'
|
import { orderDetail, orderList } from '@/api/order.index/orderindex'
|
||||||
import { parseOrderDetailPayload, normalizeOrderDetailItems } from '@/views/order/shared/orderListExport'
|
import { parseOrderDetailPayload, normalizeOrderDetailItems } from '@/views/order/shared/orderListExport'
|
||||||
|
|||||||
@ -138,13 +138,10 @@
|
|||||||
<el-descriptions v-if="detailRecord" title="登记信息" :column="2" border size="small">
|
<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="登记ID">{{ detailRecord.id ?? '-' }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="运单号">
|
<el-descriptions-item label="运单号">
|
||||||
<span
|
<WaybillCodeActions
|
||||||
v-if="detailRecord.waybill_code"
|
v-if="detailRecord.waybill_code"
|
||||||
class="copyable"
|
:codes="toWaybillCodes(detailRecord.waybill_code)"
|
||||||
role="button"
|
/>
|
||||||
title="点击复制"
|
|
||||||
@click="copyText(detailRecord.waybill_code)"
|
|
||||||
>{{ detailRecord.waybill_code }}</span>
|
|
||||||
<span v-else>-</span>
|
<span v-else>-</span>
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="货主ID">{{ detailRecord.store_id ?? '-' }}</el-descriptions-item>
|
<el-descriptions-item label="货主ID">{{ detailRecord.store_id ?? '-' }}</el-descriptions-item>
|
||||||
@ -303,6 +300,8 @@ import {
|
|||||||
returnWaybillDelete,
|
returnWaybillDelete,
|
||||||
} from '@/api/returnwaybill'
|
} from '@/api/returnwaybill'
|
||||||
import { loadStores } from '@/api/index/index'
|
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 { extractStoreListFromResponse, mapStoreListToSelectOptions, fillStoreScanFieldOptions } from '@/utils/storeScanOptions'
|
||||||
import { getStatusTextClass } from '@/utils/statusText'
|
import { getStatusTextClass } from '@/utils/statusText'
|
||||||
import type { ToolbarButtonConfig } from '@/components/ToolbarButtonGroup/types'
|
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))
|
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
|
const availableFields = returnWaybillAvailableFields
|
||||||
@ -769,15 +738,6 @@ onMounted(() => {
|
|||||||
|
|
||||||
.detail-content {
|
.detail-content {
|
||||||
min-height: 120px;
|
min-height: 120px;
|
||||||
|
|
||||||
.copyable {
|
|
||||||
cursor: pointer;
|
|
||||||
color: #409eff;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 编辑未退登记:面板结构 / 尺寸对齐「手工录入运单号」(ManualWaybillForm) */
|
/* 编辑未退登记:面板结构 / 尺寸对齐「手工录入运单号」(ManualWaybillForm) */
|
||||||
|
|||||||
@ -62,11 +62,15 @@
|
|||||||
<el-table-column label="运单ID" width="100" align="center">
|
<el-table-column label="运单ID" width="100" align="center">
|
||||||
<template #default="{ row }">{{ row.waybill_id ?? '-' }}</template>
|
<template #default="{ row }">{{ row.waybill_id ?? '-' }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="运单号" min-width="170" align="center" show-overflow-tooltip>
|
<el-table-column label="运单号" min-width="170" align="center">
|
||||||
<template #default="{ row }">{{ row.waybill_code || '-' }}</template>
|
<template #default="{ row }">
|
||||||
|
<WaybillCodeActions :codes="toWaybillCodes(row.waybill_code)" />
|
||||||
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="主单号" min-width="170" align="center" show-overflow-tooltip>
|
<el-table-column label="主单号" min-width="170" align="center">
|
||||||
<template #default="{ row }">{{ row.main_waybill_code || '-' }}</template>
|
<template #default="{ row }">
|
||||||
|
<WaybillCodeActions :codes="toWaybillCodes(row.main_waybill_code)" label="主单号" />
|
||||||
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="业务键" width="90" align="center">
|
<el-table-column label="业务键" width="90" align="center">
|
||||||
<template #default="{ row }">{{ row.business_key ?? '-' }}</template>
|
<template #default="{ row }">{{ row.business_key ?? '-' }}</template>
|
||||||
@ -101,7 +105,11 @@
|
|||||||
<el-tab-pane :label="`成功 (${successList.length})`" name="success">
|
<el-tab-pane :label="`成功 (${successList.length})`" name="success">
|
||||||
<el-table :data="successList" size="small" border max-height="220" empty-text="无">
|
<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_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_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="unpack_no" label="拆包单号" min-width="170" align="center" show-overflow-tooltip />
|
||||||
<el-table-column prop="detail_count" label="明细行数" width="95" align="center" />
|
<el-table-column prop="detail_count" label="明细行数" width="95" align="center" />
|
||||||
@ -123,8 +131,10 @@
|
|||||||
<el-table-column label="运单ID" width="100" align="center">
|
<el-table-column label="运单ID" width="100" align="center">
|
||||||
<template #default="{ row }">{{ row.waybill_id ?? '-' }}</template>
|
<template #default="{ row }">{{ row.waybill_id ?? '-' }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="退回运单号" min-width="170" align="center" show-overflow-tooltip>
|
<el-table-column label="退回运单号" min-width="170" align="center">
|
||||||
<template #default="{ row }">{{ row.waybill_code || '-' }}</template>
|
<template #default="{ row }">
|
||||||
|
<WaybillCodeActions :codes="toWaybillCodes(row.waybill_code)" label="退回运单号" />
|
||||||
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="reason" label="失败原因" min-width="260" align="center" show-overflow-tooltip />
|
<el-table-column prop="reason" label="失败原因" min-width="260" align="center" show-overflow-tooltip />
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -162,6 +172,8 @@
|
|||||||
import { computed, ref, watch } from 'vue'
|
import { computed, ref, watch } from 'vue'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import SelectedTags from '@/components/task-progress/SelectedTags.vue'
|
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 { returnUnpackTransferByWaybills } from '@/api/returnunpack'
|
||||||
import type {
|
import type {
|
||||||
ReturnUnpackTransferByWaybillsResponse,
|
ReturnUnpackTransferByWaybillsResponse,
|
||||||
|
|||||||
57
src/views/express/waybill/config/components/TracePanel.vue
Normal file
57
src/views/express/waybill/config/components/TracePanel.vue
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<!--
|
||||||
|
TracePanel — 运单物流轨迹面板(运单管理页底部「轨迹」标签页)
|
||||||
|
|
||||||
|
取数入参:当前行的运单号(waybill_code / waybillCode)。
|
||||||
|
轨迹渲染复用通用组件 WaybillTraceList(waybill.warehouse.getTrace)。
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<div class="trace-panel">
|
||||||
|
<div class="section-title">物流轨迹</div>
|
||||||
|
<WaybillTraceList :waybill-code="waybillCode" :api-method="apiMethod" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
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?: (params: { waybillCode: string }) => Promise<any>
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const waybillCode = computed(() =>
|
||||||
|
String(props.row?.waybill_code ?? props.row?.waybillCode ?? '').trim()
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.trace-panel {
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 6px 10px 8px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
padding-left: 8px;
|
||||||
|
border-left: 3px solid #409eff;
|
||||||
|
line-height: 1.4;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #303133;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.waybill-trace-list) {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -8,17 +8,20 @@
|
|||||||
* - waybillWarehouseExport → waybill.warehouse.export 运单导出
|
* - waybillWarehouseExport → waybill.warehouse.export 运单导出
|
||||||
* - waybillWarehouseUpdateReceive → waybill.warehouse.updateReceive 批量更新揽收
|
* - waybillWarehouseUpdateReceive → waybill.warehouse.updateReceive 批量更新揽收
|
||||||
* - waybillWarehouseUpdateReceiveTaskProgress → waybill.warehouse.updateReceiveTaskProgress 揽收更新进度
|
* - waybillWarehouseUpdateReceiveTaskProgress → waybill.warehouse.updateReceiveTaskProgress 揽收更新进度
|
||||||
|
* - waybillWarehouseGetTrace → waybill.warehouse.getTrace 单运单物流轨迹
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { Component } from 'vue'
|
import type { Component } from 'vue'
|
||||||
import DetailPanel from './components/DetailPanel.vue'
|
import DetailPanel from './components/DetailPanel.vue'
|
||||||
import LogPanel from './components/LogPanel.vue'
|
import LogPanel from './components/LogPanel.vue'
|
||||||
|
import TracePanel from './components/TracePanel.vue'
|
||||||
import {
|
import {
|
||||||
waybillWarehouseList,
|
waybillWarehouseList,
|
||||||
waybillWarehouseExport,
|
waybillWarehouseExport,
|
||||||
waybillWarehouseExportTaskProgress,
|
waybillWarehouseExportTaskProgress,
|
||||||
waybillWarehouseUpdateReceive,
|
waybillWarehouseUpdateReceive,
|
||||||
waybillWarehouseUpdateReceiveTaskProgress,
|
waybillWarehouseUpdateReceiveTaskProgress,
|
||||||
|
waybillWarehouseGetTrace,
|
||||||
} from '@/api/waybill.warehouse'
|
} from '@/api/waybill.warehouse'
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
@ -44,7 +47,8 @@ export const LIST_REQUEST_TIMEOUT = 5 * 60 * 1000
|
|||||||
// ============================================================
|
// ============================================================
|
||||||
export const COMPONENT_REGISTRY: Record<string, Component> = {
|
export const COMPONENT_REGISTRY: Record<string, Component> = {
|
||||||
DetailPanel,
|
DetailPanel,
|
||||||
LogPanel
|
LogPanel,
|
||||||
|
TracePanel
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
@ -575,6 +579,8 @@ export interface TabPageApiConfig {
|
|||||||
updateReceive?: ApiMethod
|
updateReceive?: ApiMethod
|
||||||
/** 揽收状态更新任务进度查询 */
|
/** 揽收状态更新任务进度查询 */
|
||||||
updateReceiveProgress?: ApiMethod
|
updateReceiveProgress?: ApiMethod
|
||||||
|
/** 单个运单的物流轨迹查询(明细面板「轨迹」标签页) */
|
||||||
|
trace?: ApiMethod
|
||||||
scanBoxOptions?: Record<string, ApiMethod>
|
scanBoxOptions?: Record<string, ApiMethod>
|
||||||
toolbar?: Record<string, ApiMethod>
|
toolbar?: Record<string, ApiMethod>
|
||||||
parseListResponse?: (res: any) => { list: any[]; total: number }
|
parseListResponse?: (res: any) => { list: any[]; total: number }
|
||||||
@ -901,7 +907,7 @@ export const TOOLBAR_BUTTONS: Record<string, ToolbarButtonConfig> = {
|
|||||||
{ label: '更新选中', action: 'handleUpdateReceiveSelected' },
|
{ label: '更新选中', action: 'handleUpdateReceiveSelected' },
|
||||||
{ label: '更新全部(当前筛选)', action: 'handleUpdateReceiveAll', divided: true }
|
{ label: '更新全部(当前筛选)', action: 'handleUpdateReceiveAll', divided: true }
|
||||||
]
|
]
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getTabToolbarButtons(tabName: string): ToolbarButtonConfig[] {
|
export function getTabToolbarButtons(tabName: string): ToolbarButtonConfig[] {
|
||||||
@ -969,7 +975,8 @@ export const tabPages: TabPageRawConfig[] = [
|
|||||||
showSelection: true
|
showSelection: true
|
||||||
},
|
},
|
||||||
detailTabs: [
|
detailTabs: [
|
||||||
{ name: 'detail', label: '运单明细', componentKey: 'DetailPanel' }
|
{ name: 'detail', label: '运单明细', componentKey: 'DetailPanel' },
|
||||||
|
{ name: 'trace', label: '轨迹', componentKey: 'TracePanel' }
|
||||||
],
|
],
|
||||||
detailSections: [
|
detailSections: [
|
||||||
{
|
{
|
||||||
@ -1032,6 +1039,7 @@ export const tabPages: TabPageRawConfig[] = [
|
|||||||
exportProgress: waybillWarehouseExportTaskProgress as ApiMethod,
|
exportProgress: waybillWarehouseExportTaskProgress as ApiMethod,
|
||||||
updateReceive: waybillWarehouseUpdateReceive as ApiMethod,
|
updateReceive: waybillWarehouseUpdateReceive as ApiMethod,
|
||||||
updateReceiveProgress: waybillWarehouseUpdateReceiveTaskProgress as ApiMethod,
|
updateReceiveProgress: waybillWarehouseUpdateReceiveTaskProgress as ApiMethod,
|
||||||
|
trace: waybillWarehouseGetTrace as ApiMethod,
|
||||||
parseListResponse(res: any) {
|
parseListResponse(res: any) {
|
||||||
const data = res?.data ?? res
|
const data = res?.data ?? res
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -434,6 +434,9 @@ const currentDetailTabApiMethod = computed(() => {
|
|||||||
case 'LogPanel':
|
case 'LogPanel':
|
||||||
componentCfg = cfg.api.log
|
componentCfg = cfg.api.log
|
||||||
break
|
break
|
||||||
|
case 'TracePanel':
|
||||||
|
componentCfg = cfg.api.trace
|
||||||
|
break
|
||||||
default:
|
default:
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
@ -758,7 +761,7 @@ const RECEIVE_ALL_MAX_PAGES = 1000
|
|||||||
const RECEIVE_ALL_MAX_CODES = 100000
|
const RECEIVE_ALL_MAX_CODES = 100000
|
||||||
|
|
||||||
/** 解析异步任务响应体(兼容 data / data.data 嵌套) */
|
/** 解析异步任务响应体(兼容 data / data.data 嵌套) */
|
||||||
function parseReceiveTaskPayload(res: any): Record<string, any> {
|
function parseTaskPayload(res: any): Record<string, any> {
|
||||||
if (!res || typeof res !== 'object') return {}
|
if (!res || typeof res !== 'object') return {}
|
||||||
const root = res as Record<string, any>
|
const root = res as Record<string, any>
|
||||||
const nested = root.data
|
const nested = root.data
|
||||||
@ -776,8 +779,8 @@ function parseReceiveTaskPayload(res: any): Record<string, any> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 进度接口响应 → useTaskProgress 期望结构(频率字段做兼容归一) */
|
/** 进度接口响应 → useTaskProgress 期望结构(频率字段做兼容归一) */
|
||||||
function normalizeReceiveProgress(res: any) {
|
function normalizeTaskProgress(res: any) {
|
||||||
const payload = parseReceiveTaskPayload(res)
|
const payload = parseTaskPayload(res)
|
||||||
const rawStatus = String(payload.status || '').toLowerCase()
|
const rawStatus = String(payload.status || '').toLowerCase()
|
||||||
// 任务不存在/已过期:按失败处理,避免无意义轮询到超时
|
// 任务不存在/已过期:按失败处理,避免无意义轮询到超时
|
||||||
const status = rawStatus === 'not_found' ? 'failed' : rawStatus
|
const status = rawStatus === 'not_found' ? 'failed' : rawStatus
|
||||||
@ -787,6 +790,8 @@ function normalizeReceiveProgress(res: any) {
|
|||||||
payload.processed
|
payload.processed
|
||||||
?? payload.processed_count
|
?? payload.processed_count
|
||||||
?? payload.processedCount
|
?? payload.processedCount
|
||||||
|
?? payload.current_count
|
||||||
|
?? payload.currentCount
|
||||||
?? payload.current
|
?? payload.current
|
||||||
?? payload.done
|
?? payload.done
|
||||||
?? 0
|
?? 0
|
||||||
@ -823,7 +828,7 @@ const {
|
|||||||
const cfg = currentTabConfig.value
|
const cfg = currentTabConfig.value
|
||||||
if (!cfg?.api?.updateReceiveProgress) throw new Error('揽收进度接口未配置')
|
if (!cfg?.api?.updateReceiveProgress) throw new Error('揽收进度接口未配置')
|
||||||
const res = await cfg.api.updateReceiveProgress({ task_id: taskId })
|
const res = await cfg.api.updateReceiveProgress({ task_id: taskId })
|
||||||
return normalizeReceiveProgress(res)
|
return normalizeTaskProgress(res)
|
||||||
},
|
},
|
||||||
onSuccess: async () => {
|
onSuccess: async () => {
|
||||||
ElMessage.success('揽收状态更新完成')
|
ElMessage.success('揽收状态更新完成')
|
||||||
@ -856,7 +861,7 @@ async function submitReceiveTask(waybillCodes: string[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const res = await cfg.api.updateReceive({ waybillCodes })
|
const res = await cfg.api.updateReceive({ waybillCodes })
|
||||||
const payload = parseReceiveTaskPayload(res)
|
const payload = parseTaskPayload(res)
|
||||||
const taskId = String(payload.task_id || payload.taskId || '').trim()
|
const taskId = String(payload.task_id || payload.taskId || '').trim()
|
||||||
if (!taskId) {
|
if (!taskId) {
|
||||||
throw new Error(payload.message || res?.message || '揽收状态更新任务提交失败')
|
throw new Error(payload.message || res?.message || '揽收状态更新任务提交失败')
|
||||||
@ -1043,6 +1048,8 @@ const handleRowClick = async (row: Record<string, any>) => {
|
|||||||
const cfg = currentTabConfig.value
|
const cfg = currentTabConfig.value
|
||||||
if (!cfg) return
|
if (!cfg) return
|
||||||
selectedRow.value = row
|
selectedRow.value = row
|
||||||
|
// 先展示行内数据:避免明细/轨迹面板短暂停留在上一条运单
|
||||||
|
selectedDetail.value = { ...row }
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const detailRes = await waybillWarehouseDetail({
|
const detailRes = await waybillWarehouseDetail({
|
||||||
|
|||||||
@ -8,10 +8,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-table :data="expressRows" border stripe size="small" empty-text="暂无运单信息" align="center">
|
<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 }">
|
<template #default="{ row }">
|
||||||
<span>{{ row.waybill_code }}</span>
|
<div class="express-waybill-cell">
|
||||||
<el-tag v-if="row.is_main" size="small" type="danger" effect="dark" style="margin-left:4px">主</el-tag>
|
<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>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="logistics_name" label="物流公司" min-width="120" align="center" show-overflow-tooltip />
|
<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 { interceptScan } from '@/api/order.recheckorder/recheckOrder'
|
||||||
import { isOrderIndexApiSuccess, parseOrderDetailPayload, normalizeOrderExpressList } from '@/views/order/shared/orderListExport'
|
import { isOrderIndexApiSuccess, parseOrderDetailPayload, normalizeOrderExpressList } from '@/views/order/shared/orderListExport'
|
||||||
import BindPackageMaterialByWaybillDialog from './BindPackageMaterialByWaybillDialog.vue'
|
import BindPackageMaterialByWaybillDialog from './BindPackageMaterialByWaybillDialog.vue'
|
||||||
|
import WaybillCodeActions from '@/components/waybill/WaybillCodeActions.vue'
|
||||||
|
import { toWaybillCodes } from '@/components/waybill/waybill-column'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
row: Record<string, any> | null
|
row: Record<string, any> | null
|
||||||
|
|||||||
@ -56,8 +56,10 @@
|
|||||||
<el-table-column label="发货单号" min-width="170" align="center" show-overflow-tooltip>
|
<el-table-column label="发货单号" min-width="170" align="center" show-overflow-tooltip>
|
||||||
<template #default="{ row }">{{ row.delivery_order_code || '-' }}</template>
|
<template #default="{ row }">{{ row.delivery_order_code || '-' }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="运单号" min-width="170" align="center" show-overflow-tooltip>
|
<el-table-column label="运单号" min-width="170" align="center">
|
||||||
<template #default="{ row }">{{ row.waybill_codes || '-' }}</template>
|
<template #default="{ row }">
|
||||||
|
<WaybillCodeActions :codes="toWaybillCodes(row.waybill_codes)" />
|
||||||
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="拦截状态" width="130" align="center">
|
<el-table-column label="拦截状态" width="130" align="center">
|
||||||
<template #default="{ row }">{{ row.intercept_status_label }}</template>
|
<template #default="{ row }">{{ row.intercept_status_label }}</template>
|
||||||
@ -132,7 +134,11 @@
|
|||||||
<div class="task-panel__table-wrap">
|
<div class="task-panel__table-wrap">
|
||||||
<el-table :data="successList" size="small" border max-height="200" empty-text="无">
|
<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="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_id" label="拆包单ID" width="100" align="center" />
|
||||||
<el-table-column prop="unpack_no" label="拆包单号" min-width="170" show-overflow-tooltip />
|
<el-table-column prop="unpack_no" label="拆包单号" min-width="170" show-overflow-tooltip />
|
||||||
<el-table-column prop="detail_count" label="明细行数" width="95" align="center" />
|
<el-table-column prop="detail_count" label="明细行数" width="95" align="center" />
|
||||||
@ -209,6 +215,8 @@
|
|||||||
import { computed, ref, watch } from 'vue'
|
import { computed, ref, watch } from 'vue'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import SelectedTags from '@/components/task-progress/SelectedTags.vue'
|
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 { returnUnpackTransferByOrders } from '@/api/returnunpack'
|
||||||
import type {
|
import type {
|
||||||
ReturnUnpackTransferByOrdersResponse,
|
ReturnUnpackTransferByOrdersResponse,
|
||||||
|
|||||||
@ -41,7 +41,11 @@
|
|||||||
<div v-if="showOrderSummary" class="detail-section">
|
<div v-if="showOrderSummary" class="detail-section">
|
||||||
<div class="section-title">运单信息</div>
|
<div class="section-title">运单信息</div>
|
||||||
<el-table :data="expresses" border stripe size="small" empty-text="暂无运单信息">
|
<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 prop="logistics_name" label="物流公司" min-width="140" show-overflow-tooltip />
|
||||||
<el-table-column label="称重(g)" width="100" align="right">
|
<el-table-column label="称重(g)" width="100" align="right">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
@ -67,6 +71,8 @@
|
|||||||
import { computed, ref, watch } from 'vue'
|
import { computed, ref, watch } from 'vue'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { orderDetail } from '@/api/order.index/orderindex'
|
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'
|
import { isOrderIndexApiSuccess, parseOrderDetailPayload, normalizeOrderDetailItems, normalizeOrderExpressList, normalizeOrderWaybillCodes } from '@/views/order/shared/orderListExport'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
|||||||
@ -271,7 +271,11 @@
|
|||||||
@selection-change="onSubWaybillSelectChange"
|
@selection-change="onSubWaybillSelectChange"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="48" align="center" />
|
<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">
|
<el-table-column label="类型" width="80" align="center">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<span :class="row.is_main ? 'ut-status-text ut-status-text--info' : 'ut-status-text ut-status-text--success'">
|
<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 OrderItemsDetailPanel from './component/OrderItemsDetailPanel.vue'
|
||||||
import OrderDetailDisplayToggle, { type OrderDetailDisplayMode } from './component/OrderDetailDisplayToggle.vue'
|
import OrderDetailDisplayToggle, { type OrderDetailDisplayMode } from './component/OrderDetailDisplayToggle.vue'
|
||||||
import ExpressWaybillPanel from './component/ExpressWaybillPanel.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 log from './component/log.vue'
|
||||||
import OrderExportProgressDialog from '@/views/order/shared/component/OrderExportProgressDialog.vue'
|
import OrderExportProgressDialog from '@/views/order/shared/component/OrderExportProgressDialog.vue'
|
||||||
import OrderExportColumnsDialog from './component/OrderExportColumnsDialog.vue'
|
import OrderExportColumnsDialog from './component/OrderExportColumnsDialog.vue'
|
||||||
|
|||||||
@ -79,14 +79,22 @@
|
|||||||
<el-tab-pane :label="`成功 (${result.success.length})`" name="success">
|
<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 :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="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-column prop="message" label="说明" min-width="160" align="center" show-overflow-tooltip />
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane :label="`失败 (${result.failed.length})`" name="failed">
|
<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 :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="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="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-column prop="message" label="说明" min-width="160" align="center" show-overflow-tooltip />
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -111,6 +119,8 @@ import { computed, reactive, ref, watch } from 'vue'
|
|||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import type { FormInstance, FormRules } from 'element-plus'
|
import type { FormInstance, FormRules } from 'element-plus'
|
||||||
import SelectedTags from '@/components/task-progress/SelectedTags.vue'
|
import SelectedTags from '@/components/task-progress/SelectedTags.vue'
|
||||||
|
import WaybillCodeActions from '@/components/waybill/WaybillCodeActions.vue'
|
||||||
|
import { toWaybillCodes } from '@/components/waybill/waybill-column'
|
||||||
import {
|
import {
|
||||||
batchQuickRecheck,
|
batchQuickRecheck,
|
||||||
type BatchQuickRecheckResponse
|
type BatchQuickRecheckResponse
|
||||||
|
|||||||
@ -50,14 +50,22 @@
|
|||||||
<el-tab-pane :label="`成功 (${result.success.length})`" name="success">
|
<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 :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="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-column prop="message" label="说明" min-width="160" show-overflow-tooltip />
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane :label="`失败 (${result.failed.length})`" name="failed">
|
<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 :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="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="reason" label="原因" min-width="180" show-overflow-tooltip />
|
||||||
<el-table-column prop="message" label="说明" min-width="160" show-overflow-tooltip />
|
<el-table-column prop="message" label="说明" min-width="160" show-overflow-tooltip />
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -75,6 +83,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, reactive, ref, watch } from 'vue'
|
import { computed, reactive, ref, watch } from 'vue'
|
||||||
import { ElMessage } from 'element-plus'
|
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 type { FormInstance, FormRules } from 'element-plus'
|
||||||
import {
|
import {
|
||||||
batchQuickRecheck,
|
batchQuickRecheck,
|
||||||
|
|||||||
@ -154,7 +154,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #column-waybill_no="{ row }">
|
<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>
|
||||||
|
|
||||||
<template #column-recheck_status="{ row }">
|
<template #column-recheck_status="{ row }">
|
||||||
@ -303,6 +305,8 @@ import type { ToolbarButtonConfig } from '@/components/ToolbarButtonGroup/types'
|
|||||||
import { getStatusTextClass } from '@/utils/statusText'
|
import { getStatusTextClass } from '@/utils/statusText'
|
||||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||||
import BatchQuickRecheckDialog from './component/BatchQuickRecheckDialog.vue'
|
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 RecheckOrderSingleListForm from './form/RecheckOrderSingleListForm.vue'
|
||||||
import * as stationApi from '@/api/print/print'
|
import * as stationApi from '@/api/print/print'
|
||||||
import { getOrderPrintData } from '@/api/order.print/orderprint'
|
import { getOrderPrintData } from '@/api/order.print/orderprint'
|
||||||
|
|||||||
@ -483,9 +483,12 @@
|
|||||||
{{ row.delivery_no || row.delivery_order_code || row.order_sn || '—' }}
|
{{ row.delivery_no || row.delivery_order_code || row.order_sn || '—' }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="物流单号" min-width="160" show-overflow-tooltip>
|
<el-table-column label="物流单号" min-width="160">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
{{ row.tracking_no || row.tracking_number || '—' }}
|
<WaybillCodeActions
|
||||||
|
:codes="toWaybillCodes(row.tracking_no || row.tracking_number)"
|
||||||
|
label="物流单号"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="店铺" min-width="140" show-overflow-tooltip>
|
<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 { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import ScanBox from '@/components/ScanBox/index.vue'
|
import ScanBox from '@/components/ScanBox/index.vue'
|
||||||
import UpperTable from '@/components/UpperTable/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 OrderToolbarButtonGroup from '@/components/ToolbarButtonGroup/index.vue'
|
||||||
import type { ToolbarButtonConfig } from '@/components/ToolbarButtonGroup/types'
|
import type { ToolbarButtonConfig } from '@/components/ToolbarButtonGroup/types'
|
||||||
import { getStatusTextClass } from '@/utils/statusText'
|
import { getStatusTextClass } from '@/utils/statusText'
|
||||||
|
|||||||
@ -227,7 +227,7 @@ export const entryColums = [
|
|||||||
{ prop: 'extend_props', label: '转单订单号', width: '180', formatter: (row: any) => formatTransferredOrderCode(row) },
|
{ prop: 'extend_props', label: '转单订单号', width: '180', formatter: (row: any) => formatTransferredOrderCode(row) },
|
||||||
// { prop: 'qimen_owner_code', label: '奇门货主编码', width: '140' },
|
// { prop: 'qimen_owner_code', label: '奇门货主编码', width: '140' },
|
||||||
// { prop: 'qimen_warehouse_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_code', label: '快递编码', width: '110' },
|
||||||
{ prop: 'express_name', label: '快递名称', width: '110' },
|
{ prop: 'express_name', label: '快递名称', width: '110' },
|
||||||
{ prop: 'total_order_lines', label: '订单行数', width: '90' },
|
{ prop: 'total_order_lines', label: '订单行数', width: '90' },
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user