diff --git a/src/views/order/waveOrder2/components/ColumnCellRenderer.vue b/src/views/order/waveOrder2/components/ColumnCellRenderer.vue new file mode 100644 index 00000000..c31a303d --- /dev/null +++ b/src/views/order/waveOrder2/components/ColumnCellRenderer.vue @@ -0,0 +1,51 @@ + + + diff --git a/src/views/order/waveOrder2/components/DetailPanel.vue b/src/views/order/waveOrder2/components/DetailPanel.vue new file mode 100644 index 00000000..f6280917 --- /dev/null +++ b/src/views/order/waveOrder2/components/DetailPanel.vue @@ -0,0 +1,165 @@ + + + + + diff --git a/src/views/order/waveOrder2/components/TabArea.vue b/src/views/order/waveOrder2/components/TabArea.vue new file mode 100644 index 00000000..9d030853 --- /dev/null +++ b/src/views/order/waveOrder2/components/TabArea.vue @@ -0,0 +1,141 @@ + + + + + diff --git a/src/views/order/waveOrder2/config/waveorder-config.ts b/src/views/order/waveOrder2/config/waveorder-config.ts new file mode 100644 index 00000000..741cd50e --- /dev/null +++ b/src/views/order/waveOrder2/config/waveorder-config.ts @@ -0,0 +1,935 @@ +/** + * waveOrder2 页面配置文件 v3 + * + * ===== 核心设计 ===== + * + * 1. FIELD_DICT — 全局字段预设表,每个字段拥有唯一翻译(label)和完整元数据 + * 2. 各标签页通过 key 引用所需字段(scanBoxFieldKeys / tableColumnKeys) + * 3. resolveTabConfig() — 加载时将 key 列表展开为完整配置,注入 index.vue + * + * 优势: + * - 字段定义集中管理,一处修改全局生效 + * - 页面只声明"我需要哪些字段",无需关心渲染细节 + * - 新增字段只需在 FIELD_DICT 追加,页面引用 key 即可 + */ + +import type { Component } from 'vue' +import DetailPanel from '../components/DetailPanel.vue' + +// ============================================================ +// 一、全局字段预设表 FIELD_DICT +// ============================================================ +// 每个字段拥有: +// label — 唯一翻译文本 +// scanBox — ScanBox 渲染配置(type/options/group/required) +// table — 表格列配置(minWidth/fixed/align/sortable) +// slot — 单元格渲染配置(tag/tagResolver/translateField) +// detailLabel — 明细面板中的标签文本(可选,默认用 label) + +export interface FieldDefinition { + /** 字段唯一标识(作为 key 使用) */ + key: string + /** 字段唯一翻译文本 */ + label: string + /** ScanBox 筛选配置(null 表示不可筛选) */ + scanBox: { + type: 'text' | 'select' | 'daterange' | 'number' + group?: string + options?: { label: string; value: any }[] + required?: boolean + extraAction?: { label: string; action: string } + } | null + /** 表格列配置(null 表示不作为列显示) */ + table: { + minWidth?: number + width?: number + fixed?: 'left' | 'right' | boolean + align?: 'left' | 'center' | 'right' + sortable?: boolean + showOverflowTooltip?: boolean + } | null + /** 单元格渲染配置(null 表示默认文本渲染) */ + slot: { + type: 'tag' | 'text' | 'default' + /** 固定 tag 颜色 或 值→颜色映射表 */ + tagType?: string | Record + /** tagResolver 函数名(查 TAG_RESOLVERS) */ + tagResolver?: string + /** 从 VALUE_MAPS 翻译显示文本 */ + translateField?: string + } | null + /** 明细面板标签文本(不设则用 label) */ + detailLabel?: string +} + +// ============================================================ +// ScanBox 分组名称 +// ============================================================ +export const SCANBOX_GROUPS = { + basic: '基础信息', + process: '流程状态', + logistics: '物流信息', + time: '时间范围', + custom: '自定义字段' +} as const + +// ============================================================ +// VALUE_MAPS — 值翻译映射(select options 和 tag 翻译共用) +// ============================================================ +export const VALUE_MAPS: Record> = { + wave_type: { '1': '团购', '2': '散单' }, + wave_status: { '0': '自动加团中', '1': '已就绪' }, + distinguish_express: { '1': '是', '0': '否' }, + storage_assignment_status: { '未分配': '未分配', '已分配': '已分配', 'partial': '部分分配' }, + express_assignment_status: { 'assigned': '已分配', 'unassigned': '未分配', '已分配': '已分配', '未分配': '未分配' }, + print_assignment_status: { 'printed': '已打印', 'unprinted': '未打印', '已打印': '已打印', '未打印': '未打印' }, + pick_assignment_status: { '未拣货': '未拣货', '部分拣货': '部分拣货', '已拣货': '已拣货' }, + review_assignment_status: { 'reviewed': '已复核', 'unreviewed': '未复核', '已复核': '已复核', '未复核': '未复核' }, + order_status: { 'pending': '待处理', 'processing': '处理中', 'done': '已完成' } +} + +/** 从 VALUE_MAPS 衍生 options */ +export function getOptions(field: string): { label: string; value: string }[] { + const map = VALUE_MAPS[field] + if (!map) return [] + const seen = new Set() + const opts: { label: string; value: string }[] = [] + for (const [v, l] of Object.entries(map)) { + if (!seen.has(l)) { + seen.add(l) + opts.push({ label: l, value: v }) + } + } + return opts +} + +/** 翻译 value → label */ +export function translate(field: string, value: any): string { + const map = VALUE_MAPS[field] + if (!map) return String(value ?? '—') + return map[String(value)] ?? String(value ?? '—') +} + +// ============================================================ +// TAG_RESOLVERS — 标签颜色解析器 +// ============================================================ +export const TAG_RESOLVERS: Record string> = { + resolveAssignTag(v) { + if (!v) return 'info' + if (v === '已分配' || v === 'assigned') return 'success' + if (v === '部分分配' || v === 'partial') return 'warning' + return 'danger' + }, + resolvePrintTag(v) { + if (!v) return 'info' + return v === '已打印' || v === 'printed' ? 'success' : 'warning' + }, + resolvePickTag(v) { + if (!v) return 'info' + if (v === '已拣货') return 'success' + if (v === '部分拣货') return 'warning' + return 'danger' + }, + resolveReviewTag(v) { + if (!v) return 'info' + return v === '已复核' || v === 'reviewed' ? 'success' : 'warning' + }, + resolveWaveStatusTag(v) { + if (!v) return 'info' + return v === '已就绪' ? 'success' : 'warning' + }, + resolveBoolTag(v) { + if (v === undefined || v === null) return 'info' + return v === '是' || v === true || v === 1 ? 'warning' : 'info' + } +} + +// ============================================================ +// 二、FIELD_DICT — 全局字段预设表(唯一真相来源) +// ============================================================ +export const FIELD_DICT: Record = { + // ---- 基础信息 ---- + wave_no: { + key: 'wave_no', + label: '波次编号', + scanBox: { type: 'text', group: SCANBOX_GROUPS.basic }, + table: { minWidth: 180, fixed: 'left' }, + slot: null, + detailLabel: '波次编号' + }, + wave_type: { + key: 'wave_type', + label: '波次类型', + scanBox: { type: 'select', group: SCANBOX_GROUPS.basic, options: getOptions('wave_type') }, + table: { minWidth: 96, align: 'center' }, + slot: { type: 'tag', tagType: 'info' }, + detailLabel: '波次类型' + }, + wave_status: { + key: 'wave_status', + label: '波次状态', + scanBox: { type: 'select', group: SCANBOX_GROUPS.basic, options: getOptions('wave_status') }, + table: { minWidth: 110, align: 'center' }, + slot: { type: 'tag', tagResolver: 'resolveWaveStatusTag' }, + detailLabel: '波次状态' + }, + total_orders: { + key: 'total_orders', + label: '总订单数', + scanBox: null, + table: { minWidth: 110, align: 'center' }, + slot: null + }, + order_count: { + key: 'order_count', + label: '订单数量', + scanBox: null, + table: { minWidth: 100, align: 'center' }, + slot: null + }, + processed_orders: { + key: 'processed_orders', + label: '已处理订单', + scanBox: null, + table: { minWidth: 108, align: 'center' }, + slot: null + }, + distinguish_express: { + key: 'distinguish_express', + label: '区分快递', + scanBox: { type: 'select', group: SCANBOX_GROUPS.basic, options: getOptions('distinguish_express') }, + table: { minWidth: 100, align: 'center' }, + slot: { type: 'tag', tagResolver: 'resolveBoolTag' }, + detailLabel: '区分快递' + }, + logistics_name: { + key: 'logistics_name', + label: '快递', + scanBox: { type: 'text', group: SCANBOX_GROUPS.basic }, + table: { minWidth: 120 }, + slot: null, + detailLabel: '快递' + }, + creator: { + key: 'creator', + label: '创建人', + scanBox: { type: 'text', group: SCANBOX_GROUPS.basic }, + table: { minWidth: 100 }, + slot: null, + detailLabel: '创建人' + }, + warehouse_id: { + key: 'warehouse_id', + label: '仓库ID', + scanBox: null, + table: { minWidth: 110, align: 'center' }, + slot: null, + detailLabel: '仓库ID' + }, + create_time: { + key: 'create_time', + label: '创建时间', + scanBox: { type: 'daterange', group: SCANBOX_GROUPS.time }, + table: { minWidth: 168 }, + slot: null, + detailLabel: '创建时间' + }, + update_time: { + key: 'update_time', + label: '更新时间', + scanBox: { type: 'daterange', group: SCANBOX_GROUPS.time }, + table: { minWidth: 168 }, + slot: null, + detailLabel: '更新时间' + }, + + // ---- 流程状态 ---- + storage_assignment_status: { + key: 'storage_assignment_status', + label: '库位分配', + scanBox: { type: 'select', group: SCANBOX_GROUPS.process, options: getOptions('storage_assignment_status') }, + table: { minWidth: 120, align: 'center' }, + slot: { type: 'tag', tagResolver: 'resolveAssignTag' }, + detailLabel: '库位分配状态' + }, + express_assignment_status: { + key: 'express_assignment_status', + label: '快递分配', + scanBox: { type: 'select', group: SCANBOX_GROUPS.process, options: getOptions('express_assignment_status') }, + table: { minWidth: 120, align: 'center' }, + slot: { type: 'tag', tagResolver: 'resolveAssignTag' }, + detailLabel: '快递分配状态' + }, + print_assignment_status: { + key: 'print_assignment_status', + label: '打印状态', + scanBox: { type: 'select', group: SCANBOX_GROUPS.process, options: getOptions('print_assignment_status') }, + table: { minWidth: 110, align: 'center' }, + slot: { type: 'tag', tagResolver: 'resolvePrintTag' }, + detailLabel: '打印分配状态' + }, + pick_assignment_status: { + key: 'pick_assignment_status', + label: '拣货状态', + scanBox: { type: 'select', group: SCANBOX_GROUPS.process, options: getOptions('pick_assignment_status') }, + table: { minWidth: 110, align: 'center' }, + slot: { type: 'tag', tagResolver: 'resolvePickTag' }, + detailLabel: '拣货状态' + }, + review_assignment_status: { + key: 'review_assignment_status', + label: '复核状态', + scanBox: { type: 'select', group: SCANBOX_GROUPS.process, options: getOptions('review_assignment_status') }, + table: { minWidth: 110, align: 'center' }, + slot: { type: 'tag', tagResolver: 'resolveReviewTag' }, + detailLabel: '复核状态' + }, + unreviewed_order_count: { + key: 'unreviewed_order_count', + label: '未复核数', + scanBox: null, + table: { minWidth: 96, align: 'center' }, + slot: null, + detailLabel: '未复核订单数' + }, + + // ---- 订单相关 ---- + order_no: { + key: 'order_no', + label: '订单编号', + scanBox: { type: 'text', group: SCANBOX_GROUPS.basic }, + table: { minWidth: 180, fixed: 'left' }, + slot: null + }, + order_status: { + key: 'order_status', + label: '订单状态', + scanBox: { type: 'select', group: SCANBOX_GROUPS.basic, options: getOptions('order_status') }, + table: { minWidth: 100, align: 'center' }, + slot: { type: 'tag', tagType: { 'pending': 'warning', 'processing': '', 'done': 'success' }, translateField: 'order_status' } + }, + customer_name: { + key: 'customer_name', + label: '客户名称', + scanBox: { type: 'text', group: SCANBOX_GROUPS.basic }, + table: { minWidth: 120 }, + slot: null + }, + sku_count: { + key: 'sku_count', + label: 'SKU数', + scanBox: null, + table: { minWidth: 80, align: 'center' }, + slot: null + }, + total_qty: { + key: 'total_qty', + label: '总数量', + scanBox: null, + table: { minWidth: 80, align: 'center' }, + slot: null + }, + total_amount: { + key: 'total_amount', + label: '总金额(元)', + scanBox: null, + table: { minWidth: 110, align: 'center' }, + slot: null + }, + order_time: { + key: 'order_time', + label: '下单时间', + scanBox: { type: 'daterange', group: SCANBOX_GROUPS.time }, + table: { minWidth: 168 }, + slot: null + }, + + // ---- 快递相关 ---- + express_company: { + key: 'express_company', + label: '快递公司', + scanBox: { + type: 'select', group: SCANBOX_GROUPS.logistics, + options: [ + { label: '顺丰速运', value: 'SF' }, + { label: '圆通快递', value: 'YTO' }, + { label: '中通快递', value: 'ZTO' }, + { label: '韵达快递', value: 'YUNDA' }, + { label: '申通快递', value: 'STO' } + ] + }, + table: { minWidth: 120 }, + slot: null + }, + express_bill_count: { + key: 'express_bill_count', + label: '快递单数', + scanBox: null, + table: { minWidth: 100, align: 'center' }, + slot: null + }, + assigned_count: { + key: 'assigned_count', + label: '已分配数', + scanBox: null, + table: { minWidth: 90, align: 'center' }, + slot: null + }, + unassigned_count: { + key: 'unassigned_count', + label: '未分配数', + scanBox: null, + table: { minWidth: 90, align: 'center' }, + slot: null + }, + + // ---- 拣货相关 ---- + picker: { + key: 'picker', + label: '拣货员', + scanBox: { type: 'text', group: SCANBOX_GROUPS.process }, + table: { minWidth: 100 }, + slot: null + }, + pick_cart_no: { + key: 'pick_cart_no', + label: '拣货车', + scanBox: { type: 'text', group: SCANBOX_GROUPS.process }, + table: { minWidth: 120 }, + slot: null + }, + picked_sku_count: { + key: 'picked_sku_count', + label: '已拣SKU', + scanBox: null, + table: { minWidth: 90, align: 'center' }, + slot: null + }, + unpicked_sku_count: { + key: 'unpicked_sku_count', + label: '未拣SKU', + scanBox: null, + table: { minWidth: 90, align: 'center' }, + slot: null + }, + pick_start_time: { + key: 'pick_start_time', + label: '开始拣货', + scanBox: null, + table: { minWidth: 168 }, + slot: null + }, + pick_end_time: { + key: 'pick_end_time', + label: '完成拣货', + scanBox: null, + table: { minWidth: 168 }, + slot: null + }, + + // ---- 复核相关 ---- + reviewer: { + key: 'reviewer', + label: '复核员', + scanBox: { type: 'text', group: SCANBOX_GROUPS.process }, + table: { minWidth: 100 }, + slot: null + }, + reviewed_order_count: { + key: 'reviewed_order_count', + label: '已复核单', + scanBox: null, + table: { minWidth: 100, align: 'center' }, + slot: null + }, + review_start_time: { + key: 'review_start_time', + label: '开始复核', + scanBox: null, + table: { minWidth: 168 }, + slot: null + }, + review_end_time: { + key: 'review_end_time', + label: '完成复核', + scanBox: null, + table: { minWidth: 168 }, + slot: null + } +} + +// ============================================================ +// 三、列插槽配置类型(与 ColumnCellRenderer 配合) +// ============================================================ +export interface ColumnSlotConfig { + type: 'tag' | 'text' | 'default' + tagType?: string | Record + tagResolver?: string + translateField?: string +} + +// ============================================================ +// 四、TabPageRawConfig — 标签页声明配置(仅用 key 引用) +// ============================================================ + +export interface ToolbarButton { + key: string + label: string + type?: 'primary' | 'success' | 'warning' | 'danger' | 'info' | '' + icon?: string + disabled?: boolean +} + +export interface TabPageRawConfig { + name: string + label: string + scanBoxCacheKey: string + /** ScanBox 需要的字段 key 列表(从 FIELD_DICT 中查找) */ + scanBoxFieldKeys: string[] + /** 表格需要的列 key 列表(从 FIELD_DICT 中查找) */ + tableColumnKeys: string[] + upperTableDefaults: { + title: string + enableColumnConfig?: boolean + showIndex?: boolean + showSelection?: boolean + emptyText?: string + } + detailComponent: Component + mock: { + generateList: (count: number) => Record[] + generateDetail: (row: Record) => Record | null + } + toolbar?: { + left?: ToolbarButton[] + showRefresh?: boolean + showExport?: boolean + } +} + +// ============================================================ +// 五、TabPageConfig — 展开后的完整配置(给 index.vue 使用) +// ============================================================ +export interface TabPageConfig { + name: string + label: string + scanBoxCacheKey: string + scanBoxFields: Record[] + upperTable: { + title: string + enableColumnConfig: boolean + showIndex: boolean + showSelection: boolean + emptyText: string + columns: Record[] + } + columnSlots: Record + detailComponent: Component + mock: { + generateList: (count: number) => Record[] + generateDetail: (row: Record) => Record | null + } + toolbar?: { + left?: ToolbarButton[] + showRefresh?: boolean + showExport?: boolean + } +} + +// ============================================================ +// 六、resolveTabConfig — 加载时将 RawConfig 展开为完整配置 +// ============================================================ +export function resolveTabConfig(raw: TabPageRawConfig): TabPageConfig { + // 展开 ScanBox 字段 + const scanBoxFields: Record[] = [] + let lastGroup = '' + for (const key of raw.scanBoxFieldKeys) { + const def = FIELD_DICT[key] + if (!def || !def.scanBox) continue + scanBoxFields.push({ + label: def.label, + value: def.key, + type: def.scanBox.type, + options: def.scanBox.options ? [...def.scanBox.options] : undefined, + group: def.scanBox.group, + required: def.scanBox.required, + extraAction: def.scanBox.extraAction + }) + } + + // 展开表格列 + const columns: Record[] = [] + for (const key of raw.tableColumnKeys) { + const def = FIELD_DICT[key] + if (!def || !def.table) continue + columns.push({ + prop: def.key, + label: def.label, + ...def.table + }) + } + + // 展开列插槽 + const columnSlots: Record = {} + for (const key of raw.tableColumnKeys) { + const def = FIELD_DICT[key] + if (!def || !def.slot) continue + columnSlots[def.key] = { ...def.slot } + } + + return { + name: raw.name, + label: raw.label, + scanBoxCacheKey: raw.scanBoxCacheKey, + scanBoxFields, + upperTable: { + title: raw.upperTableDefaults.title, + enableColumnConfig: raw.upperTableDefaults.enableColumnConfig ?? true, + showIndex: raw.upperTableDefaults.showIndex ?? true, + showSelection: raw.upperTableDefaults.showSelection ?? true, + emptyText: raw.upperTableDefaults.emptyText ?? '暂无数据', + columns + }, + columnSlots, + detailComponent: raw.detailComponent, + mock: raw.mock, + toolbar: raw.toolbar + } +} + +// ============================================================ +// 七、通用模拟数据 +// ============================================================ + +export function makeBaseMockWaveList(count = 25) { + const assignStatuses = ['未分配', '已分配', '部分分配'] + const printStatuses = ['未打印', '已打印'] + const pickStatuses = ['未拣货', '部分拣货', '已拣货'] + const reviewStatuses = ['未复核', '已复核'] + const expressNames = ['顺丰速运', '圆通快递', '中通快递', '韵达快递', '申通快递'] + const creators = ['张三', '李四', '王五', '赵六', '陈七'] + const warehouseIds = [1, 2, 3, 4, 5] + const pad = (n: number) => String(n).padStart(2, '0') + + return Array.from({ length: count }, (_, i) => { + const idx = i + 1 + const created = new Date(2026, 6, 10 - Math.floor(i / 3), 8 + Math.floor(i / 2), idx % 60, 0) + const updated = new Date(created.getTime() + (idx % 12) * 3600000) + return { + id: idx, + wave_no: `WV202607${pad(Math.floor(idx / 5) + 1)}${pad(idx)}`, + wave_type: idx % 3 === 0 ? '1' : '2', + wave_status: idx % 4 === 0 ? '0' : '1', + total_orders: 10 + (idx % 50), + order_count: 8 + (idx % 45), + processed_orders: idx % 2 === 0 ? 0 : (3 + (idx % 8)), + distinguish_express: idx % 3 === 0 ? '1' : '0', + storage_assignment_status: assignStatuses[idx % 3], + express_assignment_status: idx % 2 === 0 ? '已分配' : '未分配', + print_assignment_status: printStatuses[idx % 2], + pick_assignment_status: pickStatuses[idx % 3], + review_assignment_status: reviewStatuses[idx % 2], + unreviewed_order_count: idx % 2 === 0 ? 0 : (1 + (idx % 5)), + logistics_name: expressNames[idx % expressNames.length], + creator: creators[idx % creators.length], + warehouse_id: warehouseIds[idx % warehouseIds.length], + create_time: created.toISOString().replace('T', ' ').slice(0, 19), + update_time: updated.toISOString().replace('T', ' ').slice(0, 19) + } + }) +} + +export function makeBaseMockDetail(row: Record) { + if (!row) return null + return { + ...row, + wave_code: row.wave_no, + batch_code: row.wave_no, + status: row.wave_status, + creator_name: row.creator, + order_list_preview: [ + `订单 OD2026070100${row.id}1 — 商品A ×2, 商品B ×1`, + `订单 OD2026070100${row.id}2 — 商品C ×3`, + `订单 OD2026070100${row.id}3 — 商品D ×1, 商品E ×2` + ].join('\n'), + order_info_summary: `共 ${row.total_orders} 个订单,涉及 ${row.order_count} 个SKU`, + item_snapshot_text: `SKU-A(×${(row.id % 5) + 2}), SKU-B(×${(row.id % 3) + 1}), SKU-C(×${(row.id % 4) + 2})`, + storage_assignment_error: + row.storage_assignment_status === '部分分配' + ? `SKU-C 库位不足,仅分配 ${(row.id % 3) + 1} 件` + : '' + } +} + +// ============================================================ +// 八、标签页注册表(仅声明 key,由 resolveTabConfig 展开) +// ============================================================ + +export const waveOrder2TabPages: TabPageRawConfig[] = [ + // ===== 标签页一:波次列表 ===== + { + name: 'tab1', + label: '波次列表', + scanBoxCacheKey: 'wave-order2-tab1', + scanBoxFieldKeys: [ + 'wave_no', 'wave_type', 'wave_status', 'distinguish_express', + 'logistics_name', 'creator', + 'storage_assignment_status', 'express_assignment_status', + 'print_assignment_status', 'pick_assignment_status', 'review_assignment_status', + 'create_time', 'update_time' + ], + tableColumnKeys: [ + 'wave_no', 'wave_type', 'wave_status', + 'total_orders', 'order_count', 'processed_orders', + 'distinguish_express', + 'storage_assignment_status', 'express_assignment_status', + 'print_assignment_status', 'pick_assignment_status', 'review_assignment_status', + 'unreviewed_order_count', 'logistics_name', 'creator', 'warehouse_id', + 'create_time', 'update_time' + ], + upperTableDefaults: { + title: '波次列表', + showSelection: true + }, + detailComponent: DetailPanel, + mock: { + generateList: makeBaseMockWaveList, + generateDetail: makeBaseMockDetail + } + }, + + // ===== 标签页二:订单汇总 ===== + { + name: 'tab2', + label: '订单汇总', + scanBoxCacheKey: 'wave-order2-tab2', + scanBoxFieldKeys: [ + 'order_no', 'order_status', 'creator', + 'order_time', 'create_time', 'update_time' + ], + tableColumnKeys: [ + 'order_no', 'order_status', 'customer_name', + 'sku_count', 'total_qty', 'total_amount', + 'wave_no', 'logistics_name', 'creator', + 'order_time', 'create_time' + ], + upperTableDefaults: { + title: '订单汇总', + showSelection: false + }, + detailComponent: DetailPanel, + mock: { + generateList(count) { + const customers = ['客户A', '客户B', '客户C', '客户D'] + const statusKeys = ['pending', 'processing', 'done'] + const pad = (n: number) => String(n).padStart(3, '0') + return Array.from({ length: count }, (_, i) => { + const idx = i + 1 + return { + id: idx, + order_no: `OD202607${pad(idx)}`, + order_status: statusKeys[idx % 3], + customer_name: customers[idx % customers.length], + sku_count: 1 + (idx % 10), + total_qty: 2 + (idx % 50), + total_amount: ((idx % 20) + 1) * 99.9, + wave_no: `WV2026070${(idx % 5) + 1}`, + logistics_name: ['顺丰速运', '圆通快递'][idx % 2], + creator: ['张三', '李四'][idx % 2], + order_time: new Date(2026, 6, 10 - Math.floor(i / 4), 9 + (i % 8), i % 60).toISOString().replace('T', ' ').slice(0, 19), + create_time: new Date(2026, 6, 10 - Math.floor(i / 3), 8, i % 60).toISOString().replace('T', ' ').slice(0, 19) + } + }) + }, + generateDetail(row) { + if (!row) return null + return { ...row, order_info_summary: `订单 ${row.order_no} 明细`, item_snapshot_text: `共 ${row.sku_count} 个SKU,${row.total_qty} 件` } + } + } + }, + + // ===== 标签页三:快递分配 ===== + { + name: 'tab3', + label: '快递分配', + scanBoxCacheKey: 'wave-order2-tab3', + scanBoxFieldKeys: [ + 'wave_no', 'express_company', 'express_assignment_status', + 'distinguish_express', 'creator', 'create_time' + ], + tableColumnKeys: [ + 'wave_no', 'wave_type', 'express_company', 'express_assignment_status', + 'express_bill_count', 'distinguish_express', + 'assigned_count', 'unassigned_count', + 'creator', 'create_time' + ], + upperTableDefaults: { + title: '快递分配列表', + showSelection: true + }, + detailComponent: DetailPanel, + mock: { + generateList(count) { + const companies = ['顺丰速运', '圆通快递', '中通快递', '韵达快递', '申通快递'] + const pad = (n: number) => String(n).padStart(2, '0') + return Array.from({ length: count }, (_, i) => { + const idx = i + 1 + const total = 5 + (idx % 20) + const assigned = idx % 2 === 0 ? total : Math.floor(total * 0.6) + return { + id: idx, + wave_no: `WV202607${pad(Math.floor(idx / 5) + 1)}${pad(idx)}`, + wave_type: idx % 3 === 0 ? '1' : '2', + express_company: companies[idx % companies.length], + express_assignment_status: idx % 2 === 0 ? '已分配' : '未分配', + express_bill_count: total, + distinguish_express: idx % 3 === 0 ? '1' : '0', + assigned_count: assigned, + unassigned_count: total - assigned, + creator: ['张三', '李四'][idx % 2], + create_time: new Date(2026, 6, 10 - Math.floor(i / 4), 10, i % 60).toISOString().replace('T', ' ').slice(0, 19) + } + }) + }, + generateDetail(row) { + if (!row) return null + return { ...row, order_info_summary: `波次 ${row.wave_no} 快递分配详情`, item_snapshot_text: `共 ${row.express_bill_count} 单` } + } + } + }, + + // ===== 标签页四:拣货状态 ===== + { + name: 'tab4', + label: '拣货状态', + scanBoxCacheKey: 'wave-order2-tab4', + scanBoxFieldKeys: [ + 'wave_no', 'pick_assignment_status', 'picker', 'pick_cart_no', + 'creator', 'create_time' + ], + tableColumnKeys: [ + 'wave_no', 'wave_type', 'pick_assignment_status', + 'picker', 'pick_cart_no', + 'picked_sku_count', 'unpicked_sku_count', + 'pick_start_time', 'pick_end_time', + 'create_time' + ], + upperTableDefaults: { + title: '拣货状态列表', + showSelection: true + }, + detailComponent: DetailPanel, + mock: { + generateList(count) { + const pickers = ['拣货员A', '拣货员B', '拣货员C'] + const statuses = ['未拣货', '部分拣货', '已拣货'] + const pad = (n: number) => String(n).padStart(2, '0') + return Array.from({ length: count }, (_, i) => { + const idx = i + 1 + const total = 3 + (idx % 15) + const picked = statuses[idx % 3] === '已拣货' ? total : statuses[idx % 3] === '部分拣货' ? Math.floor(total * 0.5) : 0 + const st = new Date(2026, 6, 11 - Math.floor(i / 4), 8, i % 60) + return { + id: idx, + wave_no: `WV202607${pad(Math.floor(idx / 5) + 1)}${pad(idx)}`, + wave_type: idx % 3 === 0 ? '1' : '2', + pick_assignment_status: statuses[idx % 3], + picker: statuses[idx % 3] !== '未拣货' ? pickers[idx % pickers.length] : '—', + pick_cart_no: statuses[idx % 3] !== '未拣货' ? `CART-${pad(idx)}` : '—', + picked_sku_count: picked, + unpicked_sku_count: total - picked, + pick_start_time: statuses[idx % 3] !== '未拣货' ? st.toISOString().replace('T', ' ').slice(0, 19) : '—', + pick_end_time: statuses[idx % 3] === '已拣货' ? new Date(st.getTime() + 3600000 * (idx % 4 + 1)).toISOString().replace('T', ' ').slice(0, 19) : '—', + create_time: new Date(2026, 6, 10, 8, i % 60).toISOString().replace('T', ' ').slice(0, 19) + } + }) + }, + generateDetail(row) { + if (!row) return null + return { ...row, order_info_summary: `波次 ${row.wave_no} 拣货详情`, item_snapshot_text: `已拣 ${row.picked_sku_count}/${row.picked_sku_count + row.unpicked_sku_count} SKU` } + } + } + }, + + // ===== 标签页五:复核状态 ===== + { + name: 'tab5', + label: '复核状态', + scanBoxCacheKey: 'wave-order2-tab5', + scanBoxFieldKeys: [ + 'wave_no', 'review_assignment_status', 'reviewer', + 'creator', 'create_time' + ], + tableColumnKeys: [ + 'wave_no', 'wave_type', 'review_assignment_status', + 'reviewer', 'reviewed_order_count', 'unreviewed_order_count', + 'review_start_time', 'review_end_time', + 'create_time' + ], + upperTableDefaults: { + title: '复核状态列表', + showSelection: true + }, + detailComponent: DetailPanel, + mock: { + generateList(count) { + const reviewers = ['复核员X', '复核员Y'] + const statuses = ['未复核', '已复核'] + const pad = (n: number) => String(n).padStart(2, '0') + return Array.from({ length: count }, (_, i) => { + const idx = i + 1 + const total = 4 + (idx % 12) + const unreviewed = statuses[idx % 2] === '未复核' ? total : 0 + const st = new Date(2026, 6, 11 - Math.floor(i / 5), 9, i % 60) + return { + id: idx, + wave_no: `WV202607${pad(Math.floor(idx / 5) + 1)}${pad(idx)}`, + wave_type: idx % 3 === 0 ? '1' : '2', + review_assignment_status: statuses[idx % 2], + reviewer: statuses[idx % 2] === '已复核' ? reviewers[idx % reviewers.length] : '—', + reviewed_order_count: total - unreviewed, + unreviewed_order_count: unreviewed, + review_start_time: statuses[idx % 2] === '已复核' ? st.toISOString().replace('T', ' ').slice(0, 19) : '—', + review_end_time: statuses[idx % 2] === '已复核' ? new Date(st.getTime() + 7200000 * (idx % 3 + 1)).toISOString().replace('T', ' ').slice(0, 19) : '—', + create_time: new Date(2026, 6, 10, 9, i % 60).toISOString().replace('T', ' ').slice(0, 19) + } + }) + }, + generateDetail(row) { + if (!row) return null + return { ...row, order_info_summary: `波次 ${row.wave_no} 复核详情`, item_snapshot_text: `已复核 ${row.reviewed_order_count} 单,未复核 ${row.unreviewed_order_count} 单` } + } + } + } +] + +// ============================================================ +// 九、向后兼容导出 +// ============================================================ +export const WAVEORDER2_PAGE_CONFIG = { showTabArea: true, singlePage: false } + +export const waveOrder2Tabs = waveOrder2TabPages.map((t) => ({ + name: t.name, label: t.label, scanBoxCacheKey: t.scanBoxCacheKey +})) + +export const waveOrder2AvailableFields = (() => { + const raw = waveOrder2TabPages[0] + if (!raw) return [] + return resolveTabConfig(raw).scanBoxFields +})() + +export const waveOrder2UpperTableDefaults = (() => { + const raw = waveOrder2TabPages[0] + if (!raw) return { title: '', enableColumnConfig: true, showIndex: true, showSelection: true, emptyText: '', columns: [] } + return { ...resolveTabConfig(raw).upperTable } +})() + +export const waveOrder2Columns = (() => { + const raw = waveOrder2TabPages[0] + if (!raw) return [] + return resolveTabConfig(raw).upperTable.columns +})() + +export const generateMockWaveList = waveOrder2TabPages[0]?.mock.generateList ?? makeBaseMockWaveList +export const generateMockDetail = waveOrder2TabPages[0]?.mock.generateDetail ?? makeBaseMockDetail + diff --git a/src/views/order/waveOrder2/index.vue b/src/views/order/waveOrder2/index.vue new file mode 100644 index 00000000..779c0321 --- /dev/null +++ b/src/views/order/waveOrder2/index.vue @@ -0,0 +1,491 @@ + + + + + \ No newline at end of file