This commit is contained in:
yin 2026-07-13 18:20:20 +08:00
parent 9e0b85624b
commit 1d7964770e
5 changed files with 1783 additions and 0 deletions

View File

@ -0,0 +1,51 @@
<template>
<template v-if="!config || config.type === 'default'">
<slot />
</template>
<template v-else-if="config.type === 'tag'">
<el-tag size="small" :type="resolvedTagType">
{{ displayValue }}
</el-tag>
</template>
<template v-else>
<span>{{ displayValue }}</span>
</template>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import type { ColumnSlotConfig } from '../config/waveorder-config'
import { TAG_RESOLVERS, translate } from '../config/waveorder-config'
defineOptions({ name: 'ColumnCellRenderer' })
const props = defineProps<{
/** 列插槽渲染配置 */
config: ColumnSlotConfig | undefined
/** 单元格值 */
value: any
}>()
/** 显示文本:如果配置了 translateField,则使用 VALUE_MAPS 翻译 */
const displayValue = computed(() => {
if (props.config?.translateField) {
return translate(props.config.translateField, props.value)
}
return props.value
})
const resolvedTagType = computed(() => {
if (!props.config || props.config.type !== 'tag') return ''
const { tagType, tagResolver } = props.config
// 优先使用 tagResolver(函数名映射)
if (tagResolver && TAG_RESOLVERS[tagResolver]) {
return TAG_RESOLVERS[tagResolver](props.value)
}
// 其次使用 tagType 映射表(用翻译后的值查找)
if (tagType && typeof tagType === 'object') {
return tagType[String(props.value)] ?? 'info'
}
// 最后使用固定值
return (typeof tagType === 'string' ? tagType : 'info')
})
</script>

View File

