1
This commit is contained in:
parent
1925741ada
commit
ac66dce6cf
@ -96,17 +96,56 @@ export function pickWavePickTaskSubmit(
|
||||
} as any)
|
||||
}
|
||||
|
||||
/** pick.wavePickTaskComplete 请求参数(完全提交拣货任务) */
|
||||
export type PickWavePickTaskCompleteParams = {
|
||||
/** 拣货任务ID */
|
||||
task_id: number
|
||||
/** 提交模式:1=全部确认(默认),2=部分确认 */
|
||||
mode?: number
|
||||
/** 部分确认模式(mode=2)时必填;仅会确认命中当前任务的订单ID */
|
||||
order_ids?: Array<number | string>
|
||||
}
|
||||
|
||||
/** 被跳过的拦截订单明细(skipped_intercepted_orders 数组项) */
|
||||
export type PickWavePickTaskCompleteInterceptedOrder = {
|
||||
/** 订单ID */
|
||||
order_id: number | string
|
||||
/** 拦截状态 */
|
||||
intercept_status?: string | null
|
||||
/** 面单打印状态:none/空 = 未打印(会被自动移出波次);其余 = 已打印(保持不动) */
|
||||
print_status?: string | null
|
||||
}
|
||||
|
||||
/**
|
||||
* pick.wavePickTaskComplete 响应(2026-10-13 后端更新)。
|
||||
*
|
||||
* 拦截订单处理语义:
|
||||
* - 目标订单中已进入拦截流程的订单**直接跳过**(不完成拣货、不扣减库存、不报错)
|
||||
* → `skipped_intercepted_order_ids` / `skipped_intercepted_orders`
|
||||
* - 其中**未打印面单**(print_status = none/空)的拦截订单自动移出波次(wave_id 清零、删波次索引、
|
||||
* 回写波次统计、移除任务订单关联与篮子明细,写 ORDER_WAVE_REMOVE 日志、触发策略快扫)
|
||||
* → `removed_from_wave_order_ids`
|
||||
* - 其中**已打印面单**的拦截订单保持不动(保留波次/任务关联,需人工 wave.batchRemoveOrders 处理)
|
||||
* → `kept_intercepted_order_ids`
|
||||
*/
|
||||
export type PickWavePickTaskCompleteResponse = {
|
||||
/** 拣货任务ID */
|
||||
task_id: number
|
||||
/** 实际生效的提交模式(1=全部确认,2=部分确认) */
|
||||
mode: number
|
||||
/** 本次成功确认的订单ID列表 */
|
||||
confirmed_order_ids: Array<number | string>
|
||||
/** 被跳过(已进入拦截流程)的订单ID列表 */
|
||||
skipped_intercepted_order_ids: Array<number | string>
|
||||
/** 被跳过的拦截订单明细(每项含 order_id / intercept_status / print_status) */
|
||||
skipped_intercepted_orders: PickWavePickTaskCompleteInterceptedOrder[]
|
||||
/** 被自动移出波次的「未打印面单」拦截订单ID列表 */
|
||||
removed_from_wave_order_ids: Array<number | string>
|
||||
/** 「已打印面单」保持不动的拦截订单ID列表(不自动移出波次,需人工 wave.batchRemoveOrders 处理) */
|
||||
kept_intercepted_order_ids: Array<number | string>
|
||||
/** 提交后任务是否已完成 */
|
||||
is_completed: boolean
|
||||
/** 任务订单拣货进度统计 */
|
||||
progress: Record<string, unknown>
|
||||
}
|
||||
|
||||
@ -140,7 +179,13 @@ export function pickWavePickComplete(
|
||||
} as any)
|
||||
}
|
||||
|
||||
/** pick.wavePickTaskComplete:完全提交拣货任务 */
|
||||
/**
|
||||
* pick.wavePickTaskComplete:完全提交拣货任务。
|
||||
* 支持 mode=1 全部确认 / mode=2 部分确认(需传 order_ids);提交后按是否全部完成自动推进任务状态。
|
||||
* ⚠️ 后台抓取创建的任务(source=2)必须先绑定拣货车才能提交,否则返回 400。
|
||||
* ⚠️ 拦截订单不阻断提交:直接跳过,其中未打印面单的自动移出波次(removed_from_wave_order_ids),
|
||||
* 已打印面单的保持不动(kept_intercepted_order_ids,需人工 wave.batchRemoveOrders 处理)。
|
||||
*/
|
||||
export function pickWavePickTaskComplete(
|
||||
data: PickWavePickTaskCompleteParams
|
||||
): Promise<PickWavePickTaskCompleteResponse & { code?: number; message?: string; data?: Partial<PickWavePickTaskCompleteResponse> }> {
|
||||
|
||||
@ -38,8 +38,11 @@ export function returnReceivedCreate(
|
||||
|
||||
/** returnReceived.list 的 where 筛选条件 */
|
||||
export type ReturnReceivedListWhere = {
|
||||
/** 退回收件运单号(模糊搜索,传 {operator:'like',value} 或直接值) */
|
||||
waybill_code?: string | { operator: string; value: any }
|
||||
/**
|
||||
* 退回收件运单号(模糊搜索,传 {operator:'like',value} 或直接值;
|
||||
* **value 为数组时多值 OR 包含匹配**,用于多单号批量搜索)
|
||||
*/
|
||||
waybill_code?: string | string[] | { operator: string; value: any }
|
||||
/** 扫描日期范围 { operator:'between'|'gte'|'lte', value:[start,end] 或单值 } */
|
||||
scan_date?: { operator: 'between' | 'gte' | 'lte'; value: [string, string] | string }
|
||||
/** 扫描人员工号ID(等值) */
|
||||
@ -226,9 +229,11 @@ export function returnReceivedDelete(data: ReturnReceivedDeleteParams): Promise<
|
||||
export type ReturnReceivedExportParams = {
|
||||
/**
|
||||
* 查询条件,语义与 returnReceived.list 的 where 一致;禁止传 warehouse_id/warehouseId(服务端注入)。
|
||||
* 支持字段:waybill_code(模糊)、scan_date/created_at/updated_at(范围)、
|
||||
* scanner_id/scanner_name/store_id/order_express_id/order_id/return_received_task_id(等值)、
|
||||
* is_original_return(是否原单退回)
|
||||
* 支持 {operator,value} 标准结构或直接值;支持字段:
|
||||
* - waybill_code 模糊(like 支持**数组多值 OR 包含**)
|
||||
* - scan_date / created_at / updated_at 范围
|
||||
* - scanner_id / scanner_name / store_id / order_express_id / order_id / return_received_task_id 等值
|
||||
* - is_original_return 是否原单退回
|
||||
*/
|
||||
where?: Record<string, any>
|
||||
/** 排序参数,语义与 returnReceived.list 的 sort 一致(sortField 白名单 id/scan_date/created_at/updated_at/waybill_code,默认 created_at desc) */
|
||||
|
||||
@ -148,8 +148,11 @@ export function returnWaybillUpdate(data: ReturnWaybillUpdateParams): Promise<an
|
||||
|
||||
/** returnWaybill.list 的 where 筛选条件 */
|
||||
export type ReturnWaybillListWhere = {
|
||||
/** 运单号(模糊搜索,传 {operator:'like',value} 或直接值) */
|
||||
waybill_code?: string | { operator: string; value: any }
|
||||
/**
|
||||
* 运单号(模糊搜索,传 {operator:'like',value} 或直接值;
|
||||
* **value 为数组时多值 OR 包含匹配**,用于多单号批量搜索)
|
||||
*/
|
||||
waybill_code?: string | string[] | { operator: string; value: any }
|
||||
/** 货主ID(等值) */
|
||||
store_id?: number
|
||||
/** 是否已通知(等值):1 已通知 / 0 未通知 */
|
||||
|
||||
@ -2,29 +2,41 @@
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="dialogTitle"
|
||||
width="1135px"
|
||||
width="min(1135px, 96vw)"
|
||||
align-center
|
||||
class="print-dialog"
|
||||
custom-class="print-dialog"
|
||||
:body-style="printDialogBodyStyle"
|
||||
>
|
||||
<div class="print-dialog-layout">
|
||||
<div class="print-batch-list">
|
||||
<div class="list-title">打印队列 ({{ selectionRows.length }})</div>
|
||||
<div class="list-title">
|
||||
<span>打印队列 ({{ selectionRows.length }})</span>
|
||||
<span class="list-progress">已打印 {{ completedPrintCount }}/{{ selectionRows.length }}</span>
|
||||
</div>
|
||||
<div v-if="queueSearchVisible" class="queue-search">
|
||||
<el-input v-model="queueKeyword" size="small" clearable placeholder="搜索单号" />
|
||||
</div>
|
||||
<div class="print-batch-list__content">
|
||||
<div
|
||||
v-for="(row, index) in selectionRows"
|
||||
:key="row.id"
|
||||
v-for="entry in filteredQueue"
|
||||
:key="entry.row.id"
|
||||
:ref="(el) => setQueueItemRef(el, entry.index)"
|
||||
class="batch-item"
|
||||
:class="{ active: currentPrintIndex === index }"
|
||||
@click="switchPrintItem(index)"
|
||||
:class="{
|
||||
active: currentPrintIndex === entry.index,
|
||||
'is-done': printStatusMap[entry.row.id] === 'done',
|
||||
'is-error': printStatusMap[entry.row.id] === 'error'
|
||||
}"
|
||||
@click="switchPrintItem(entry.index)"
|
||||
>
|
||||
<span class="item-index">{{ index + 1 }}</span>
|
||||
<span class="item-number">{{ getQueueNumber(row) }}</span>
|
||||
<el-tag size="small" :type="getStatusTagType(row.id)">
|
||||
{{ getStatusLabel(row.id) }}
|
||||
<span class="item-index">{{ entry.index + 1 }}</span>
|
||||
<span class="item-number" :title="getQueueNumber(entry.row)">{{ getQueueNumber(entry.row) }}</span>
|
||||
<el-tag size="small" :type="getStatusTagType(entry.row.id)">
|
||||
{{ getStatusLabel(entry.row.id) }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<div v-if="!filteredQueue.length" class="queue-empty">
|
||||
{{ queueKeyword ? '没有匹配的单据' : '暂无待打印单据' }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -57,62 +69,83 @@
|
||||
</div>
|
||||
|
||||
<div class="print-preview-main__content">
|
||||
<div class="print-canvas-area">
|
||||
<div class="preview-toolbar">
|
||||
<span v-if="previewReady" class="preview-toolbar__info">共 {{ currentPages.length }} 页</span>
|
||||
<span v-else class="preview-toolbar__info">未选择打印模板</span>
|
||||
<div class="preview-toolbar__actions">
|
||||
<el-button size="small" text :disabled="!previewReady || previewScale <= PREVIEW_MIN_SCALE" @click="zoomOut">缩小</el-button>
|
||||
<span class="preview-scale">{{ previewScaleText }}</span>
|
||||
<el-button size="small" text :disabled="!previewReady || previewScale >= PREVIEW_MAX_SCALE" @click="zoomIn">放大</el-button>
|
||||
<el-button size="small" text :disabled="!previewReady" @click="fitPreview">适应宽度</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ref="previewScrollRef" class="print-canvas-area">
|
||||
<template v-if="previewInfo.width && previewInfo.height && currentPages.length">
|
||||
<div
|
||||
v-for="(page, pIdx) in currentPages"
|
||||
:key="'page-' + pIdx"
|
||||
class="preview-page"
|
||||
:style="{ width: previewInfo.width + 'mm', height: previewInfo.height + 'mm', position: 'relative' }"
|
||||
class="preview-scale-wrap"
|
||||
:style="{ width: previewScaledWidth + 'px', height: previewScaledHeight + 'px' }"
|
||||
>
|
||||
<div v-for="(item, idx) in page.templateContent" :key="item.id + '_' + pIdx" :style="computePreviewItemStyle(item, idx)">
|
||||
<template v-if="item.type === 'text'">
|
||||
<span>{{ getPreviewValue(item, page.data) }}</span>
|
||||
</template>
|
||||
<template v-else-if="item.type === 'barcode'">
|
||||
<barcode-img :text="getPreviewValue(item, page.data) || '0123456789'" />
|
||||
</template>
|
||||
<template v-else-if="item.type === 'qrcode'">
|
||||
<qrcode-img :text="getPreviewValue(item, page.data) || ''" />
|
||||
</template>
|
||||
<template v-else-if="item.type === 'image'">
|
||||
<img :src="item.content" alt="" style="width: 100%; height: 100%; object-fit: fill;" />
|
||||
</template>
|
||||
<template v-else-if="item.type === 'table'">
|
||||
<table style="border: 1px solid #000; border-collapse: collapse;" border="1" cellspacing="0" cellpadding="0" width="100%" height="auto">
|
||||
<thead>
|
||||
<tr>
|
||||
<td
|
||||
v-for="c in item.rows"
|
||||
:key="c.id"
|
||||
:style="{ width: c.width + 'mm', fontSize: (c.fontSize || 8) + 'pt', textAlign: 'center', border: '1px solid #000', height: (item.headerHeight || 4) + 'mm' }"
|
||||
>
|
||||
{{ c.title }}
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="(detailItem, dIdx) in (page.data.details && page.data.details.length ? page.data.details : [page.data])"
|
||||
:key="dIdx"
|
||||
>
|
||||
<td
|
||||
v-for="c in item.rows"
|
||||
:key="c.id + '_v'"
|
||||
:style="{ fontSize: (c.fontSize || 8) + 'pt', textAlign: 'center', border: '1px solid #000', height: (item.rowHeight || 4) + 'mm' }"
|
||||
>
|
||||
{{ detailItem[c.field_code] || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</template>
|
||||
<template v-else-if="item.type === 'shape'">
|
||||
<div style="width: 100%; height: 100%;" />
|
||||
</template>
|
||||
</div>
|
||||
<div v-if="currentPages.length > 1" class="preview-page-label">
|
||||
{{ page.pageNo }} / {{ page.pageTotal }}
|
||||
<div
|
||||
class="preview-scale-inner"
|
||||
:style="{ width: previewPageWidthPx + 'px', transform: `scale(${previewScale})` }"
|
||||
>
|
||||
<div
|
||||
v-for="(page, pIdx) in currentPages"
|
||||
:key="'page-' + pIdx"
|
||||
class="preview-page"
|
||||
:style="{ width: previewInfo.width + 'mm', height: previewInfo.height + 'mm', position: 'relative' }"
|
||||
>
|
||||
<div v-for="(item, idx) in page.templateContent" :key="item.id + '_' + pIdx" :style="computePreviewItemStyle(item, idx)">
|
||||
<template v-if="item.type === 'text'">
|
||||
<span>{{ getPreviewValue(item, page.data) }}</span>
|
||||
</template>
|
||||
<template v-else-if="item.type === 'barcode'">
|
||||
<barcode-img :text="getPreviewValue(item, page.data) || '0123456789'" />
|
||||
</template>
|
||||
<template v-else-if="item.type === 'qrcode'">
|
||||
<qrcode-img :text="getPreviewValue(item, page.data) || ''" />
|
||||
</template>
|
||||
<template v-else-if="item.type === 'image'">
|
||||
<img :src="item.content" alt="" style="width: 100%; height: 100%; object-fit: fill;" />
|
||||
</template>
|
||||
<template v-else-if="item.type === 'table'">
|
||||
<table style="border: 1px solid #000; border-collapse: collapse;" border="1" cellspacing="0" cellpadding="0" width="100%" height="auto">
|
||||
<thead>
|
||||
<tr>
|
||||
<td
|
||||
v-for="c in item.rows"
|
||||
:key="c.id"
|
||||
:style="{ width: c.width + 'mm', fontSize: (c.fontSize || 8) + 'pt', textAlign: 'center', border: '1px solid #000', height: (item.headerHeight || 4) + 'mm' }"
|
||||
>
|
||||
{{ c.title }}
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="(detailItem, dIdx) in (page.data.details && page.data.details.length ? page.data.details : [page.data])"
|
||||
:key="dIdx"
|
||||
>
|
||||
<td
|
||||
v-for="c in item.rows"
|
||||
:key="c.id + '_v'"
|
||||
:style="{ fontSize: (c.fontSize || 8) + 'pt', textAlign: 'center', border: '1px solid #000', height: (item.rowHeight || 4) + 'mm' }"
|
||||
>
|
||||
{{ detailItem[c.field_code] || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</template>
|
||||
<template v-else-if="item.type === 'shape'">
|
||||
<div style="width: 100%; height: 100%;" />
|
||||
</template>
|
||||
</div>
|
||||
<div v-if="currentPages.length > 1" class="preview-page-label">
|
||||
{{ page.pageNo }} / {{ page.pageTotal }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -128,9 +161,9 @@
|
||||
<div class="dialog-footer">
|
||||
<span class="progress-tip">进度: {{ completedPrintCount }} / {{ selectionRows.length }}</span>
|
||||
<div>
|
||||
<el-button @click="visible = false">关闭</el-button>
|
||||
<el-button type="success" plain :disabled="!previewInfo.width" @click="browserPrint">浏览器打印</el-button>
|
||||
<el-button type="primary" :loading="printing" @click="doPrint">
|
||||
<el-button size="small" @click="visible = false">关闭</el-button>
|
||||
<el-button size="small" type="success" plain :disabled="!previewInfo.width" @click="browserPrint">浏览器打印</el-button>
|
||||
<el-button size="small" type="primary" :loading="printing" @click="doPrint">
|
||||
{{ currentPrintIndex < selectionRows.length - 1 ? '打印并切换下一个' : '打印当前单据' }}
|
||||
</el-button>
|
||||
</div>
|
||||
@ -141,6 +174,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, h, nextTick, reactive, ref, watch } from 'vue'
|
||||
import { useResizeObserver } from '@vueuse/core'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import JsBarcode from 'jsbarcode'
|
||||
import QRCode from 'qrcode'
|
||||
@ -182,10 +216,6 @@ const visible = computed({
|
||||
set: (value: boolean) => emit('update:modelValue', value)
|
||||
})
|
||||
const dialogTitle = computed(() => props.dialogTitle || '批量打印收货单')
|
||||
const printDialogBodyStyle = {
|
||||
padding: '0',
|
||||
overflow: 'hidden'
|
||||
} as const
|
||||
|
||||
const printing = ref(false)
|
||||
const currentPrintIndex = ref(0)
|
||||
@ -334,6 +364,100 @@ const completedPrintCount = computed(() => {
|
||||
return Object.values(printStatusMap.value).filter(s => s === 'done').length
|
||||
})
|
||||
|
||||
/* ===== 打印队列:搜索 + 当前项定位 ===== */
|
||||
const queueKeyword = ref('')
|
||||
/** 单据较多时才显示搜索框,少单量时不占地方 */
|
||||
const queueSearchVisible = computed(() => props.selectionRows.length > 5)
|
||||
/** 过滤后的队列条目(带原始索引:序号/当前项/切换都以原始顺序为准) */
|
||||
const filteredQueue = computed(() => {
|
||||
const kw = queueKeyword.value.trim().toLowerCase()
|
||||
return props.selectionRows
|
||||
.map((row, index) => ({ row, index }))
|
||||
.filter(({ row }) => !kw || getQueueNumber(row).toLowerCase().includes(kw))
|
||||
})
|
||||
const queueItemRefs = new Map<number, HTMLElement>()
|
||||
function setQueueItemRef(el: unknown, index: number) {
|
||||
if (el) queueItemRefs.set(index, el as HTMLElement)
|
||||
else queueItemRefs.delete(index)
|
||||
}
|
||||
/** 把当前打印项滚入队列可视区(block:'nearest' 不打扰已可见的项) */
|
||||
function scrollActiveQueueItemIntoView() {
|
||||
void nextTick(() => {
|
||||
queueItemRefs.get(currentPrintIndex.value)?.scrollIntoView({ block: 'nearest' })
|
||||
})
|
||||
}
|
||||
|
||||
/* ===== 预览缩放:适应宽度 / 放大缩小 ===== */
|
||||
const PREVIEW_MIN_SCALE = 0.3
|
||||
const PREVIEW_MAX_SCALE = 2
|
||||
/** 适应宽度时的上限(不放大超过 100%,避免预览模糊) */
|
||||
const PREVIEW_FIT_MAX_SCALE = 1
|
||||
const PREVIEW_PAGE_GAP = 20
|
||||
const previewScrollRef = ref<HTMLElement | null>(null)
|
||||
const previewScale = ref(1)
|
||||
/** 用户手动缩放后不再自动适应宽度,避免切单据/换模板时缩放比例被重置 */
|
||||
const previewScaleManual = ref(false)
|
||||
|
||||
/** mm → px(浏览器 96dpi:1mm = 96/25.4 px) */
|
||||
function mmToPx(mm: number) {
|
||||
return (Number(mm) || 0) * 96 / 25.4
|
||||
}
|
||||
const previewPageWidthPx = computed(() => mmToPx(previewInfo.value.width))
|
||||
const previewScaledWidth = computed(() => Math.round(previewPageWidthPx.value * previewScale.value))
|
||||
/** 缩放后需占用的高度 =(页数 × 页高 + 页间距)× 比例,供外层占位,避免缩放后滚动区尺寸不变 */
|
||||
const previewScaledHeight = computed(() => {
|
||||
const count = currentPages.value.length
|
||||
const pageH = mmToPx(previewInfo.value.height)
|
||||
const total = count > 0 ? count * pageH + (count - 1) * PREVIEW_PAGE_GAP : pageH
|
||||
return Math.round(total * previewScale.value)
|
||||
})
|
||||
const previewScaleText = computed(() => `${Math.round(previewScale.value * 100)}%`)
|
||||
/** 预览就绪:已选模板且已分页出内容 */
|
||||
const previewReady = computed(() => !!previewInfo.value.width && currentPages.value.length > 0)
|
||||
|
||||
function clampScale(val: number) {
|
||||
return Math.min(PREVIEW_MAX_SCALE, Math.max(PREVIEW_MIN_SCALE, val))
|
||||
}
|
||||
function zoomIn() {
|
||||
previewScaleManual.value = true
|
||||
previewScale.value = clampScale(+(previewScale.value + 0.1).toFixed(2))
|
||||
}
|
||||
function zoomOut() {
|
||||
previewScaleManual.value = true
|
||||
previewScale.value = clampScale(+(previewScale.value - 0.1).toFixed(2))
|
||||
}
|
||||
/** 适应宽度:按容器可用宽度等比缩放整页(只缩不放,最大 100%) */
|
||||
function fitPreview() {
|
||||
const host = previewScrollRef.value
|
||||
const pageW = previewPageWidthPx.value
|
||||
if (!host || !pageW) return
|
||||
const available = host.clientWidth - 40 // 左右各 20px 内边距
|
||||
if (available <= 0) return
|
||||
previewScale.value = clampScale(Math.min(PREVIEW_FIT_MAX_SCALE, available / pageW))
|
||||
}
|
||||
|
||||
/** 预览容器宽度变化时自动适应宽度(手动缩放过则保持用户选择)
|
||||
* 对话框内容懒渲染,此处交给 VueUse:元素出现后自动开始监听,卸载时自动断开 */
|
||||
useResizeObserver(previewScrollRef, () => {
|
||||
if (!previewScaleManual.value) fitPreview()
|
||||
})
|
||||
|
||||
/** 模板选中/分页变化(含首次出预览)后自动适应宽度 */
|
||||
watch(
|
||||
[() => previewInfo.value.width, () => currentPages.value.length],
|
||||
() => {
|
||||
if (!previewInfo.value.width || previewScaleManual.value) return
|
||||
void nextTick(() => fitPreview())
|
||||
},
|
||||
{ flush: 'post' }
|
||||
)
|
||||
|
||||
/** 切换单据(含打印后自动跳下一条)时:队列定位 + 预览回到顶部 */
|
||||
watch(currentPrintIndex, () => {
|
||||
scrollActiveQueueItemIntoView()
|
||||
previewScrollRef.value?.scrollTo({ top: 0 })
|
||||
})
|
||||
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
value => {
|
||||
@ -350,10 +474,15 @@ async function initDialog() {
|
||||
printStatusMap.value[row.id] = 'pending'
|
||||
})
|
||||
resetPrintData()
|
||||
// 每次打开重置为「适应宽度」的默认状态
|
||||
queueKeyword.value = ''
|
||||
previewScaleManual.value = false
|
||||
previewScale.value = 1
|
||||
if (props.selectionRows.length > 0) {
|
||||
await loadPrintFormData(0)
|
||||
}
|
||||
await loadPrintOptions()
|
||||
scrollActiveQueueItemIntoView()
|
||||
}
|
||||
|
||||
function resetPrintData() {
|
||||
@ -906,10 +1035,10 @@ async function browserPrint() {
|
||||
<style scoped lang="scss">
|
||||
.print-dialog-layout {
|
||||
display: flex;
|
||||
height: calc(80vh - 130px);
|
||||
max-height: calc(80vh - 130px);
|
||||
border: 1px solid #ebeef5;
|
||||
/* 用 flex 撑满 body(不写 height:100%:弹窗高度由内容决定时百分比解析不出来,会被当成 auto) */
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
border: 1px solid #ebeef5;
|
||||
|
||||
.print-batch-list {
|
||||
width: 220px;
|
||||
@ -922,10 +1051,27 @@ async function browserPrint() {
|
||||
|
||||
.list-title {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
padding: 10px;
|
||||
font-weight: bold;
|
||||
font-weight: 600;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
background-color: #fff;
|
||||
|
||||
.list-progress {
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
color: #909399;
|
||||
}
|
||||
}
|
||||
|
||||
.queue-search {
|
||||
flex-shrink: 0;
|
||||
padding: 8px 10px;
|
||||
background-color: #fff;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
}
|
||||
|
||||
.print-batch-list__content {
|
||||
@ -934,6 +1080,13 @@ async function browserPrint() {
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.queue-empty {
|
||||
padding: 24px 12px;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.batch-item {
|
||||
padding: 12px 15px;
|
||||
cursor: pointer;
|
||||
@ -952,6 +1105,14 @@ async function browserPrint() {
|
||||
border-left: 3px solid #1890ff;
|
||||
}
|
||||
|
||||
&.is-done .item-number {
|
||||
color: #67c23a;
|
||||
}
|
||||
|
||||
&.is-error .item-number {
|
||||
color: #f56c6c;
|
||||
}
|
||||
|
||||
.item-index {
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
@ -959,6 +1120,10 @@ async function browserPrint() {
|
||||
|
||||
.item-number {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
font-weight: 500;
|
||||
font-family: monospace;
|
||||
}
|
||||
@ -976,15 +1141,15 @@ async function browserPrint() {
|
||||
.print-settings-bar {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 10px 15px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
background-color: #fafafa;
|
||||
flex-shrink: 0;
|
||||
|
||||
.el-select {
|
||||
flex: 1;
|
||||
flex: 1 1 160px;
|
||||
min-width: 130px;
|
||||
}
|
||||
|
||||
@ -1010,17 +1175,62 @@ async function browserPrint() {
|
||||
.print-preview-main__content {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.preview-toolbar {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding: 4px 15px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
|
||||
.preview-toolbar__info {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.preview-toolbar__actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.preview-scale {
|
||||
min-width: 46px;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
}
|
||||
|
||||
.print-canvas-area {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 20px;
|
||||
box-sizing: border-box;
|
||||
overflow: auto;
|
||||
padding: 20px;
|
||||
background-color: #f0f2f5;
|
||||
|
||||
/* 预览缩放:外层用缩放后的尺寸占位(保证滚动条正确),内层做 scale */
|
||||
.preview-scale-wrap {
|
||||
flex-shrink: 0;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.preview-scale-inner {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
transform-origin: top left;
|
||||
}
|
||||
|
||||
.preview-page {
|
||||
background: #fff;
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
|
||||
@ -1041,11 +1251,12 @@ async function browserPrint() {
|
||||
}
|
||||
|
||||
.preview-empty {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-height: 120px;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1064,14 +1275,35 @@ async function browserPrint() {
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-dialog.print-dialog) {
|
||||
margin-top: 0 !important;
|
||||
top: 50% !important;
|
||||
transform: translateY(-50%) !important;
|
||||
/* 弹窗自身的尺寸约束不在这里(scoped 里写 :deep(.el-dialog…) 是死代码,会命中不到):
|
||||
见文件末尾的非 scoped 样式块「打印弹窗尺寸约束」注释 */
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
/* 打印弹窗尺寸约束(非 scoped)
|
||||
⚠️ 为什么必须放非 scoped:<el-dialog> 是本组件模板的根节点,且 EP 弹窗内部 DOM 由 Teleport 渲染,
|
||||
scoped 里的 :deep(.el-dialog…) 会被编译成 “[data-v-x] .el-dialog…” ,而 .el-dialog 的祖先上没有 data-v-x
|
||||
→ 命中不到(已在浏览器实测:scoped 属性只会挂在组件自身模板里的元素上)。
|
||||
目标:整窗始终在用户视口内(高度按内容自适应,上限 = 视口高 - 32px),内部队列/预览各自滚动,不靠固定高撑满。 */
|
||||
.print-dialog {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-height: calc(100vh - 32px);
|
||||
/* 配合 align-center:自动外边距吸收剩余空间 → 整窗始终垂直/水平居中在视口内(不必再用 top:50% + translateY(-50%)) */
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
:deep(.el-dialog.print-dialog .el-dialog__body) {
|
||||
padding: 0 !important;
|
||||
overflow: hidden !important;
|
||||
.print-dialog .el-dialog__header,
|
||||
.print-dialog .el-dialog__footer {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.print-dialog .el-dialog__body {
|
||||
/* body 做成 flex 容器,让弹窗内部的「队列/预览」按 flex 分配高度并各自滚动 */
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -227,6 +227,43 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 时间模式 + 区间(先选查询模式/时间类型,再设置时间范围) -->
|
||||
<div v-else-if="isModeTimeRangeField(field)" class="field-form-item">
|
||||
<div class="field-label">
|
||||
<span>{{ field.label }}</span>
|
||||
<el-tag v-if="field.required" size="small" type="danger">必填</el-tag>
|
||||
</div>
|
||||
<div class="field-control field-control--range">
|
||||
<el-select
|
||||
v-model="customConditions[field.value].mode"
|
||||
:placeholder="field.placeholder || '请选择查询模式'"
|
||||
size="small"
|
||||
style="width: 100%;"
|
||||
@change="handleCustomChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="option in field.options"
|
||||
:key="option.value"
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
/>
|
||||
</el-select>
|
||||
<el-date-picker
|
||||
v-model="customConditions[field.value].value"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
:default-time="modeTimeRangeDefaultTime"
|
||||
size="small"
|
||||
style="width: 100%;"
|
||||
@change="handleCustomChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 日期/日期时间范围类型,operator 固定为 between -->
|
||||
<div v-else-if="isRangePickerField(field)" class="field-form-item">
|
||||
<div class="field-label">
|
||||
@ -649,6 +686,38 @@
|
||||
@change="handleCompactChange"
|
||||
/>
|
||||
</div>
|
||||
<!-- 时间模式 + 区间(先选查询模式/时间类型,再设置时间范围) -->
|
||||
<div v-else-if="isModeTimeRangeField(field)" class="compact-field-item">
|
||||
<div class="compact-field-control compact-field-control--stacked">
|
||||
<el-select
|
||||
v-model="customConditions[field.value].mode"
|
||||
:placeholder="field.placeholder || '请选择查询模式'"
|
||||
size="small"
|
||||
class="compact-operator-select"
|
||||
@change="handleCompactChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="option in field.options"
|
||||
:key="option.value"
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
/>
|
||||
</el-select>
|
||||
<el-date-picker
|
||||
v-model="customConditions[field.value].value"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
:default-time="modeTimeRangeDefaultTime"
|
||||
size="small"
|
||||
style="width: 100%"
|
||||
@change="handleCompactChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 文本类型(默认) -->
|
||||
<div v-else class="compact-field-item">
|
||||
<div
|
||||
@ -863,6 +932,8 @@ function handleCompactRangeInput(field: any, key: 'min' | 'max', v: string) {
|
||||
function handleCompactChange() {
|
||||
// 为有值的字段设置默认操作符
|
||||
props.availableFields.forEach((field: any) => {
|
||||
// 时间模式字段的 operator 固定为 between,不参与默认操作符推导
|
||||
if (isModeTimeRangeField(field)) return
|
||||
const condition = customConditions[field.value]
|
||||
if (!condition) return
|
||||
const val = condition.value
|
||||
@ -1169,11 +1240,18 @@ function handleTextPaste(event: ClipboardEvent, field: any) {
|
||||
|
||||
const defaultDayStart = new Date(2000, 0, 1, 0, 0, 0)
|
||||
const defaultDayEnd = new Date(2000, 0, 1, 23, 59, 59)
|
||||
/** 时间模式字段(modetimerange)区间默认时间:与 datetimerange 一致(开始 00:00:00 / 结束 23:59:59) */
|
||||
const modeTimeRangeDefaultTime = [defaultDayStart, defaultDayEnd] as [Date, Date]
|
||||
|
||||
function isRangePickerFieldType(type: string) {
|
||||
return type === 'daterange' || type === 'datetimerange'
|
||||
}
|
||||
|
||||
/** 时间模式字段:先选查询模式(mode = 真实表字段名)再设置时间范围,条件键 = 所选 mode */
|
||||
function isModeTimeRangeField(field: any) {
|
||||
return String(field?.type || '') === 'modetimerange'
|
||||
}
|
||||
|
||||
function isRangePickerField(field: any) {
|
||||
return isRangePickerFieldType(String(field?.type || ''))
|
||||
}
|
||||
@ -1231,6 +1309,27 @@ function cloneConditionDefaultValue(value: any) {
|
||||
return value
|
||||
}
|
||||
|
||||
/** 时间模式字段:先选查询模式(mode)再设置时间范围;条件键 = mode(真实表字段名)
|
||||
* 输出 { [mode]: { value: [start, end], operator: 'between', field: mode, type: 'datetimerange' } } */
|
||||
function buildModeTimeRangeCondition(field: any): { key: string; condition: Record<string, any> } | null {
|
||||
const condition = customConditions[field.value]
|
||||
const mode = String(condition?.mode || field.defaultMode || field.options?.[0]?.value || '').trim()
|
||||
const rangeValue = condition?.value
|
||||
if (!mode || !Array.isArray(rangeValue) || rangeValue.length < 2) return null
|
||||
const start = rangeValue[0]
|
||||
const end = rangeValue[1]
|
||||
if (!start || !end) return null
|
||||
return {
|
||||
key: mode,
|
||||
condition: {
|
||||
value: [start, end],
|
||||
operator: 'between',
|
||||
field: mode,
|
||||
type: 'datetimerange'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function initCustomConditions(fields: any[], isSilent = false, forceReset = false) {
|
||||
fields.forEach(field => {
|
||||
let defaultValue: any = undefined
|
||||
@ -1246,6 +1345,7 @@ function initCustomConditions(fields: any[], isSilent = false, forceReset = fals
|
||||
break
|
||||
case 'daterange':
|
||||
case 'datetimerange':
|
||||
case 'modetimerange':
|
||||
defaultValue = []
|
||||
defaultOperator = 'between'
|
||||
break
|
||||
@ -1253,8 +1353,8 @@ function initCustomConditions(fields: any[], isSilent = false, forceReset = fals
|
||||
defaultValue = undefined
|
||||
}
|
||||
|
||||
// daterange 已在上面 switch 设置了 defaultOperator,其他类型按字段配置或默认列表确定
|
||||
if (!isRangePickerFieldType(field.type)) {
|
||||
// daterange / modetimerange 已在上面 switch 设置了 defaultOperator,其他类型按字段配置或默认列表确定
|
||||
if (!isRangePickerFieldType(field.type) && field.type !== 'modetimerange') {
|
||||
if (field.operators && Array.isArray(field.operators) && field.operators.length > 0) {
|
||||
defaultOperator = field.defaultOperator || field.operators[0]
|
||||
} else {
|
||||
@ -1269,18 +1369,27 @@ function initCustomConditions(fields: any[], isSilent = false, forceReset = fals
|
||||
defaultValue = cloneConditionDefaultValue(field.defaultValue)
|
||||
}
|
||||
|
||||
const baseCondition: any = {
|
||||
value: defaultValue,
|
||||
operator: defaultOperator,
|
||||
valueMin: undefined,
|
||||
valueMax: undefined
|
||||
}
|
||||
// 时间模式字段:额外保存所选查询模式(mode = 真实表字段名)
|
||||
if (isModeTimeRangeField(field)) {
|
||||
baseCondition.mode = String(field.defaultMode || field.options?.[0]?.value || '')
|
||||
}
|
||||
|
||||
if (!customConditions[field.value]) {
|
||||
customConditions[field.value] = {
|
||||
value: defaultValue,
|
||||
operator: defaultOperator,
|
||||
valueMin: undefined,
|
||||
valueMax: undefined
|
||||
}
|
||||
customConditions[field.value] = baseCondition
|
||||
} else if (forceReset) {
|
||||
customConditions[field.value].value = defaultValue
|
||||
customConditions[field.value].operator = defaultOperator
|
||||
customConditions[field.value].value = baseCondition.value
|
||||
customConditions[field.value].operator = baseCondition.operator
|
||||
customConditions[field.value].valueMin = undefined
|
||||
customConditions[field.value].valueMax = undefined
|
||||
if (baseCondition.mode !== undefined) {
|
||||
customConditions[field.value].mode = baseCondition.mode
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@ -1384,6 +1493,15 @@ function buildAndEmitCustomCondition() {
|
||||
let hasCondition = false
|
||||
|
||||
props.availableFields.forEach((field: any) => {
|
||||
// 时间模式字段:条件键 = 所选 mode(真实表字段)
|
||||
if (isModeTimeRangeField(field)) {
|
||||
const modeTimeResult = buildModeTimeRangeCondition(field)
|
||||
if (modeTimeResult) {
|
||||
conditions[modeTimeResult.key] = modeTimeResult.condition
|
||||
hasCondition = true
|
||||
}
|
||||
return
|
||||
}
|
||||
const condition = customConditions[field.value]
|
||||
const op = resolveFieldOperator(field)
|
||||
|
||||
@ -1568,6 +1686,14 @@ function getConditions() {
|
||||
function buildConditionsObject() {
|
||||
const conditions: any = {}
|
||||
props.availableFields.forEach((field: any) => {
|
||||
// 时间模式字段:条件键 = 所选 mode(真实表字段)
|
||||
if (isModeTimeRangeField(field)) {
|
||||
const modeTimeResult = buildModeTimeRangeCondition(field)
|
||||
if (modeTimeResult) {
|
||||
conditions[modeTimeResult.key] = modeTimeResult.condition
|
||||
}
|
||||
return
|
||||
}
|
||||
const condition = customConditions[field.value]
|
||||
const op = resolveFieldOperator(field)
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<!-- ===== 表格工作模式 ===== -->
|
||||
<div class="more-section">
|
||||
<div class="more-section-title">表格工作模式</div>
|
||||
<div class="more-section-desc">调整大列表表格(UpperTable)的渲染调度策略。</div>
|
||||
<div class="more-section-desc">调整大列表表格的渲染调度策略</div>
|
||||
<div class="more-setting-row">
|
||||
<el-radio-group v-model="tableMode" size="small" @change="handleTableModeChange">
|
||||
<el-radio-button value="resource">低占用(默认)</el-radio-button>
|
||||
@ -33,7 +33,7 @@
|
||||
<div class="more-section">
|
||||
<div class="more-section-title">界面显示</div>
|
||||
<div class="more-section-desc">
|
||||
以下选项保存在当前浏览器(按账号 + 角色隔离),仅影响本机显示,换电脑需重新设置。
|
||||
以下选项保存在当前浏览器,仅影响本机显示,换电脑需重新设置
|
||||
</div>
|
||||
|
||||
<div class="more-setting-row">
|
||||
@ -66,7 +66,7 @@
|
||||
<!-- ===== 页面缓存分类 ===== -->
|
||||
<div class="more-section">
|
||||
<div class="more-section-title">页面缓存</div>
|
||||
<div class="more-section-desc">控制通过顶部导航栏 / 页面 tab 切换的路由页面缓存策略(AppMain 路由级 keep-alive)。</div>
|
||||
<div class="more-section-desc">控制通过顶部导航栏 / 页面 tab 切换的路由页面缓存策略</div>
|
||||
|
||||
<div class="more-setting-row">
|
||||
<span class="setting-label">页面缓存</span>
|
||||
@ -92,7 +92,7 @@
|
||||
<!-- ===== tab 缓存分类 ===== -->
|
||||
<div class="more-section">
|
||||
<div class="more-section-title">tab 缓存</div>
|
||||
<div class="more-section-desc">控制含 tab 标签页切换功能页面的 KeepAlive 缓存策略。</div>
|
||||
<div class="more-section-desc">控制含 tab 标签页切换功能页面的 KeepAlive 缓存策略</div>
|
||||
|
||||
<div class="more-setting-row">
|
||||
<span class="setting-label">tab 缓存</span>
|
||||
@ -115,7 +115,7 @@
|
||||
|
||||
<template #footer>
|
||||
<el-button size="small" type="danger" plain @click="handleResetDefaults">恢复默认</el-button>
|
||||
<el-button @click="dialogVisible = false">关闭</el-button>
|
||||
<el-button size="small" @click="dialogVisible = false">关闭</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
@ -351,7 +351,7 @@
|
||||
</template>
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button @click="columnConfigDialogVisible = false">关闭</el-button>
|
||||
<el-button size="small" @click="columnConfigDialogVisible = false">关闭</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
@ -1672,6 +1672,7 @@ async function handleRepairColumnConfig() {
|
||||
'确认故障修复',
|
||||
{
|
||||
type: 'warning',
|
||||
buttonSize: 'small',
|
||||
confirmButtonText: '确认清除',
|
||||
cancelButtonText: '取消'
|
||||
}
|
||||
@ -1682,6 +1683,7 @@ async function handleRepairColumnConfig() {
|
||||
'二次确认',
|
||||
{
|
||||
type: 'warning',
|
||||
buttonSize: 'small',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '返回'
|
||||
}
|
||||
|
||||
@ -330,7 +330,8 @@ const upperPagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||
|
||||
// ─── 导出处理(导出选中 / 导出全部) ──────────────────────────────────────────
|
||||
// where/sort 语义与 returnReceived.list 一致:
|
||||
// - 导出选中:仅传勾选记录运单号 waybill_code({ operator:'in', value: waybillCodes }),不叠加筛选条件
|
||||
// - 导出选中:仅传勾选记录运单号 waybill_code(按文档:该字段只支持 like,value 为数组时多值 OR 包含匹配),
|
||||
// 不叠加筛选条件
|
||||
// - 导出全部:筛选条件有设置时传当前条件 where;无筛选时不传 where(全量导出);sort 按当前排序透传
|
||||
function buildReturnReceivedExportPayload(selected: boolean): Record<string, any> {
|
||||
const payload: Record<string, any> = {}
|
||||
@ -339,7 +340,8 @@ function buildReturnReceivedExportPayload(selected: boolean): Record<string, any
|
||||
.map((row: any) => row?.waybill_code)
|
||||
.filter((v: any) => v !== undefined && v !== null && String(v).trim() !== '')
|
||||
if (waybillCodes.length) {
|
||||
payload.where = { waybill_code: { operator: 'in', value: waybillCodes } }
|
||||
// 运单号全局唯一,like + 数组与「精确匹配选中集合」等价(文档未定义 in,不按 in 传)
|
||||
payload.where = { waybill_code: { operator: 'like', value: waybillCodes } }
|
||||
}
|
||||
} else {
|
||||
// 当前筛选条件一并传入导出(与列表查询 where 语义一致)
|
||||
@ -427,13 +429,25 @@ function buildWhereFromConditions(conditions: Record<string, any>) {
|
||||
const where: Record<string, any> = {}
|
||||
for (const [key, cond] of Object.entries(conditions || {})) {
|
||||
if (cond === undefined || cond === null || cond === '') continue
|
||||
// ScanBox 条件形状:{ value, operator, type };保留 operator 以免用户选的「包含」被当成模糊
|
||||
const rawOperator = cond && typeof cond === 'object' && 'operator' in cond ? String((cond as any).operator || '') : ''
|
||||
const value = cond && typeof cond === 'object' && 'value' in cond ? cond.value : cond
|
||||
if (value === undefined || value === null || value === '' || (Array.isArray(value) && value.length === 0)) continue
|
||||
|
||||
switch (key) {
|
||||
case 'waybill_code':
|
||||
where.waybill_code = { operator: 'like', value: String(value) }
|
||||
// 退回收件运单号:默认 like;ScanBox「包含(contains)」= 多值输入框(换行/逗号分隔 → 数组),
|
||||
// 归一为 like + 数组(接口文档:value 为数组时多值 OR 包含匹配)→ 支持多单号批量搜索
|
||||
case 'waybill_code': {
|
||||
const normalizedOp = rawOperator === 'contains' ? 'like' : rawOperator
|
||||
const operator = ['like', 'eq', 'ne'].includes(normalizedOp) ? normalizedOp : 'like'
|
||||
where.waybill_code = {
|
||||
operator,
|
||||
value: Array.isArray(value)
|
||||
? value.map((v: any) => String(v).trim()).filter((v: string) => v !== '')
|
||||
: String(value),
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'return_received_task_id': {
|
||||
const n = Number(value)
|
||||
if (!Number.isNaN(n) && n > 0) where.return_received_task_id = n
|
||||
|
||||
@ -5,12 +5,15 @@ import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/o
|
||||
// 对齐 returnReceived.list 接口文档 where 参数
|
||||
// ============================================================
|
||||
export const returnReceivedAvailableFields = [
|
||||
// 退回收件运单号:默认「模糊匹配(like)」;
|
||||
// 「包含(contains)」= 多值输入框(换行/逗号分隔多单号),提交时归一为 {operator:'like', value:[...]}
|
||||
// 接口文档(returnReceived.list where.waybill_code):value 为数组时多值 OR 包含匹配 → 多单号批量搜索
|
||||
{
|
||||
value: 'waybill_code',
|
||||
label: '退回收件运单号',
|
||||
type: 'text',
|
||||
placeholder: '运单号模糊搜索',
|
||||
operators: ['like'],
|
||||
operators: ['like', 'contains'],
|
||||
defaultOperator: 'like',
|
||||
},
|
||||
{
|
||||
|
||||
@ -18,7 +18,8 @@ export const returnUnpackAvailableFields = [
|
||||
label: '退回运单号',
|
||||
type: 'text',
|
||||
placeholder: '运单号模糊搜索',
|
||||
operators: ['like'],
|
||||
// 「包含(contains)」= 多值输入框(换行/逗号分隔多单号),提交时归一为 {operator:'like', value:[...]}(多值 LIKE 取并集)
|
||||
operators: ['like', 'contains'],
|
||||
defaultOperator: 'like',
|
||||
},
|
||||
{
|
||||
|
||||
@ -367,13 +367,25 @@ function buildWhereFromConditions(conditions: Record<string, any>) {
|
||||
const where: Record<string, any> = {}
|
||||
for (const [key, cond] of Object.entries(conditions || {})) {
|
||||
if (cond === undefined || cond === null || cond === '') continue
|
||||
// ScanBox 条件形状:{ value, operator, type };保留 operator 以免用户选的「包含」被当成模糊
|
||||
const rawOperator = cond && typeof cond === 'object' && 'operator' in cond ? String((cond as any).operator || '') : ''
|
||||
const value = cond && typeof cond === 'object' && 'value' in cond ? cond.value : cond
|
||||
if (value === undefined || value === null || value === '' || (Array.isArray(value) && value.length === 0)) continue
|
||||
|
||||
switch (key) {
|
||||
case 'waybill_code':
|
||||
where.waybill_code = { operator: 'like', value: String(value) }
|
||||
// 运单号:默认 like;ScanBox「包含(contains)」= 多值输入框(换行/逗号分隔 → 数组),
|
||||
// 归一为 like + 数组(接口文档:value 为数组时多值 OR 包含匹配)→ 支持多单号批量搜索
|
||||
case 'waybill_code': {
|
||||
const normalizedOp = rawOperator === 'contains' ? 'like' : rawOperator
|
||||
const operator = ['like', 'eq', 'ne'].includes(normalizedOp) ? normalizedOp : 'like'
|
||||
where.waybill_code = {
|
||||
operator,
|
||||
value: Array.isArray(value)
|
||||
? value.map((v: any) => String(v).trim()).filter((v: string) => v !== '')
|
||||
: String(value),
|
||||
}
|
||||
break
|
||||
}
|
||||
case 'created_at':
|
||||
where.created_at = { operator: 'between', value }
|
||||
break
|
||||
|
||||
@ -5,12 +5,15 @@ import type { ToolbarButtonConfig } from '@/views/order/orderManagement/config/o
|
||||
// 对齐 returnWaybill.list 接口文档 where 参数
|
||||
// ============================================================
|
||||
export const returnWaybillAvailableFields = [
|
||||
// 运单号:默认「模糊匹配(like)」;「包含(contains)」= 多值输入框(换行/逗号分隔多单号),
|
||||
// 提交时归一为 {operator:'like', value:[...]}
|
||||
// 接口文档(returnWaybill.list where.waybill_code):value 为数组时多值 OR 包含匹配
|
||||
{
|
||||
value: 'waybill_code',
|
||||
label: '运单号',
|
||||
type: 'text',
|
||||
placeholder: '运单号模糊搜索',
|
||||
operators: ['like'],
|
||||
operators: ['like', 'contains'],
|
||||
defaultOperator: 'like',
|
||||
},
|
||||
{
|
||||
|
||||
@ -1467,6 +1467,36 @@ export const deliveryTimeRangeScanField = scanBasicField({ label: '配送时间'
|
||||
export const placeOrderTimeRangeScanField = scanBasicField({ label: '下单时间', value: 'place_order_time', type: 'datetimerange' })
|
||||
/** ScanBox:复核时间(订单表 recheck_time),区间查询输出 { operator: 'between', type: 'datetimerange', value: [start, end] } */
|
||||
export const recheckTimeRangeScanField = scanBasicField({ label: '复核时间', value: 'recheck_time', type: 'datetimerange' })
|
||||
|
||||
/**
|
||||
* 「下单时间 / 创建时间 / 复核时间」时间查询模式(value = 订单表真实列名)。
|
||||
* 对应 order.*.list 的 where 条件键(统一 where 无字段白名单,可直接传订单表列名)。
|
||||
*/
|
||||
export const ORDER_TIME_MODE_OPTIONS = [
|
||||
{ label: '下单时间', value: 'place_order_time' },
|
||||
{ label: '创建时间', value: 'create_at' },
|
||||
{ label: '复核时间', value: 'recheck_time' }
|
||||
]
|
||||
|
||||
/**
|
||||
* ScanBox:时间查询模式字段(modetimerange)。
|
||||
* 把「下单时间 / 创建时间 / 复核时间」等多个时间区间筛选项合并为一个控件:
|
||||
* 先选查询模式(options 的 value 即真实表字段名),再设置时间范围;
|
||||
* 提交时按所选模式输出 where,如 { place_order_time: { operator: 'between', value: [start, end] } }。
|
||||
*/
|
||||
export function createOrderTimeRangeScanField(
|
||||
modes: Array<{ label: string; value: string }> = ORDER_TIME_MODE_OPTIONS
|
||||
) {
|
||||
return scanBasicField({
|
||||
label: '时间',
|
||||
value: '__order_time_range__',
|
||||
type: 'modetimerange',
|
||||
placeholder: '请选择查询模式',
|
||||
options: modes,
|
||||
defaultMode: modes[0]?.value
|
||||
})
|
||||
}
|
||||
|
||||
export const isUrgencyScanField = scanBasicField({ label: '是否紧急', value: 'is_urgency', type: 'select', options: isUrgencyFilterOptions })
|
||||
export const buyerMessageHasScanField = scanBasicField({ label: '有无留言', value: 'buyer_message_has', type: 'select', options: buyerMessageHasFilterOptions })
|
||||
export const buyerMessageScanField = scanBasicField({ label: '留言', value: 'buyer_message', type: 'text', defaultOperator: 'like' })
|
||||
@ -1706,10 +1736,10 @@ export const deliveryAvailableFields = [
|
||||
{ ...buyerMessageHasScanField, group: SCAN_RECEIVING_INFO_GROUP },
|
||||
{ ...buyerMessageScanField, group: SCAN_RECEIVING_INFO_GROUP },
|
||||
// 时间
|
||||
{ ...createAtRangeScanField, group: SCAN_TIME_GROUP },
|
||||
// 时间:下单时间/创建时间/复核时间合并为一个「查询模式 + 时间范围」控件
|
||||
{ ...createOrderTimeRangeScanField(), group: SCAN_TIME_GROUP },
|
||||
{ ...payTimeRangeScanField, group: SCAN_TIME_GROUP },
|
||||
{ ...deliveryTimeRangeScanField, group: SCAN_TIME_GROUP },
|
||||
{ ...recheckTimeRangeScanField, group: SCAN_TIME_GROUP },
|
||||
]
|
||||
|
||||
/** upper-table 列点击复制:`copy` 仅复制;`copyQr` 复制并弹出快递单号二维码 */
|
||||
@ -1897,8 +1927,8 @@ export const reviewAvailableFields = [
|
||||
{ ...receiverMobileScanField, group: SCAN_RECEIVING_INFO_GROUP },
|
||||
{ ...buyerMessageHasScanField, group: SCAN_RECEIVING_INFO_GROUP },
|
||||
{ ...buyerMessageScanField, group: SCAN_RECEIVING_INFO_GROUP },
|
||||
// 时间
|
||||
{ ...createAtRangeScanField, group: SCAN_TIME_GROUP },
|
||||
// 时间:下单时间/创建时间/复核时间合并为一个「查询模式 + 时间范围」控件
|
||||
{ ...createOrderTimeRangeScanField(), group: SCAN_TIME_GROUP },
|
||||
]
|
||||
|
||||
export const reviewColums = applyOrderListCopyActions([
|
||||
@ -2077,10 +2107,8 @@ export const pendingAvailableFields = [
|
||||
{ ...receiverAreaScanField, group: SCAN_RECEIVING_INFO_GROUP },
|
||||
{ ...buyerMessageHasScanField, group: SCAN_RECEIVING_INFO_GROUP },
|
||||
{ ...buyerMessageScanField, group: SCAN_RECEIVING_INFO_GROUP },
|
||||
// 时间
|
||||
{ ...placeOrderTimeRangeScanField, group: SCAN_TIME_GROUP },
|
||||
{ ...createAtRangeScanField, group: SCAN_TIME_GROUP },
|
||||
{ ...recheckTimeRangeScanField, group: SCAN_TIME_GROUP },
|
||||
// 时间:下单时间/创建时间/复核时间合并为一个「查询模式 + 时间范围」控件
|
||||
{ ...createOrderTimeRangeScanField(), group: SCAN_TIME_GROUP },
|
||||
]
|
||||
|
||||
export const pendingCloums = [
|
||||
@ -2471,9 +2499,8 @@ export const expectionOrderAvailableFields = [
|
||||
// 收货信息
|
||||
{ ...buyerMessageHasScanField, group: SCAN_RECEIVING_INFO_GROUP },
|
||||
{ ...buyerMessageScanField, group: SCAN_RECEIVING_INFO_GROUP },
|
||||
// 时间
|
||||
{ ...createAtRangeScanField, group: SCAN_TIME_GROUP },
|
||||
{ ...recheckTimeRangeScanField, group: SCAN_TIME_GROUP },
|
||||
// 时间:下单时间/创建时间/复核时间合并为一个「查询模式 + 时间范围」控件
|
||||
{ ...createOrderTimeRangeScanField(), group: SCAN_TIME_GROUP },
|
||||
]
|
||||
|
||||
export const expectionColumns = [
|
||||
@ -2595,8 +2622,8 @@ export const archiveAvailableFields = [
|
||||
{ ...receiverMobileScanField, group: SCAN_RECEIVING_INFO_GROUP },
|
||||
{ ...buyerMessageHasScanField, group: SCAN_RECEIVING_INFO_GROUP },
|
||||
{ ...buyerMessageScanField, group: SCAN_RECEIVING_INFO_GROUP },
|
||||
// 时间
|
||||
{ ...recheckTimeRangeScanField, group: SCAN_TIME_GROUP },
|
||||
// 时间:下单时间/创建时间/复核时间合并为一个「查询模式 + 时间范围」控件
|
||||
{ ...createOrderTimeRangeScanField(), group: SCAN_TIME_GROUP },
|
||||
]
|
||||
|
||||
export const archiveColumns = applyOrderListCopyActions([
|
||||
|
||||
@ -676,7 +676,7 @@ async function submitFallbackOrderFetchByIds() {
|
||||
await ElMessageBox.confirm(
|
||||
`确定将选中的 ${ids.length} 条订单按散单抓取至波次吗?`,
|
||||
'抓取散单',
|
||||
{ type: 'warning' }
|
||||
{ type: 'warning', buttonSize: 'small' }
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
|
||||
@ -1829,7 +1829,7 @@ async function handleBatchAutoGrouping() {
|
||||
await ElMessageBox.confirm(
|
||||
`确定要将 ${ids.length} 个波次批量修改为自动加团中吗?仅会作用当前登录仓库命中的波次。`,
|
||||
'批量改为自动加团',
|
||||
{ type: 'warning', confirmButtonText: '确认修改', cancelButtonText: '取消' }
|
||||
{ type: 'warning', buttonSize: 'small', confirmButtonText: '确认修改', cancelButtonText: '取消' }
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
@ -1869,7 +1869,7 @@ async function handleBatchFinishAutoGrouping() {
|
||||
await ElMessageBox.confirm(
|
||||
`确定要将 ${ids.length} 个波次批量结束自动加团吗?仅会作用当前登录仓库命中且处于自动加团中的波次。`,
|
||||
'批量结束自动加团',
|
||||
{ type: 'warning', confirmButtonText: '确认结束', cancelButtonText: '取消' }
|
||||
{ type: 'warning', buttonSize: 'small', confirmButtonText: '确认结束', cancelButtonText: '取消' }
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
@ -2800,7 +2800,7 @@ async function handleBatchAllocateExpress() {
|
||||
await ElMessageBox.confirm(
|
||||
`确定要为选中的 ${wave_ids.length} 个波次提交快递号分配任务吗?`,
|
||||
'批次分配快递号',
|
||||
{ type: 'warning', confirmButtonText: '确认提交', cancelButtonText: '取消' }
|
||||
{ type: 'warning', buttonSize: 'small', confirmButtonText: '确认提交', cancelButtonText: '取消' }
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
@ -2859,7 +2859,7 @@ async function handleBatchAllocateStorage() {
|
||||
await ElMessageBox.confirm(
|
||||
`确定要为选中的 ${wave_ids.length} 个波次提交储位分配任务吗?`,
|
||||
'批量分配储位',
|
||||
{ type: 'warning', confirmButtonText: '确认提交', cancelButtonText: '取消' }
|
||||
{ type: 'warning', buttonSize: 'small', confirmButtonText: '确认提交', cancelButtonText: '取消' }
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
@ -2918,7 +2918,7 @@ async function handleBatchRemoveExceptionOrders() {
|
||||
await ElMessageBox.confirm(
|
||||
`确定要为选中的 ${wave_ids.length} 个波次提交移除异常订单任务吗?`,
|
||||
'批量移除异常订单',
|
||||
{ type: 'warning', confirmButtonText: '确认提交', cancelButtonText: '取消' }
|
||||
{ type: 'warning', buttonSize: 'small', confirmButtonText: '确认提交', cancelButtonText: '取消' }
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
@ -2978,7 +2978,7 @@ async function handleBatchCancel() {
|
||||
await ElMessageBox.confirm(
|
||||
`确定要批量取消 ${ids.length} 个波次吗?取消后将解除订单与波次的关联。`,
|
||||
'批量取消波次',
|
||||
{ type: 'warning', confirmButtonText: '确认取消', cancelButtonText: '取消' }
|
||||
{ type: 'warning', buttonSize: 'small', confirmButtonText: '确认取消', cancelButtonText: '取消' }
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
@ -3039,7 +3039,7 @@ async function handleBatchQuickRecheckByWave() {
|
||||
await ElMessageBox.confirm(
|
||||
`确定要对 ${waveIds.length} 个波次执行批量发货(快捷复核)吗?`,
|
||||
'批量发货',
|
||||
{ type: 'warning', confirmButtonText: '确认发货', cancelButtonText: '取消' }
|
||||
{ type: 'warning', buttonSize: 'small', confirmButtonText: '确认发货', cancelButtonText: '取消' }
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
@ -3103,7 +3103,7 @@ async function handleToggleWavePrintStatus(row: any) {
|
||||
await ElMessageBox.confirm(
|
||||
`确定要${actionText}波次「${waveNo}」吗?`,
|
||||
actionText,
|
||||
{ type: 'warning', confirmButtonText: '确认', cancelButtonText: '取消' }
|
||||
{ type: 'warning', buttonSize: 'small', confirmButtonText: '确认', cancelButtonText: '取消' }
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
|
||||
@ -1213,7 +1213,7 @@ async function handleBatchAutoGrouping() {
|
||||
await ElMessageBox.confirm(
|
||||
`确定要将 ${ids.length} 个波次批量修改为自动加团中吗?仅会作用当前登录仓库命中的波次。`,
|
||||
'批量改为自动加团',
|
||||
{ type: 'warning', confirmButtonText: '确认修改', cancelButtonText: '取消' }
|
||||
{ type: 'warning', buttonSize: 'small', confirmButtonText: '确认修改', cancelButtonText: '取消' }
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
@ -1253,7 +1253,7 @@ async function handleBatchFinishAutoGrouping() {
|
||||
await ElMessageBox.confirm(
|
||||
`确定要将 ${ids.length} 个波次批量结束自动加团吗?仅会作用当前登录仓库命中且处于自动加团中的波次。`,
|
||||
'批量结束自动加团',
|
||||
{ type: 'warning', confirmButtonText: '确认结束', cancelButtonText: '取消' }
|
||||
{ type: 'warning', buttonSize: 'small', confirmButtonText: '确认结束', cancelButtonText: '取消' }
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
@ -2230,7 +2230,7 @@ async function handleBatchAllocateExpress() {
|
||||
await ElMessageBox.confirm(
|
||||
`确定要为选中的 ${wave_ids.length} 个波次提交快递号分配任务吗?`,
|
||||
'批次分配快递号',
|
||||
{ type: 'warning', confirmButtonText: '确认提交', cancelButtonText: '取消' }
|
||||
{ type: 'warning', buttonSize: 'small', confirmButtonText: '确认提交', cancelButtonText: '取消' }
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
@ -2289,7 +2289,7 @@ async function handleBatchAllocateStorage() {
|
||||
await ElMessageBox.confirm(
|
||||
`确定要为选中的 ${wave_ids.length} 个波次提交储位分配任务吗?`,
|
||||
'批量分配储位',
|
||||
{ type: 'warning', confirmButtonText: '确认提交', cancelButtonText: '取消' }
|
||||
{ type: 'warning', buttonSize: 'small', confirmButtonText: '确认提交', cancelButtonText: '取消' }
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
@ -2348,7 +2348,7 @@ async function handleBatchRemoveExceptionOrders() {
|
||||
await ElMessageBox.confirm(
|
||||
`确定要为选中的 ${wave_ids.length} 个波次提交移除异常订单任务吗?`,
|
||||
'批量移除异常订单',
|
||||
{ type: 'warning', confirmButtonText: '确认提交', cancelButtonText: '取消' }
|
||||
{ type: 'warning', buttonSize: 'small', confirmButtonText: '确认提交', cancelButtonText: '取消' }
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
@ -2408,7 +2408,7 @@ async function handleBatchCancel() {
|
||||
await ElMessageBox.confirm(
|
||||
`确定要批量取消 ${ids.length} 个波次吗?取消后将解除订单与波次的关联。`,
|
||||
'批量取消波次',
|
||||
{ type: 'warning', confirmButtonText: '确认取消', cancelButtonText: '取消' }
|
||||
{ type: 'warning', buttonSize: 'small', confirmButtonText: '确认取消', cancelButtonText: '取消' }
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
@ -2469,7 +2469,7 @@ async function handleBatchQuickRecheckByWave() {
|
||||
await ElMessageBox.confirm(
|
||||
`确定要对 ${waveIds.length} 个波次执行批量发货(快捷复核)吗?`,
|
||||
'批量发货',
|
||||
{ type: 'warning', confirmButtonText: '确认发货', cancelButtonText: '取消' }
|
||||
{ type: 'warning', buttonSize: 'small', confirmButtonText: '确认发货', cancelButtonText: '取消' }
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
@ -2533,7 +2533,7 @@ async function handleToggleWavePrintStatus(row: any) {
|
||||
await ElMessageBox.confirm(
|
||||
`确定要${actionText}波次「${waveNo}」吗?`,
|
||||
actionText,
|
||||
{ type: 'warning', confirmButtonText: '确认', cancelButtonText: '取消' }
|
||||
{ type: 'warning', buttonSize: 'small', confirmButtonText: '确认', cancelButtonText: '取消' }
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
|
||||
@ -152,6 +152,16 @@
|
||||
</template>
|
||||
|
||||
<template #column-operation="{ row }">
|
||||
<el-button
|
||||
v-if="!isPickTaskCancelled(row) && !isPickTaskPickFinished(row)"
|
||||
type="primary"
|
||||
link
|
||||
:loading="completingTaskId === getTaskId(row)"
|
||||
:disabled="!getTaskId(row)"
|
||||
@click.stop="handleCompletePickTask(row)"
|
||||
>
|
||||
完成拣货
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="!isPickTaskCancelled(row) && !isPickTaskPickFinished(row)"
|
||||
type="danger"
|
||||
@ -281,6 +291,10 @@ import {
|
||||
type WavePickTaskListItem,
|
||||
type WavePickTaskTextOperator
|
||||
} from '@/api/order.wave/orderwave'
|
||||
import {
|
||||
pickWavePickTaskComplete,
|
||||
type PickWavePickTaskCompleteResponse
|
||||
} from '@/api/pick/pick'
|
||||
import {
|
||||
pickTaskWaveAvailableFields,
|
||||
pickTaskWaveListDefaults,
|
||||
@ -318,6 +332,7 @@ const presetTree = ref<unknown[]>([])
|
||||
const availableFieldsRef = reactive(JSON.parse(JSON.stringify(pickTaskWaveAvailableFields)))
|
||||
const queryTime = ref(0)
|
||||
const cancelingTaskId = ref<number | string | null>(null)
|
||||
const completingTaskId = ref<number | string | null>(null)
|
||||
const batchCancelLoading = ref(false)
|
||||
const selectedTaskRows = ref<Array<Record<string, any>>>([])
|
||||
|
||||
@ -854,6 +869,7 @@ async function handleCancelSelfTask(row: Record<string, any>) {
|
||||
'取消本人拣货任务',
|
||||
{
|
||||
type: 'warning',
|
||||
buttonSize: 'small',
|
||||
confirmButtonText: '确认取消',
|
||||
cancelButtonText: '返回'
|
||||
}
|
||||
@ -998,6 +1014,85 @@ function handleConditionReset() {
|
||||
void loadData()
|
||||
}
|
||||
|
||||
/** 兼容接口可能返回 null / 非数组 的 ID 列表 */
|
||||
function toIdList(value: unknown): Array<number | string> {
|
||||
if (!Array.isArray(value)) return []
|
||||
return value.filter((item) => item !== null && item !== undefined && item !== '')
|
||||
}
|
||||
|
||||
/**
|
||||
* pick.wavePickTaskComplete:完成拣货(mode=1 全部确认)。
|
||||
* 目标订单中已进入拦截流程的订单会被后端跳过,其中未打印面单的自动移出波次、
|
||||
* 已打印面单的保持不动(需人工处理),此处按响应字段汇总提示给用户。
|
||||
*/
|
||||
async function handleCompletePickTask(row: Record<string, any>) {
|
||||
const taskId = getTaskId(row)
|
||||
if (!taskId) {
|
||||
ElMessage.warning('未获取到任务ID')
|
||||
return
|
||||
}
|
||||
if (completingTaskId.value === taskId) return
|
||||
|
||||
const numericTaskId = Number(taskId)
|
||||
if (!Number.isFinite(numericTaskId) || numericTaskId <= 0) {
|
||||
ElMessage.warning('任务ID非法,无法完成拣货')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`确认对任务 ${row.task_no || taskId} 执行「完成拣货」(全部确认)吗?提交后按是否全部完成自动推进任务状态。`,
|
||||
'完成拣货',
|
||||
{
|
||||
type: 'warning',
|
||||
buttonSize: 'small',
|
||||
confirmButtonText: '确认完成',
|
||||
cancelButtonText: '返回'
|
||||
}
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
completingTaskId.value = taskId
|
||||
try {
|
||||
const res = await pickWavePickTaskComplete({ task_id: numericTaskId, mode: 1 }) as
|
||||
PickWavePickTaskCompleteResponse & { code?: number; message?: string; data?: Partial<PickWavePickTaskCompleteResponse> }
|
||||
if (!res || !okCode(res.code)) {
|
||||
throw new Error(res?.message || '完成拣货失败')
|
||||
}
|
||||
|
||||
const data = (
|
||||
res.data && typeof res.data === 'object' && !Array.isArray(res.data) ? res.data : res
|
||||
) as PickWavePickTaskCompleteResponse
|
||||
|
||||
const confirmedCount = toIdList(data?.confirmed_order_ids).length
|
||||
const skippedCount = toIdList(data?.skipped_intercepted_order_ids).length
|
||||
const removedCount = toIdList(data?.removed_from_wave_order_ids).length
|
||||
const keptCount = toIdList(data?.kept_intercepted_order_ids).length
|
||||
|
||||
ElMessage.success(
|
||||
`完成拣货:本次确认 ${confirmedCount} 单${data?.is_completed ? ',任务已全部完成' : ',任务尚未全部完成'}`
|
||||
)
|
||||
|
||||
if (skippedCount || removedCount || keptCount) {
|
||||
const parts = [
|
||||
skippedCount ? `跳过拦截订单 ${skippedCount} 单` : '',
|
||||
removedCount ? `其中 ${removedCount} 单未打印面单已自动移出波次` : '',
|
||||
keptCount ? `其中 ${keptCount} 单已打印面单保持不动,需人工移除波次` : ''
|
||||
].filter(Boolean)
|
||||
ElMessage.warning(parts.join(';'))
|
||||
}
|
||||
|
||||
await loadData()
|
||||
} catch (error: any) {
|
||||
console.error('complete wave pick task failed:', error)
|
||||
ElMessage.error(error?.message || '完成拣货失败')
|
||||
} finally {
|
||||
completingTaskId.value = null
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCancelTask(row: Record<string, any>) {
|
||||
const taskId = getTaskId(row)
|
||||
if (!taskId) {
|
||||
@ -1011,6 +1106,7 @@ async function handleCancelTask(row: Record<string, any>) {
|
||||
'取消拣货任务',
|
||||
{
|
||||
type: 'warning',
|
||||
buttonSize: 'small',
|
||||
confirmButtonText: '确认取消',
|
||||
cancelButtonText: '返回'
|
||||
}
|
||||
@ -1049,6 +1145,7 @@ async function handleBatchCancelTasks() {
|
||||
try {
|
||||
await ElMessageBox.confirm(confirmMsg, '批量取消拣货任务', {
|
||||
type: 'warning',
|
||||
buttonSize: 'small',
|
||||
confirmButtonText: '确认取消',
|
||||
cancelButtonText: '返回'
|
||||
})
|
||||
|
||||
@ -355,8 +355,8 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="waveStrategyFormDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="waveStrategyFormSubmitting" @click="submitWaveStrategyForm">
|
||||
<el-button size="small" @click="waveStrategyFormDialogVisible = false">取消</el-button>
|
||||
<el-button size="small" type="primary" :loading="waveStrategyFormSubmitting" @click="submitWaveStrategyForm">
|
||||
保存
|
||||
</el-button>
|
||||
</template>
|
||||
|
||||
@ -47,8 +47,8 @@
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="visibleProxy = false">关闭</el-button>
|
||||
<el-button type="primary" :loading="submitting" @click="handleSubmit">确认打印</el-button>
|
||||
<el-button size="small" @click="visibleProxy = false">关闭</el-button>
|
||||
<el-button size="small" type="primary" :loading="submitting" @click="handleSubmit">确认打印</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
@ -274,12 +274,13 @@
|
||||
<div v-else class="wave-print-muted">(无数据)</div>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="visibleProxy = false">关闭</el-button>
|
||||
<el-button type="primary" plain size="default" @click="printerComponentConnectionVisible = true">
|
||||
<el-button size="small" @click="visibleProxy = false">关闭</el-button>
|
||||
<el-button size="small" type="primary" plain @click="printerComponentConnectionVisible = true">
|
||||
打印组件连接
|
||||
</el-button>
|
||||
<el-button-group>
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
:loading="printMode === 'station' ? stationPrinting : browserPrinting"
|
||||
:disabled="!payload || (printMode === 'station' ? (!printSettings.station || !hasWaveGroups) : (!hasWaveGroups || !allComponentsConnected))"
|
||||
@ -289,6 +290,7 @@
|
||||
</el-button>
|
||||
<el-dropdown trigger="click" @command="handlePrintModeSwitch">
|
||||
<el-button
|
||||
size="small"
|
||||
type="primary"
|
||||
:disabled="!payload"
|
||||
>▾</el-button>
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<el-button :disabled="!canClose" @click="handleClose">关闭</el-button>
|
||||
<el-button size="small" :disabled="!canClose" @click="handleClose">关闭</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
@ -35,7 +35,7 @@ export function useWavePickComplete(options: { onSuccess?: () => void | Promise<
|
||||
await ElMessageBox.confirm(
|
||||
`确定要对波次「${waveNo}」执行批量拣货(一键完成整个波次拣货)吗?`,
|
||||
'批量拣货',
|
||||
{ type: 'warning', confirmButtonText: '确认拣货', cancelButtonText: '取消' }
|
||||
{ type: 'warning', buttonSize: 'small', confirmButtonText: '确认拣货', cancelButtonText: '取消' }
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
|
||||
@ -13,6 +13,31 @@
|
||||
</el-tooltip>
|
||||
</div>
|
||||
<div class="tabs-header-action">
|
||||
<!-- 可抓取订单数(order.wave.fetchableOrderCount):当前仓库团购可抓取订单数,点击刷新 -->
|
||||
<el-tooltip placement="bottom">
|
||||
<template #content>
|
||||
<template v-if="fetchableOrderCount">
|
||||
<div>当前仓库可抓取团购订单:{{ fetchableOrderCount.order_count }} 单</div>
|
||||
<div>
|
||||
命中 {{ fetchableOrderCount.group_count }} 组 · 阈值 {{ fetchableOrderCount.same_order_quantity }} · 候选 {{ fetchableOrderCount.raw_order_count }} 单
|
||||
</div>
|
||||
</template>
|
||||
<div v-else-if="fetchableOrderCountError">{{ fetchableOrderCountError }}</div>
|
||||
<div v-else>统计中…</div>
|
||||
<div>点击「可抓取订单」可刷新统计</div>
|
||||
</template>
|
||||
<span
|
||||
class="fetchable-order-chip"
|
||||
:class="{
|
||||
'is-active': !fetchableOrderCountLoading && !fetchableOrderCountError && (fetchableOrderCount?.order_count ?? 0) > 0,
|
||||
'is-error': !!fetchableOrderCountError
|
||||
}"
|
||||
@click="fetchFetchableOrderCount"
|
||||
>
|
||||
<span class="chip-label">可抓取订单</span>
|
||||
<em class="chip-count">{{ fetchableOrderCountLoading ? '…' : (fetchableOrderCount ? fetchableOrderCount.order_count : '—') }}</em>
|
||||
</span>
|
||||
</el-tooltip>
|
||||
<!-- 已确认打印未领单波次数量(order.wave.confirmPrintUnclaimedWaveCount 长轮询实时刷新) -->
|
||||
<el-tooltip
|
||||
content="已确认打印(confirm_print_status=fin)但未领单(claim_status != fin)的波次数量,实时刷新"
|
||||
@ -99,6 +124,7 @@ import WaveStrategyListPanel from './WaveStrategyListPanel.vue'
|
||||
import WavePickTaskListPanel from './WavePickTaskListPanel.vue'
|
||||
import { safeInvoke } from '@/utils/safe-invoke'
|
||||
import { orderWaveConfirmPrintScan, orderWaveConfirmPrintUnclaimedWaveCount } from '@/api/order/order'
|
||||
import { orderWaveFetchableOrderCount, type WaveFetchableOrderCountResponse } from '@/api/order.wave/orderwave'
|
||||
import { useBarcodeScan } from '@/composables/useBarcodeScan'
|
||||
import { WAVE_PAGE_CONFIG } from './config/wave-config'
|
||||
|
||||
@ -378,6 +404,60 @@ onDeactivated(stopConfirmPrintUnclaimedWaveCountPoll)
|
||||
onMounted(() => {
|
||||
applySavedTabOrder()
|
||||
})
|
||||
|
||||
// ============================================================
|
||||
// 可抓取订单数(tab 区展示,order.wave.fetchableOrderCount)
|
||||
// ============================================================
|
||||
/**
|
||||
* order.wave.fetchableOrderCount:当前仓库团购可抓取订单数。
|
||||
* 口径与 order.wave.groupOrderFetchList 一致(同一候选条件 + items_hash 粗分组 + 团购阈值过滤),
|
||||
* 但不分页、不查明细;页面级不带筛选条件 → 按仓库配置阈值统计全仓。
|
||||
* 刷新时机:进入页面(mounted / keep-alive activated)与切回「团购波次」页签;也可点击标签手动刷新。
|
||||
* 失败不弹 toast,仅在标签内提示,不影响页面其它功能。
|
||||
*/
|
||||
const fetchableOrderCountLoading = ref(false)
|
||||
const fetchableOrderCount = ref<WaveFetchableOrderCountResponse | null>(null)
|
||||
const fetchableOrderCountError = ref('')
|
||||
|
||||
/** 业务成功码(1/200/0 视为成功;无 code 视为成功) */
|
||||
function isSuccessCode(code: unknown) {
|
||||
if (code === undefined || code === null) return true
|
||||
return code === 1 || code === 200 || code === 0
|
||||
}
|
||||
|
||||
async function fetchFetchableOrderCount() {
|
||||
// 单页模式不渲染 tab 区;处理中重复点击直接忽略
|
||||
if (singlePage || fetchableOrderCountLoading.value) return
|
||||
fetchableOrderCountLoading.value = true
|
||||
fetchableOrderCountError.value = ''
|
||||
try {
|
||||
const res = await orderWaveFetchableOrderCount({}) as
|
||||
WaveFetchableOrderCountResponse & { code?: number; message?: string; data?: Partial<WaveFetchableOrderCountResponse> }
|
||||
if (!res || !isSuccessCode(res.code)) {
|
||||
throw new Error(res?.message || '统计可抓取订单数失败')
|
||||
}
|
||||
// 兼容 data 嵌套与顶层平铺两种返回
|
||||
const payload = (
|
||||
res.data && typeof res.data === 'object' && !Array.isArray(res.data) ? res.data : res
|
||||
) as WaveFetchableOrderCountResponse
|
||||
fetchableOrderCount.value = payload
|
||||
} catch (error: any) {
|
||||
console.error('fetch fetchable order count failed:', error)
|
||||
fetchableOrderCount.value = null
|
||||
fetchableOrderCountError.value = error?.message || '统计可抓取订单数失败'
|
||||
} finally {
|
||||
fetchableOrderCountLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// keep-alive 页面:首次挂载与每次回到页面都刷新(loading 守卫避免与 activated 重复请求)
|
||||
onMounted(() => { void fetchFetchableOrderCount() })
|
||||
onActivated(() => { void fetchFetchableOrderCount() })
|
||||
|
||||
/** 切回「团购波次」页签时刷新可抓取订单数 */
|
||||
watch(activeTab, (name) => {
|
||||
if (name === 'groupWave') void fetchFetchableOrderCount()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@ -444,6 +524,55 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
|
||||
/* 可抓取订单数(tab 区常显;点击可刷新统计;>0 时高亮) */
|
||||
.fetchable-order-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
height: 22px;
|
||||
padding: 0 10px;
|
||||
border-radius: 11px;
|
||||
font-size: 12px;
|
||||
line-height: 22px;
|
||||
color: #606266;
|
||||
background: #f4f4f5;
|
||||
border: 1px solid #e9e9eb;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
|
||||
&:hover {
|
||||
color: #409eff;
|
||||
background: rgba(64, 158, 255, 0.08);
|
||||
border-color: rgba(64, 158, 255, 0.35);
|
||||
}
|
||||
|
||||
.chip-count {
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
color: #409eff;
|
||||
background: rgba(64, 158, 255, 0.1);
|
||||
border-color: rgba(64, 158, 255, 0.35);
|
||||
|
||||
.chip-count {
|
||||
color: #409eff;
|
||||
}
|
||||
}
|
||||
|
||||
&.is-error {
|
||||
color: #f56c6c;
|
||||
background: rgba(245, 108, 108, 0.1);
|
||||
border-color: rgba(245, 108, 108, 0.35);
|
||||
|
||||
.chip-count {
|
||||
color: #f56c6c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 标签排序入口(tab 区域左侧,样式对齐 order/orderManagement) */
|
||||
.tab-sort-entry {
|
||||
position: absolute;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user