feat: 新增打包流水功能
新增打包流水页面(data/packingflow)及API(api/order/packing); 添加路由映射与中英文国际化; 清理zh-CN中多余空字符串
This commit is contained in:
parent
19ac3babad
commit
86f76ba14a
118
src/api/order/packing/index.ts
Normal file
118
src/api/order/packing/index.ts
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
const v = '1.0'
|
||||||
|
|
||||||
|
/** 打包任务列表查询参数 */
|
||||||
|
export type PackingListParams = {
|
||||||
|
/** 仓库ID(按仓库维度查询,必填) */
|
||||||
|
warehouse_id?: number | string
|
||||||
|
pagination?: {
|
||||||
|
page?: number
|
||||||
|
pageSize?: number
|
||||||
|
}
|
||||||
|
where?: PackingListWhere
|
||||||
|
sort?: PackingListSort
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 打包任务列表 where 条件 */
|
||||||
|
export type PackingListWhere = {
|
||||||
|
/** 任务状态:0=待处理 1=打包中 2=已完成 3=异常 */
|
||||||
|
status?: number | string
|
||||||
|
/** 打包模式:1=散单 2=团购 */
|
||||||
|
pack_mode?: number | string
|
||||||
|
/** 运单号(模糊匹配) */
|
||||||
|
waybill_code?: string
|
||||||
|
/** 波次号(模糊匹配) */
|
||||||
|
wave_no?: string
|
||||||
|
/** 订单ID(精确匹配) */
|
||||||
|
order_id?: number | string
|
||||||
|
/** 工作台ID(精确匹配) */
|
||||||
|
workbench_id?: number | string
|
||||||
|
/** 快捷搜索:运单号/波次号模糊匹配 */
|
||||||
|
quickWhere?: string
|
||||||
|
/** 开始打包时间范围-起始 */
|
||||||
|
start_time_start?: string
|
||||||
|
/** 开始打包时间范围-结束 */
|
||||||
|
start_time_end?: string
|
||||||
|
[key: string]: any
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 打包任务列表排序 */
|
||||||
|
export type PackingListSort = {
|
||||||
|
sortField?: string
|
||||||
|
sortOrder?: 'ASC' | 'DESC' | 'asc' | 'desc'
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 打包任务列表项 */
|
||||||
|
export type PackingTaskItem = {
|
||||||
|
id?: number
|
||||||
|
order_id?: number | string
|
||||||
|
warehouse_id?: number | string
|
||||||
|
workbench_id?: number | string
|
||||||
|
wave_id?: number | string
|
||||||
|
wave_no?: string
|
||||||
|
waybill_code?: string
|
||||||
|
pack_quantity?: number
|
||||||
|
pack_mode?: number | string
|
||||||
|
status?: number | string
|
||||||
|
start_time?: string
|
||||||
|
end_time?: string
|
||||||
|
create_time?: string
|
||||||
|
update_time?: string
|
||||||
|
[key: string]: any
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 打包任务列表响应 */
|
||||||
|
export type PackingListResponse = {
|
||||||
|
list: PackingTaskItem[]
|
||||||
|
pagination: {
|
||||||
|
page?: number
|
||||||
|
pageSize?: number
|
||||||
|
total?: number
|
||||||
|
totalPages?: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打包任务列表查询(仓库侧)
|
||||||
|
* 按仓库维度查询 wms_pack_task 表,支持分页、筛选、排序
|
||||||
|
*/
|
||||||
|
export function packingList(data: PackingListParams = {}): Promise<{
|
||||||
|
code: number
|
||||||
|
message: string
|
||||||
|
data: PackingListResponse
|
||||||
|
}> {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'order.packing.list',
|
||||||
|
v,
|
||||||
|
timestamp: new Date().getTime()
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打包任务详情查询(仓库侧)
|
||||||
|
* 按打包任务ID + 仓库维度查询单条打包任务记录
|
||||||
|
*/
|
||||||
|
export function packingGet(id: number): Promise<{
|
||||||
|
code: number
|
||||||
|
message: string
|
||||||
|
data: PackingTaskItem
|
||||||
|
}> {
|
||||||
|
return request({
|
||||||
|
url: '/system',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
method: 'order.packing.get',
|
||||||
|
v,
|
||||||
|
timestamp: new Date().getTime()
|
||||||
|
},
|
||||||
|
data: { id },
|
||||||
|
isSystemApi: true
|
||||||
|
} as any)
|
||||||
|
}
|
||||||
@ -71,6 +71,7 @@ export default {
|
|||||||
'Externalwarehouse':'External Warehouse',
|
'Externalwarehouse':'External Warehouse',
|
||||||
'workbench':'Workbench',
|
'workbench':'Workbench',
|
||||||
// 'OwnerReceiving':'Owner Receiving',
|
// 'OwnerReceiving':'Owner Receiving',
|
||||||
|
'PackingFlow':'Packing Flow',
|
||||||
},
|
},
|
||||||
"login": {
|
"login": {
|
||||||
"title": "Login",
|
"title": "Login",
|
||||||
|
|||||||
@ -74,9 +74,7 @@ export default {
|
|||||||
'workbench':'工作台',
|
'workbench':'工作台',
|
||||||
// 'OwnerReceiving':'仓库收货单',
|
// 'OwnerReceiving':'仓库收货单',
|
||||||
'WmsCameraServer':'录像服务器',
|
'WmsCameraServer':'录像服务器',
|
||||||
'':'',
|
'PackingFlow':'打包流水',
|
||||||
'':'',
|
|
||||||
'':'',
|
|
||||||
},
|
},
|
||||||
"login": {
|
"login": {
|
||||||
"title": "登录",
|
"title": "登录",
|
||||||
|
|||||||
@ -65,4 +65,5 @@ export const componentMap: Record<string, any> = {
|
|||||||
'system/setting/pickcart/index':() => import('@/views/system/setting/pickcart/index.vue'),
|
'system/setting/pickcart/index':() => import('@/views/system/setting/pickcart/index.vue'),
|
||||||
'video/cameraServer/index': () => import('@/views/video/cameraServer/index.vue'),
|
'video/cameraServer/index': () => import('@/views/video/cameraServer/index.vue'),
|
||||||
'video/camera/index': () => import('@/views/video/newcamara/index.vue'),
|
'video/camera/index': () => import('@/views/video/newcamara/index.vue'),
|
||||||
|
'data/packingflow': () => import('@/views/data/packingflow/index.vue'),
|
||||||
};
|
};
|
||||||
34
src/views/data/packingflow/components/VideoButton.vue
Normal file
34
src/views/data/packingflow/components/VideoButton.vue
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<template>
|
||||||
|
<el-button
|
||||||
|
v-if="videoCount > 0"
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
@click.stop="$emit('click')"
|
||||||
|
>
|
||||||
|
<el-icon style="margin-right:2px"><VideoCameraFilled /></el-icon>
|
||||||
|
有视频 ({{ videoCount }})
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue'
|
||||||
|
import { VideoCameraFilled } from '@element-plus/icons-vue'
|
||||||
|
|
||||||
|
export interface VideoItem {
|
||||||
|
id: number
|
||||||
|
video_url: string
|
||||||
|
camera_id?: number
|
||||||
|
camera_name?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
videos: VideoItem[]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
defineEmits<{
|
||||||
|
click: []
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const videoCount = computed(() => props.videos?.length ?? 0)
|
||||||
|
</script>
|
||||||
134
src/views/data/packingflow/components/VideoListDialog.vue
Normal file
134
src/views/data/packingflow/components/VideoListDialog.vue
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
:model-value="visible"
|
||||||
|
title="打包录像列表"
|
||||||
|
width="700px"
|
||||||
|
align-center
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
@update:model-value="$emit('update:visible', $event)"
|
||||||
|
>
|
||||||
|
<div v-if="videos.length === 0" class="empty-hint">
|
||||||
|
<el-empty description="暂无录像" :image-size="80" />
|
||||||
|
</div>
|
||||||
|
<div v-else class="video-list">
|
||||||
|
<div
|
||||||
|
v-for="(video, index) in videos"
|
||||||
|
:key="video.id ?? index"
|
||||||
|
class="video-item"
|
||||||
|
@click="$emit('play', video)"
|
||||||
|
>
|
||||||
|
<div class="video-item__thumb">
|
||||||
|
<el-icon size="28"><VideoPlay /></el-icon>
|
||||||
|
</div>
|
||||||
|
<div class="video-item__info">
|
||||||
|
<div class="video-item__name">
|
||||||
|
{{ video.camera_name || '录像 ' + (index + 1) }}
|
||||||
|
</div>
|
||||||
|
<div class="video-item__meta">
|
||||||
|
<span>摄像头ID: {{ video.camera_id ?? '—' }}</span>
|
||||||
|
<span class="meta-divider">|</span>
|
||||||
|
<span>录像ID: {{ video.id }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="video-item__action">
|
||||||
|
<el-button type="primary" size="small" round>播放</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<el-button size="small" @click="$emit('update:visible', false)">关闭</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { VideoPlay } from '@element-plus/icons-vue'
|
||||||
|
import type { VideoItem } from './VideoButton.vue'
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
visible: boolean
|
||||||
|
videos: VideoItem[]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
defineEmits<{
|
||||||
|
'update:visible': [value: boolean]
|
||||||
|
play: [video: VideoItem]
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.video-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 4px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.video-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16px;
|
||||||
|
padding: 16px 20px;
|
||||||
|
border: 1px solid #ebeef5;
|
||||||
|
border-radius: 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.video-item:hover {
|
||||||
|
border-color: #409eff;
|
||||||
|
background: #ecf5ff;
|
||||||
|
box-shadow: 0 2px 8px rgba(64, 158, 255, 0.15);
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.video-item__thumb {
|
||||||
|
width: 56px;
|
||||||
|
height: 56px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: linear-gradient(135deg, #ecf5ff 0%, #d9ecff 100%);
|
||||||
|
border-radius: 12px;
|
||||||
|
color: #409eff;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.video-item:hover .video-item__thumb {
|
||||||
|
background: linear-gradient(135deg, #409eff 0%, #66b1ff 100%);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.video-item__info {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.video-item__name {
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #303133;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.video-item__meta {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #909399;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.meta-divider {
|
||||||
|
color: #dcdfe6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.video-item__action {
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-hint {
|
||||||
|
padding: 40px 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
173
src/views/data/packingflow/components/VideoPlayerDialog.vue
Normal file
173
src/views/data/packingflow/components/VideoPlayerDialog.vue
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
:model-value="visible"
|
||||||
|
:title="video?.camera_name || '录像回放'"
|
||||||
|
width="800px"
|
||||||
|
align-center
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
destroy-on-close
|
||||||
|
@update:model-value="$emit('update:visible', $event)"
|
||||||
|
@closed="handleClosed"
|
||||||
|
>
|
||||||
|
<div class="player-wrapper">
|
||||||
|
<!-- 加载中 -->
|
||||||
|
<div v-if="loading" class="player-overlay">
|
||||||
|
<el-icon class="is-loading" size="32"><Loading /></el-icon>
|
||||||
|
<span>加载中…</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 播放错误 -->
|
||||||
|
<div v-else-if="errorMsg" class="player-overlay">
|
||||||
|
<el-icon size="32"><WarningFilled /></el-icon>
|
||||||
|
<span class="error-text">{{ errorMsg }}</span>
|
||||||
|
<el-button size="small" type="primary" @click="retry">重试</el-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 视频播放器 -->
|
||||||
|
<video
|
||||||
|
v-show="!loading && !errorMsg"
|
||||||
|
ref="videoRef"
|
||||||
|
class="video-element"
|
||||||
|
:src="video?.video_url"
|
||||||
|
controls
|
||||||
|
autoplay
|
||||||
|
@loadeddata="loading = false"
|
||||||
|
@error="handleVideoError"
|
||||||
|
@ended="handleEnded"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 视频信息 -->
|
||||||
|
<div v-if="video" class="video-info-bar">
|
||||||
|
<span v-if="video.camera_id">摄像头ID: {{ video.camera_id }}</span>
|
||||||
|
<span v-if="video.camera_name && video.camera_id" class="info-divider">|</span>
|
||||||
|
<span v-if="video.camera_name">{{ video.camera_name }}</span>
|
||||||
|
<span class="info-divider">|</span>
|
||||||
|
<span>录像ID: {{ video.id }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<el-button size="small" @click="$emit('update:visible', false)">关闭</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, watch, nextTick } from 'vue'
|
||||||
|
import { Loading, WarningFilled } from '@element-plus/icons-vue'
|
||||||
|
import type { VideoItem } from './VideoButton.vue'
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
visible: boolean
|
||||||
|
video: VideoItem | null
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
'update:visible': [value: boolean]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const videoRef = ref<HTMLVideoElement | null>(null)
|
||||||
|
const loading = ref(true)
|
||||||
|
const errorMsg = ref('')
|
||||||
|
|
||||||
|
// 打开时重置状态
|
||||||
|
watch(() => props.visible, (val) => {
|
||||||
|
if (val) {
|
||||||
|
loading.value = true
|
||||||
|
errorMsg.value = ''
|
||||||
|
nextTick(() => {
|
||||||
|
if (videoRef.value) {
|
||||||
|
videoRef.value.load()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
function handleVideoError(e: Event) {
|
||||||
|
loading.value = false
|
||||||
|
const el = e.target as HTMLVideoElement
|
||||||
|
const code = el?.error?.code
|
||||||
|
const msgMap: Record<number, string> = {
|
||||||
|
1: '视频加载被中止',
|
||||||
|
2: '网络错误,无法加载视频',
|
||||||
|
3: '视频解码失败',
|
||||||
|
4: '视频格式不支持或文件不存在'
|
||||||
|
}
|
||||||
|
errorMsg.value = msgMap[code ?? 4] || '视频播放失败'
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleEnded() {
|
||||||
|
// 播放结束
|
||||||
|
}
|
||||||
|
|
||||||
|
function retry() {
|
||||||
|
loading.value = true
|
||||||
|
errorMsg.value = ''
|
||||||
|
nextTick(() => {
|
||||||
|
if (videoRef.value) {
|
||||||
|
videoRef.value.load()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleClosed() {
|
||||||
|
if (videoRef.value) {
|
||||||
|
videoRef.value.pause()
|
||||||
|
videoRef.value.removeAttribute('src')
|
||||||
|
videoRef.value.load()
|
||||||
|
}
|
||||||
|
loading.value = true
|
||||||
|
errorMsg.value = ''
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.player-wrapper {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 360px;
|
||||||
|
background: #000;
|
||||||
|
border-radius: 6px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.video-element {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 360px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.player-overlay {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 8px;
|
||||||
|
color: #909399;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-text {
|
||||||
|
color: #f56c6c;
|
||||||
|
max-width: 300px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.video-info-bar {
|
||||||
|
margin-top: 10px;
|
||||||
|
padding: 6px 0;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #909399;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-divider {
|
||||||
|
color: #dcdfe6;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
550
src/views/data/packingflow/index.vue
Normal file
550
src/views/data/packingflow/index.vue
Normal file
@ -0,0 +1,550 @@
|
|||||||
|
<template>
|
||||||
|
<div class="packingflow-container">
|
||||||
|
<scan-box
|
||||||
|
ref="scanBox"
|
||||||
|
width="250px"
|
||||||
|
title="打包筛选"
|
||||||
|
:available-fields="availableFields"
|
||||||
|
@condition-change="handleConditionChange"
|
||||||
|
@reset="handleReset"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div class="main-content">
|
||||||
|
<div class="toolbar">
|
||||||
|
<div class="toolbar-left">
|
||||||
|
<el-button size="small" @click="loadData">
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 上下分栏 -->
|
||||||
|
<div class="split-stack" ref="splitStackRef">
|
||||||
|
<div class="upper-wrapper" :style="upperPaneStyle">
|
||||||
|
<upper-table
|
||||||
|
ref="tableRef"
|
||||||
|
default-align="center"
|
||||||
|
:enable-column-config="true"
|
||||||
|
table-id="packingflow-list"
|
||||||
|
:data="list"
|
||||||
|
:columns="columns"
|
||||||
|
:loading="loading"
|
||||||
|
:pagination="pagination"
|
||||||
|
@current-change="handleRowClick"
|
||||||
|
@page-change="handlePageChange"
|
||||||
|
@page-size-change="handleSizeChange"
|
||||||
|
@sort-change="handleSortChange"
|
||||||
|
>
|
||||||
|
<template #column-id="{ row }">
|
||||||
|
<span>{{ row.id ?? '—' }}</span>
|
||||||
|
</template>
|
||||||
|
<template #column-status="{ row }">
|
||||||
|
<el-tag :type="statusTagType(row.status)" size="small">
|
||||||
|
{{ statusLabel(row.status) }}
|
||||||
|
</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>
|
||||||
|
</template>
|
||||||
|
<template #column-videos="{ row }">
|
||||||
|
<VideoButton :videos="row.videos || []" @click="openVideoList(row)" />
|
||||||
|
</template>
|
||||||
|
<template #column-actions="{ row }">
|
||||||
|
<el-button link type="primary" size="small" @click.stop="openDetail(row)">详情</el-button>
|
||||||
|
</template>
|
||||||
|
<template #empty>
|
||||||
|
<el-empty description="暂无打包任务数据" :image-size="60" />
|
||||||
|
</template>
|
||||||
|
</upper-table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 分隔条 -->
|
||||||
|
<div
|
||||||
|
class="pane-resizer"
|
||||||
|
title="拖动调整列表与详情区域高度"
|
||||||
|
@mousedown="beginSplitDrag"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 详情面板 -->
|
||||||
|
<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>
|
||||||
|
</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>
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<!-- 未选中时占位 -->
|
||||||
|
<div class="lower-level empty" v-else :style="lowerPaneStyle">
|
||||||
|
<el-empty description="点击表格行查看详情" :image-size="60" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 录像列表弹窗 -->
|
||||||
|
<VideoListDialog
|
||||||
|
v-model:visible="videoListVisible"
|
||||||
|
:videos="currentVideos"
|
||||||
|
@play="handlePlayVideo"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 录像播放弹窗 -->
|
||||||
|
<VideoPlayerDialog
|
||||||
|
v-model:visible="playerVisible"
|
||||||
|
:video="playingVideo"
|
||||||
|
/>
|
||||||
|
</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 dayjs from 'dayjs'
|
||||||
|
import { packingList, packingGet, type PackingTaskItem, type PackingListSort } from '@/api/order/packing/index'
|
||||||
|
import ScanBox from '@/components/ScanBox/index.vue'
|
||||||
|
import UpperTable from '@/components/UpperTable/index.vue'
|
||||||
|
import WarehouseSelect from '@/components/WarehouseSelect.vue'
|
||||||
|
import VideoButton, { type VideoItem } from './components/VideoButton.vue'
|
||||||
|
import VideoListDialog from './components/VideoListDialog.vue'
|
||||||
|
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' },
|
||||||
|
{ prop: 'actions', label: '操作', width: 80, fixed: 'right' }
|
||||||
|
]
|
||||||
|
|
||||||
|
// ─── 筛选字段配置 ──────────────────────────────────────────────────────────
|
||||||
|
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 statusMap: Record<number, string> = {
|
||||||
|
0: '待处理',
|
||||||
|
1: '打包中',
|
||||||
|
2: '已完成',
|
||||||
|
3: '异常'
|
||||||
|
}
|
||||||
|
|
||||||
|
function statusLabel(status: any): string {
|
||||||
|
const s = Number(status)
|
||||||
|
return statusMap[s] ?? '—'
|
||||||
|
}
|
||||||
|
|
||||||
|
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'
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 从 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 || ''
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── 响应式状态 ────────────────────────────────────────────────────────────
|
||||||
|
const scanBox = ref()
|
||||||
|
const tableRef = ref()
|
||||||
|
const loading = ref(false)
|
||||||
|
const list = ref<PackingTaskItem[]>([])
|
||||||
|
const pagination = reactive({
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
total: 0
|
||||||
|
})
|
||||||
|
|
||||||
|
const queryForm = reactive({
|
||||||
|
warehouse_id: '' as string | number,
|
||||||
|
quickWhere: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
const whereConditions = ref<Record<string, any>>({})
|
||||||
|
|
||||||
|
// ─── 数据加载 ──────────────────────────────────────────────────────────────
|
||||||
|
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,
|
||||||
|
pagination: { page: pagination.currentPage, pageSize: pagination.pageSize },
|
||||||
|
where,
|
||||||
|
sort: sortState.value
|
||||||
|
})
|
||||||
|
|
||||||
|
const codeOk = [200, 20000, 1, 0].includes(res.code)
|
||||||
|
if (!codeOk) {
|
||||||
|
ElMessage.error(res.message || '查询失败')
|
||||||
|
list.value = []
|
||||||
|
pagination.total = 0
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
list.value = res.data?.list ?? []
|
||||||
|
pagination.total = res.data?.pagination?.total ?? 0
|
||||||
|
} catch (e: any) {
|
||||||
|
ElMessage.error(e?.message || '查询异常')
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── 排序状态 ──────────────────────────────────────────────────────────────
|
||||||
|
const sortState = ref<PackingListSort>({
|
||||||
|
sortField: 'create_time',
|
||||||
|
sortOrder: 'DESC'
|
||||||
|
})
|
||||||
|
|
||||||
|
function handleSortChange(sort: { prop: string; order: string }) {
|
||||||
|
if (!sort.order) {
|
||||||
|
sortState.value = { sortField: 'create_time', sortOrder: 'DESC' }
|
||||||
|
} else {
|
||||||
|
sortState.value = {
|
||||||
|
sortField: sort.prop,
|
||||||
|
sortOrder: sort.order === 'ascending' ? 'ASC' : 'DESC'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pagination.currentPage = 1
|
||||||
|
loadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── 分页 ──────────────────────────────────────────────────────────────────
|
||||||
|
function handlePageChange(page: number) {
|
||||||
|
pagination.currentPage = page
|
||||||
|
loadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSizeChange(size: number) {
|
||||||
|
pagination.pageSize = size
|
||||||
|
pagination.currentPage = 1
|
||||||
|
loadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── 筛选 ──────────────────────────────────────────────────────────────────
|
||||||
|
function handleConditionChange(conditions: Record<string, any>) {
|
||||||
|
whereConditions.value = { ...conditions }
|
||||||
|
pagination.currentPage = 1
|
||||||
|
loadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleReset() {
|
||||||
|
whereConditions.value = {}
|
||||||
|
pagination.currentPage = 1
|
||||||
|
loadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleWarehouseChange() {
|
||||||
|
pagination.currentPage = 1
|
||||||
|
loadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSearch() {
|
||||||
|
pagination.currentPage = 1
|
||||||
|
loadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── 上下分栏拖动 ──────────────────────────────────────────────────────────
|
||||||
|
const { splitStackRef, beginSplitDrag, lowerPaneStyle, upperPaneStyle } = useVerticalSplitPane({
|
||||||
|
defaultLowerPercent: 35,
|
||||||
|
minLowerPercent: 15,
|
||||||
|
maxLowerPercent: 70
|
||||||
|
})
|
||||||
|
|
||||||
|
// ─── 详情面板 ──────────────────────────────────────────────────────────────
|
||||||
|
const selectedRow = ref<PackingTaskItem | null>(null)
|
||||||
|
const detailLoading = ref(false)
|
||||||
|
const detail = ref<PackingTaskItem>({})
|
||||||
|
|
||||||
|
function handleRowClick(row: PackingTaskItem) {
|
||||||
|
selectedRow.value = row
|
||||||
|
loadDetail(row)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function openDetail(row: PackingTaskItem) {
|
||||||
|
selectedRow.value = row
|
||||||
|
loadDetail(row)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadDetail(row: PackingTaskItem) {
|
||||||
|
detailLoading.value = true
|
||||||
|
try {
|
||||||
|
const res = await packingGet(Number(row.id))
|
||||||
|
const codeOk = [200, 20000, 1, 0].includes(res.code)
|
||||||
|
if (!codeOk) {
|
||||||
|
ElMessage.error(res.message || '获取详情失败')
|
||||||
|
detail.value = row
|
||||||
|
return
|
||||||
|
}
|
||||||
|
detail.value = res.data ?? row
|
||||||
|
} catch (e: any) {
|
||||||
|
ElMessage.error(e?.message || '获取详情异常')
|
||||||
|
detail.value = row
|
||||||
|
} finally {
|
||||||
|
detailLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── 录像相关 ──────────────────────────────────────────────────────────────
|
||||||
|
const videoListVisible = ref(false)
|
||||||
|
const playerVisible = ref(false)
|
||||||
|
const currentVideos = ref<VideoItem[]>([])
|
||||||
|
const playingVideo = ref<VideoItem | null>(null)
|
||||||
|
|
||||||
|
function openVideoList(row: PackingTaskItem) {
|
||||||
|
currentVideos.value = (row.videos as VideoItem[]) || []
|
||||||
|
if (currentVideos.value.length === 0) return
|
||||||
|
videoListVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePlayVideo(video: VideoItem) {
|
||||||
|
videoListVisible.value = false
|
||||||
|
playingVideo.value = video
|
||||||
|
playerVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── 初始化 ────────────────────────────────────────────────────────────────
|
||||||
|
onMounted(() => {
|
||||||
|
loadData()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.packingflow-container {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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;
|
||||||
|
overflow: auto;
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.express-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 2px 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
x
Reference in New Issue
Block a user