@ -0,0 +1,165 @@
<template>
<div class="wave-order2-detail">
<div v-if="!row" class="empty-tip">请从上方列表中选择一项查看明细</div>
<template v-else>
<!-- 基础信息 -->
<div class="section">
<div class="section-title">基础信息</div>
<el-descriptions :column="4" border size="small" class="detail-descriptions">
<el-descriptions-item label="波次编号">{{ row.wave_no ?? '—' }}</el-descriptions-item>
<el-descriptions-item label="波次类型">
<el-tag size="small" type="info">{{ row.wave_type ?? '—' }}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="波次状态">
<el-tag size="small" :type="row.wave_status === '已就绪' ? 'success' : 'warning'">
{{ row.wave_status ?? '—' }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="仓库ID">{{ row.warehouse_id ?? '—' }}</el-descriptions-item>
<el-descriptions-item label="订单数量">{{ row.total_orders ?? '—' }}</el-descriptions-item>
<el-descriptions-item label="已处理订单">{{ row.processed_orders ?? '—' }}</el-descriptions-item>
<el-descriptions-item label="快递">{{ row.logistics_name ?? '—' }}</el-descriptions-item>
<el-descriptions-item label="创建人">{{ row.creator ?? '—' }}</el-descriptions-item>
</el-descriptions>
</div>
<!-- 分配状态 -->
<div class="section">
<div class="section-title">分配状态</div>
<el-descriptions :column="3" border size="small" class="detail-descriptions">
<el-descriptions-item label="库位分配状态">
<el-tag size="small" :type="getAssignTagType(row.storage_assignment_status)">
{{ row.storage_assignment_status ?? '—' }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="快递分配状态">
<el-tag size="small" :type="getAssignTagType(row.express_assignment_status)">
{{ row.express_assignment_status ?? '—' }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="打印分配状态">
<el-tag size="small" :type="getPrintTagType(row.print_assignment_status)">
{{ row.print_assignment_status ?? '—' }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="拣货状态">
<el-tag size="small" :type="getPickTagType(row.pick_assignment_status)">
{{ row.pick_assignment_status ?? '—' }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="复核状态">
<el-tag size="small" :type="getReviewTagType(row.review_assignment_status)">
{{ row.review_assignment_status ?? '—' }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="未复核订单数">{{ row.unreviewed_order_count ?? '—' }}</el-descriptions-item>
<el-descriptions-item v-if="row.storage_assignment_error" label="库位分配异常" :span="3">
{{ row.storage_assignment_error }}
</el-descriptions-item>
</el-descriptions>
</div>
<!-- 订单信息 -->
<div class="section">
<div class="section-title">结构与订单信息</div>
<el-descriptions :column="2" border size="small" class="detail-descriptions">
<el-descriptions-item label="商品结构快照" :span="2">
{{ row.item_snapshot_text ?? '—' }}
</el-descriptions-item>
<el-descriptions-item label="订单信息" :span="2">
{{ row.order_info_summary ?? '—' }}
</el-descriptions-item>
<el-descriptions-item label="订单列表" :span="2">
<pre class="order-list-pre">{{ row.order_list_preview ?? '—' }}</pre>
</el-descriptions-item>
<el-descriptions-item label="创建时间">{{ row.create_time ?? '—' }}</el-descriptions-item>
<el-descriptions-item label="更新时间">{{ row.update_time ?? '—' }}</el-descriptions-item>
</el-descriptions>
</div>
</template>
</div>
</template>
<script setup lang="ts">
defineOptions({ name: 'WaveOrder2DetailPanel' })
defineProps<{
row: Record<string, any> | null
}>()
function getAssignTagType(status: string | undefined): string {
if (!status) return 'info'
if (status === '已分配' || status === 'assigned') return 'success'
if (status === '部分分配' || status === 'partial') return 'warning'
return 'danger'
}
function getPrintTagType(status: string | undefined): string {
if (!status) return 'info'
return status === '已打印' || status === 'printed' ? 'success' : 'warning'
}
function getPickTagType(status: string | undefined): string {
if (!status) return 'info'
if (status === '已拣货') return 'success'
if (status === '部分拣货') return 'warning'
return 'danger'
}
function getReviewTagType(status: string | undefined): string {
if (!status) return 'info'
return status === '已复核' || status === 'reviewed' ? 'success' : 'warning'
}
</script>
<style lang="scss" scoped>
.wave-order2-detail {
height: 100%;
overflow-y: auto;
padding: 16px;
}
.empty-tip {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
font-size: 14px;
color: #909399;
}
.section {
margin-bottom: 16px;
&:last-child {
margin-bottom: 0;
}
.section-title {
font-size: 14px;
font-weight: 600;
color: #303133;
margin-bottom: 10px;
padding-left: 8px;
border-left: 3px solid #409eff;
line-height: 1.4;
}
}
.detail-descriptions {
:deep(.el-descriptions__label) {
width: 120px;
background: #fafbfc;
font-weight: 500;
}
}
.order-list-pre {
margin: 0;
font-family: inherit;
font-size: 13px;
line-height: 1.8;
white-space: pre-wrap;
color: #606266;
}
</style>

View File

@ -0,0 +1,141 @@
<template>
<div class="tab-area-wrapper">
<el-tabs
v-model="activeTab"
tab-position="top"
type="border-card"
class="tab-container"
@tab-click="handleTabClick"
>
<el-tab-pane
v-for="tab in tabs"
:key="tab.name"
:name="tab.name"
:lazy="false"
>
<template #label>
<span class="custom-tab-label">{{ tab.label }}</span>
</template>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
defineOptions({ name: 'TabArea' })
interface TabItem {
name: string
label: string
}
const props = withDefaults(
defineProps<{
/** 标签页列表 */
tabs?: TabItem[]
/** 默认激活的标签页名称 */
defaultActive?: string
}>(),
{
tabs: () => [
{ name: 'tab1', label: '标签页一' },
{ name: 'tab2', label: '标签页二' },
{ name: 'tab3', label: '标签页三' },
{ name: 'tab4', label: '标签页四' },
{ name: 'tab5', label: '标签页五' }
],
defaultActive: 'tab1'
}
)
const emit = defineEmits<{
(e: 'tab-change', tabName: string): void
}>()
const activeTab = ref(props.defaultActive)
const handleTabClick = (pane: any) => {
const name = pane?.name ?? pane?.props?.name ?? ''
if (name) {
activeTab.value = name
emit('tab-change', name)
}
}
</script>
<style lang="scss" scoped>
.tab-area-wrapper {
flex-shrink: 0;
}
.tab-container {
display: flex;
flex-direction: column;
:deep(.el-tabs__header) {
margin-bottom: 0;
flex-shrink: 0;
}
:deep(.el-tabs__header.is-top) {
padding: 4px 12px 0;
background: #f8fbff;
border-bottom: 1px solid #e8eef7;
margin: 0;
}
:deep(.el-tabs__nav-wrap::after) {
display: none;
}
:deep(.el-tabs__item.is-top) {
height: 38px;
line-height: 38px;
padding: 0 20px;
border-radius: 6px 6px 0 0;
color: #606266;
font-size: 14px;
font-weight: 500;
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
border: 1px solid transparent;
border-bottom: none;
margin-right: 4px;
}
:deep(.el-tabs__item.is-top:hover) {
color: #409eff;
background-color: rgba(64, 158, 255, 0.05);
}
:deep(.el-tabs__item.is-top.is-active) {
color: #409eff;
font-weight: 600;
background: #ffffff;
border-color: #e8eef7;
border-bottom: 2px solid #ffffff;
margin-bottom: -1px;
position: relative;
z-index: 1;
}
:deep(.el-tabs__active-bar) {
height: 2px;
border-radius: 2px;
background-color: #409eff;
bottom: 0;
}
/* 隐藏内容区,仅展示标签头 */
:deep(.el-tabs__content) {
display: none;
}
}
.custom-tab-label {
display: inline-flex;
align-items: center;
gap: 6px;
}
</style>

View File

@ -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<string, string>
/** 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<string, Record<string, string>> = {
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<string>()
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, (val: any) => 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<string, FieldDefinition> = {
// ---- 基础信息 ----
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<string, string>
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<string, any>[]
generateDetail: (row: Record<string, any>) => Record<string, any> | null
}
toolbar?: {
left?: ToolbarButton[]
showRefresh?: boolean
showExport?: boolean
}
}
// ============================================================
// 五、TabPageConfig — 展开后的完整配置(给 index.vue 使用)
// ============================================================
export interface TabPageConfig {
name: string
label: string
scanBoxCacheKey: string
scanBoxFields: Record<string, any>[]
upperTable: {
title: string
enableColumnConfig: boolean
showIndex: boolean
showSelection: boolean
emptyText: string
columns: Record<string, any>[]
}
columnSlots: Record<string, ColumnSlotConfig>
detailComponent: Component
mock: {
generateList: (count: number) => Record<string, any>[]
generateDetail: (row: Record<string, any>) => Record<string, any> | null
}
toolbar?: {
left?: ToolbarButton[]
showRefresh?: boolean
showExport?: boolean
}
}
// ============================================================
// 六、resolveTabConfig — 加载时将 RawConfig 展开为完整配置
// ============================================================
export function resolveTabConfig(raw: TabPageRawConfig): TabPageConfig {
// 展开 ScanBox 字段
const scanBoxFields: Record<string, any>[] = []
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<string, any>[] = []
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<string, ColumnSlotConfig> = {}
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<string, any>) {
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

View File

@ -0,0 +1,491 @@
<template>
<div class="order-management-wrapper" :style="{ height: containerHeight }">
<!-- ===== 多标签模式:显示顶部多标签页 ===== -->
<template v-if="WAVEORDER2_PAGE_CONFIG.showTabArea && !WAVEORDER2_PAGE_CONFIG.singlePage">
<div class="tab-section">
<TabArea
:tabs="tabList"
:default-active="activeTabName"
@tab-change="handleTabChange"
/>
</div>
</template>
<!-- ===== 标签页隐藏时的提示条 ===== -->
<!-- <div
v-if="!WAVEORDER2_PAGE_CONFIG.showTabArea && !WAVEORDER2_PAGE_CONFIG.singlePage"
class="tab-hidden-bar"
>
<span class="tab-hidden-hint">多标签页区域已隐藏</span>
</div> -->
<!-- ===== 主内容区(结构与 waveOrder 子面板完全一致) ===== -->
<div class="tab-container main-container">
<div class="order-sub-container">
<scan-box
ref="scanBoxRef"
:cache-key="currentScanBoxCacheKey"
width="250px"
:tree-props="{ children: 'children', label: 'label' }"
:auto-submit="false"
:preset-tree="presetTree"
:available-fields="currentScanBoxFields"
@condition-change="handleConditionChange"
@reset="handleConditionReset"
@condition-clear="handleConditionClear"
/>
<div class="main-content">
<div class="toolbar">
<div class="toolbar-left">
<!-- 默认刷新按钮 -->
<el-button
v-if="currentTabConfig?.toolbar?.showRefresh !== false"
type="primary" size="small" @click="handleRefresh"
>
<el-icon><Refresh /></el-icon>
刷新
</el-button>
<!-- 自定义工具栏按钮 -->
<el-button
v-for="btn in currentToolbarButtons"
:key="btn.key"
:type="btn.type || ''"
size="small"
:disabled="btn.disabled"
@click="handleToolbarAction(btn.key)"
>
{{ btn.label }}
</el-button>
<!-- 默认导出按钮 -->
<el-button
v-if="currentTabConfig?.toolbar?.showExport !== false"
size="small" @click="handleExport"
>
导出
</el-button>
</div>
</div>
<div class="split-stack" ref="splitStackRef">
<div class="upper-wrapper" :style="detailVisible ? upperPaneStyle : upperPaneFullStyle">
<upper-table
ref="upperTableRef"
:title="currentTabConfig?.upperTable.title ?? '列表'"
default-align="center"
:enable-column-config="currentTabConfig?.upperTable.enableColumnConfig ?? true"
:column-config-schema-version="1"
:table-id="`wave-order2-table-${activeTabName}`"
:data="mockList"
:row-key="'id'"
:columns="currentColumns"
table-size="small"
:pagination="pagination"
:show-index="currentTabConfig?.upperTable.showIndex ?? true"
:show-selection="currentTabConfig?.upperTable.showSelection ?? true"
:loading="loading"
:query-time="queryTime"
@current-change="handleRowClick"
@row-click="handleRowClick"
@page-change="handlePageChange"
@page-size-change="handlePageSizeChange"
@refresh="loadMockData"
@selection-change="handleSelectionChange"
>
<!-- 动态列插槽:根据列配置的 columnSlots 自动渲染 -->
<template
v-for="(slotConfig, colProp) in currentColumnSlots"
:key="`${columnSlotsKey}-${colProp}`"
#[`column-${colProp}`]="{ row }"
>
<ColumnCellRenderer
:config="slotConfig"
:value="row[colProp]"
/>
</template>
<template #empty>
<div class="empty-tip">{{ currentTabConfig?.upperTable.emptyText ?? '暂无数据' }}</div>
</template>
</upper-table>
</div>
<template v-if="detailVisible">
<div
class="pane-resizer"
title="拖动调整列表与详情区域高度"
@mousedown="beginSplitDrag"
/>
<div v-if="selectedRow" class="lower-level" :style="lowerPaneStyle">
<div class="detail-header">
<el-tabs v-model="activeDetailTab" class="detail-tab">
<el-tab-pane label="波次明细" name="detail" />
</el-tabs>
</div>
<div class="detail-container">
<component :is="currentDetailComponent" :row="selectedDetail" />
</div>
</div>
<div v-else class="no-selection" :style="lowerPaneStyle">
<div class="empty-tip">
<p>请从上方列表中选择一项查看详情</p>
</div>
</div>
</template>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, computed, onMounted, reactive } from 'vue'
import { useSettingsStore } from '@/stores/modules/settings'
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
import ScanBox from '@/components/ScanBox/index.vue'
import UpperTable from '@/components/UpperTable/index.vue'
import TabArea from './components/TabArea.vue'
import ColumnCellRenderer from './components/ColumnCellRenderer.vue'
import {
WAVEORDER2_PAGE_CONFIG,
waveOrder2Tabs,
waveOrder2TabPages,
resolveTabConfig
} from './config/waveorder-config'
import type { TabPageConfig } from './config/waveorder-config'
defineOptions({ name: 'WaveOrder2' })
const settingsStore = useSettingsStore()
// ===== 容器高度(与 waveOrder 一致) =====
const shortcutExpanded = computed(() => settingsStore.shortcutExpanded)
const containerHeight = computed(() => {
return shortcutExpanded.value
? 'calc(100vh - 150px)'
: 'calc(100vh - 100px)'
})
// ===== 标签页 =====
const tabList = ref(waveOrder2Tabs.map((t) => ({ name: t.name, label: t.label })))
const activeTabName = ref(waveOrder2Tabs[0]?.name ?? 'tab1')
/** 当前激活标签页的完整配置(运行时由 resolveTabConfig 展开 key 引用) */
const currentTabConfig = computed<TabPageConfig | undefined>(() => {
const raw = waveOrder2TabPages.find((t) => t.name === activeTabName.value)
if (!raw) return undefined
return resolveTabConfig(raw)
})
/** 当前标签页的 ScanBox 缓存 key */
const currentScanBoxCacheKey = computed(() => {
return currentTabConfig.value?.scanBoxCacheKey ?? 'wave-order2-default'
})
/** 当前标签页的 ScanBox 筛选字段 */
const currentScanBoxFields = computed(() => {
return currentTabConfig.value?.scanBoxFields ?? []
})
/** 当前标签页的表格列 */
const currentColumns = computed(() => {
return currentTabConfig.value?.upperTable.columns ?? []
})
/** 当前标签页的列插槽配置 */
const currentColumnSlots = computed(() => {
return currentTabConfig.value?.columnSlots ?? {}
})
/** 当前标签页的明细组件 */
const currentDetailComponent = computed(() => {
return currentTabConfig.value?.detailComponent ?? null
})
/** 当前标签页的自定义工具栏按钮 */
const currentToolbarButtons = computed(() => {
return currentTabConfig.value?.toolbar?.left ?? []
})
/** 切换标签页时重置状态并加载新数据 */
const handleTabChange = (tabName: string) => {
if (activeTabName.value === tabName) return
activeTabName.value = tabName
// 重置分页和选中状态
pagination.currentPage = 1
selectedRow.value = null
selectedDetail.value = null
selectedRows.value = []
loadMockData()
}
// ===== ScanBox =====
const scanBoxRef = ref<any>(null)
const presetTree = ref<any[]>([])
const handleConditionChange = () => {
pagination.currentPage = 1
loadMockData()
}
const handleConditionReset = () => {
pagination.currentPage = 1
loadMockData()
}
const handleConditionClear = () => {
pagination.currentPage = 1
loadMockData()
}
// ===== 模拟数据 =====
const mockList = ref<Record<string, any>[]>([])
const loading = ref(false)
const queryTime = ref(0)
const pagination = reactive({
currentPage: 1,
pageSize: 20,
total: 0
})
const loadMockData = () => {
const cfg = currentTabConfig.value
if (!cfg) return
loading.value = true
const startTime = performance.now()
setTimeout(() => {
const full = cfg.mock.generateList(50)
const { currentPage, pageSize } = pagination
const start = (currentPage - 1) * pageSize
mockList.value = full.slice(start, start + pageSize)
pagination.total = full.length
loading.value = false
queryTime.value = Math.round(performance.now() - startTime)
}, 200)
}
const handlePageChange = (page: number) => {
pagination.currentPage = page
loadMockData()
}
const handlePageSizeChange = (size: number) => {
pagination.pageSize = size
pagination.currentPage = 1
loadMockData()
}
// ===== 工具栏 =====
const handleRefresh = () => {
pagination.currentPage = 1
loadMockData()
}
const handleExport = () => {
console.log('[WaveOrder2] 导出数据', activeTabName.value)
}
/** 自定义工具栏按钮点击 */
const handleToolbarAction = (key: string) => {
console.log('[WaveOrder2] 工具栏操作:', key, activeTabName.value)
// 各标签页可在此扩展处理逻辑
switch (key) {
case 'batchAssign': // 示例:批量分配
console.log('批量分配选中行:', selectedRows.value)
break
default:
break
}
}
// ===== UpperTable =====
const upperTableRef = ref<any>(null)
const selectedRows = ref<Record<string, any>[]>([])
const handleSelectionChange = (rows: Record<string, any>[]) => {
selectedRows.value = rows
}
// ===== 明细面板 =====
const detailVisible = ref(true)
const selectedRow = ref<Record<string, any> | null>(null)
const selectedDetail = ref<Record<string, any> | null>(null)
const activeDetailTab = ref('detail')
const handleRowClick = (row: Record<string, any>) => {
const cfg = currentTabConfig.value
if (!cfg) return
selectedRow.value = row
selectedDetail.value = cfg.mock.generateDetail(row)
}
// ===== 分栏拖拽(使用 useVerticalSplitPane,与 waveOrder 一致) =====
const { splitStackRef, beginSplitDrag, lowerPaneStyle, upperPaneStyle } = useVerticalSplitPane({
defaultLowerPercent: 38
})
const upperPaneFullStyle = computed(() => ({
flex: '1 1 auto',
minHeight: '0',
overflow: 'hidden' as const
}))
// ===== 初始化 & 标签页切换时重新加载 =====
onMounted(() => {
loadMockData()
})
// 当 currentTabConfig 变化(如列配置变更)时,列插槽的 key 也会变,触发重新渲染
const columnSlotsKey = computed(() => {
return `${activeTabName.value}-${Object.keys(currentColumnSlots.value).join(',')}`
})
</script>
<style lang="scss" scoped>
/* ===== 引入 waveOrder 共享样式(scan-box / toolbar / split-stack / pane-resizer / lower-level 等) ===== */
@use "../orderManagement/styles/order-sub.scss";
/* ================================================================
整体布局容器
================================================================ */
.order-management-wrapper {
position: relative;
width: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
}
/* ================================================================
1. 顶部多标签页区域(抽离组件)
================================================================ */
.tab-section {
flex-shrink: 0;
background: #fff;
border: 1px solid #e8eef7;
border-bottom: none;
border-radius: 6px 6px 0 0;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
overflow: hidden;
}
.tab-hidden-bar {
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
padding: 4px 16px;
background: #fff;
border: 1px dashed #dcdfe6;
border-bottom: none;
border-radius: 6px 6px 0 0;
.tab-hidden-hint {
font-size: 12px;
color: #909399;
}
}
/* ================================================================
2. 主内容区容器
================================================================ */
.main-container {
flex: 1;
display: flex;
flex-direction: column;
min-height: 0;
background: #fff;
border: 1px solid #e8eef7;
border-radius: 0 0 6px 6px;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
overflow: hidden;
}
/* ================================================================
3. ScanBox"筛选/过滤"标签样式(对齐页面顶部 TabArea 风格)
================================================================ */
.main-container {
:deep(.scan-box-container .scan-tabs) {
flex-shrink: 0;
border-bottom: 1px solid #e8eef7;
background: #f8fbff;
}
:deep(.scan-box-container .scan-tabs .el-tabs__header) {
margin: 0;
padding: 4px 8px 0;
}
:deep(.scan-box-container .scan-tabs .el-tabs__nav-wrap::after) {
display: none;
}
:deep(.scan-box-container .scan-tabs .el-tabs__active-bar) {
display: none;
}
:deep(.scan-box-container .scan-tabs .el-tabs__item) {
height: 38px;
line-height: 38px;
font-size: 14px;
font-weight: 500;
padding: 0 20px;
color: #606266;
border: 1px solid transparent;
border-bottom: none;
border-radius: 6px 6px 0 0;
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
margin-right: 4px;
}
:deep(.scan-box-container .scan-tabs .el-tabs__item:hover) {
color: #409eff;
background-color: rgba(64, 158, 255, 0.05);
}
:deep(.scan-box-container .scan-tabs .el-tabs__item.is-active) {
color: #409eff;
font-weight: 600;
background: #ffffff;
border-color: #e8eef7;
border-bottom-color: #fff;
}
}
/* ================================================================
补充:工具栏信息文字
================================================================ */
.toolbar-info {
font-size: 12px;
color: #909399;
white-space: nowrap;
}
/* ================================================================
补充:空提示样式
================================================================ */
.empty-tip {
text-align: center;
font-size: 13px;
color: #909399;
line-height: 1.5;
}
/* ================================================================
无选中行时的占位(与 waveOrder 保持一致)
================================================================ */
.no-selection {
flex: 0 0 38%;
height: 38%;
display: flex;
align-items: center;
justify-content: center;
border-top: 1px solid #ebeef5;
overflow: hidden;
background-color: #fff;
}
</style>