新页面
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
parent
abd7ab7013
commit
70ed7232ef
@ -24,6 +24,50 @@ export type WaveBatchListResponse = {
|
||||
pagination: WaveListPagination
|
||||
}
|
||||
|
||||
export type WavePickTaskListParams = {
|
||||
warehouse_id: number
|
||||
pagination?: {
|
||||
page?: number
|
||||
pageSize?: number
|
||||
current?: number
|
||||
size?: number
|
||||
}
|
||||
page_no?: number
|
||||
page_size?: number
|
||||
status?: number | string | Array<number | string>
|
||||
review_status?: number
|
||||
pick_mode?: number
|
||||
source?: string
|
||||
pick_user_id?: number
|
||||
review_user_id?: number
|
||||
task_no?: string
|
||||
cart_id?: number
|
||||
keyword?: string
|
||||
start_time_start?: string
|
||||
start_time_end?: string
|
||||
where?: Record<string, any>
|
||||
strategy_id?: number
|
||||
}
|
||||
|
||||
export type WavePickTaskListResponse = {
|
||||
list: Array<Record<string, unknown>>
|
||||
total?: number
|
||||
page?: number
|
||||
page_size?: number
|
||||
}
|
||||
|
||||
export type WavePickTaskCancelParams = {
|
||||
task_ids: Array<number | string>
|
||||
}
|
||||
|
||||
export type WavePickTaskCancelResponse = {
|
||||
cancelled_count?: number
|
||||
task_ids?: Array<number | string>
|
||||
task_nos?: Array<string>
|
||||
task_id?: number | string
|
||||
task_no?: string
|
||||
}
|
||||
|
||||
export type WaveGroupOrderFetchListParams = {
|
||||
pagination?: {
|
||||
page?: number
|
||||
@ -487,6 +531,38 @@ export function orderWaveBatchList(
|
||||
} as any)
|
||||
}
|
||||
|
||||
export function orderWaveWavePickTaskList(
|
||||
data: WavePickTaskListParams
|
||||
): Promise<WavePickTaskListResponse & { code?: number; message?: string; data?: Partial<WavePickTaskListResponse> }> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.wave.wavePickTaskList',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export function orderWaveWavePickTaskCancel(
|
||||
data: WavePickTaskCancelParams
|
||||
): Promise<WavePickTaskCancelResponse & { code?: number; message?: string; data?: Partial<WavePickTaskCancelResponse> }> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.wave.wavePickTaskCancel',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export function orderWaveGroupOrderFetchList(
|
||||
data: WaveGroupOrderFetchListParams = {}
|
||||
): Promise<WaveGroupOrderFetchListResponse & { code?: number; message?: string; data?: Partial<WaveGroupOrderFetchListResponse> }> {
|
||||
@ -574,7 +650,7 @@ export function orderWaveWaveStrategyFetchAdmin(
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.wave.waveStrategyFetchAdmin',
|
||||
method: 'order.wave.waveStrategyFetchPda',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
@ -870,6 +946,8 @@ export function orderWaveBatchRemoveOrders(
|
||||
|
||||
export const orderWave = {
|
||||
batchList: orderWaveBatchList,
|
||||
wavePickTaskList: orderWaveWavePickTaskList,
|
||||
wavePickTaskCancel: orderWaveWavePickTaskCancel,
|
||||
groupOrderFetchList: orderWaveGroupOrderFetchList,
|
||||
waveStrategyList: orderWaveWaveStrategyList,
|
||||
waveStrategyCreate: orderWaveWaveStrategyCreate,
|
||||
|
||||
@ -37,6 +37,14 @@
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="toolbar-right">
|
||||
<span class="toolbar-switch-label">显示库内抓取波次</span>
|
||||
<el-switch
|
||||
v-model="showInternalSourceWaves"
|
||||
size="small"
|
||||
@change="handleSourceFilterChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="batchAllocateExpressTaskProgress.taskId" class="task-progress-panel task-progress-panel--toolbar">
|
||||
@ -942,6 +950,7 @@ const groupOrderTableRef = ref<any>(null)
|
||||
const singleOrderTableRef = ref<any>(null)
|
||||
const scrollContainerRef = ref<HTMLElement | null>(null)
|
||||
const loading = ref(false)
|
||||
const showInternalSourceWaves = ref(false)
|
||||
const batchAutoGroupingLoading = ref(false)
|
||||
const batchFinishAutoGroupingLoading = ref(false)
|
||||
const batchCancelLoading = ref(false)
|
||||
@ -1337,7 +1346,11 @@ async function loadData() {
|
||||
loading.value = true
|
||||
const start = Date.now()
|
||||
try {
|
||||
const where = sanitizeWaveWhere(buildWhereConditions(scanBox.value?.getConditions?.() || {}))
|
||||
const rawWhere = buildWhereConditions(scanBox.value?.getConditions?.() || {})
|
||||
if (!showInternalSourceWaves.value) {
|
||||
rawWhere.source = 0
|
||||
}
|
||||
const where = sanitizeWaveWhere(rawWhere)
|
||||
if (where.wave_type === undefined || where.wave_type === null || where.wave_type === '') {
|
||||
where.wave_type = currentWaveType.value
|
||||
}
|
||||
@ -1389,6 +1402,11 @@ function handlePageSizeChange(size: number) {
|
||||
loadData()
|
||||
}
|
||||
|
||||
function handleSourceFilterChange() {
|
||||
pagination.currentPage = 1
|
||||
void loadData()
|
||||
}
|
||||
|
||||
function buildWhereConditions(rawConditions: Record<string, any>) {
|
||||
const where: Record<string, any> = {}
|
||||
Object.keys(rawConditions || {}).forEach((key) => {
|
||||
@ -3564,6 +3582,24 @@ async function submitFallbackOrderFetchByIds() {
|
||||
|
||||
.order-sub-container .main-content {
|
||||
.toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.toolbar-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
flex-shrink: 0;
|
||||
padding-left: 8px;
|
||||
}
|
||||
|
||||
.toolbar-switch-label {
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-regular);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.toolbar-left {
|
||||
cursor: grab;
|
||||
|
||||
|
||||
@ -37,6 +37,14 @@
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="toolbar-right">
|
||||
<span class="toolbar-switch-label">显示库内抓取波次</span>
|
||||
<el-switch
|
||||
v-model="showInternalSourceWaves"
|
||||
size="small"
|
||||
@change="handleSourceFilterChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="batchAllocateExpressTaskProgress.taskId" class="task-progress-panel task-progress-panel--toolbar">
|
||||
@ -942,6 +950,7 @@ const groupOrderTableRef = ref<any>(null)
|
||||
const singleOrderTableRef = ref<any>(null)
|
||||
const scrollContainerRef = ref<HTMLElement | null>(null)
|
||||
const loading = ref(false)
|
||||
const showInternalSourceWaves = ref(false)
|
||||
const batchAutoGroupingLoading = ref(false)
|
||||
const batchFinishAutoGroupingLoading = ref(false)
|
||||
const batchCancelLoading = ref(false)
|
||||
@ -1337,7 +1346,11 @@ async function loadData() {
|
||||
loading.value = true
|
||||
const start = Date.now()
|
||||
try {
|
||||
const where = sanitizeWaveWhere(buildWhereConditions(scanBox.value?.getConditions?.() || {}))
|
||||
const rawWhere = buildWhereConditions(scanBox.value?.getConditions?.() || {})
|
||||
if (!showInternalSourceWaves.value) {
|
||||
rawWhere.source = 0
|
||||
}
|
||||
const where = sanitizeWaveWhere(rawWhere)
|
||||
if (where.wave_type === undefined || where.wave_type === null || where.wave_type === '') {
|
||||
where.wave_type = currentWaveType.value
|
||||
}
|
||||
@ -1389,6 +1402,11 @@ function handlePageSizeChange(size: number) {
|
||||
loadData()
|
||||
}
|
||||
|
||||
function handleSourceFilterChange() {
|
||||
pagination.currentPage = 1
|
||||
void loadData()
|
||||
}
|
||||
|
||||
function buildWhereConditions(rawConditions: Record<string, any>) {
|
||||
const where: Record<string, any> = {}
|
||||
Object.keys(rawConditions || {}).forEach((key) => {
|
||||
@ -3564,6 +3582,24 @@ async function submitFallbackOrderFetchByIds() {
|
||||
|
||||
.order-sub-container .main-content {
|
||||
.toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.toolbar-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
flex-shrink: 0;
|
||||
padding-left: 8px;
|
||||
}
|
||||
|
||||
.toolbar-switch-label {
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-regular);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.toolbar-left {
|
||||
cursor: grab;
|
||||
|
||||
|
||||
648
src/views/order/waveOrder/WavePickTaskListPanel.vue
Normal file
648
src/views/order/waveOrder/WavePickTaskListPanel.vue
Normal file
@ -0,0 +1,648 @@
|
||||
<template>
|
||||
<div class="order-sub-container pick-task-panel">
|
||||
<ScanBox
|
||||
ref="scanBox"
|
||||
:width="'320px'"
|
||||
:tree-props="scanTreeProps"
|
||||
:auto-submit="false"
|
||||
:preset-tree="[]"
|
||||
:available-fields="pickTaskAvailableFields"
|
||||
@condition-change="handleConditionChange"
|
||||
@reset="handleConditionReset"
|
||||
@condition-clear="handleConditionClear"
|
||||
/>
|
||||
|
||||
<div class="main-content pick-task-main">
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-left">
|
||||
<div class="toolbar-scroll-container">
|
||||
<el-button type="primary" size="small" @click="handleSearch">查询</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
size="small"
|
||||
:disabled="selectedTaskRows.length === 0"
|
||||
:loading="batchCancelLoading"
|
||||
@click="handleBatchCancelTasks"
|
||||
>
|
||||
批量取消任务({{ selectedTaskRows.length }})
|
||||
</el-button>
|
||||
<el-button size="small" @click="loadData">刷新</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="upper-wrapper">
|
||||
<div class="pick-task-table-panel">
|
||||
<div class="pick-task-table-wrap">
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="list"
|
||||
@selection-change="handleSelectionChange"
|
||||
border
|
||||
stripe
|
||||
height="100%"
|
||||
:empty-text="emptyText"
|
||||
>
|
||||
<el-table-column type="selection" width="52" align="center" fixed="left" />
|
||||
<el-table-column prop="task_id" label="任务ID" width="90" align="center" />
|
||||
<el-table-column prop="task_no" label="任务编号" min-width="220" show-overflow-tooltip />
|
||||
<el-table-column prop="batch_no" label="波次号" min-width="150" show-overflow-tooltip />
|
||||
<el-table-column label="任务状态" width="110" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag size="small" :type="getStatusTagType(row.status)">
|
||||
{{ formatStatus(row.status) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="复核状态" width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag size="small" :type="getReviewStatusTagType(row.review_status)">
|
||||
{{ formatReviewStatus(row.review_status) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="拣货模式" width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag size="small" type="info">
|
||||
{{ formatPickMode(row.pick_mode) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="来源" width="90" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag size="small" :type="getSourceTagType(row.source)">
|
||||
{{ formatSource(row.source) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="wave_count" label="波次数" width="90" align="right" />
|
||||
<el-table-column prop="order_count" label="订单数" width="90" align="right" />
|
||||
<el-table-column label="箱数" width="110" align="right">
|
||||
<template #default="{ row }">
|
||||
<el-tooltip v-if="row.box_count === 0" content="可能未统计" placement="top">
|
||||
<span>{{ row.box_count }}</span>
|
||||
</el-tooltip>
|
||||
<span v-else>{{ row.box_count }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作人" min-width="120" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ row.operator_name || row.operator_id || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="拣货员" min-width="120" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ row.pick_user_name || row.pick_user_id || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="复核人" min-width="120" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ row.review_user_name || row.review_user_id || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="current_cart_id" label="当前车ID" width="100" align="center" />
|
||||
<el-table-column prop="current_cart_code_snapshot" label="当前车编码" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column prop="device_id" label="设备ID" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column label="开始时间" min-width="168" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ formatDateTime(row.start_at || row.start_time) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="完成时间" min-width="168" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ formatDateTime(row.finish_at || row.finish_time) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="复核开始" min-width="168" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ formatDateTime(row.review_start_time) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="复核完成" min-width="168" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ formatDateTime(row.review_finish_time) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" min-width="168" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ formatDateTime(row.created_at || row.create_time) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="更新时间" min-width="168" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ formatDateTime(row.update_time) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="110" fixed="right" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
type="danger"
|
||||
link
|
||||
:loading="cancelingTaskId === getTaskId(row)"
|
||||
:disabled="!getTaskId(row)"
|
||||
@click="handleCancelTask(row)"
|
||||
>
|
||||
取消任务
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<div class="pick-task-pagination">
|
||||
<div class="pagination-info">共 {{ pagination.total }} 条</div>
|
||||
<el-pagination
|
||||
:current-page="pagination.currentPage"
|
||||
:page-size="pagination.pageSize"
|
||||
:page-sizes="[20, 50, 100, 200]"
|
||||
:total="pagination.total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
background
|
||||
@size-change="handlePageSizeChange"
|
||||
@current-change="handlePageChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import ScanBox from '@/components/ScanBox/index.vue'
|
||||
import { useUserStore } from '@/stores/modules/user'
|
||||
import { orderWaveWavePickTaskCancel, orderWaveWavePickTaskList } from '@/api/order.wave/orderwave'
|
||||
|
||||
const userStore = useUserStore()
|
||||
const loading = ref(false)
|
||||
const list = ref<Array<Record<string, any>>>([])
|
||||
const emptyText = ref('暂无拣货任务')
|
||||
const scanBox = ref<any>(null)
|
||||
const cancelingTaskId = ref<number | string | null>(null)
|
||||
const batchCancelLoading = ref(false)
|
||||
const selectedTaskRows = ref<Array<Record<string, any>>>([])
|
||||
|
||||
const filters = reactive<Record<string, any>>({})
|
||||
|
||||
const scanTreeProps = { children: 'children', label: 'label' } as const
|
||||
|
||||
const pickTaskAvailableFields = [
|
||||
{ label: '任务编号', value: 'task_no', type: 'text' },
|
||||
{ label: '关键字', value: 'keyword', type: 'text' },
|
||||
{
|
||||
label: '任务状态',
|
||||
value: 'status',
|
||||
type: 'multiple',
|
||||
options: [
|
||||
{ label: '待拣货', value: 0 },
|
||||
{ label: '拣货中', value: 1 },
|
||||
{ label: '已完成', value: 2 }
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '复核状态',
|
||||
value: 'review_status',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '未复核', value: 0 },
|
||||
{ label: '复核中', value: 1 },
|
||||
{ label: '已复核', value: 2 }
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '拣货模式',
|
||||
value: 'pick_mode',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '模式1', value: 1 },
|
||||
{ label: '模式2', value: 2 }
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '来源',
|
||||
value: 'source',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '来源0', value: 0 },
|
||||
{ label: '来源1', value: 1 },
|
||||
{ label: '来源2', value: 2 }
|
||||
]
|
||||
},
|
||||
{ label: '拣货员ID', value: 'pick_user_id', type: 'number' },
|
||||
{ label: '复核人ID', value: 'review_user_id', type: 'number' },
|
||||
{ label: '拣货车ID', value: 'cart_id', type: 'number' },
|
||||
{ label: '开始时间', value: 'start_time_range', type: 'daterange' }
|
||||
]
|
||||
|
||||
const pagination = reactive({
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
total: 0
|
||||
})
|
||||
|
||||
const warehouseId = computed(() => Number(userStore.user?.warehouse_id ?? userStore.user?.store_id ?? 0))
|
||||
|
||||
const okCode = (code: unknown) => code === 1 || code === 200 || code === 0
|
||||
|
||||
function toNumber(value: unknown, fallback = 0): number {
|
||||
const num = Number(value)
|
||||
return Number.isFinite(num) ? num : fallback
|
||||
}
|
||||
|
||||
function normalizePickTaskRow(row: Record<string, any>) {
|
||||
return {
|
||||
...row,
|
||||
raw: row,
|
||||
task_id: toNumber(row.task_id),
|
||||
warehouse_id: toNumber(row.warehouse_id),
|
||||
pick_mode: toNumber(row.pick_mode),
|
||||
status: toNumber(row.status),
|
||||
review_status: toNumber(row.review_status),
|
||||
source: toNumber(row.source),
|
||||
wave_count: toNumber(row.wave_count),
|
||||
order_count: toNumber(row.order_count),
|
||||
box_count: toNumber(row.box_count),
|
||||
operator_id: row.operator_id ?? row.pick_user_id,
|
||||
operator_name: row.operator_name || row.pick_user_name || '',
|
||||
pick_user_id: row.pick_user_id ?? row.operator_id,
|
||||
pick_user_name: row.pick_user_name || row.operator_name || '',
|
||||
start_at: row.start_at || row.start_time || '',
|
||||
finish_at: row.finish_at || row.finish_time || '',
|
||||
created_at: row.created_at || row.create_time || '',
|
||||
update_time: row.update_time || ''
|
||||
}
|
||||
}
|
||||
|
||||
function formatStatus(value: unknown): string {
|
||||
const num = Number(value)
|
||||
if (num === 0) return '待开始'
|
||||
if (num === 1) return '拣货中'
|
||||
if (num === 2) return '待复核'
|
||||
if (num === 3) return '已完成'
|
||||
if (num === 9) return '已取消'
|
||||
return value === null || value === undefined || value === '' ? '-' : String(value)
|
||||
}
|
||||
|
||||
function formatReviewStatus(value: unknown): string {
|
||||
const num = Number(value)
|
||||
if (num === 0) return '未就绪'
|
||||
if (num === 1) return '待复核'
|
||||
if (num === 2) return '复核中'
|
||||
if (num === 3) return '复核通过'
|
||||
if (num === 4) return '复核异常'
|
||||
return value === null || value === undefined || value === '' ? '-' : String(value)
|
||||
}
|
||||
|
||||
function formatPickMode(value: unknown): string {
|
||||
const num = Number(value)
|
||||
if (num === 1) return '小团购'
|
||||
if (num === 2) return '单品单件'
|
||||
if (num === 3) return '先拣后分'
|
||||
if (num === 4) return '边拣边分'
|
||||
if (num === 5) return '大团购'
|
||||
return value === null || value === undefined || value === '' ? '-' : String(value)
|
||||
}
|
||||
|
||||
function formatSource(value: unknown): string {
|
||||
const num = Number(value)
|
||||
if (num === 1) return 'PDA'
|
||||
if (num === 2) return '后台'
|
||||
return value === null || value === undefined || value === '' ? '-' : String(value)
|
||||
}
|
||||
|
||||
function getStatusTagType(value: unknown): 'info' | 'warning' | 'success' | 'danger' {
|
||||
const num = Number(value)
|
||||
if (num === 0) return 'info'
|
||||
if (num === 1) return 'warning'
|
||||
if (num === 2) return 'danger'
|
||||
if (num === 3) return 'success'
|
||||
if (num === 9) return 'info'
|
||||
return 'info'
|
||||
}
|
||||
|
||||
function getReviewStatusTagType(value: unknown): 'info' | 'warning' | 'success' | 'danger' {
|
||||
const num = Number(value)
|
||||
if (num === 0) return 'info'
|
||||
if (num === 1) return 'warning'
|
||||
if (num === 2) return 'warning'
|
||||
if (num === 3) return 'success'
|
||||
if (num === 4) return 'danger'
|
||||
return 'info'
|
||||
}
|
||||
|
||||
function getSourceTagType(value: unknown): 'info' | 'success' {
|
||||
const num = Number(value)
|
||||
if (num === 1) return 'success'
|
||||
return 'info'
|
||||
}
|
||||
|
||||
function formatDateTime(value: unknown): string {
|
||||
if (value === null || value === undefined || value === '') return '-'
|
||||
const text = String(value)
|
||||
const ts = Number(text)
|
||||
if (Number.isFinite(ts) && ts > 0) {
|
||||
const date = new Date(ts)
|
||||
if (!Number.isNaN(date.getTime())) {
|
||||
return date.toLocaleString('zh-CN', { hour12: false })
|
||||
}
|
||||
}
|
||||
const date = new Date(text)
|
||||
if (!Number.isNaN(date.getTime())) {
|
||||
return date.toLocaleString('zh-CN', { hour12: false })
|
||||
}
|
||||
return text
|
||||
}
|
||||
|
||||
function getTaskId(row: Record<string, any>): number | string | null {
|
||||
const taskId = row.task_id
|
||||
if (taskId === null || taskId === undefined || taskId === '') return null
|
||||
return taskId
|
||||
}
|
||||
|
||||
function getValidTaskIds(rows: Array<Record<string, any>>): Array<number | string> {
|
||||
return rows
|
||||
.map((row) => getTaskId(row))
|
||||
.filter((taskId): taskId is number | string => taskId !== null)
|
||||
}
|
||||
|
||||
async function loadData() {
|
||||
const wid = warehouseId.value
|
||||
if (!Number.isFinite(wid) || wid <= 0) {
|
||||
emptyText.value = '未获取到仓库ID'
|
||||
list.value = []
|
||||
pagination.total = 0
|
||||
return
|
||||
}
|
||||
|
||||
if (loading.value) return
|
||||
loading.value = true
|
||||
emptyText.value = '加载中...'
|
||||
|
||||
try {
|
||||
const startRange = Array.isArray(filters.start_time_range) ? filters.start_time_range : []
|
||||
const res = await orderWaveWavePickTaskList({
|
||||
warehouse_id: wid,
|
||||
page_no: pagination.currentPage,
|
||||
page_size: pagination.pageSize,
|
||||
status: filters.status,
|
||||
review_status: filters.review_status,
|
||||
pick_mode: filters.pick_mode,
|
||||
source: filters.source === undefined || filters.source === null || filters.source === '' ? undefined : String(filters.source),
|
||||
pick_user_id: filters.pick_user_id,
|
||||
review_user_id: filters.review_user_id,
|
||||
task_no: String(filters.task_no || '').trim() || undefined,
|
||||
cart_id: filters.cart_id,
|
||||
keyword: String(filters.keyword || '').trim() || undefined,
|
||||
start_time_start: startRange[0] || undefined,
|
||||
start_time_end: startRange[1] || undefined
|
||||
})
|
||||
|
||||
if (!res || !okCode(res.code)) {
|
||||
throw new Error(res?.message || '获取拣货任务列表失败')
|
||||
}
|
||||
|
||||
const responseList = Array.isArray(res.list)
|
||||
? res.list
|
||||
: Array.isArray(res.data?.list)
|
||||
? res.data.list
|
||||
: []
|
||||
|
||||
const responseTotal = Number(res.total ?? res.data?.total ?? 0)
|
||||
const responsePage = Number(res.page ?? res.data?.page ?? pagination.currentPage)
|
||||
const responsePageSize = Number(res.page_size ?? res.data?.page_size ?? pagination.pageSize)
|
||||
|
||||
list.value = responseList.map((item) => normalizePickTaskRow(item as Record<string, any>))
|
||||
selectedTaskRows.value = []
|
||||
pagination.total = Number.isFinite(responseTotal) ? responseTotal : 0
|
||||
pagination.currentPage = Number.isFinite(responsePage) && responsePage > 0 ? responsePage : pagination.currentPage
|
||||
pagination.pageSize = Number.isFinite(responsePageSize) && responsePageSize > 0 ? responsePageSize : pagination.pageSize
|
||||
emptyText.value = '暂无拣货任务'
|
||||
} catch (error: any) {
|
||||
console.error('load wave pick task list failed:', error)
|
||||
ElMessage.error(error?.message || '获取拣货任务列表失败')
|
||||
list.value = []
|
||||
pagination.total = 0
|
||||
emptyText.value = '加载失败'
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
Object.assign(filters, scanBox.value?.getConditions?.() || {})
|
||||
pagination.currentPage = 1
|
||||
void loadData()
|
||||
}
|
||||
|
||||
function handleConditionChange() {
|
||||
Object.assign(filters, scanBox.value?.getConditions?.() || {})
|
||||
}
|
||||
|
||||
function handleSelectionChange(rows: Array<Record<string, any>>) {
|
||||
selectedTaskRows.value = rows
|
||||
}
|
||||
|
||||
function handleConditionClear() {
|
||||
Object.keys(filters).forEach((key) => delete filters[key])
|
||||
pagination.currentPage = 1
|
||||
void loadData()
|
||||
}
|
||||
|
||||
function handleConditionReset() {
|
||||
Object.keys(filters).forEach((key) => delete filters[key])
|
||||
pagination.currentPage = 1
|
||||
void loadData()
|
||||
}
|
||||
|
||||
async function handleCancelTask(row: Record<string, any>) {
|
||||
const taskId = getTaskId(row)
|
||||
if (!taskId) {
|
||||
ElMessage.warning('未获取到任务ID')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`确认取消任务 ${row.task_no || taskId} 吗?取消后会释放关联波次并回池订单。`,
|
||||
'取消拣货任务',
|
||||
{
|
||||
type: 'warning',
|
||||
confirmButtonText: '确认取消',
|
||||
cancelButtonText: '返回'
|
||||
}
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
cancelingTaskId.value = taskId
|
||||
try {
|
||||
await cancelTasks([taskId])
|
||||
} catch (error: any) {
|
||||
console.error('cancel wave pick task failed:', error)
|
||||
ElMessage.error(error?.message || '取消拣货任务失败')
|
||||
} finally {
|
||||
cancelingTaskId.value = null
|
||||
}
|
||||
}
|
||||
|
||||
async function handleBatchCancelTasks() {
|
||||
const taskIds = getValidTaskIds(selectedTaskRows.value)
|
||||
if (taskIds.length === 0) {
|
||||
ElMessage.warning('请先选择要取消的任务')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`确认批量取消 ${taskIds.length} 个任务吗?取消后会释放关联波次并回池订单。`,
|
||||
'批量取消拣货任务',
|
||||
{
|
||||
type: 'warning',
|
||||
confirmButtonText: '确认取消',
|
||||
cancelButtonText: '返回'
|
||||
}
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
batchCancelLoading.value = true
|
||||
try {
|
||||
await cancelTasks(taskIds)
|
||||
} catch (error: any) {
|
||||
console.error('batch cancel wave pick task failed:', error)
|
||||
ElMessage.error(error?.message || '批量取消拣货任务失败')
|
||||
} finally {
|
||||
batchCancelLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function cancelTasks(taskIds: Array<number | string>) {
|
||||
const res = await orderWaveWavePickTaskCancel({ task_ids: taskIds })
|
||||
if (!res || !okCode(res.code)) {
|
||||
throw new Error(res?.message || '取消拣货任务失败')
|
||||
}
|
||||
|
||||
const cancelledCount = Number(res.cancelled_count ?? res.data?.cancelled_count ?? 0)
|
||||
ElMessage.success(cancelledCount > 0 ? `已取消 ${cancelledCount} 个任务` : '取消任务成功')
|
||||
|
||||
if (list.value.length === taskIds.length && pagination.currentPage > 1) {
|
||||
pagination.currentPage -= 1
|
||||
}
|
||||
await loadData()
|
||||
}
|
||||
|
||||
function handlePageChange(page: number) {
|
||||
pagination.currentPage = page
|
||||
void loadData()
|
||||
}
|
||||
|
||||
function handlePageSizeChange(size: number) {
|
||||
pagination.pageSize = size
|
||||
pagination.currentPage = 1
|
||||
void loadData()
|
||||
}
|
||||
|
||||
watch(
|
||||
warehouseId,
|
||||
(next, prev) => {
|
||||
if (next === prev) return
|
||||
pagination.currentPage = 1
|
||||
void loadData()
|
||||
}
|
||||
)
|
||||
|
||||
onMounted(() => {
|
||||
void loadData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@use "../orderManagement/styles/order-sub.scss";
|
||||
|
||||
.pick-task-panel {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.pick-task-main {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.pick-task-table-panel {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: #fff;
|
||||
border: 1px solid #ebeef5;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.pick-task-table-wrap {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.order-sub-container :deep(.scan-box-container) {
|
||||
flex: 0 0 320px;
|
||||
}
|
||||
|
||||
.order-sub-container :deep(.scan-content) {
|
||||
height: calc(100% - 48px);
|
||||
}
|
||||
|
||||
.order-sub-container :deep(.custom-filter) {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.order-sub-container :deep(.filter-scroll-area) {
|
||||
max-height: calc(100vh - 260px);
|
||||
}
|
||||
|
||||
.order-sub-container .main-content {
|
||||
.toolbar {
|
||||
.toolbar-left {
|
||||
cursor: grab;
|
||||
|
||||
&:active {
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
.toolbar-scroll-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
overflow-x: auto;
|
||||
scrollbar-width: none;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.pick-task-pagination {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
padding: 5px 10px;
|
||||
border-top: 1px solid #e8e8e8;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.pagination-info {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.pick-task-pagination :deep(.el-pagination) {
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
</style>
|
||||
@ -144,7 +144,8 @@ export const waveWhereAllowedFieldList = [
|
||||
'total_orders_min',
|
||||
'total_orders_max',
|
||||
'processed_orders_min',
|
||||
'processed_orders_max'
|
||||
'processed_orders_max',
|
||||
'source'
|
||||
] as const
|
||||
|
||||
export const waveWhereAllowedFields = new Set<string>(waveWhereAllowedFieldList)
|
||||
|
||||
@ -30,6 +30,7 @@ import { useRoute, useRouter } from 'vue-router'
|
||||
import { useSettingsStore } from '@/stores/modules/settings'
|
||||
import GroupWaveBatchListPanel from './GroupWaveBatchListPanel.vue'
|
||||
import SandanWaveBatchListPanel from './SandanWaveBatchListPanel.vue'
|
||||
import WavePickTaskListPanel from './WavePickTaskListPanel.vue'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
|
||||
const route = useRoute()
|
||||
@ -49,7 +50,8 @@ type WaveTabItem = {
|
||||
|
||||
const tabs = ref<WaveTabItem[]>([
|
||||
{ name: 'groupWave', label: '团购波次', component: markRaw(GroupWaveBatchListPanel) },
|
||||
{ name: 'sandanWave', label: '散单波次', component: markRaw(SandanWaveBatchListPanel) }
|
||||
{ name: 'sandanWave', label: '散单波次', component: markRaw(SandanWaveBatchListPanel) },
|
||||
{ name: 'pickTaskWave', label: '拣货中任务', component: markRaw(WavePickTaskListPanel) }
|
||||
])
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user