1
This commit is contained in:
parent
9743cdd36f
commit
2385b40866
BIN
dist.tar.gz
BIN
dist.tar.gz
Binary file not shown.
@ -66,3 +66,64 @@ export function packingDetail(data: PackingDetailParams): Promise<any> {
|
||||
isSystemApi: true,
|
||||
} as any)
|
||||
}
|
||||
|
||||
/** order.packing.setEndTime 请求参数 */
|
||||
export type PackingSetEndTimeParams = {
|
||||
/** 打包任务ID(必填) */
|
||||
id: number
|
||||
/** 结束时间 ISO 8601 格式(必填)。前端默认值:若任务已有结束时间→当前时间;无结束时间→开始时间+5分钟 */
|
||||
end_time: string
|
||||
}
|
||||
|
||||
/** order.packing.setEndTime 响应 */
|
||||
export type PackingSetEndTimeResponse = {
|
||||
id: number
|
||||
end_time: string
|
||||
status: number
|
||||
}
|
||||
|
||||
/** order.packing.setEndTime:设置打包任务结束时间。若任务状态不是已完成则同步更新状态。 */
|
||||
export function packingSetEndTime(data: PackingSetEndTimeParams): Promise<PackingSetEndTimeResponse> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.packing.setEndTime',
|
||||
v,
|
||||
timestamp: new Date().getTime(),
|
||||
},
|
||||
data,
|
||||
isSystemApi: true,
|
||||
} as any)
|
||||
}
|
||||
|
||||
/** order.packing.forceRecord 请求参数 */
|
||||
export type PackingForceRecordParams = {
|
||||
/** 打包任务ID(必填) */
|
||||
id: number
|
||||
}
|
||||
|
||||
/** order.packing.forceRecord 响应 */
|
||||
export type PackingForceRecordResponse = {
|
||||
pack_task_id: number
|
||||
computer_id: number
|
||||
print_service_url: string
|
||||
print_service_request: { pack_task_id: number }
|
||||
print_service_response: { status: number; headers: Record<string, unknown>; data: unknown }
|
||||
print_service_error?: string | null
|
||||
}
|
||||
|
||||
/** order.packing.forceRecord:强制重新录制打包任务视频。将任务推送到录制电脑,通过打印服务触发重新录制。 */
|
||||
export function packingForceRecord(data: PackingForceRecordParams): Promise<PackingForceRecordResponse> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.packing.forceRecord',
|
||||
v,
|
||||
timestamp: new Date().getTime(),
|
||||
},
|
||||
data,
|
||||
isSystemApi: true,
|
||||
} as any)
|
||||
}
|
||||
|
||||
@ -383,6 +383,7 @@ export type RecheckOrderSingleListItem = {
|
||||
items_total?: number
|
||||
items_weight?: number | string
|
||||
weight_type?: string
|
||||
waybill_code?: string
|
||||
status?: string
|
||||
create_at?: string
|
||||
pick_time?: string
|
||||
|
||||
@ -250,9 +250,81 @@ export function orderBindExpressPackageMaterialByWaybill(
|
||||
} as any)
|
||||
}
|
||||
|
||||
/** order.pendingOrder.allocateSubOrderNumber 请求参数 */
|
||||
export type PendingOrderAllocateSubOrderNumberParams = {
|
||||
/** 订单 ID,必须为正整数 */
|
||||
order_id: number
|
||||
/** 子单号数量,>= 1。business_key 从 2 开始递增 */
|
||||
sub_order_count: number
|
||||
}
|
||||
|
||||
/** order.pendingOrder.allocateSubOrderNumber 响应 data */
|
||||
export type PendingOrderAllocateSubOrderNumberData = {
|
||||
task_id: string
|
||||
order_id: number
|
||||
status: string
|
||||
progress: number
|
||||
message: string
|
||||
result: Record<string, unknown>
|
||||
}
|
||||
|
||||
/** order.pendingOrder.allocateSubOrderNumber:分配子单号(异步任务模式) */
|
||||
export function orderModulePendingOrderAllocateSubOrderNumber(
|
||||
data: PendingOrderAllocateSubOrderNumberParams
|
||||
): Promise<any> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.pendingOrder.allocateSubOrderNumber',
|
||||
v,
|
||||
timestamp: Date.now()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
/** order.pendingOrder.allocateSubOrderNumberProgress 请求参数 */
|
||||
export type PendingOrderAllocateSubOrderNumberProgressParams = {
|
||||
/** 任务 ID(必填),支持 task_id 或 taskId */
|
||||
task_id: string
|
||||
/** 子单号业务ID(可选),支持 business_key 或 businessKey */
|
||||
business_key?: number
|
||||
}
|
||||
|
||||
/** order.pendingOrder.allocateSubOrderNumberProgress 响应 data */
|
||||
export type PendingOrderAllocateSubOrderNumberProgressData = {
|
||||
task_id: string
|
||||
order_id: number
|
||||
status: string
|
||||
progress: number
|
||||
message: string
|
||||
result: Record<string, unknown>
|
||||
}
|
||||
|
||||
/** order.pendingOrder.allocateSubOrderNumberProgress:查询子单号分配任务进度 */
|
||||
export function orderModulePendingOrderAllocateSubOrderNumberProgress(
|
||||
data: PendingOrderAllocateSubOrderNumberProgressParams
|
||||
): Promise<any> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.pendingOrder.allocateSubOrderNumberProgress',
|
||||
v,
|
||||
timestamp: Date.now()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export const orderModule = {
|
||||
waveBatchList: orderModuleWaveBatchList,
|
||||
pendingOrderDownloadCreateTemplate: orderModulePendingOrderDownloadCreateTemplate,
|
||||
pendingOrderManualWaybill: orderModulePendingOrderManualWaybill,
|
||||
bindExpressPackageMaterialByWaybill: orderBindExpressPackageMaterialByWaybill
|
||||
bindExpressPackageMaterialByWaybill: orderBindExpressPackageMaterialByWaybill,
|
||||
pendingOrderAllocateSubOrderNumber: orderModulePendingOrderAllocateSubOrderNumber,
|
||||
pendingOrderAllocateSubOrderNumberProgress: orderModulePendingOrderAllocateSubOrderNumberProgress
|
||||
}
|
||||
|
||||
@ -116,3 +116,74 @@ export function packingGet(id: number): Promise<{
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
/** order.packing.setEndTime 请求参数 */
|
||||
export type PackingSetEndTimeParams = {
|
||||
/** 打包任务ID(必填) */
|
||||
id: number
|
||||
/** 结束时间 ISO 8601 格式(必填) */
|
||||
end_time: string
|
||||
}
|
||||
|
||||
/** order.packing.setEndTime 响应 */
|
||||
export type PackingSetEndTimeResponse = {
|
||||
id: number
|
||||
end_time: string
|
||||
status: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置打包任务结束时间
|
||||
* 若任务状态不是已完成(2),则同步更新状态为已完成
|
||||
*/
|
||||
export function packingSetEndTime(data: PackingSetEndTimeParams): Promise<{
|
||||
code: number
|
||||
message: string
|
||||
data: PackingSetEndTimeResponse
|
||||
}> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.packing.setEndTime',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
/** order.packing.forceRecord 请求参数 */
|
||||
export type PackingForceRecordParams = {
|
||||
/** 打包任务ID(必填) */
|
||||
id: number
|
||||
}
|
||||
|
||||
/** order.packing.forceRecord 响应 */
|
||||
export type PackingForceRecordResponse = {
|
||||
pack_task_id: number
|
||||
computer_id: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 强制重新录制打包任务视频
|
||||
* 将任务推送到录制电脑,通过打印服务触发重新录制
|
||||
*/
|
||||
export function packingForceRecord(data: PackingForceRecordParams): Promise<{
|
||||
code: number
|
||||
message: string
|
||||
data: PackingForceRecordResponse
|
||||
}> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.packing.forceRecord',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ import { VideoCameraFilled } from '@element-plus/icons-vue'
|
||||
export interface VideoItem {
|
||||
id: number
|
||||
video_url: string
|
||||
status?: string
|
||||
camera_id?: number
|
||||
camera_name?: string
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ import { VideoCameraFilled } from '@element-plus/icons-vue'
|
||||
export interface VideoItem {
|
||||
id: number
|
||||
video_url: string
|
||||
status?: string
|
||||
camera_id?: number
|
||||
camera_name?: string
|
||||
}
|
||||
|
||||
@ -15,7 +15,8 @@
|
||||
v-for="(video, index) in videos"
|
||||
:key="video.id ?? index"
|
||||
class="video-item"
|
||||
@click="$emit('play', video)"
|
||||
:class="{ 'video-item--disabled': !video.video_url }"
|
||||
@click="video.video_url && $emit('play', video)"
|
||||
>
|
||||
<div class="video-item__thumb">
|
||||
<el-icon size="28"><VideoPlay /></el-icon>
|
||||
@ -28,15 +29,26 @@
|
||||
<span>摄像头ID: {{ video.camera_id ?? '—' }}</span>
|
||||
<span class="meta-divider">|</span>
|
||||
<span>录像ID: {{ video.id }}</span>
|
||||
<template v-if="video.status">
|
||||
<span class="meta-divider">|</span>
|
||||
<el-tag size="small" :type="video.status === 'completed' ? 'success' : 'danger'">
|
||||
{{ video.status === 'completed' ? '已完成' : video.status === 'failed' ? '失败' : video.status }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<div class="video-item__action">
|
||||
<el-button type="primary" size="small" round>播放</el-button>
|
||||
<el-button v-if="video.video_url" type="primary" size="small" round>播放</el-button>
|
||||
<span v-else-if="video.status === 'failed'" class="video-item__status video-item__status--unavailable">录像不可用</span>
|
||||
<span v-else class="video-item__status video-item__status--unplayable">不可播放</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button size="small" @click="$emit('update:visible', false)">关闭</el-button>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="warning" size="small" plain @click="$emit('force-record')">强制录制</el-button>
|
||||
<el-button size="small" @click="$emit('update:visible', false)">关闭</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@ -53,6 +65,7 @@ defineProps<{
|
||||
defineEmits<{
|
||||
'update:visible': [value: boolean]
|
||||
play: [video: VideoItem]
|
||||
'force-record': []
|
||||
}>()
|
||||
</script>
|
||||
|
||||
@ -83,6 +96,23 @@ defineEmits<{
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.video-item--disabled {
|
||||
cursor: default;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.video-item--disabled:hover {
|
||||
border-color: #ebeef5;
|
||||
background: #fff;
|
||||
box-shadow: none;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.video-item--disabled .video-item__thumb {
|
||||
background: linear-gradient(135deg, #f5f7fa 0%, #e4e7ed 100%);
|
||||
color: #c0c4cc;
|
||||
}
|
||||
|
||||
.video-item__thumb {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
@ -131,4 +161,23 @@ defineEmits<{
|
||||
.empty-hint {
|
||||
padding: 40px 0;
|
||||
}
|
||||
|
||||
.dialog-footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.video-item__status {
|
||||
font-size: 13px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.video-item__status--unavailable {
|
||||
color: #f56c6c;
|
||||
}
|
||||
|
||||
.video-item__status--unplayable {
|
||||
color: #c0c4cc;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="packingflow-container">
|
||||
<div class="order-sub-container">
|
||||
<scan-box
|
||||
ref="scanBox"
|
||||
width="250px"
|
||||
@ -16,32 +16,15 @@
|
||||
<el-icon><Refresh /></el-icon> 刷新
|
||||
</el-button>
|
||||
<el-button size="small" plain @click="tableRef?.openColumnConfig?.()">字段设置</el-button>
|
||||
</div>
|
||||
<div class="toolbar-right">
|
||||
<WarehouseSelect
|
||||
v-model="queryForm.warehouse_id"
|
||||
width="200px"
|
||||
style="margin-right: 8px"
|
||||
@change="handleWarehouseChange"
|
||||
/>
|
||||
<el-input
|
||||
v-model="queryForm.quickWhere"
|
||||
placeholder="搜索运单号/波次号"
|
||||
clearable
|
||||
size="small"
|
||||
style="width: 220px"
|
||||
@keyup.enter="handleSearch"
|
||||
>
|
||||
<template #prefix>
|
||||
<el-icon><Search /></el-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
<el-button size="small" plain @click="toggleDetailVisible">
|
||||
{{ detailVisible ? '隐藏详情' : '显示详情' }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 上下分栏 -->
|
||||
<div class="split-stack" ref="splitStackRef">
|
||||
<div class="upper-wrapper" :style="upperPaneStyle">
|
||||
<div class="upper-wrapper" :style="detailVisible ? upperPaneStyle : upperPaneFullStyle">
|
||||
<upper-table
|
||||
ref="tableRef"
|
||||
default-align="center"
|
||||
@ -65,19 +48,50 @@
|
||||
</el-tag>
|
||||
</template>
|
||||
<template #column-pack_mode="{ row }">
|
||||
<el-tag :type="row.pack_mode === 2 ? 'warning' : 'info'" size="small">
|
||||
{{ row.pack_mode === 2 ? '团购' : '散单' }}
|
||||
<el-tag :type="packModeTagType(row.pack_mode)" size="small">
|
||||
{{ packModeLabel(row.pack_mode) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<template #column-end_time="{ row }">
|
||||
<span
|
||||
class="end-time-link"
|
||||
@click.stop="openSetEndTimeDialog(row)"
|
||||
>
|
||||
{{ row.end_time ? dayjs(row.end_time).format('YYYY-MM-DD HH:mm:ss') : '—' }}
|
||||
</span>
|
||||
</template>
|
||||
<template #column-has_video="{ row }">
|
||||
<el-tag :type="hasVideoConfig[resolveHasVideoVal(row)]?.tagType || 'info'" size="small">
|
||||
{{ hasVideoConfig[resolveHasVideoVal(row)]?.text || '—' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<template #column-video_enable="{ row }">
|
||||
<el-tag :type="videoEnableConfig[resolveVideoEnableVal(row)]?.tagType || 'info'" size="small">
|
||||
{{ videoEnableConfig[resolveVideoEnableVal(row)]?.text || '—' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<template #column-videos="{ row }">
|
||||
<VideoButton :videos="row.videos || []" @click="openVideoList(row)" />
|
||||
</template>
|
||||
<template #column-operation="{ row }">
|
||||
<div class="operation-btns">
|
||||
<el-button
|
||||
type="warning"
|
||||
size="small"
|
||||
link
|
||||
@click.stop="openForceRecordDialog(row)"
|
||||
>
|
||||
强制录制
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<template #empty>
|
||||
<el-empty description="暂无打包任务数据" :image-size="60" />
|
||||
</template>
|
||||
</upper-table>
|
||||
</div>
|
||||
|
||||
<template v-if="detailVisible">
|
||||
<!-- 分隔条 -->
|
||||
<div
|
||||
class="pane-resizer"
|
||||
@ -88,58 +102,100 @@
|
||||
<!-- 详情面板 -->
|
||||
<div class="lower-level" v-if="selectedRow" :style="lowerPaneStyle">
|
||||
<div class="detail-header">
|
||||
<span class="detail-title">任务详情 #{{ selectedRow.id }}</span>
|
||||
<el-button link type="primary" size="small" @click="selectedRow = null">收起</el-button>
|
||||
<el-tabs v-model="activeTab" class="detail-tab">
|
||||
<el-tab-pane label="任务详情" name="detail" />
|
||||
<!-- <el-tab-pane label="录像" name="videos" /> -->
|
||||
</el-tabs>
|
||||
</div>
|
||||
<div class="detail-container" v-loading="detailLoading">
|
||||
<el-descriptions :column="2" border size="small">
|
||||
<el-descriptions-item label="任务ID">{{ detail.id ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="订单ID">{{ detail.order_id ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="波次号">{{ detail.wave_no || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="运单号">
|
||||
<template v-if="detail.expresses && detail.expresses.length">
|
||||
<el-tag v-for="(exp, i) in detail.expresses" :key="i" size="small" style="margin-right:4px;margin-bottom:2px">{{ exp.waybill_code }}</el-tag>
|
||||
</template>
|
||||
<span v-else>—</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="打包员">{{ detail.operator_text || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="工作台">{{ detail.workbench_name || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="打包数量">{{ detail.pack_quantity ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="打包模式">
|
||||
<el-tag :type="detail.pack_mode === 2 ? 'warning' : 'info'" size="small">
|
||||
{{ detail.pack_mode === 2 ? '团购' : '散单' }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="任务状态">
|
||||
<el-tag :type="statusTagType(detail.status)" size="small">
|
||||
{{ statusLabel(detail.status) }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="快递信息" :span="2">
|
||||
<template v-if="detail.expresses && detail.expresses.length">
|
||||
<div v-for="(exp, i) in detail.expresses" :key="i" class="express-row">
|
||||
<span>运单号:<b>{{ exp.waybill_code }}</b></span>
|
||||
<span v-if="exp.logistics_interface_name">接口:{{ exp.logistics_interface_name }}</span>
|
||||
<span v-if="exp.platform_code">平台:{{ exp.platform_code }}</span>
|
||||
<el-tag size="small" :type="exp.status === 1 ? 'success' : 'info'">
|
||||
{{ exp.status === 1 ? '已发货' : '未发货' }}
|
||||
</el-tag>
|
||||
<div v-if="activeTab === 'detail'" class="detail-page">
|
||||
<el-descriptions :column="2" border size="small">
|
||||
<el-descriptions-item label="任务ID">{{ detail.id ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="订单ID">{{ detail.order_id ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="波次号">{{ detail.wave_no || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="波次ID">{{ detail.wave_id || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="仓库ID">{{ detail.warehouse_id ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="工作台ID">{{ detail.workbench_id ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="工作台名称">{{ detail.workbench_name || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="工作台类型">{{ detail.workbench_type || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="工作台条码">{{ detail.workbench_barcode || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="打包数量">{{ detail.pack_quantity ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="商品数量">{{ detail.item_quantity ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="SKU数">{{ detail.sku_count ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="打包员">{{ detail.operator_text || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="打包模式">
|
||||
<el-tag :type="packModeTagType(detail.pack_mode)" size="small">
|
||||
{{ packModeLabel(detail.pack_mode) }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="任务状态">
|
||||
<el-tag :type="statusTagType(detail.status)" size="small">
|
||||
{{ statusLabel(detail.status) }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="设备ID">{{ (detail.device_ids || []).join(',') || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="备注">{{ detail.remark || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="运单号">
|
||||
<template v-if="detail.expresses && detail.expresses.length">
|
||||
<el-tag v-for="(exp, i) in detail.expresses" :key="i" size="small" style="margin-right:4px;margin-bottom:2px">{{ exp.waybill_code }}</el-tag>
|
||||
</template>
|
||||
<span v-else>—</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="快递信息" :span="2">
|
||||
<template v-if="detail.expresses && detail.expresses.length">
|
||||
<div v-for="(exp, i) in detail.expresses" :key="i" class="express-row">
|
||||
<span>运单号:<b>{{ exp.waybill_code }}</b></span>
|
||||
<span v-if="exp.logistics_interface_name">接口:{{ exp.logistics_interface_name }}</span>
|
||||
<span v-if="exp.platform_code">平台:{{ exp.platform_code }}</span>
|
||||
<el-tag size="small" :type="exp.status === 1 ? 'success' : 'info'">
|
||||
{{ exp.status === 1 ? '已发货' : '未发货' }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
<span v-else>—</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="开始时间">{{ detail.start_time || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="结束时间">{{ detail.end_time || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">{{ detail.create_time || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="更新时间">{{ detail.update_time || '—' }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
<div v-else-if="activeTab === 'videos'" class="detail-page">
|
||||
<template v-if="currentVideos.length">
|
||||
<div class="video-tab-list">
|
||||
<div v-for="(v, i) in currentVideos" :key="i" class="video-tab-item">
|
||||
<div class="video-tab-info">
|
||||
<span class="video-tab-label">录像 #{{ i + 1 }}</span>
|
||||
<span class="video-tab-camera">{{ v.camera_name || '—' }}</span>
|
||||
<el-tag v-if="v.status" size="small" :type="v.status === 'completed' ? 'success' : 'danger'">
|
||||
{{ v.status === 'completed' ? '已完成' : v.status === 'failed' ? '失败' : v.status }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<el-button
|
||||
v-if="v.video_url"
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="handlePlayVideo(v)"
|
||||
>
|
||||
播放
|
||||
</el-button>
|
||||
<span v-else-if="v.status === 'failed'" class="video-tab-unavailable">录像不可用</span>
|
||||
<span v-else class="video-tab-unplayable">不可播放</span>
|
||||
</div>
|
||||
</template>
|
||||
<span v-else>—</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="开始时间">{{ detail.start_time || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="结束时间">{{ detail.end_time || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">{{ detail.create_time || '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="更新时间">{{ detail.update_time || '—' }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
</template>
|
||||
<el-empty v-else description="暂无录像" :image-size="60" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 未选中时占位 -->
|
||||
<div class="lower-level empty" v-else :style="lowerPaneStyle">
|
||||
<el-empty description="点击表格行查看详情" :image-size="60" />
|
||||
<div class="no-selection" v-else :style="lowerPaneStyle">
|
||||
<div class="empty-tip">
|
||||
<p>请从上方列表中选择一项查看详情</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -148,6 +204,7 @@
|
||||
v-model:visible="videoListVisible"
|
||||
:videos="currentVideos"
|
||||
@play="handlePlayVideo"
|
||||
@force-record="handleVideoListForceRecord"
|
||||
/>
|
||||
|
||||
<!-- 录像播放弹窗 -->
|
||||
@ -155,15 +212,61 @@
|
||||
v-model:visible="playerVisible"
|
||||
:video="playingVideo"
|
||||
/>
|
||||
|
||||
<!-- 设置结束时间弹窗 -->
|
||||
<el-dialog
|
||||
v-model="setEndTimeVisible"
|
||||
title="设置结束时间"
|
||||
width="420px"
|
||||
:close-on-click-modal="false"
|
||||
align-center
|
||||
>
|
||||
<el-form :model="setEndTimeForm" label-width="100px">
|
||||
<el-form-item label="任务ID">
|
||||
<span>{{ operatingRow?.id ?? '—' }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="当前状态">
|
||||
<el-tag :type="statusTagType(operatingRow?.status)" size="small">
|
||||
{{ statusLabel(operatingRow?.status) }}
|
||||
</el-tag>
|
||||
</el-form-item>
|
||||
<el-form-item label="结束时间" required>
|
||||
<el-date-picker
|
||||
v-model="setEndTimeForm.end_time"
|
||||
type="datetime"
|
||||
placeholder="选择结束时间"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
value-format="YYYY-MM-DDTHH:mm:ss.SSS[Z]"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="setEndTimeVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="setEndTimeLoading" @click="handleSetEndTime">
|
||||
确定
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Search, Refresh } from '@element-plus/icons-vue'
|
||||
import { ref, reactive, computed, onMounted } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { Refresh } from '@element-plus/icons-vue'
|
||||
import dayjs from 'dayjs'
|
||||
import { packingList, packingGet, type PackingTaskItem, type PackingListSort } from '@/api/order/packing/index'
|
||||
import { packingList, packingGet, packingSetEndTime, packingForceRecord, type PackingTaskItem, type PackingListSort } from '@/api/order/packing/index'
|
||||
import {
|
||||
packingColumns,
|
||||
createAvailableFields,
|
||||
getStatusLabel,
|
||||
getStatusTagType,
|
||||
getPackModeLabel,
|
||||
getPackModeTagType,
|
||||
hasVideoConfig,
|
||||
videoEnableConfig
|
||||
} from './packingflow-config'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import WarehouseSelect from '@/components/WarehouseSelect.vue'
|
||||
@ -173,96 +276,39 @@ import VideoPlayerDialog from './components/VideoPlayerDialog.vue'
|
||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||
|
||||
// ─── 列配置 ─────────────────────────────────────────────────────────────────
|
||||
const columns = [
|
||||
{ prop: 'id', label: '任务ID', width: 90 },
|
||||
{ prop: 'order_id', label: '订单ID', width: 100 },
|
||||
{ prop: 'waybill_code', label: '扫描运单号', minWidth: 160, formatter: (row: any) => getWaybill(row) || '—' },
|
||||
{ prop: 'wave_no', label: '波次号', minWidth: 140 },
|
||||
{ prop: 'operator_text', label: '打包员', width: 100 },
|
||||
{ prop: 'workbench_info', label: '工作台', width: 120, formatter: (row: any) => row.workbench_name || '—' },
|
||||
{ prop: 'pack_quantity', label: '打包数量', width: 100, sortable: true },
|
||||
{ prop: 'pack_mode', label: '打包模式', width: 100 },
|
||||
{ prop: 'status', label: '任务状态', width: 100 },
|
||||
{ prop: 'start_time', label: '开始时间', width: 170, sortable: true, formatter: (row: any) => row.start_time ? dayjs(row.start_time).format('YYYY-MM-DD HH:mm:ss') : '—' },
|
||||
{ prop: 'end_time', label: '结束时间', width: 170, sortable: true, formatter: (row: any) => row.end_time ? dayjs(row.end_time).format('YYYY-MM-DD HH:mm:ss') : '—' },
|
||||
{ prop: 'create_time', label: '创建时间', width: 170, sortable: true, formatter: (row: any) => row.create_time ? dayjs(row.create_time).format('YYYY-MM-DD HH:mm:ss') : '—' },
|
||||
{ prop: 'videos', label: '录像', width: 110, fixed: 'right' }
|
||||
]
|
||||
const columns = packingColumns
|
||||
|
||||
// ─── 筛选字段配置 ──────────────────────────────────────────────────────────
|
||||
const availableFields = [
|
||||
{
|
||||
label: '任务状态',
|
||||
value: 'status',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '全部', value: undefined },
|
||||
{ label: '待处理', value: 0 },
|
||||
{ label: '打包中', value: 1 },
|
||||
{ label: '已完成', value: 2 },
|
||||
{ label: '异常', value: 3 }
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '打包模式',
|
||||
value: 'pack_mode',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '全部', value: undefined },
|
||||
{ label: '散单', value: 1 },
|
||||
{ label: '团购', value: 2 }
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '运单号',
|
||||
value: 'waybill_code',
|
||||
type: 'text'
|
||||
},
|
||||
{
|
||||
label: '波次号',
|
||||
value: 'wave_no',
|
||||
type: 'text'
|
||||
},
|
||||
{
|
||||
label: '订单ID',
|
||||
value: 'order_id',
|
||||
type: 'text'
|
||||
},
|
||||
{
|
||||
label: '工作台ID',
|
||||
value: 'workbench_id',
|
||||
type: 'text'
|
||||
}
|
||||
]
|
||||
const availableFields: any[] = createAvailableFields(WarehouseSelect)
|
||||
|
||||
// ─── 状态映射 ──────────────────────────────────────────────────────────────
|
||||
const statusMap: Record<number, string> = {
|
||||
0: '待处理',
|
||||
1: '打包中',
|
||||
2: '已完成',
|
||||
3: '异常'
|
||||
}
|
||||
// ─── 状态映射(从配置引用)─────────────────────────────────────────────────
|
||||
|
||||
/** 从 expresses 数组提取运单号 */
|
||||
function statusLabel(status: any): string {
|
||||
const s = Number(status)
|
||||
return statusMap[s] ?? '—'
|
||||
return getStatusLabel(status)
|
||||
}
|
||||
|
||||
function statusTagType(status: any): 'info' | 'warning' | 'success' | 'danger' {
|
||||
const s = Number(status)
|
||||
if (s === 0) return 'info'
|
||||
if (s === 1) return 'warning'
|
||||
if (s === 2) return 'success'
|
||||
if (s === 3) return 'danger'
|
||||
return 'info'
|
||||
return getStatusTagType(status) as 'info' | 'warning' | 'success' | 'danger'
|
||||
}
|
||||
|
||||
/** 从 expresses 数组提取运单号,兜底取顶层 waybill_code */
|
||||
function getWaybill(row: any): string {
|
||||
if (row.expresses && row.expresses.length) {
|
||||
return row.expresses.map((e: any) => e.waybill_code).filter(Boolean).join(',')
|
||||
}
|
||||
return row.waybill_code || ''
|
||||
function packModeLabel(mode: any): string {
|
||||
return getPackModeLabel(mode)
|
||||
}
|
||||
|
||||
function packModeTagType(mode: any): 'info' | 'warning' | 'success' | 'danger' | '' {
|
||||
return getPackModeTagType(mode)
|
||||
}
|
||||
|
||||
function resolveHasVideoVal(row: any): number {
|
||||
if (row.has_video != null) return Number(row.has_video)
|
||||
return row.videos && row.videos.length > 0 ? 1 : 2
|
||||
}
|
||||
|
||||
function resolveVideoEnableVal(row: any): number {
|
||||
if (row.video_enable != null) return Number(row.video_enable)
|
||||
if (!row.videos || !row.videos.length) return 2
|
||||
return row.videos.some((v: any) => v.video_url && v.status !== 'failed') ? 1 : 2
|
||||
}
|
||||
|
||||
// ─── 响应式状态 ────────────────────────────────────────────────────────────
|
||||
@ -277,8 +323,7 @@ const pagination = reactive({
|
||||
})
|
||||
|
||||
const queryForm = reactive({
|
||||
warehouse_id: '' as string | number,
|
||||
quickWhere: ''
|
||||
warehouse_id: '' as string | number
|
||||
})
|
||||
|
||||
const whereConditions = ref<Record<string, any>>({})
|
||||
@ -288,9 +333,6 @@ async function loadData() {
|
||||
loading.value = true
|
||||
try {
|
||||
const where: Record<string, any> = { ...whereConditions.value }
|
||||
if (queryForm.quickWhere) {
|
||||
where.quickWhere = queryForm.quickWhere
|
||||
}
|
||||
|
||||
const res = await packingList({
|
||||
warehouse_id: queryForm.warehouse_id || undefined,
|
||||
@ -349,23 +391,19 @@ function handleSizeChange(size: number) {
|
||||
|
||||
// ─── 筛选 ──────────────────────────────────────────────────────────────────
|
||||
function handleConditionChange(conditions: Record<string, any>) {
|
||||
whereConditions.value = { ...conditions }
|
||||
const { warehouse_id, ...rest } = conditions
|
||||
if (warehouse_id !== undefined) {
|
||||
const val = typeof warehouse_id === 'object' ? warehouse_id.value : warehouse_id
|
||||
queryForm.warehouse_id = (val !== undefined && val !== null && val !== '') ? val : ''
|
||||
}
|
||||
whereConditions.value = { ...rest }
|
||||
pagination.currentPage = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
function handleReset() {
|
||||
whereConditions.value = {}
|
||||
pagination.currentPage = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
function handleWarehouseChange() {
|
||||
pagination.currentPage = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
queryForm.warehouse_id = ''
|
||||
pagination.currentPage = 1
|
||||
loadData()
|
||||
}
|
||||
@ -377,6 +415,20 @@ const { splitStackRef, beginSplitDrag, lowerPaneStyle, upperPaneStyle } = useVer
|
||||
maxLowerPercent: 70
|
||||
})
|
||||
|
||||
// ─── 详情显示/隐藏 ──────────────────────────────────────────────────────────
|
||||
const detailVisible = ref(true)
|
||||
const activeTab = ref('detail')
|
||||
|
||||
const upperPaneFullStyle = computed(() => ({
|
||||
flex: '1 1 auto',
|
||||
minHeight: '0',
|
||||
overflow: 'hidden'
|
||||
}))
|
||||
|
||||
function toggleDetailVisible() {
|
||||
detailVisible.value = !detailVisible.value
|
||||
}
|
||||
|
||||
// ─── 详情面板 ──────────────────────────────────────────────────────────────
|
||||
const selectedRow = ref<PackingTaskItem | null>(null)
|
||||
const detailLoading = ref(false)
|
||||
@ -400,12 +452,15 @@ async function loadDetail(row: PackingTaskItem) {
|
||||
if (!codeOk) {
|
||||
ElMessage.error(res.message || '获取详情失败')
|
||||
detail.value = row
|
||||
currentVideos.value = (row.videos as VideoItem[]) || []
|
||||
return
|
||||
}
|
||||
detail.value = res.data ?? row
|
||||
currentVideos.value = (detail.value.videos as VideoItem[]) || []
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e?.message || '获取详情异常')
|
||||
detail.value = row
|
||||
currentVideos.value = (row.videos as VideoItem[]) || []
|
||||
} finally {
|
||||
detailLoading.value = false
|
||||
}
|
||||
@ -420,6 +475,11 @@ const playingVideo = ref<VideoItem | null>(null)
|
||||
function openVideoList(row: PackingTaskItem) {
|
||||
currentVideos.value = (row.videos as VideoItem[]) || []
|
||||
if (currentVideos.value.length === 0) return
|
||||
selectedRow.value = row
|
||||
activeTab.value = 'videos'
|
||||
if (!detailVisible.value) {
|
||||
detailVisible.value = true
|
||||
}
|
||||
videoListVisible.value = true
|
||||
}
|
||||
|
||||
@ -429,109 +489,125 @@ function handlePlayVideo(video: VideoItem) {
|
||||
playerVisible.value = true
|
||||
}
|
||||
|
||||
function handleVideoListForceRecord() {
|
||||
videoListVisible.value = false
|
||||
if (selectedRow.value) {
|
||||
openForceRecordDialog(selectedRow.value)
|
||||
}
|
||||
}
|
||||
|
||||
// ─── 设置结束时间 ──────────────────────────────────────────────────────────
|
||||
const setEndTimeVisible = ref(false)
|
||||
const setEndTimeLoading = ref(false)
|
||||
const operatingRow = ref<PackingTaskItem | null>(null)
|
||||
const setEndTimeForm = reactive({
|
||||
end_time: ''
|
||||
})
|
||||
|
||||
/** 计算结束时间默认值:已有结束时间→当前时间;无→开始时间+5分钟 */
|
||||
function computeDefaultEndTime(): string {
|
||||
const now = dayjs()
|
||||
if (operatingRow.value?.end_time) {
|
||||
return now.toISOString()
|
||||
}
|
||||
if (operatingRow.value?.start_time) {
|
||||
const start = dayjs(operatingRow.value.start_time)
|
||||
return start.add(5, 'minute').toISOString()
|
||||
}
|
||||
return now.toISOString()
|
||||
}
|
||||
|
||||
function openSetEndTimeDialog(row: PackingTaskItem) {
|
||||
operatingRow.value = row
|
||||
setEndTimeForm.end_time = computeDefaultEndTime()
|
||||
setEndTimeVisible.value = true
|
||||
}
|
||||
|
||||
async function handleSetEndTime() {
|
||||
if (!setEndTimeForm.end_time) {
|
||||
ElMessage.warning('请选择结束时间')
|
||||
return
|
||||
}
|
||||
if (!operatingRow.value?.id) return
|
||||
setEndTimeLoading.value = true
|
||||
try {
|
||||
const res = await packingSetEndTime({
|
||||
id: Number(operatingRow.value.id),
|
||||
end_time: setEndTimeForm.end_time
|
||||
})
|
||||
const codeOk = [200, 20000, 1, 0].includes(res.code)
|
||||
if (!codeOk) {
|
||||
ElMessage.error(res.message || '设置失败')
|
||||
return
|
||||
}
|
||||
ElMessage.success('结束时间设置成功')
|
||||
setEndTimeVisible.value = false
|
||||
// 刷新详情和列表
|
||||
if (selectedRow.value) {
|
||||
loadDetail(selectedRow.value)
|
||||
}
|
||||
loadData()
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e?.message || '设置异常')
|
||||
} finally {
|
||||
setEndTimeLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// ─── 强制录制 ──────────────────────────────────────────────────────────────
|
||||
const forceRecordLoading = ref(false)
|
||||
|
||||
async function openForceRecordDialog(row: PackingTaskItem) {
|
||||
operatingRow.value = row
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`确定要强制重新录制任务 #${row.id} 的视频吗?将清空现有视频并推送到录制电脑重新录制。`,
|
||||
'强制录制确认',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}
|
||||
)
|
||||
await doForceRecord()
|
||||
} catch {
|
||||
// 用户取消
|
||||
}
|
||||
}
|
||||
|
||||
async function doForceRecord() {
|
||||
if (!operatingRow.value?.id) return
|
||||
forceRecordLoading.value = true
|
||||
try {
|
||||
const res = await packingForceRecord({ id: Number(operatingRow.value.id) })
|
||||
const codeOk = [200, 20000, 1, 0].includes(res.code)
|
||||
if (!codeOk) {
|
||||
ElMessage.error(res.message || '录制请求失败')
|
||||
return
|
||||
}
|
||||
ElMessage.success(`录制请求已提交,录制电脑ID:${res.data?.computer_id ?? '—'}`)
|
||||
// 刷新详情
|
||||
if (selectedRow.value) {
|
||||
loadDetail(selectedRow.value)
|
||||
}
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e?.message || '录制请求异常')
|
||||
} finally {
|
||||
forceRecordLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// ─── 初始化 ────────────────────────────────────────────────────────────────
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.packingflow-container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
}
|
||||
<style scoped lang="scss">
|
||||
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||
|
||||
.main-content {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 0 12px 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 8px 0;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.toolbar-left,
|
||||
.toolbar-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
/* ─── 上下分栏 ──────────────────────────────────────────────────────────── */
|
||||
.split-stack {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.upper-wrapper {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 确保 UpperTable 填满 upper-wrapper */
|
||||
.upper-wrapper :deep(.upper-table-container) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.pane-resizer {
|
||||
flex: 0 0 6px;
|
||||
min-height: 6px;
|
||||
background: #e4e7ed;
|
||||
cursor: row-resize;
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.pane-resizer:hover {
|
||||
background: #dcdfe6;
|
||||
}
|
||||
|
||||
/* ─── 详情面板 ──────────────────────────────────────────────────────────── */
|
||||
.lower-level {
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.lower-level.empty {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.detail-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 8px 12px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
flex-shrink: 0;
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
.detail-title {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.detail-container {
|
||||
padding: 12px;
|
||||
.order-sub-container .main-content .lower-level .detail-container {
|
||||
padding: 6px 10px;
|
||||
overflow: auto;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
@ -543,4 +619,62 @@ onMounted(() => {
|
||||
gap: 12px;
|
||||
padding: 2px 0;
|
||||
}
|
||||
|
||||
.operation-btns {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.end-time-link {
|
||||
color: var(--el-color-primary);
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
color: var(--el-color-primary-light-3);
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
.video-tab-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.video-tab-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 6px 10px;
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.video-tab-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.video-tab-label {
|
||||
font-size: 13px;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.video-tab-camera {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.video-tab-unplayable {
|
||||
font-size: 12px;
|
||||
color: #c0c4cc;
|
||||
}
|
||||
|
||||
.video-tab-unavailable {
|
||||
font-size: 12px;
|
||||
color: #f56c6c;
|
||||
}
|
||||
</style>
|
||||
|
||||
233
src/views/data/packingflow/packingflow-config.ts
Normal file
233
src/views/data/packingflow/packingflow-config.ts
Normal file
@ -0,0 +1,233 @@
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
// =============================================================================
|
||||
// 类型定义
|
||||
// =============================================================================
|
||||
|
||||
export interface StatusConfigItem {
|
||||
text: string
|
||||
tagType: 'info' | 'warning' | 'success' | 'danger' | ''
|
||||
}
|
||||
|
||||
export type StatusConfigMap = Record<number, StatusConfigItem>
|
||||
|
||||
export interface PackModeConfigItem {
|
||||
text: string
|
||||
tagType: 'info' | 'warning' | 'success' | 'danger' | ''
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// 状态配置
|
||||
// =============================================================================
|
||||
|
||||
/** 任务状态映射 */
|
||||
export const statusConfig: StatusConfigMap = {
|
||||
0: { text: '待处理', tagType: 'info' },
|
||||
1: { text: '打包中', tagType: 'warning' },
|
||||
2: { text: '已完成', tagType: 'success' },
|
||||
3: { text: '异常', tagType: 'danger' }
|
||||
}
|
||||
|
||||
/** 打包模式映射 */
|
||||
export const packModeConfig: Record<number, PackModeConfigItem> = {
|
||||
1: { text: '散单', tagType: 'info' },
|
||||
2: { text: '团购', tagType: 'warning' }
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// 辅助函数
|
||||
// =============================================================================
|
||||
|
||||
/** 根据状态码获取文本 */
|
||||
export function getStatusLabel(status: any): string {
|
||||
const s = Number(status)
|
||||
return statusConfig[s]?.text ?? '—'
|
||||
}
|
||||
|
||||
/** 根据状态码获取标签类型 */
|
||||
export function getStatusTagType(status: any): 'info' | 'warning' | 'success' | 'danger' | '' {
|
||||
const s = Number(status)
|
||||
return statusConfig[s]?.tagType ?? 'info'
|
||||
}
|
||||
|
||||
/** 获取打包模式文本 */
|
||||
export function getPackModeLabel(mode: any): string {
|
||||
const m = Number(mode)
|
||||
return packModeConfig[m]?.text ?? '—'
|
||||
}
|
||||
|
||||
/** 获取打包模式标签类型 */
|
||||
export function getPackModeTagType(mode: any): 'info' | 'warning' | 'success' | 'danger' | '' {
|
||||
const m = Number(mode)
|
||||
return packModeConfig[m]?.tagType ?? 'info'
|
||||
}
|
||||
|
||||
/** 从 expresses 数组提取运单号,兜底取顶层 waybill_code */
|
||||
export function getWaybill(row: any): string {
|
||||
if (row.expresses && row.expresses.length) {
|
||||
return row.expresses.map((e: any) => e.waybill_code).filter(Boolean).join(',')
|
||||
}
|
||||
return row.waybill_code || ''
|
||||
}
|
||||
|
||||
/** 从 expresses 数组提取快递接口名称 */
|
||||
export function getExpressInfo(row: any): string {
|
||||
if (row.expresses && row.expresses.length) {
|
||||
return row.expresses
|
||||
.map((e: any) => e.logistics_interface_name || e.logistics_name || '—')
|
||||
.filter(Boolean)
|
||||
.join(',')
|
||||
}
|
||||
return '—'
|
||||
}
|
||||
|
||||
/** 判断是否包含录像:1=包含, 2=不包含 */
|
||||
export function resolveHasVideo(row: any): number {
|
||||
return row.videos && row.videos.length > 0 ? 1 : 2
|
||||
}
|
||||
|
||||
/** 判断录像是否可用:1=可用(有video_url且非failed), 2=不可用 */
|
||||
export function resolveVideoEnable(row: any): number {
|
||||
if (!row.videos || !row.videos.length) return 2
|
||||
return row.videos.some((v: any) => v.video_url && v.status !== 'failed') ? 1 : 2
|
||||
}
|
||||
|
||||
/** 包含录像状态映射 */
|
||||
export const hasVideoConfig: Record<number, { text: string; tagType: 'success' | 'danger' }> = {
|
||||
1: { text: '有', tagType: 'success' },
|
||||
2: { text: '无', tagType: 'danger' }
|
||||
}
|
||||
|
||||
/** 录像可用状态映射 */
|
||||
export const videoEnableConfig: Record<number, { text: string; tagType: 'success' | 'info' | 'danger' }> = {
|
||||
1: { text: '可用', tagType: 'success' },
|
||||
2: { text: '不可用', tagType: 'info' }
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// 表格列定义
|
||||
// =============================================================================
|
||||
|
||||
export const packingColumns = [
|
||||
{ prop: 'id', label: '任务ID', width: 90 },
|
||||
{ prop: 'order_id', label: '订单ID', width: 100 },
|
||||
{ prop: 'waybill_code', label: '运单号', minWidth: 160, copyAction: 'copy' as const, copyValue: (row: any) => getWaybill(row), formatter: (row: any) => getWaybill(row) || '—' },
|
||||
{ prop: 'wave_no', label: '波次号', minWidth: 140, copyAction: 'copy' as const },
|
||||
{ prop: 'operator_text', label: '打包员', width: 100 },
|
||||
{ prop: 'workbench_info', label: '工作台', width: 120, formatter: (row: any) => row.workbench_name || '—' },
|
||||
{ prop: 'pack_quantity', label: '打包数量', width: 100, sortable: true },
|
||||
{ prop: 'pack_mode', label: '打包模式', width: 100 },
|
||||
{ prop: 'status', label: '任务状态', width: 100 },
|
||||
{ prop: 'start_time', label: '开始时间', width: 170, sortable: true, formatter: (row: any) => row.start_time ? dayjs(row.start_time).format('YYYY-MM-DD HH:mm:ss') : '—' },
|
||||
{ prop: 'end_time', label: '结束时间', width: 170, sortable: true, formatter: (row: any) => row.end_time ? dayjs(row.end_time).format('YYYY-MM-DD HH:mm:ss') : '—' },
|
||||
{ prop: 'create_time', label: '创建时间', width: 170, sortable: true, formatter: (row: any) => row.create_time ? dayjs(row.create_time).format('YYYY-MM-DD HH:mm:ss') : '—' },
|
||||
{ prop: 'update_time', label: '更新时间', width: 170, sortable: true, formatter: (row: any) => row.update_time ? dayjs(row.update_time).format('YYYY-MM-DD HH:mm:ss') : '—' },
|
||||
{ prop: 'express_info', label: '快递信息', minWidth: 140, formatter: (row: any) => getExpressInfo(row) },
|
||||
{ prop: 'has_video', label: '包含录像', width: 90 },
|
||||
{ prop: 'video_enable', label: '录像可用', width: 90 },
|
||||
{ prop: 'videos', label: '录像', width: 110 },
|
||||
{ prop: 'operation', label: '操作', width: 140, fixed: 'right' }
|
||||
]
|
||||
|
||||
// =============================================================================
|
||||
// ScanBox 筛选字段分组
|
||||
// =============================================================================
|
||||
|
||||
export const PACKING_SCAN_FIELD_GROUPS = {
|
||||
basic: '基础信息',
|
||||
workflow: '流程状态',
|
||||
} as const
|
||||
|
||||
type PackingScanFieldGroupKey = keyof typeof PACKING_SCAN_FIELD_GROUPS
|
||||
|
||||
function packingScanField<G extends PackingScanFieldGroupKey>(
|
||||
group: G,
|
||||
field: Record<string, any>
|
||||
) {
|
||||
return { ...field, group: PACKING_SCAN_FIELD_GROUPS[group] }
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// ScanBox 筛选字段配置
|
||||
// =============================================================================
|
||||
|
||||
/** 筛选字段配置(不含需要组件引用的仓库字段,由页面注入) */
|
||||
export const baseAvailableFields = [
|
||||
packingScanField('basic', {
|
||||
label: '快捷搜索',
|
||||
value: 'quickWhere',
|
||||
type: 'text' as const,
|
||||
placeholder: '运单号/波次号'
|
||||
}),
|
||||
packingScanField('basic', {
|
||||
label: '打包模式',
|
||||
value: 'pack_mode',
|
||||
type: 'select' as const,
|
||||
options: [
|
||||
{ label: '全部', value: undefined },
|
||||
{ label: '散单', value: 1 },
|
||||
{ label: '团购', value: 2 }
|
||||
]
|
||||
}),
|
||||
packingScanField('basic', {
|
||||
label: '运单号',
|
||||
value: 'waybill_code',
|
||||
type: 'text' as const
|
||||
}),
|
||||
packingScanField('basic', {
|
||||
label: '波次号',
|
||||
value: 'wave_no',
|
||||
type: 'text' as const
|
||||
}),
|
||||
packingScanField('basic', {
|
||||
label: '订单ID',
|
||||
value: 'order_id',
|
||||
type: 'text' as const
|
||||
}),
|
||||
packingScanField('workflow', {
|
||||
label: '任务状态',
|
||||
value: 'status',
|
||||
type: 'select' as const,
|
||||
options: [
|
||||
{ label: '全部', value: undefined },
|
||||
{ label: '待处理', value: 0 },
|
||||
{ label: '打包中', value: 1 },
|
||||
{ label: '已完成', value: 2 },
|
||||
{ label: '异常', value: 3 }
|
||||
]
|
||||
}),
|
||||
packingScanField('workflow', {
|
||||
label: '包含录像',
|
||||
value: 'has_video',
|
||||
type: 'select' as const,
|
||||
options: [
|
||||
{ label: '全部', value: undefined },
|
||||
{ label: '有', value: 1 },
|
||||
{ label: '无', value: 2 }
|
||||
]
|
||||
}),
|
||||
packingScanField('workflow', {
|
||||
label: '录像可用',
|
||||
value: 'video_enable',
|
||||
type: 'select' as const,
|
||||
options: [
|
||||
{ label: '全部', value: undefined },
|
||||
{ label: '可用', value: 1 },
|
||||
{ label: '不可用', value: 2 }
|
||||
]
|
||||
}),
|
||||
]
|
||||
|
||||
/** 创建完整筛选字段(注入仓库选择组件) */
|
||||
export function createAvailableFields(warehouseComponent: any): any[] {
|
||||
return [
|
||||
packingScanField('basic', {
|
||||
label: '仓库',
|
||||
value: 'warehouse_id',
|
||||
type: 'custom',
|
||||
component: warehouseComponent,
|
||||
props: { width: '100%' }
|
||||
}),
|
||||
...baseAvailableFields
|
||||
]
|
||||
}
|
||||
@ -767,7 +767,7 @@ export const orderDetailFullSections: OrderDetailSectionConfig[] = [
|
||||
title: '流程与状态',
|
||||
column: 4,
|
||||
fields: [
|
||||
{ prop: 'status', label: '订单状态', tag: true, formatter: (row: any) => translateOrderField('status', row.status) },
|
||||
{ prop: 'status', label: '订单状态', tag: true },
|
||||
{ prop: 'step', label: '流程步骤' },
|
||||
{ prop: 'sync_status', label: '同步状态', tag: true },
|
||||
{ prop: 'inspection_status', label: '审核状态', tag: true },
|
||||
@ -866,7 +866,7 @@ export const orderDetailCompactSections: OrderDetailSectionConfig[] = [
|
||||
{ prop: 'create_channel', label: '来源' },
|
||||
{ prop: 'shop_nick', label: '店铺名称' },
|
||||
{ prop: 'buyer_nick', label: '买家昵称' },
|
||||
{ prop: 'status', label: '订单状态', tag: true, formatter: (row: any) => translateOrderField('status', row.status) },
|
||||
{ prop: 'status', label: '订单状态', tag: true },
|
||||
{ prop: 'source_order_codes', label: '平台交易单号' },
|
||||
{ prop: 'is_urgency', label: '是否紧急', tag: true },
|
||||
{ prop: 'seller_nick', label: '卖家昵称' },
|
||||
|
||||
@ -152,6 +152,19 @@
|
||||
business-type="RECEIPT"
|
||||
/>
|
||||
|
||||
<AsyncExportProgressDialog
|
||||
v-model:visible="exportDialogVisible"
|
||||
title="收货单导出进度"
|
||||
:loading="exportLoading"
|
||||
:progress-percent="exportProgressPercent"
|
||||
:progress-status="exportProgressStatus"
|
||||
:status-label="exportStatusLabel"
|
||||
:task-id="exportTaskProgress.taskId"
|
||||
:message="exportTaskProgress.message"
|
||||
:error="exportTaskProgress.error"
|
||||
:update-time="exportTaskProgress.updateTime"
|
||||
/>
|
||||
|
||||
<!-- 新建收货单对话框 -->
|
||||
<el-dialog v-model="createDialogVisible" title="新建收货单" width="600px" align-center
|
||||
@closed="handleCreateDialogClosed">
|
||||
@ -313,6 +326,7 @@ import UpperTable from '@/components/UpperTable/index.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import BatchReceivingPrintDialog from '@/components/BatchReceivingPrintDialog.vue'
|
||||
import AsyncExportProgressDialog from '@/components/AsyncExportProgressDialog.vue'
|
||||
import Details from './component/DetailsPanel.vue'
|
||||
import StorageComp from './component/Storage.vue'
|
||||
import Logs from './component/Logs.vue'
|
||||
@ -334,7 +348,7 @@ import {
|
||||
addReceivingFields,
|
||||
receivingToolbarButtons,
|
||||
} from './receiving-config'
|
||||
import * as XLSX from 'xlsx'
|
||||
import { useAsyncExportTask } from '@/composables/useAsyncExportTask'
|
||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
|
||||
@ -360,6 +374,20 @@ const {
|
||||
upperPaneStyle,
|
||||
} = useVerticalSplitPane({ defaultLowerPercent: 40 })
|
||||
|
||||
const {
|
||||
exportLoading,
|
||||
exportDialogVisible,
|
||||
exportTaskProgress,
|
||||
exportProgressPercent,
|
||||
exportProgressStatus,
|
||||
exportStatusLabel,
|
||||
submitExportTask
|
||||
} = useAsyncExportTask({
|
||||
storageKey: 'storage:receiving:exportTaskId',
|
||||
submitExport: (payload) => receivingApi.exportReceiving(payload as any),
|
||||
queryProgress: (params) => receivingApi.exportReceivingTaskProgress(params)
|
||||
})
|
||||
|
||||
const upperPaneFullStyle = computed(() => ({
|
||||
flex: '1 1 auto',
|
||||
minHeight: '0',
|
||||
@ -370,7 +398,6 @@ const activeTab = ref('details')
|
||||
|
||||
const list = ref<any[]>([])
|
||||
const loading = ref(false)
|
||||
const exportLoading = ref(false)
|
||||
const quickPutawayLoading = ref(false)
|
||||
const reviewLoading = ref(false)
|
||||
const queryTime = ref(0)
|
||||
@ -449,11 +476,11 @@ const toolbarActionMap: Record<string, () => void> = {
|
||||
void loadData()
|
||||
},
|
||||
handleCreateReceiving: () => handleCreateReceiving(),
|
||||
handleExportWaybill: () => {
|
||||
void handleExport('waybill')
|
||||
handleExportSelected: () => {
|
||||
void handleExportSelected()
|
||||
},
|
||||
handleExportItem: () => {
|
||||
void handleExport('item')
|
||||
handleExportAll: () => {
|
||||
void handleExportAll()
|
||||
},
|
||||
openColumnConfigPanel: () => openColumnConfigPanel(),
|
||||
toggleDetailVisible: () => toggleDetailVisible(),
|
||||
@ -1465,112 +1492,33 @@ async function handleQuickPutaway() {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleExport(mode: 'waybill' | 'item' = 'waybill') {
|
||||
if (selectionRows.value.length === 0) {
|
||||
// 导出相关 —— 使用异步任务模式
|
||||
function buildExportPayload() {
|
||||
if (currentCondition.value && currentCondition.value !== 'reset') {
|
||||
return { where: normalizeToWhere(currentCondition.value) }
|
||||
}
|
||||
return { where: normalizeToWhere({}) }
|
||||
}
|
||||
|
||||
function buildExportSelectedPayload() {
|
||||
const ids = selectionRows.value.map((item: any) => item.id)
|
||||
return {
|
||||
where: {
|
||||
id: { operator: 'in', value: ids }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function handleExportSelected() {
|
||||
if (!selectionRows.value.length) {
|
||||
ElMessage.warning('请先勾选要导出的收货单')
|
||||
return
|
||||
}
|
||||
exportLoading.value = true
|
||||
try {
|
||||
const allExportData: any[] = []
|
||||
await submitExportTask(buildExportSelectedPayload())
|
||||
}
|
||||
|
||||
for (const row of selectionRows.value) {
|
||||
const productExportData: any[] = []
|
||||
const receivingExportData: any[] = []
|
||||
|
||||
receivingExportData.push({
|
||||
'收货单号': row.receiving_number,
|
||||
'收货状态': statusConfig[row.status as keyof typeof statusConfig]?.text || row.status || '',
|
||||
'匹配状态': detailStatusConfig[row.detail_status as keyof typeof detailStatusConfig]?.text || row.detail_status || '',
|
||||
'入库状态': storageStatusConfig[row.storage_status as keyof typeof storageStatusConfig]?.text || row.storage_status || '',
|
||||
'货主': row.store_name || '',
|
||||
'商品种类': row.total_items ?? '',
|
||||
'总数量': row.total_quantity ?? '',
|
||||
'总箱数': row.total_boxes ?? '',
|
||||
'总托盘数': row.total_pallets ?? '',
|
||||
'车牌号': row.license_plate || '',
|
||||
'物流单号': row.tracking_number || '',
|
||||
'来货方式': deliveryMethodConfig[row.delivery_method as keyof typeof deliveryMethodConfig]?.text || row.delivery_method || '',
|
||||
'装卸方式': loadingMethodConfig[row.loading_method as keyof typeof loadingMethodConfig]?.text || row.loading_method || '',
|
||||
'创建人': row.creator_name || '',
|
||||
'收货开始': row.receiving_start_time || '',
|
||||
'收货结束': row.receiving_end_time || '',
|
||||
'创建时间': row.created_at || '',
|
||||
'备注': row.remark || ''
|
||||
})
|
||||
|
||||
if (mode === 'item') {
|
||||
try {
|
||||
const res: any = await receivingApi.getReceivingDetail({
|
||||
id: row.id,
|
||||
pagination: { page: 1, pageSize: 10000 }
|
||||
})
|
||||
|
||||
if (res && res.code === 200 && res.data) {
|
||||
const receivingData = res.data.receiving || {}
|
||||
const detailList = Array.isArray(receivingData.details)
|
||||
? receivingData.details
|
||||
: Array.isArray(res.data.list)
|
||||
? res.data.list
|
||||
: Array.isArray(res.data.details)
|
||||
? res.data.details
|
||||
: []
|
||||
|
||||
detailList.forEach((item: any) => {
|
||||
productExportData.push({
|
||||
'收货单号': row.receiving_number,
|
||||
'货主': row.store_name || '',
|
||||
'商品名称': item.product_name || '',
|
||||
'条码': item.barcode || '',
|
||||
'匹配状态': item.system_product_id ? '已匹配' : '未匹配',
|
||||
'实收数量': item.actual_quantity ?? '',
|
||||
'箱数': item.box_quantity ?? '',
|
||||
'箱规': item.boxes_per_pallet ?? '',
|
||||
'重量(g)': item.weight ?? '',
|
||||
'批次号': item.batch_number || '',
|
||||
'生产日期': item.production_date || '',
|
||||
'有效期': item.expiry_date || '',
|
||||
'入库状态': storageStatusConfig[item.storage_status as keyof typeof storageStatusConfig]?.text || item.storage_status || '',
|
||||
'库位': item.space_id || '',
|
||||
'备注': item.remark || ''
|
||||
})
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn(`获取收货单 ${row.receiving_number} 商品明细失败,跳过`, e)
|
||||
}
|
||||
}
|
||||
|
||||
const rowExportData = mode === 'item'
|
||||
? (productExportData.length > 0 ? productExportData : receivingExportData)
|
||||
: receivingExportData
|
||||
allExportData.push(...rowExportData)
|
||||
}
|
||||
|
||||
if (allExportData.length === 0) {
|
||||
ElMessage.warning('没有可导出的数据')
|
||||
return
|
||||
}
|
||||
|
||||
const hasProductDetail = mode === 'item' && allExportData.some((row) => '商品名称' in row)
|
||||
const sheetName = hasProductDetail ? '收货单商品明细' : '收货单摘要'
|
||||
const suffix = mode === 'item' ? '-含明细' : ''
|
||||
const fileName = selectionRows.value.length === 1
|
||||
? `${selectionRows.value[0].receiving_number}${suffix}.xlsx`
|
||||
: `收货单导出_${Date.now()}${suffix}.xlsx`
|
||||
|
||||
const ws = XLSX.utils.json_to_sheet(allExportData)
|
||||
const wb = XLSX.utils.book_new()
|
||||
XLSX.utils.book_append_sheet(wb, ws, sheetName)
|
||||
XLSX.writeFile(wb, fileName)
|
||||
|
||||
ElMessage.success('导出完成')
|
||||
} catch (e) {
|
||||
console.error('导出 Excel 失败:', e)
|
||||
ElMessage.error('导出失败')
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
async function handleExportAll() {
|
||||
await submitExportTask(buildExportPayload())
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@ -548,11 +548,11 @@ export const receivingToolbarButtons: ToolbarButtonConfig[] = [
|
||||
label: '导出',
|
||||
size: 'small',
|
||||
loadingKey: 'exportLoading',
|
||||
action: 'handleExportWaybill',
|
||||
action: 'handleExportSelected',
|
||||
buttonType: 'dropdown',
|
||||
dropdownOptions: [
|
||||
{ label: '不含明细', action: 'handleExportWaybill' },
|
||||
{ label: '含明细', action: 'handleExportItem', divided: true }
|
||||
{ label: '导出选中', action: 'handleExportSelected' },
|
||||
{ label: '导出全部', action: 'handleExportAll', divided: true }
|
||||
]
|
||||
},
|
||||
{ key: 'columnConfig', label: '字段设置', size: 'small', action: 'openColumnConfigPanel' },
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
<template>
|
||||
<div class="storage-report-container" :style="{ height: containerHeight }">
|
||||
<div class="order-sub-container" :style="{ height: containerHeight }">
|
||||
<scan-box
|
||||
ref="scanBox"
|
||||
cache-key="storage-report"
|
||||
:width="reportScanBoxConfig.width"
|
||||
:tree-props="reportScanBoxConfig.treeProps"
|
||||
:auto-submit="reportScanBoxConfig.autoSubmit"
|
||||
@ -15,32 +16,15 @@
|
||||
<div class="main-content">
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-left">
|
||||
<el-button size="small" type="primary" @click="loadData">刷新</el-button>
|
||||
<el-button size="small" @click="loadData">刷新</el-button>
|
||||
<ExportModeDropdown :loading="exportLoading" @action="handleExportAction" />
|
||||
<el-button size="small" @click="openColumnConfigPanel">字段设置</el-button>
|
||||
<el-button size="small" @click="toggleDetailVisible">{{ detailVisible ? '隐藏详情' : '显示详情' }}</el-button>
|
||||
<!-- <span class="toolbar-title">库存报表</span>
|
||||
<el-tag size="small" type="info">共 {{ pagination.total }} 条</el-tag> -->
|
||||
<template v-if="pagination.total > 0">
|
||||
<el-tag size="small" effect="plain">入库合计 {{ formatNumber(sumInbound) }}</el-tag>
|
||||
<el-tag size="small" effect="plain">出库合计 {{ formatNumber(sumOutbound) }}</el-tag>
|
||||
</template>
|
||||
</div>
|
||||
<div class="toolbar-right">
|
||||
<el-input
|
||||
v-model="keyword"
|
||||
placeholder="搜索商品名称/编码/条码"
|
||||
clearable
|
||||
size="small"
|
||||
style="width: 240px"
|
||||
@keyup.enter="handleKeywordSearch"
|
||||
@clear="handleKeywordSearch"
|
||||
>
|
||||
<template #prefix>
|
||||
<el-icon><Search /></el-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="split-stack" ref="splitStackRef">
|
||||
@ -78,21 +62,24 @@
|
||||
@mousedown="beginSplitDrag"
|
||||
/>
|
||||
<div v-if="selectedRow" class="lower-level" :class="tableSize" :style="lowerPaneStyle">
|
||||
<!-- <div class="detail-header">
|
||||
<span class="detail-title">行明细</span>
|
||||
<span class="detail-sub">字段与接口 <code>data.list[]</code> 单条对象一致</span>
|
||||
</div> -->
|
||||
<div class="detail-header">
|
||||
<el-tabs v-model="activeTab" class="detail-tab">
|
||||
<el-tab-pane label="库存明细" name="detail" />
|
||||
</el-tabs>
|
||||
</div>
|
||||
<div class="detail-container">
|
||||
<el-descriptions :column="2" border size="small">
|
||||
<el-descriptions-item
|
||||
v-for="key in detailKeys"
|
||||
:key="key"
|
||||
:label="fieldLabel(key)"
|
||||
:span="isWideKey(key) ? 2 : 1"
|
||||
>
|
||||
{{ detailValue(key) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<div v-if="activeTab === 'detail'" class="detail-page">
|
||||
<el-descriptions :column="2" border size="small">
|
||||
<el-descriptions-item
|
||||
v-for="key in detailKeys"
|
||||
:key="key"
|
||||
:label="fieldLabel(key)"
|
||||
:span="isWideKey(key) ? 2 : 1"
|
||||
>
|
||||
{{ detailValue(key) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="no-selection" :style="lowerPaneStyle">
|
||||
@ -120,7 +107,6 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Search } from '@element-plus/icons-vue'
|
||||
import dayjs from 'dayjs'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import UpperTable from '@/components/UpperTable/index.vue'
|
||||
@ -175,6 +161,7 @@ const upperPaneFullStyle = computed(() => ({
|
||||
}))
|
||||
|
||||
const detailVisible = ref(true)
|
||||
const activeTab = ref('detail')
|
||||
|
||||
function toggleDetailVisible() {
|
||||
detailVisible.value = !detailVisible.value
|
||||
@ -220,7 +207,6 @@ const currentSort = reactive<{ prop: string; order: '' | 'ascending' | 'descendi
|
||||
|
||||
const selectedRid = ref<string | null>(null)
|
||||
const currentConditionRaw = ref<any>({})
|
||||
const keyword = ref('')
|
||||
|
||||
const selectedRow = computed(() => fullList.value.find((r) => r.__rid === selectedRid.value) || null)
|
||||
|
||||
@ -304,10 +290,6 @@ function buildSortPayload(): StockReportSearchBody['sort'] | undefined {
|
||||
|
||||
function buildReportQueryPayload(): StockReportSearchBody {
|
||||
const where = normalizeScanConditionToReportWhere(currentConditionRaw.value)
|
||||
// 关键字搜索
|
||||
if (keyword.value.trim()) {
|
||||
where.keyword = keyword.value.trim()
|
||||
}
|
||||
const sort = buildSortPayload()
|
||||
const body: StockReportSearchBody = {}
|
||||
if (Object.keys(where).length > 0) {
|
||||
@ -371,19 +353,12 @@ function handleConditionChange(condition: any) {
|
||||
|
||||
function handleConditionClear() {
|
||||
currentConditionRaw.value = {}
|
||||
keyword.value = ''
|
||||
pagination.currentPage = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
function handleKeywordSearch() {
|
||||
pagination.currentPage = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
function handleConditionReset() {
|
||||
currentConditionRaw.value = {}
|
||||
keyword.value = ''
|
||||
pagination.currentPage = 1
|
||||
if (scanBox.value?.reset) {
|
||||
scanBox.value.reset()
|
||||
@ -461,177 +436,43 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.storage-report-container {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
background-color: #f0f2f5;
|
||||
<style scoped lang="scss">
|
||||
@use "../../order/orderManagement/styles/order-sub.scss";
|
||||
|
||||
.main-content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 10px;
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
.order-sub-container .main-content .lower-level .detail-container {
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
|
||||
.toolbar {
|
||||
padding: 5px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
:deep(.el-descriptions__body) {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.toolbar-left {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.toolbar-title {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
margin-left: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.filter-hint {
|
||||
margin: 6px 0 0;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
line-height: 1.5;
|
||||
|
||||
code {
|
||||
font-size: 12px;
|
||||
padding: 0 4px;
|
||||
background: #f4f4f5;
|
||||
border-radius: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.split-stack {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.pane-resizer {
|
||||
flex: 0 0 6px;
|
||||
min-height: 6px;
|
||||
background: #e4e7ed;
|
||||
cursor: row-resize;
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
|
||||
&:hover {
|
||||
background: #dcdfe6;
|
||||
}
|
||||
}
|
||||
|
||||
.upper-wrapper {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.upper-wrapper :deep(.upper-table-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.upper-wrapper :deep(.upper-table-container) :deep(.table-container) {
|
||||
height: auto !important;
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.upper-wrapper :deep(.el-table__header-wrapper) {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 3;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.upper-wrapper :deep(.el-table__body-wrapper) {
|
||||
overflow: auto;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.lower-level {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-top: 1px solid #ebeef5;
|
||||
overflow: hidden;
|
||||
background-color: #fff;
|
||||
|
||||
.detail-header {
|
||||
padding: 10px 12px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
background: #fafafa;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: baseline;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.detail-title {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.detail-sub {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
|
||||
code {
|
||||
font-size: 12px;
|
||||
padding: 0 4px;
|
||||
background: #f4f4f5;
|
||||
border-radius: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.detail-container {
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
|
||||
:deep(.el-descriptions__body) {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
:deep(.el-descriptions-item__cell) {
|
||||
padding: 8px 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.no-selection {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #909399;
|
||||
background-color: #fff;
|
||||
border: 1px dashed #dcdfe6;
|
||||
|
||||
.empty-tip {
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
}
|
||||
:deep(.el-descriptions-item__cell) {
|
||||
padding: 8px 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.detail-page {
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.no-selection {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #909399;
|
||||
background-color: #fff;
|
||||
|
||||
.empty-tip {
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -70,6 +70,7 @@ export type ReportColumn = {
|
||||
align?: 'left' | 'center' | 'right'
|
||||
sortable?: boolean | 'custom'
|
||||
sortOrders?: string[]
|
||||
copyAction?: 'copy' | 'copyQr'
|
||||
formatter?: (row: StockReportListItem) => string
|
||||
}
|
||||
|
||||
@ -77,9 +78,9 @@ export type ReportColumn = {
|
||||
export const fixedReportColumns: ReportColumn[] = [
|
||||
{ prop: 'store_name', label: '货主', minWidth: 120, formatter: (row) => row.store_name || '--' },
|
||||
{ prop: 'item_name', label: '商品名称', minWidth: 140, formatter: (row) => row.item_name || '--' },
|
||||
{ prop: 'item_code', label: '商品编码', minWidth: 120, formatter: (row) => row.item_code || '--' },
|
||||
{ prop: 'barcode', label: '条码', minWidth: 140, formatter: (row) => row.barcode || '--' },
|
||||
{ prop: 'stock_id', label: 'SKU', width: 96, formatter: (row) => formatReportCell(row.stock_id) },
|
||||
{ prop: 'item_code', label: '商品编码', minWidth: 120, copyAction: 'copy' as const, formatter: (row) => row.item_code || '--' },
|
||||
{ prop: 'barcode', label: '条码', minWidth: 140, copyAction: 'copy' as const, formatter: (row) => row.barcode || '--' },
|
||||
{ prop: 'stock_id', label: 'SKU', width: 96, copyAction: 'copy' as const, formatter: (row) => formatReportCell(row.stock_id) },
|
||||
{
|
||||
prop: 'begin_total',
|
||||
label: '期初数量',
|
||||
@ -193,13 +194,6 @@ export const reportScanBoxAvailableFields = [
|
||||
type: 'text',
|
||||
placeholder: '搜索商品名称/编码/条码'
|
||||
}),
|
||||
reportScanField('time', {
|
||||
value: 'report_period',
|
||||
label: '统计时间',
|
||||
type: 'daterange',
|
||||
startPlaceholder: '开始日期',
|
||||
endPlaceholder: '结束日期'
|
||||
}),
|
||||
reportScanField('basic', {
|
||||
value: 'store_id',
|
||||
label: '货主',
|
||||
@ -215,6 +209,13 @@ export const reportScanBoxAvailableFields = [
|
||||
type: 'boolean',
|
||||
placeholder: '开启后按商品+库位+货主返回;关闭则按商品+货主聚合'
|
||||
}),
|
||||
reportScanField('time', {
|
||||
value: 'report_period',
|
||||
label: '统计时间',
|
||||
type: 'daterange',
|
||||
startPlaceholder: '开始日期',
|
||||
endPlaceholder: '结束日期'
|
||||
}),
|
||||
]
|
||||
|
||||
/** 将 ScanBox 条件转为接口扁平 where;无有效条件时返回 {} */
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
</div>
|
||||
|
||||
<div class="toolbar-right">
|
||||
<el-input size="small" placeholder="搜索出库单号" v-model="quickSearch" style="width:220px" @keyup.enter="onQuickSearch" />
|
||||
<!-- <el-input size="small" placeholder="搜索出库单号" v-model="quickSearch" style="width:220px" @keyup.enter="onQuickSearch" /> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -288,7 +288,7 @@ import ColumnCellRenderer from './components/ColumnCellRenderer.vue'
|
||||
import OperationCellRenderer from './components/OperationCellRenderer.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import type { ToolbarButtonConfig as OrderToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { update as printComputerUpdate, del as printComputerDel, setRecording as printComputerSetRecording, cancelRecording as printComputerCancelRecording } from '@/api/print_computer/print_computer'
|
||||
import { update as printComputerUpdate, del as printComputerDel, setRecording as printComputerSetRecording, cancelRecording as printComputerCancelRecording } from '@/api/printer.station/print_computer'
|
||||
import {
|
||||
PAGE_CONFIG,
|
||||
tabPages,
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
* 5. 在 router/map.ts 中添加路由
|
||||
*/
|
||||
|
||||
import { list as printComputerList, update as printComputerUpdate, del as printComputerDel, setRecording as printComputerSetRecording, cancelRecording as printComputerCancelRecording } from '@/api/print_computer/print_computer'
|
||||
import { list as printComputerList, update as printComputerUpdate, del as printComputerDel, setRecording as printComputerSetRecording, cancelRecording as printComputerCancelRecording } from '@/api/printer.station/print_computer'
|
||||
|
||||
// ============================================================
|
||||
// 〇、全局页面配置
|
||||
|
||||
@ -288,7 +288,7 @@ import ColumnCellRenderer from './components/ColumnCellRenderer.vue'
|
||||
import OperationCellRenderer from './components/OperationCellRenderer.vue'
|
||||
import OrderToolbarButtonGroup from '@/views/order/orderManagement/component/OrderToolbarButtonGroup.vue'
|
||||
import type { ToolbarButtonConfig as OrderToolbarButtonConfig } from '@/views/order/orderManagement/config/order-common-config'
|
||||
import { update as printComputerUpdate, del as printComputerDel, setRecording as printComputerSetRecording, cancelRecording as printComputerCancelRecording } from '@/api/print_computer/print_computer'
|
||||
import { update as printComputerUpdate, del as printComputerDel, setRecording as printComputerSetRecording, cancelRecording as printComputerCancelRecording } from '@/api/printer.station/print_computer'
|
||||
import {
|
||||
PAGE_CONFIG,
|
||||
tabPages,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user