From 7f9ed5eb673e576b030bc3c0bda23b89a298432b Mon Sep 17 00:00:00 2001 From: yin <3313488199@qq.com> Date: Mon, 11 May 2026 18:13:14 +0800 Subject: [PATCH] =?UTF-8?q?5=E6=9C=8811?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/order.wave/orderwave.ts | 62 +- src/api/order/order.ts | 21 + src/api/pick/pick.ts | 34 +- src/components/BatchReceivingPrintDialog.vue | 685 ++++++++++++++ src/components/ScanBox/index.vue | 4 +- .../order/orderManagement/archiveOrder.vue | 2 +- .../orderManagement/deliveryException.vue | 2 +- .../order/orderManagement/deliveryOrder.vue | 2 +- .../orderManagement/entrustWarehouse.vue | 2 +- .../order/orderManagement/exceptionOrder.vue | 2 +- .../order/orderManagement/outboundOrder.vue | 2 +- .../order/orderManagement/pendingOrder.vue | 2 +- .../order/orderManagement/reviewOrder.vue | 2 +- .../waveOrder/GroupWaveBatchListPanel.vue | 179 +++- .../waveOrder/SandanWaveBatchListPanel.vue | 293 ++++-- .../order/waveOrder/WavePickTaskListPanel.vue | 847 +++++++++++++----- .../component/PendingOrderListPanel.vue | 4 +- .../order/waveOrder/config/wave-config.ts | 213 ++++- src/views/order/waveOrder/index.vue | 20 +- src/views/stock/stock/index.vue | 2 +- src/views/storage/entry/index.vue | 2 +- src/views/storage/inventory/index.vue | 2 +- src/views/storage/log/index.vue | 2 +- src/views/storage/receiving/index.vue | 549 +----------- src/views/storage/stockout/index.vue | 2 +- .../validityperiod/validityperiod-config.ts | 2 +- src/views/store/index.vue | 2 +- .../system/setting/printStation/index.vue | 2 +- .../components/TemplateEditor.vue | 2 +- .../system/setting/printTemplate/index.vue | 533 ++++++++++- workflows/api-doc-agent/config/接口.md | 18 +- .../interface-details/interface-details.json | 281 ++++-- .../data/module-list/module-list.json | 103 +-- .../data/module/config/_module.lifecycle.json | 2 +- .../data/module/config/module.json | 4 +- .../module/dashboard/_module.lifecycle.json | 2 +- .../data/module/dashboard/module.json | 4 +- .../data/module/index/_module.lifecycle.json | 2 +- .../data/module/index/module.json | 4 +- .../order.archiveorder/_module.lifecycle.json | 2 +- .../module/order.archiveorder/module.json | 4 +- .../_module.lifecycle.json | 2 +- .../order.deliveryexpectionorder/module.json | 4 +- .../_module.lifecycle.json | 2 +- .../module/order.deliveryorder/module.json | 4 +- .../order.entrustorder/_module.lifecycle.json | 2 +- .../module/order.entrustorder/module.json | 4 +- .../_module.lifecycle.json | 2 +- .../module/order.expectionorder/module.json | 4 +- .../module/order.index/_module.lifecycle.json | 2 +- .../data/module/order.index/module.json | 4 +- .../_module.lifecycle.json | 2 +- .../module/order.outboundorder/module.json | 4 +- .../order.pendingorder/_module.lifecycle.json | 2 +- .../module/order.pendingorder/module.json | 4 +- .../module/order.print/_module.lifecycle.json | 2 +- .../data/module/order.print/module.json | 4 +- .../order.revieworder/_module.lifecycle.json | 2 +- .../data/module/order.revieworder/module.json | 4 +- .../module/order.wave/_module.lifecycle.json | 2 +- .../data/module/order.wave/module.json | 146 ++- .../data/module/order/_module.lifecycle.json | 2 +- .../data/module/order/module.json | 10 +- .../data/module/pick/_module.lifecycle.json | 2 +- .../data/module/pick/module.json | 66 +- .../data/module/print/_module.lifecycle.json | 2 +- .../data/module/print/module.json | 4 +- .../printer.station/_module.lifecycle.json | 2 +- .../data/module/printer.station/module.json | 4 +- .../setting.account/_module.lifecycle.json | 2 +- .../data/module/setting.account/module.json | 4 +- .../setting.express/_module.lifecycle.json | 2 +- .../data/module/setting.express/module.json | 4 +- .../_module.lifecycle.json | 2 +- .../setting.expressinterface/module.json | 4 +- .../setting.permission/_module.lifecycle.json | 2 +- .../module/setting.permission/module.json | 4 +- .../setting.platform/_module.lifecycle.json | 2 +- .../data/module/setting.platform/module.json | 4 +- .../_module.lifecycle.json | 2 +- .../module/setting.printtemplate/module.json | 4 +- .../setting.role/_module.lifecycle.json | 2 +- .../data/module/setting.role/module.json | 4 +- .../setting.warehouse/_module.lifecycle.json | 2 +- .../data/module/setting.warehouse/module.json | 4 +- .../data/module/stock/_module.lifecycle.json | 2 +- .../data/module/stock/module.json | 4 +- .../storage.entry/_module.lifecycle.json | 2 +- .../data/module/storage.entry/module.json | 4 +- .../storage.inventory/_module.lifecycle.json | 2 +- .../data/module/storage.inventory/module.json | 4 +- .../storage.stockout/_module.lifecycle.json | 2 +- .../data/module/storage.stockout/module.json | 4 +- .../storage_receiving/_module.lifecycle.json | 2 +- .../data/module/storage_receiving/module.json | 4 +- .../data/module/store/_module.lifecycle.json | 2 +- .../data/module/store/module.json | 4 +- .../_module.lifecycle.json | 2 +- .../module/storewarehouse.store/module.json | 4 +- .../data/module/user/_module.lifecycle.json | 2 +- .../data/module/user/module.json | 4 +- .../module/warehouse/_module.lifecycle.json | 2 +- .../data/module/warehouse/module.json | 4 +- .../api-doc-system/data/pending-updates.json | 83 +- 104 files changed, 3018 insertions(+), 1365 deletions(-) create mode 100644 src/api/order/order.ts create mode 100644 src/components/BatchReceivingPrintDialog.vue diff --git a/src/api/order.wave/orderwave.ts b/src/api/order.wave/orderwave.ts index a0b6c0d1..3024bc4f 100644 --- a/src/api/order.wave/orderwave.ts +++ b/src/api/order.wave/orderwave.ts @@ -68,6 +68,16 @@ export type WavePickTaskCancelResponse = { task_no?: string } +export type WavePickTaskCancelSelfParams = { + task_id: number +} + +export type WavePickTaskCancelSelfResponse = { + cancelled_count?: number + task_id?: number + task_no?: string +} + export type WaveGroupOrderFetchListParams = { pagination?: { page?: number @@ -99,6 +109,13 @@ export type WaveStrategyListParams = { page_size?: number size?: number } + /** 仅支持 1=散单、2=团购;与 where.strategy_type 同时存在时以顶层为准 */ + strategy_type?: number + /** 当前仅支持 where.strategy_type(1/2) */ + where?: { strategy_type?: number } & Record + /** 0-不计算(默认),1-计算并返回每条策略的 next_fetch_order_count */ + calculate_next_fetch_order_count?: number + calculateNextFetchOrderCount?: number } export type WaveStrategyRecord = Record & { @@ -128,6 +145,8 @@ export type WaveStrategyRecord = Record & { warehouse_id?: number create_time?: string | number update_time?: string | number + /** 当请求 calculate_next_fetch_order_count=1 时由后端计算返回 */ + next_fetch_order_count?: number } export type WaveStrategyListResponse = { @@ -226,17 +245,31 @@ export type WaveStrategyFetchAdminParams = WaveStrategyFetchStrategyId & { export type WaveStrategyFetchPdaParams = WaveStrategyFetchAdminParams -/** 按策略创建抓取主流程任务后的响应(Admin / PDA 一致) */ +/** 按策略创建抓取主流程任务后的响应(Admin / PDA 一致,见 module order.wave) */ export type WaveStrategyFetchTaskCreatedResponse = { - state: string - task_id: string - task_no: string - plan: Record - plan_summary: string + state?: string + /** fetch_state=2 时为 null;fetch_state=3 时可能为已有任务的 ID */ + task_id?: string | null + task_no?: string | null + /** 文档描述「existing task_id/task_no」时部分实现单独字段 */ + existing_task_id?: string | null + existing_task_no?: string | null + /** fetch_state=2 时后端可能返回空对象 */ + plan?: Record + plan_summary?: string warehouse_id?: number strategy_id?: number validation_errors?: Array<{ field?: string; message?: string }> message?: string + /** + * 1=成功创建任务(task_id/task_no) + * 2=普通失败(task_id 常为 null) + * 3=存在未完成任务(返回已有 task_id/task_no,可进入拣货流程) + */ + fetch_state?: number + tip?: string + /** fetch_state=3 时为 true,表示可直接进入拣货流程 */ + can_enter_pick_flow?: boolean } /** @deprecated 使用 WaveStrategyFetchTaskCreatedResponse */ @@ -605,6 +638,22 @@ export function orderWaveWavePickTaskCancel( } as any) } +export function orderWaveWavePickTaskCancelSelf( + data: WavePickTaskCancelSelfParams +): Promise }> { + return request({ + url: '/system', + method: 'post', + params: { + method: 'order.wave.wavePickTaskCancelSelf', + v, + timestamp: new Date().getTime() + }, + data, + isSystemApi: true + } as any) +} + export function orderWaveGroupOrderFetchList( data: WaveGroupOrderFetchListParams = {} ): Promise }> { @@ -1020,6 +1069,7 @@ export const orderWave = { batchList: orderWaveBatchList, wavePickTaskList: orderWaveWavePickTaskList, wavePickTaskCancel: orderWaveWavePickTaskCancel, + wavePickTaskCancelSelf: orderWaveWavePickTaskCancelSelf, groupOrderFetchList: orderWaveGroupOrderFetchList, singleOrderFetchList: orderWaveSingleOrderFetchList, waveStrategyList: orderWaveWaveStrategyList, diff --git a/src/api/order/order.ts b/src/api/order/order.ts new file mode 100644 index 00000000..2347343f --- /dev/null +++ b/src/api/order/order.ts @@ -0,0 +1,21 @@ +import request from '@/utils/request' +import type { WaveBatchListParams, WaveBatchListResponse } from '@/api/order.wave/orderwave' + +const v = '1.0' + +/** 文档模块 `order` 中的 `order.wave.batchList`(与 `order.wave/orderwave.ts` 行为一致) */ +export function orderModuleWaveBatchList( + data: WaveBatchListParams = {} +): Promise }> { + return request({ + url: '/system', + method: 'post', + params: { + method: 'order.wave.batchList', + v, + timestamp: new Date().getTime() + }, + data, + isSystemApi: true + } as any) +} diff --git a/src/api/pick/pick.ts b/src/api/pick/pick.ts index fd8fa32c..d6366bc1 100644 --- a/src/api/pick/pick.ts +++ b/src/api/pick/pick.ts @@ -23,6 +23,36 @@ export function pickQuery(data: PickQueryParams): Promise { } as any) } -export const pick = { - query: pickQuery +export type PickWavePickTaskDetailParams = { + task_id: number +} + +export type PickWavePickTaskDetailResponse = { + task?: Record + boxes?: Array> + picking_details?: Array> + picking_summary?: Record + picking_view?: Record +} + +/** pick.wavePickTaskDetail:按任务 ID 取详情(与拣货模块文档一致) */ +export function pickWavePickTaskDetail( + data: PickWavePickTaskDetailParams +): Promise }> { + return request({ + url: '/system', + method: 'post', + params: { + method: 'pick.wavePickTaskDetail', + v, + timestamp: new Date().getTime() + }, + data, + isSystemApi: true + } as any) +} + +export const pick = { + query: pickQuery, + wavePickTaskDetail: pickWavePickTaskDetail } diff --git a/src/components/BatchReceivingPrintDialog.vue b/src/components/BatchReceivingPrintDialog.vue new file mode 100644 index 00000000..10d61629 --- /dev/null +++ b/src/components/BatchReceivingPrintDialog.vue @@ -0,0 +1,685 @@ + + + + + diff --git a/src/components/ScanBox/index.vue b/src/components/ScanBox/index.vue index 71b2b6d7..b6f33b81 100644 --- a/src/components/ScanBox/index.vue +++ b/src/components/ScanBox/index.vue @@ -1,5 +1,5 @@ - @@ -877,6 +883,7 @@ import { } from './config/wave-config' import { safeInvoke } from '@/utils/safe-invoke' import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane' +import BatchReceivingPrintDialog from '@/components/BatchReceivingPrintDialog.vue' import PendingOrderListPanel from './component/PendingOrderListPanel.vue' import WaveBatchDetailPanel from './component/WaveBatchDetailPanel.vue' import WaveFetchTaskProgressDialog from './component/WaveFetchTaskProgressDialog.vue' @@ -938,8 +945,6 @@ import type { } from '@/api/order.wave/orderwave' import { useUserStore } from '@/stores/modules/user' import { getWavePrintData } from '@/api/order.print/orderprint' -import type { WavePrintDataPayload } from '@/api/order.print/orderprint' -import WaveBatchPrintPreviewDialog from './component/WaveBatchPrintPreviewDialog.vue' import pcasCodeData from 'china-division/dist/pcas-code.json' const WAVE_TYPE = 1 as const @@ -962,10 +967,8 @@ const batchAllocateStorageLoading = ref(false) const batchRemoveExceptionOrdersLoading = ref(false) const userStore = useUserStore() const wavePrintDialogVisible = ref(false) -const wavePrintDialogLoading = ref(false) -const wavePrintDialogError = ref('') -const wavePrintDialogPayload = ref(null) -const wavePrintRequestMeta = ref<{ warehouse_id: number; wave_ids: Array } | null>(null) +const wavePrintRows = ref([]) +const wavePrintDataMap = ref>({}) const queryTime = ref(0) const tableSize = ref('small') const activeTab = ref('detail') @@ -1257,6 +1260,67 @@ const currentWaveType = computed(() => WAVE_TYPE) const tableListId = computed(() => `wave-management-list-${WAVE_TYPE}`) const okCode = (code: unknown) => code === 1 || code === 200 || code === 0 + +function unwrapWaveStrategyFetchPayload(res: any): WaveStrategyFetchTaskCreatedResponse { + if (res && typeof res.data === 'object' && res.data !== null && !Array.isArray(res.data)) { + return res.data as WaveStrategyFetchTaskCreatedResponse + } + return res as WaveStrategyFetchTaskCreatedResponse +} + +function applyWaveStrategyFetchUiResult( + payload: WaveStrategyFetchTaskCreatedResponse, + options: { defaultSuccessHint?: string; afterSuccess?: () => void | Promise } = {} +) { + const validationErrors = payload?.validation_errors + if (Array.isArray(validationErrors) && validationErrors.length) { + const detail = validationErrors + .map((e) => [e?.field, e?.message].filter(Boolean).join(': ') || '') + .filter(Boolean) + .join(';') + ElMessage.warning(detail || payload?.message || '入参校验未通过') + return + } + + const fs = payload.fetch_state + + if (fs === 2) { + ElMessage.warning(payload.tip || payload.message || '抓取任务创建失败') + return + } + + if (fs === 3) { + const taskId = String(payload.task_id ?? payload.existing_task_id ?? '') + const taskNo = String(payload.task_no ?? payload.existing_task_no ?? '') + const tip = + payload.tip || + payload.message || + (payload.can_enter_pick_flow ? '存在未完成任务,可直接进入拣货流程' : '存在未完成的抓取任务') + const suffix = [taskNo ? `任务编号:${taskNo}` : '', taskId ? `任务ID:${taskId}` : ''].filter(Boolean).join(',') + ElMessage.success(suffix ? `${tip}(${suffix})` : tip) + const after = options.afterSuccess + if (after) void after() + return + } + + if (fs === 1 || fs === undefined || fs === null) { + const taskId = String(payload?.task_id ?? '') + const taskNo = String(payload?.task_no ?? '') + const summary = String(payload?.plan_summary ?? '') + if (fs === 1 && !taskId && !taskNo && !summary) { + ElMessage.warning(payload?.message || '接口未返回任务信息') + return + } + const hint = summary || payload?.message || options.defaultSuccessHint || '抓取任务已创建' + const suffix = [taskNo ? `任务编号:${taskNo}` : '', taskId ? `任务ID:${taskId}` : ''].filter(Boolean).join(',') + ElMessage.success(suffix ? `${hint}(${suffix})` : hint) + const after = options.afterSuccess + if (after) void after() + return + } + + ElMessage.warning(payload?.message || `未知抓取状态(fetch_state=${String(fs)})`) +} const printableSelectionRows = computed(() => selectionRows.value.filter((row: any) => !isAutoGroupingWave(row))) const autoGroupingSelectionRows = computed(() => selectionRows.value.filter((row: any) => isAutoGroupingWave(row))) const selectedWaveOrderTotal = computed(() => { @@ -1685,7 +1749,7 @@ async function handleBatchFinishAutoGrouping() { } } -function unwrapWavePrintPayload(res: any): WavePrintDataPayload { +function unwrapWavePrintPayload(res: any) { const inner = res?.data !== undefined && res?.data !== null && typeof res.data === 'object' && !Array.isArray(res.data) ? res.data @@ -1707,6 +1771,33 @@ function unwrapWavePrintPayload(res: any): WavePrintDataPayload { return { summary, wave_list, ext } } +function getWaveOrders(wave: Record) { + const keys = ['orders', 'order_list', 'order_details', 'items', 'print_orders', 'order_rows', 'details'] + for (const key of keys) { + const value = wave[key] + if (Array.isArray(value)) return value + } + return [] +} + +function toWavePrintForm(wave: Record) { + const details = getWaveOrders(wave) + return { + ...wave, + wave_no: String(wave.wave_no ?? wave.batch_no ?? wave.wave_code ?? wave.id ?? '—'), + details + } +} + +function rowWaveKey(row: any) { + return String(row?.id ?? row?.wave_id ?? row?.batch_id ?? row?.wave_no ?? '') +} + +async function loadWavePrintFormData(row: any) { + const key = rowWaveKey(row) + return wavePrintDataMap.value[key] || toWavePrintForm(row || {}) +} + async function handleBatchPrint() { if (!isGroupWaveTab.value) { ElMessage.warning('批量打印仅在「团购波次」页签可用') @@ -1762,23 +1853,30 @@ async function handleBatchPrint() { return } - wavePrintRequestMeta.value = { warehouse_id: warehouseId, wave_ids } - wavePrintDialogPayload.value = null - wavePrintDialogError.value = '' - wavePrintDialogVisible.value = true - wavePrintDialogLoading.value = true - batchPrintLoading.value = true try { const res: any = await getWavePrintData({ warehouse_id: warehouseId, wave_ids }) - wavePrintDialogPayload.value = unwrapWavePrintPayload(res) - const waveCount = wavePrintDialogPayload.value.wave_list?.length ?? 0 + const payload = unwrapWavePrintPayload(res) + const waveList = Array.isArray(payload.wave_list) ? payload.wave_list : [] + const nextMap: Record = {} + waveList.forEach((wave: Record) => { + const key = String(wave.id ?? wave.wave_id ?? wave.batch_id ?? wave.wave_no ?? '') + if (!key) return + nextMap[key] = toWavePrintForm(wave) + }) + wavePrintRows.value = rows.map((item: any) => ({ + ...item, + wave_no: String(item?.wave_no ?? item?.batch_no ?? item?.wave_code ?? item?.id ?? '—') + })) + wavePrintDataMap.value = nextMap + wavePrintDialogVisible.value = true + const waveCount = waveList.length ElMessage.success(res?.message || `已获取打印数据,返回 ${waveCount} 个波次`) } catch (error: any) { - wavePrintDialogError.value = error?.message || '获取波次打印数据失败' - wavePrintDialogPayload.value = null + wavePrintRows.value = [] + wavePrintDataMap.value = {} + ElMessage.error(error?.message || '获取波次打印数据失败') } finally { - wavePrintDialogLoading.value = false batchPrintLoading.value = false } } @@ -2780,7 +2878,9 @@ async function fetchWaveStrategyList() { pagination: { page: waveStrategyPagination.currentPage, pageSize: waveStrategyPagination.pageSize - } + }, + /** module order.wave:strategy_type 1=散单 2=团购(本页为团购波次) */ + strategy_type: 2, }) as WaveStrategyListResponse & { code?: number; message?: string; data?: Partial } if (!res || !okCode(res.code)) { throw new Error(res?.message || '获取波次策略列表失败') @@ -2818,30 +2918,17 @@ async function submitWaveStrategyFetchAdmin(row: Record) { try { const res = await orderWaveWaveStrategyFetchAdmin({ strategy_id: strategyId, - source: 'pda' + source: 'admin', + operation_source: 'admin' }) as WaveStrategyFetchTaskCreatedResponse & { code?: number; message?: string } if (!res || !okCode(res.code)) { throw new Error(res?.message || '提交后台抓取任务失败') } - const payload = - res && typeof (res as any).data === 'object' && (res as any).data !== null && !Array.isArray((res as any).data) - ? ((res as any).data as WaveStrategyFetchTaskCreatedResponse) - : (res as WaveStrategyFetchTaskCreatedResponse) - const validationErrors = payload?.validation_errors - if (Array.isArray(validationErrors) && validationErrors.length) { - const detail = validationErrors - .map((e) => [e?.field, e?.message].filter(Boolean).join(': ') || '') - .filter(Boolean) - .join(';') - ElMessage.warning(detail || payload?.message || '入参校验未通过') - return - } - const taskId = String(payload?.task_id || '') - const taskNo = String(payload?.task_no || '') - const summary = String(payload?.plan_summary || '') - const hint = summary || payload?.message || res?.message || '后台抓取任务已创建' - const suffix = [taskNo ? `任务编号:${taskNo}` : '', taskId ? `任务ID:${taskId}` : ''].filter(Boolean).join(',') - ElMessage.success(suffix ? `${hint}(${suffix})` : hint) + const payload = unwrapWaveStrategyFetchPayload(res) + applyWaveStrategyFetchUiResult(payload, { + defaultSuccessHint: '后台抓取任务已创建', + afterSuccess: () => fetchWaveStrategyList() + }) } catch (error: any) { console.error('submit wave strategy fetch admin failed:', error) ElMessage.error(error?.message || '提交后台抓取任务失败') diff --git a/src/views/order/waveOrder/SandanWaveBatchListPanel.vue b/src/views/order/waveOrder/SandanWaveBatchListPanel.vue index 97ba4f35..c7ca7435 100644 --- a/src/views/order/waveOrder/SandanWaveBatchListPanel.vue +++ b/src/views/order/waveOrder/SandanWaveBatchListPanel.vue @@ -1,6 +1,7 @@ @@ -173,79 +302,206 @@ 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' +import { + orderWaveWavePickTaskCancel, + orderWaveWavePickTaskCancelSelf, + orderWaveWavePickTaskList +} from '@/api/order.wave/orderwave' +import { pickWavePickTaskDetail } from '@/api/pick/pick' +import { + waveScanBoxConfig, + pickTaskWaveAvailableFields, + pickTaskWaveListDefaults, + pickTaskWavePaginationDefaults, + pickTaskWavePaginationPageSizes, + pickTaskWaveDetailDialogDefaults, + pickTaskWaveToolbarButtons, + formatPickTaskStatus, + formatPickTaskReviewStatus, + formatPickTaskPickMode, + formatPickTaskSource, + getPickTaskStatusTagType, + getPickTaskReviewStatusTagType, + getPickTaskSourceTagType, + type PickTaskWaveToolbarButton, + type PickTaskWaveToolbarKey +} from './config/wave-config' const userStore = useUserStore() const loading = ref(false) const list = ref>>([]) -const emptyText = ref('暂无拣货任务') +const emptyText = ref(pickTaskWaveListDefaults.emptyText) const scanBox = ref(null) +const presetTree = ref([]) +const splitStackRef = ref(null) +const scrollContainerRef = ref(null) +const queryTime = ref(0) +const isDragging = ref(false) +const startX = ref(0) +const scrollLeft = ref(0) const cancelingTaskId = ref(null) const batchCancelLoading = ref(false) const selectedTaskRows = ref>>([]) -const filters = reactive>({}) - -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, + pageSize: pickTaskWavePaginationDefaults.initialPageSize, total: 0 }) const warehouseId = computed(() => Number(userStore.user?.warehouse_id ?? userStore.user?.store_id ?? 0)) +const upperPaneFullStyle = computed(() => ({ + flex: '1 1 auto', + minHeight: '0', + overflow: 'hidden' as const +})) + +/** 与接口文档中 operator_id / pick_user_id(employees)对齐 */ +const currentEmployeeId = computed(() => Number(userStore.user?.employees_id ?? userStore.roleId ?? 0)) + +const taskDetailDialogVisible = ref(false) +const taskDetailDialogMode = ref<'query' | 'row'>('query') +const taskDetailLoading = ref(false) +const taskDetailPayload = ref | null>(null) +const taskDetailPermissionHint = ref('') +const taskDetailActiveTab = ref('task') +const taskDetailQueryForm = reactive<{ task_id: number | undefined }>({ task_id: undefined }) + +const cancelSelfTaskId = ref(null) + +const taskDetailTaskEntries = computed(() => { + const t = taskDetailPayload.value?.task + if (!t || typeof t !== 'object') return [] as Array<[string, unknown]> + return Object.entries(t as Record) +}) + +const taskDetailBoxes = computed(() => { + const b = taskDetailPayload.value?.boxes + return Array.isArray(b) ? b : [] +}) + +function collectObjectKeys(rows: Array>): string[] { + const keys = new Set() + for (const r of rows) { + if (r && typeof r === 'object') Object.keys(r).forEach((k) => keys.add(k)) + } + return [...keys].sort((a, b) => a.localeCompare(b, 'zh-CN')) +} + +const taskDetailBoxesColumns = computed(() => + collectObjectKeys(taskDetailBoxes.value as Array>) +) + +const taskDetailPickingDetails = computed(() => { + const d = taskDetailPayload.value?.picking_details + return Array.isArray(d) ? d : [] +}) + +const taskDetailDetailColumns = computed(() => + collectObjectKeys(taskDetailPickingDetails.value as Array>) +) + +const taskDetailSummaryEntries = computed(() => { + const s = taskDetailPayload.value?.picking_summary + if (!s || typeof s !== 'object') return [] as Array<[string, unknown]> + return Object.entries(s as Record) +}) + +const taskDetailViewJson = computed(() => { + const v = taskDetailPayload.value?.picking_view + if (v === undefined || v === null) return '' + try { + return JSON.stringify(v, null, 2) + } catch { + return String(v) + } +}) + const okCode = (code: unknown) => code === 1 || code === 200 || code === 0 +const handleToolbarWheel = (e: WheelEvent) => { + if (scrollContainerRef.value) { + e.preventDefault() + scrollContainerRef.value.scrollLeft += e.deltaY + } +} + +const handleMouseDown = (e: MouseEvent) => { + if (!scrollContainerRef.value) return + isDragging.value = true + startX.value = e.pageX - scrollContainerRef.value.offsetLeft + scrollLeft.value = scrollContainerRef.value.scrollLeft +} + +const handleMouseMove = (e: MouseEvent) => { + if (!isDragging.value || !scrollContainerRef.value) return + e.preventDefault() + const x = e.pageX - scrollContainerRef.value.offsetLeft + const walk = (x - startX.value) * 1.5 + scrollContainerRef.value.scrollLeft = scrollLeft.value - walk +} + +const handleMouseUp = () => { + isDragging.value = false +} + +/** 将 ScanBox getConditions() 压平为接口入参(与 SandanWaveBatchListPanel 中 buildWhereConditions 一致) */ +function buildPickTaskScanFilters(rawConditions: Record) { + const out: Record = {} + Object.keys(rawConditions || {}).forEach((key) => { + const condition = rawConditions[key] + if (condition && typeof condition === 'object' && 'operator' in condition) { + const value = condition.value + if (value === undefined || value === null || value === '' || (Array.isArray(value) && value.length === 0)) { + return + } + out[key] = value + return + } + if (condition !== undefined && condition !== null && condition !== '') { + out[key] = Array.isArray(condition) ? condition[0] ?? '' : condition + } + }) + return out +} + +function resolvePickToolbarDisabled(btn: PickTaskWaveToolbarButton): boolean { + if (btn.key === 'batchCancel') return selectedTaskRows.value.length === 0 + return false +} + +function resolvePickToolbarLoading(btn: PickTaskWaveToolbarButton): boolean { + if (btn.key === 'batchCancel') return batchCancelLoading.value + return false +} + +function resolvePickToolbarLabel(btn: PickTaskWaveToolbarButton): string { + if (btn.key === 'batchCancel') { + return `${btn.label}(${selectedTaskRows.value.length})` + } + return btn.label +} + +function handlePickToolbarClick(key: PickTaskWaveToolbarKey) { + switch (key) { + case 'search': + handleSearch() + break + case 'detailQuery': + openDetailQueryDialog() + break + case 'batchCancel': + void handleBatchCancelTasks() + break + case 'refresh': + void loadData() + break + default: + break + } +} + function toNumber(value: unknown, fallback = 0): number { const num = Number(value) return Number.isFinite(num) ? num : fallback @@ -264,10 +520,11 @@ function normalizePickTaskRow(row: Record) { 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 || '', + /** 任务创建/操作人(与 pick_user_id 区分;接口 wavePickTaskCancelSelf 按创建人校验) */ + operator_id: row.operator_id, + operator_name: row.operator_name || '', + pick_user_id: row.pick_user_id, + pick_user_name: row.pick_user_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 || '', @@ -275,69 +532,6 @@ function normalizePickTaskRow(row: Record) { } } -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) @@ -367,34 +561,169 @@ function getValidTaskIds(rows: Array>): Array taskId !== null) } +function formatDetailScalar(v: unknown): string { + if (v === null || v === undefined) return '—' + if (typeof v === 'object') { + try { + return JSON.stringify(v) + } catch { + return String(v) + } + } + return String(v) +} + +/** order.wave.wavePickTaskCancelSelf:仅允许取消本人创建的任务(按 operator_id / creator 与当前登录 employees_id 对齐) */ +function isSelfCreatedTask(row: Record): boolean { + const cur = currentEmployeeId.value + if (!cur) return false + const oid = row.operator_id ?? row.raw?.operator_id ?? row.creator_id ?? row.created_by + const creatorId = Number(oid) + return Number.isFinite(creatorId) && creatorId > 0 && creatorId === cur +} + +function isPickTaskCancelled(row: Record): boolean { + return Number(row.status) === 9 +} + +function resetTaskDetailState() { + taskDetailPayload.value = null + taskDetailLoading.value = false + taskDetailActiveTab.value = 'task' + taskDetailPermissionHint.value = '' + taskDetailQueryForm.task_id = undefined +} + +function openDetailQueryDialog() { + taskDetailDialogMode.value = 'query' + taskDetailPayload.value = null + taskDetailQueryForm.task_id = undefined + taskDetailPermissionHint.value = + 'pick.wavePickTaskDetail:仅当拣货任务的 pick_user_id 与当前登录用户一致时可查看详情(否则接口 403)。' + taskDetailDialogVisible.value = true +} + +function openTaskDetail(row: Record) { + const id = getTaskId(row) + if (!id) { + ElMessage.warning('未获取到任务ID') + return + } + taskDetailDialogMode.value = 'row' + taskDetailQueryForm.task_id = Number(id) + taskDetailPayload.value = null + taskDetailPermissionHint.value = + 'pick.wavePickTaskDetail:仅拣货员本人可查看完整详情(pick_user_id 需与当前账号一致)。' + taskDetailDialogVisible.value = true + void fetchTaskDetailById(Number(id)) +} + +function submitTaskDetailQuery() { + const tid = taskDetailQueryForm.task_id + if (tid === undefined || tid === null || !Number.isFinite(Number(tid)) || Number(tid) <= 0) { + ElMessage.warning('请输入有效的任务ID(正整数)') + return + } + void fetchTaskDetailById(Number(tid)) +} + +async function fetchTaskDetailById(taskId: number) { + taskDetailLoading.value = true + taskDetailPayload.value = null + try { + const res = await pickWavePickTaskDetail({ task_id: taskId }) + if (!res || !okCode(res.code)) { + throw new Error((res as any)?.message || '获取拣货任务详情失败') + } + const inner = + res && typeof (res as any).data === 'object' && (res as any).data !== null && !Array.isArray((res as any).data) + ? (res as any).data + : res + taskDetailPayload.value = inner as Record + taskDetailActiveTab.value = 'task' + } catch (error: any) { + console.error('pickWavePickTaskDetail failed:', error) + ElMessage.error(error?.message || '获取拣货任务详情失败') + taskDetailPayload.value = null + } finally { + taskDetailLoading.value = false + } +} + +async function handleCancelSelfTask(row: Record) { + const taskId = getTaskId(row) + if (!taskId) { + ElMessage.warning('未获取到任务ID') + return + } + if (!isSelfCreatedTask(row)) { + ElMessage.warning('仅可取消本人创建的任务') + return + } + + try { + await ElMessageBox.confirm( + `确认取消本人创建的任务「${row.task_no || taskId}」吗?将调用 order.wave.wavePickTaskCancelSelf(仅单个 task_id)。`, + '取消本人拣货任务', + { + type: 'warning', + confirmButtonText: '确认取消', + cancelButtonText: '返回' + } + ) + } catch { + return + } + + cancelSelfTaskId.value = taskId + try { + const res = await orderWaveWavePickTaskCancelSelf({ task_id: Number(taskId) }) + if (!res || !okCode(res.code)) { + throw new Error((res as any)?.message || '取消本人任务失败') + } + const cancelled = Number(res.cancelled_count ?? (res as any).data?.cancelled_count ?? 0) + ElMessage.success(cancelled > 0 ? `已取消任务(${cancelled})` : '操作已提交') + await loadData() + } catch (error: any) { + console.error('wavePickTaskCancelSelf failed:', error) + ElMessage.error(error?.message || '取消本人任务失败') + } finally { + cancelSelfTaskId.value = null + } +} + async function loadData() { const wid = warehouseId.value if (!Number.isFinite(wid) || wid <= 0) { - emptyText.value = '未获取到仓库ID' + emptyText.value = pickTaskWaveListDefaults.noWarehouseEmptyText list.value = [] pagination.total = 0 + queryTime.value = 0 return } if (loading.value) return + const start = Date.now() loading.value = true - emptyText.value = '加载中...' + emptyText.value = pickTaskWaveListDefaults.loadingEmptyText try { - const startRange = Array.isArray(filters.start_time_range) ? filters.start_time_range : [] + const flat = buildPickTaskScanFilters(scanBox.value?.getConditions?.() || {}) + const startRange = Array.isArray(flat.start_time_range) ? flat.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, + status: flat.status, + review_status: flat.review_status, + pick_mode: flat.pick_mode, + source: + flat.source === undefined || flat.source === null || flat.source === '' ? undefined : String(flat.source), + pick_user_id: flat.pick_user_id, + review_user_id: flat.review_user_id, + task_no: String(flat.task_no || '').trim() || undefined, + cart_id: flat.cart_id, + keyword: String(flat.keyword || '').trim() || undefined, start_time_start: startRange[0] || undefined, start_time_end: startRange[1] || undefined }) @@ -418,26 +747,27 @@ async function loadData() { 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 = '暂无拣货任务' + emptyText.value = pickTaskWaveListDefaults.emptyText } catch (error: any) { console.error('load wave pick task list failed:', error) ElMessage.error(error?.message || '获取拣货任务列表失败') list.value = [] pagination.total = 0 - emptyText.value = '加载失败' + emptyText.value = pickTaskWaveListDefaults.loadFailedEmptyText } finally { loading.value = false + queryTime.value = Date.now() - start } } function handleSearch() { - Object.assign(filters, scanBox.value?.getConditions?.() || {}) pagination.currentPage = 1 void loadData() } function handleConditionChange() { - Object.assign(filters, scanBox.value?.getConditions?.() || {}) + pagination.currentPage = 1 + void loadData() } function handleSelectionChange(rows: Array>) { @@ -445,14 +775,13 @@ function handleSelectionChange(rows: Array>) { } 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 + scanBox.value?.reset?.() void loadData() } @@ -563,46 +892,40 @@ onMounted(() => { diff --git a/src/views/order/waveOrder/component/PendingOrderListPanel.vue b/src/views/order/waveOrder/component/PendingOrderListPanel.vue index 95c94fdd..191b981c 100644 --- a/src/views/order/waveOrder/component/PendingOrderListPanel.vue +++ b/src/views/order/waveOrder/component/PendingOrderListPanel.vue @@ -2,7 +2,7 @@
\ No newline at end of file diff --git a/src/views/order/waveOrder/config/wave-config.ts b/src/views/order/waveOrder/config/wave-config.ts index 41c4106e..57849d39 100644 --- a/src/views/order/waveOrder/config/wave-config.ts +++ b/src/views/order/waveOrder/config/wave-config.ts @@ -5,9 +5,9 @@ export type WaveToolbarButtonConfig = ToolbarButtonConfig & { onlyForWaveType?: 1 | 2 } -/** ScanBox 默认 props(与 orderManagement 子页一致的可配置项) */ +/** ScanBox 默认 props(全站 scan-box 侧栏宽度统一为 250px) */ export const waveScanBoxConfig = { - width: '320px', + width: '250px', treeProps: { children: 'children', label: 'label' } as const, autoSubmit: false } @@ -47,12 +47,6 @@ export const waveAvailableFields = [ { label: '已就绪', value: 1 } ] }, - { label: '创建人', value: 'creator', type: 'text' }, - { label: '快递', value: 'logistics_name', type: 'text' }, - // { label: '商品类型', value: 'item_part_type', type: 'text' }, - // { label: '商品部位', value: 'item_part', type: 'text' }, - // { label: '商品快照键', value: 'item_snapshot_key', type: 'text' }, - // { label: '商品结构', value: 'item_detail_machine', type: 'text' }, { label: '区分快递', value: 'distinguish_express', @@ -67,6 +61,24 @@ export const waveAvailableFields = [ { label: '部分分配', value: '部分分配' }, { label: '已分配', value: '已分配' }, ]}, + { label:'快递分配', value: 'express_assignment_status', type: 'select', options: [ + { label: '未分配', value: '未分配' }, + { label: '部分分配', value: '部分分配' }, + { label: '已分配', value: '已分配' }, + ]}, + { label:'打印状态', value: 'print_assignment_status', type: 'select', options: [ + { label: '未打印', value: '未打印' }, + { label: '部分打印', value: '部分打印' }, + { label: '已打印', value: '已打印' }, + ]}, + { label: '创建人', value: 'creator', type: 'text' }, + { label: '快递', value: 'logistics_name', type: 'text' }, + // { label: '商品类型', value: 'item_part_type', type: 'text' }, + // { label: '商品部位', value: 'item_part', type: 'text' }, + // { label: '商品快照键', value: 'item_snapshot_key', type: 'text' }, + // { label: '商品结构', value: 'item_detail_machine', type: 'text' }, + + { label: '最小订单数', value: 'total_orders_min', type: 'number' }, { label: '最大订单数', value: 'total_orders_max', type: 'number' }, { label: '最小已处理订单', value: 'processed_orders_min', type: 'number' }, @@ -129,6 +141,8 @@ export const waveWhereAllowedFieldList = [ 'item_detail_machine', 'distinguish_express', 'storage_assignment_status', + 'express_assignment_status', + 'print_assignment_status', 'total_orders_min', 'total_orders_max', 'processed_orders_min', @@ -226,14 +240,14 @@ export const waveToolbarButtons: WaveToolbarButtonConfig[] = [ action: 'openGroupOrderDialog', onlyForWaveType: 1 }, - { - key: 'fetchSingleOrder', - label: '抓取散单候选', - type: 'warning', - size: 'small', - action: 'openSingleOrderDialog', - onlyForWaveType: 2 - } + // { + // key: 'fetchSingleOrder', + // label: '抓取散单候选', + // type: 'warning', + // size: 'small', + // action: 'openSingleOrderDialog', + // onlyForWaveType: 2 + // } ] export function getWaveToolbarButtons(waveType: 1 | 2): WaveToolbarButtonConfig[] { @@ -352,3 +366,170 @@ export const waveBooleanOptions = [ { label: '是', value: true }, { label: '否', value: false } ] + +// --------------------------------------------------------------------------- +// 拣货中任务页(pickTaskWave):与散单页共用 waveScanBoxConfig;筛选字段见 pickTaskWaveAvailableFields +// --------------------------------------------------------------------------- + +/** 列表与工具栏文案 */ +export const pickTaskWaveListDefaults = { + toolbarHint: '当前仓库拣货任务(order.wave.wavePickTaskList)', + listTitle: '拣货任务列表', + emptyText: '暂无拣货任务', + loadingEmptyText: '加载中...', + loadFailedEmptyText: '加载失败', + noWarehouseEmptyText: '未获取到仓库ID' +} + +/** 分页与详情弹窗 */ +export const pickTaskWavePaginationDefaults = { + pageSizes: [20, 50, 100, 200] as const, + layout: 'total, sizes, prev, pager, next, jumper' as const, + initialPageSize: 20 +} + +/** 供模板 :page-sizes 绑定(避免 readonly 元组在模板中的类型问题) */ +export const pickTaskWavePaginationPageSizes = [20, 50, 100, 200] + +export const pickTaskWaveDetailDialogDefaults = { + title: '拣货任务详情', + width: '920px' +} + +export type PickTaskWaveToolbarKey = 'search' | 'detailQuery' | 'batchCancel' | 'refresh' + +export type PickTaskWaveToolbarButton = { + key: PickTaskWaveToolbarKey + label: string + type?: 'primary' | 'success' | 'warning' | 'danger' | 'info' | '' + plain?: boolean + size?: 'small' | 'default' | 'large' +} + +/** 工具栏按钮顺序与类型(与散单页工具条同一套间距/滚动行为) */ +export const pickTaskWaveToolbarButtons: PickTaskWaveToolbarButton[] = [ + { key: 'search', label: '查询', type: 'primary', size: 'small' }, + { key: 'detailQuery', label: '按任务ID查详情', size: 'small' }, + { key: 'batchCancel', label: '批量取消任务', type: 'danger', size: 'small' }, + { key: 'refresh', label: '刷新', size: 'small' } +] + +/** 左侧筛选字段(与 order.wave.wavePickTaskList 入参对应) */ +export const pickTaskWaveAvailableFields = [ + { 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: 3 }, + { label: '已取消', value: 9 } + ] + }, + { + label: '复核状态', + value: 'review_status', + type: 'select', + options: [ + { label: '未就绪', value: 0 }, + { label: '待复核', value: 1 }, + { label: '复核中', value: 2 }, + { label: '复核通过', value: 3 }, + { label: '复核异常', value: 4 } + ] + }, + { + label: '拣货模式', + value: 'pick_mode', + type: 'select', + options: [ + { label: '小团购', value: 1 }, + { label: '单品单件', value: 2 }, + { label: '先拣后分', value: 3 }, + { label: '边拣边分', value: 4 }, + { label: '大团购', value: 5 } + ] + }, + { + label: '来源', + value: 'source', + type: 'select', + options: [ + { label: '默认', value: 0 }, + { label: 'PDA', value: 1 }, + { label: '后台', 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' } +] + +export function formatPickTaskStatus(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) +} + +export function formatPickTaskReviewStatus(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) +} + +export function formatPickTaskPickMode(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) +} + +export function formatPickTaskSource(value: unknown): string { + const num = Number(value) + if (num === 0) return '默认' + if (num === 1) return 'PDA' + if (num === 2) return '后台' + return value === null || value === undefined || value === '' ? '-' : String(value) +} + +export function getPickTaskStatusTagType(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' +} + +export function getPickTaskReviewStatusTagType(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' +} + +export function getPickTaskSourceTagType(value: unknown): 'info' | 'success' { + const num = Number(value) + if (num === 1) return 'success' + return 'info' +} diff --git a/src/views/order/waveOrder/index.vue b/src/views/order/waveOrder/index.vue index 02e4c1d9..37f7585a 100644 --- a/src/views/order/waveOrder/index.vue +++ b/src/views/order/waveOrder/index.vue @@ -17,7 +17,12 @@ {{ tab.label }} - + @@ -46,11 +51,24 @@ type WaveTabItem = { name: string label: string component: any + props?: Record } const tabs = ref([ { name: 'groupWave', label: '团购波次', component: markRaw(GroupWaveBatchListPanel) }, { name: 'sandanWave', label: '散单波次', component: markRaw(SandanWaveBatchListPanel) }, + { + name: 'sandanFallbackOrders', + label: '不符合波次策略订单列表', + component: markRaw(SandanWaveBatchListPanel), + props: { singleOrderOnlyView: true, initialSingleOrderTab: 'fallback-orders' } + }, + { + name: 'sandanWaveStrategy', + label: '波次策略', + component: markRaw(SandanWaveBatchListPanel), + props: { singleOrderOnlyView: true, initialSingleOrderTab: 'strategy-api' } + }, { name: 'pickTaskWave', label: '拣货中任务', component: markRaw(WavePickTaskListPanel) } ]) diff --git a/src/views/stock/stock/index.vue b/src/views/stock/stock/index.vue index 6db476b9..d100bee5 100644 --- a/src/views/stock/stock/index.vue +++ b/src/views/stock/stock/index.vue @@ -3,7 +3,7 @@
- @@ -153,102 +153,11 @@
- - - - - +