1
This commit is contained in:
parent
1d7964770e
commit
8981807258
@ -39,7 +39,7 @@ export const componentMap: Record<string, any> = {
|
|||||||
'store/productflow': () => import('@/views/storage/productflow/index.vue'),
|
'store/productflow': () => import('@/views/storage/productflow/index.vue'),
|
||||||
'store/index': () => import('@/views/store/stores/index.vue'),
|
'store/index': () => import('@/views/store/stores/index.vue'),
|
||||||
'Externalwarehouse/shipperSigning/index': () => import('@/views/Externalwarehouse/shipperSigning/index.vue'),
|
'Externalwarehouse/shipperSigning/index': () => import('@/views/Externalwarehouse/shipperSigning/index.vue'),
|
||||||
'wave/index': () => import('@/views/order/waveOrder/index.vue'),
|
'wave/index': () => import('@/views/order/waveOrder2/index.vue'),
|
||||||
/** 与后端菜单 component 字段兼容 */
|
/** 与后端菜单 component 字段兼容 */
|
||||||
'order/waveOrder': () => import('@/views/order/waveOrder/index.vue'),
|
'order/waveOrder': () => import('@/views/order/waveOrder/index.vue'),
|
||||||
'orderreview/index': () => import('@/views/order/orderreview/index.vue'),
|
'orderreview/index': () => import('@/views/order/orderreview/index.vue'),
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import type { ColumnSlotConfig } from '../config/waveorder-config'
|
import type { ColumnSlotConfig } from '../config/waveorder-config'
|
||||||
import { TAG_RESOLVERS, translate } from '../config/waveorder-config'
|
import { TAG_RESOLVERS, translate, formatTime } from '../config/waveorder-config'
|
||||||
|
|
||||||
defineOptions({ name: 'ColumnCellRenderer' })
|
defineOptions({ name: 'ColumnCellRenderer' })
|
||||||
|
|
||||||
@ -26,12 +26,16 @@ const props = defineProps<{
|
|||||||
value: any
|
value: any
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
/** 显示文本:如果配置了 translateField,则使用 VALUE_MAPS 翻译 */
|
/** 显示文本:translateField 翻译 > format 格式化 > 原始值 */
|
||||||
const displayValue = computed(() => {
|
const displayValue = computed(() => {
|
||||||
|
const v = props.value
|
||||||
if (props.config?.translateField) {
|
if (props.config?.translateField) {
|
||||||
return translate(props.config.translateField, props.value)
|
return translate(props.config.translateField, v)
|
||||||
}
|
}
|
||||||
return props.value
|
if (props.config?.format === 'datetime') {
|
||||||
|
return formatTime(v)
|
||||||
|
}
|
||||||
|
return v
|
||||||
})
|
})
|
||||||
|
|
||||||
const resolvedTagType = computed(() => {
|
const resolvedTagType = computed(() => {
|
||||||
|
|||||||
@ -1,165 +0,0 @@
|
|||||||
<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>
|
|
||||||
165
src/views/order/waveOrder2/components/public/DetailPanel.vue
Normal file
165
src/views/order/waveOrder2/components/public/DetailPanel.vue
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
<template>
|
||||||
|
<div class="wave-order2-detail">
|
||||||
|
<div v-if="!row" class="empty-tip">请从上方列表中选择一项查看明细</div>
|
||||||
|
<template v-else>
|
||||||
|
<div
|
||||||
|
v-for="(section, si) in detailConfig"
|
||||||
|
:key="si"
|
||||||
|
class="section"
|
||||||
|
>
|
||||||
|
<div class="section-title">{{ section.title }}</div>
|
||||||
|
<el-descriptions
|
||||||
|
:column="section.columnCount"
|
||||||
|
border
|
||||||
|
size="small"
|
||||||
|
class="detail-descriptions"
|
||||||
|
>
|
||||||
|
<el-descriptions-item
|
||||||
|
v-for="(field, fi) in section.fields"
|
||||||
|
:key="fi"
|
||||||
|
:label="field.label"
|
||||||
|
:span="field.span ?? 1"
|
||||||
|
>
|
||||||
|
<!-- tag 渲染 -->
|
||||||
|
<template v-if="field.renderType === 'tag'">
|
||||||
|
<el-tag size="small" :type="resolveTagType(field, getRowData()?.[field.key])">
|
||||||
|
{{ resolveDisplayValue(field, getRowData()?.[field.key]) }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
<!-- pre 渲染 -->
|
||||||
|
<template v-else-if="field.renderType === 'pre'">
|
||||||
|
<pre class="order-list-pre">{{ getRowData()?.[field.key] ?? '—' }}</pre>
|
||||||
|
</template>
|
||||||
|
<!-- 默认文本渲染 -->
|
||||||
|
<template v-else>
|
||||||
|
{{ resolveDisplayValue(field, getRowData()?.[field.key]) }}
|
||||||
|
</template>
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, watch } from 'vue'
|
||||||
|
import { TAG_RESOLVERS, translate } from '../../config/waveorder-config'
|
||||||
|
import type { DetailSectionConfig, DetailFieldConfig } from '../../config/waveorder-config'
|
||||||
|
|
||||||
|
defineOptions({ name: 'WaveOrder2DetailPanel' })
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
row: Record<string, any> | null
|
||||||
|
/** 明细区域配置(由各页面在 waveorder-config.ts 中配置) */
|
||||||
|
detailConfig: DetailSectionConfig[]
|
||||||
|
/** 可选的 detail API 方法,传入后自动调用获取完整明细数据 */
|
||||||
|
apiMethod?: (...args: any[]) => Promise<any>
|
||||||
|
}>()
|
||||||
|
|
||||||
|
/** 通过 API 获取的增强数据(与 row 合并) */
|
||||||
|
const enrichedData = ref<Record<string, any> | null>(null)
|
||||||
|
|
||||||
|
watch(() => props.row, async (newRow) => {
|
||||||
|
if (newRow && props.apiMethod) {
|
||||||
|
try {
|
||||||
|
const res = await props.apiMethod({
|
||||||
|
wave_id: newRow.wave_id ?? newRow.id,
|
||||||
|
wave_no: newRow.wave_no
|
||||||
|
})
|
||||||
|
if (res && (res.code === 1 || res.code === 200)) {
|
||||||
|
enrichedData.value = res.data ?? res
|
||||||
|
} else {
|
||||||
|
enrichedData.value = null
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
enrichedData.value = null
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
enrichedData.value = null
|
||||||
|
}
|
||||||
|
}, { immediate: true })
|
||||||
|
|
||||||
|
/** 合并 row + API 增强数据 */
|
||||||
|
function getRowData(): Record<string, any> | null {
|
||||||
|
if (!props.row) return null
|
||||||
|
if (enrichedData.value) {
|
||||||
|
return { ...props.row, ...enrichedData.value }
|
||||||
|
}
|
||||||
|
return props.row
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 解析显示值:优先使用 translateField 翻译,否则显示原始值 */
|
||||||
|
function resolveDisplayValue(field: DetailFieldConfig, value: any): string {
|
||||||
|
if (field.translateField) {
|
||||||
|
return translate(field.translateField, value)
|
||||||
|
}
|
||||||
|
return value ?? '—'
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 解析 tag 颜色 */
|
||||||
|
function resolveTagType(field: DetailFieldConfig, value: any): string {
|
||||||
|
if (field.tagResolver) {
|
||||||
|
const resolver = TAG_RESOLVERS[field.tagResolver]
|
||||||
|
if (resolver) return resolver(value)
|
||||||
|
}
|
||||||
|
if (field.tagType) {
|
||||||
|
if (typeof field.tagType === 'object') {
|
||||||
|
return field.tagType[String(value)] ?? 'info'
|
||||||
|
}
|
||||||
|
return field.tagType
|
||||||
|
}
|
||||||
|
return 'info'
|
||||||
|
}
|
||||||
|
</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>
|
||||||
204
src/views/order/waveOrder2/components/public/LogPanel.vue
Normal file
204
src/views/order/waveOrder2/components/public/LogPanel.vue
Normal file
@ -0,0 +1,204 @@
|
|||||||
|
<template>
|
||||||
|
<div class="log-panel">
|
||||||
|
<div class="section-title">操作日志</div>
|
||||||
|
<div class="log-timeline">
|
||||||
|
<div
|
||||||
|
v-for="(log, i) in logs"
|
||||||
|
:key="i"
|
||||||
|
class="log-item"
|
||||||
|
>
|
||||||
|
<div class="log-dot" :class="log.level" />
|
||||||
|
<div class="log-content">
|
||||||
|
<div class="log-header">
|
||||||
|
<span class="log-operator">{{ log.operator }}</span>
|
||||||
|
<span class="log-action">{{ log.action }}</span>
|
||||||
|
<el-tag v-if="log.result === '成功'" size="small" type="success">成功</el-tag>
|
||||||
|
<el-tag v-else-if="log.result === '失败'" size="small" type="danger">失败</el-tag>
|
||||||
|
<el-tag v-else size="small" type="info">{{ log.result }}</el-tag>
|
||||||
|
</div>
|
||||||
|
<div v-if="log.detail" class="log-detail">{{ log.detail }}</div>
|
||||||
|
<div class="log-time">{{ log.time }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, ref, watch } from 'vue'
|
||||||
|
|
||||||
|
defineOptions({ name: 'LogPanel' })
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
/** 当前选中行数据(用于生成关联日志) */
|
||||||
|
row: Record<string, any> | null
|
||||||
|
/** 可选的日志 API 方法,传入后自动调用获取真实日志 */
|
||||||
|
apiMethod?: (...args: any[]) => Promise<any>
|
||||||
|
}>()
|
||||||
|
|
||||||
|
/** 通过 API 获取的真实日志列表 */
|
||||||
|
const apiLogs = ref<any[] | null>(null)
|
||||||
|
const apiLoading = ref(false)
|
||||||
|
|
||||||
|
watch(() => props.row, async (newRow) => {
|
||||||
|
if (newRow && props.apiMethod) {
|
||||||
|
apiLoading.value = true
|
||||||
|
try {
|
||||||
|
const res = await props.apiMethod({
|
||||||
|
wave_id: newRow.wave_id ?? newRow.id,
|
||||||
|
wave_no: newRow.wave_no,
|
||||||
|
page: 1,
|
||||||
|
pageSize: 100
|
||||||
|
})
|
||||||
|
if (res && (res.code === 1 || res.code === 200)) {
|
||||||
|
const list = res.data?.list ?? res.data?.logs ?? res.list ?? res.logs ?? []
|
||||||
|
apiLogs.value = Array.isArray(list) ? list : []
|
||||||
|
} else {
|
||||||
|
apiLogs.value = []
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
apiLogs.value = []
|
||||||
|
} finally {
|
||||||
|
apiLoading.value = false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
apiLogs.value = null
|
||||||
|
}
|
||||||
|
}, { immediate: true })
|
||||||
|
|
||||||
|
/** 基于 row 生成模拟日志(无 apiMethod 时使用) */
|
||||||
|
const mockLogs = computed(() => {
|
||||||
|
if (!props.row) return []
|
||||||
|
const id = props.row.id ?? 0
|
||||||
|
const waveNo = props.row.wave_no ?? props.row.order_no ?? `#${id}`
|
||||||
|
const operators = ['张三', '李四', '系统']
|
||||||
|
const logTemplates = [
|
||||||
|
{ action: '创建波次', result: '成功', detail: `波次 ${waveNo} 创建成功,包含 ${props.row.total_orders ?? props.row.sku_count ?? 0} 个订单` },
|
||||||
|
{ action: '分配库位', result: id % 3 === 0 ? '成功' : '部分成功', detail: id % 3 === 0 ? '所有订单库位分配完成' : '部分订单库位不足,等待人工处理' },
|
||||||
|
{ action: '分配快递', result: '成功', detail: `已为波次分配快递资源` },
|
||||||
|
{ action: '打印面单', result: id % 2 === 0 ? '成功' : '进行中', detail: id % 2 === 0 ? '面单打印完成' : '面单打印中,已完成 60%' },
|
||||||
|
{ action: '开始拣货', result: '成功', detail: `拣货任务已下发` },
|
||||||
|
{ action: '完成拣货', result: id % 4 === 0 ? '成功' : '等待中', detail: id % 4 === 0 ? '拣货完成,等待复核' : '' },
|
||||||
|
{ action: '复核通过', result: id % 5 === 0 ? '成功' : '等待中', detail: id % 5 === 0 ? '复核已通过' : '' },
|
||||||
|
{ action: '发货出库', result: id % 7 === 0 ? '成功' : '等待中', detail: id % 7 === 0 ? '已出库' : '' }
|
||||||
|
]
|
||||||
|
|
||||||
|
const startTime = new Date(props.row.create_time ?? Date.now())
|
||||||
|
return logTemplates.map((tpl, i) => {
|
||||||
|
const logTime = new Date(startTime.getTime() + i * 1800000 + (id % 60) * 60000)
|
||||||
|
return {
|
||||||
|
...tpl,
|
||||||
|
operator: operators[i % operators.length],
|
||||||
|
time: logTime.toISOString().replace('T', ' ').slice(0, 19),
|
||||||
|
level: tpl.result === '成功' ? 'success' : tpl.result === '失败' ? 'error' : 'warning'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 最终展示的日志:优先使用 API 日志,否则使用 mock 日志 */
|
||||||
|
const logs = computed(() => {
|
||||||
|
if (apiLogs.value !== null) {
|
||||||
|
return apiLogs.value.map((log: any) => ({
|
||||||
|
operator: log.operator_name ?? log.operator ?? log.creator_name ?? '—',
|
||||||
|
action: log.operation_name ?? log.action ?? log.operation ?? '—',
|
||||||
|
result: log.status === 'success' || log.result === '成功' ? '成功' : log.result ?? '—',
|
||||||
|
detail: log.message ?? log.detail ?? '',
|
||||||
|
time: log.created_at ?? log.create_time ?? log.time ?? '—',
|
||||||
|
level: log.level ?? 'info'
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
return mockLogs.value
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.log-panel {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #303133;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
padding-left: 8px;
|
||||||
|
border-left: 3px solid #409eff;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-timeline {
|
||||||
|
position: relative;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-item {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 8px 0;
|
||||||
|
border-bottom: 1px dashed #ebeef5;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-dot {
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 8px;
|
||||||
|
height: 8px;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-top: 6px;
|
||||||
|
|
||||||
|
&.success {
|
||||||
|
background: #67c23a;
|
||||||
|
box-shadow: 0 0 4px rgba(103, 194, 58, 0.4);
|
||||||
|
}
|
||||||
|
&.warning {
|
||||||
|
background: #e6a23c;
|
||||||
|
box-shadow: 0 0 4px rgba(230, 162, 60, 0.4);
|
||||||
|
}
|
||||||
|
&.error {
|
||||||
|
background: #f56c6c;
|
||||||
|
box-shadow: 0 0 4px rgba(245, 108, 108, 0.4);
|
||||||
|
}
|
||||||
|
&.info {
|
||||||
|
background: #909399;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-content {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-operator {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #303133;
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-action {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #606266;
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-detail {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #909399;
|
||||||
|
margin-top: 4px;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-time {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #c0c4cc;
|
||||||
|
margin-top: 2px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -14,11 +14,20 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import type { Component } from 'vue'
|
import type { Component } from 'vue'
|
||||||
import DetailPanel from '../components/DetailPanel.vue'
|
import DetailPanel from '../components/public/DetailPanel.vue'
|
||||||
|
import LogPanel from '../components/public/LogPanel.vue'
|
||||||
|
import { orderWaveBatchList, unwrapWaveBatchListResponse } from '@/api/order/order'
|
||||||
|
import type { WaveBatchListParams, WaveBatchListResponse } from '@/api/order/order'
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// 一、全局字段预设表 FIELD_DICT
|
// 〇、组件注册表 — 所有可用组件在此注册,页面按 key 引用
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
// 新增组件步骤:1. import 组件 2. 在 COMPONENT_REGISTRY 添加一条 3. 页面通过 key 引用
|
||||||
|
|
||||||
|
export const COMPONENT_REGISTRY: Record<string, Component> = {
|
||||||
|
DetailPanel,
|
||||||
|
LogPanel
|
||||||
|
}
|
||||||
// 每个字段拥有:
|
// 每个字段拥有:
|
||||||
// label — 唯一翻译文本
|
// label — 唯一翻译文本
|
||||||
// scanBox — ScanBox 渲染配置(type/options/group/required)
|
// scanBox — ScanBox 渲染配置(type/options/group/required)
|
||||||
@ -47,6 +56,10 @@ export interface FieldDefinition {
|
|||||||
align?: 'left' | 'center' | 'right'
|
align?: 'left' | 'center' | 'right'
|
||||||
sortable?: boolean
|
sortable?: boolean
|
||||||
showOverflowTooltip?: boolean
|
showOverflowTooltip?: boolean
|
||||||
|
/** UpperTable 点击复制:'copy' 仅复制;'copyQr' 复制并弹出二维码 */
|
||||||
|
copyAction?: 'copy' | 'copyQr'
|
||||||
|
/** 自定义复制内容函数(row → 复制文本) */
|
||||||
|
copyValue?: (row: any) => any
|
||||||
} | null
|
} | null
|
||||||
/** 单元格渲染配置(null 表示默认文本渲染) */
|
/** 单元格渲染配置(null 表示默认文本渲染) */
|
||||||
slot: {
|
slot: {
|
||||||
@ -57,6 +70,8 @@ export interface FieldDefinition {
|
|||||||
tagResolver?: string
|
tagResolver?: string
|
||||||
/** 从 VALUE_MAPS 翻译显示文本 */
|
/** 从 VALUE_MAPS 翻译显示文本 */
|
||||||
translateField?: string
|
translateField?: string
|
||||||
|
/** 格式化类型:'datetime' 将时间戳转为 YYYY-MM-DD HH:mm:ss */
|
||||||
|
format?: 'datetime'
|
||||||
} | null
|
} | null
|
||||||
/** 明细面板标签文本(不设则用 label) */
|
/** 明细面板标签文本(不设则用 label) */
|
||||||
detailLabel?: string
|
detailLabel?: string
|
||||||
@ -77,10 +92,10 @@ export const SCANBOX_GROUPS = {
|
|||||||
// VALUE_MAPS — 值翻译映射(select options 和 tag 翻译共用)
|
// VALUE_MAPS — 值翻译映射(select options 和 tag 翻译共用)
|
||||||
// ============================================================
|
// ============================================================
|
||||||
export const VALUE_MAPS: Record<string, Record<string, string>> = {
|
export const VALUE_MAPS: Record<string, Record<string, string>> = {
|
||||||
wave_type: { '1': '团购', '2': '散单' },
|
wave_type: { '1': '团购', '2': '散单', '团购': '团购', '散单': '散单' },
|
||||||
wave_status: { '0': '自动加团中', '1': '已就绪' },
|
wave_status: { '0': '自动加团中', '1': '已就绪', '自动加团中': '自动加团中', '已就绪': '已就绪' },
|
||||||
distinguish_express: { '1': '是', '0': '否' },
|
distinguish_express: { '1': '是', '0': '否', '是': '是', '否': '否' },
|
||||||
storage_assignment_status: { '未分配': '未分配', '已分配': '已分配', 'partial': '部分分配' },
|
storage_assignment_status: { '未分配': '未分配', '已分配': '已分配', '部分分配': '部分分配' },
|
||||||
express_assignment_status: { 'assigned': '已分配', 'unassigned': '未分配', '已分配': '已分配', '未分配': '未分配' },
|
express_assignment_status: { 'assigned': '已分配', 'unassigned': '未分配', '已分配': '已分配', '未分配': '未分配' },
|
||||||
print_assignment_status: { 'printed': '已打印', 'unprinted': '未打印', '已打印': '已打印', '未打印': '未打印' },
|
print_assignment_status: { 'printed': '已打印', 'unprinted': '未打印', '已打印': '已打印', '未打印': '未打印' },
|
||||||
pick_assignment_status: { '未拣货': '未拣货', '部分拣货': '部分拣货', '已拣货': '已拣货' },
|
pick_assignment_status: { '未拣货': '未拣货', '部分拣货': '部分拣货', '已拣货': '已拣货' },
|
||||||
@ -88,13 +103,23 @@ export const VALUE_MAPS: Record<string, Record<string, string>> = {
|
|||||||
order_status: { 'pending': '待处理', 'processing': '处理中', 'done': '已完成' }
|
order_status: { 'pending': '待处理', 'processing': '处理中', 'done': '已完成' }
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 从 VALUE_MAPS 衍生 options */
|
/** 从 VALUE_MAPS 衍生 options(优先取中文值作为 option value) */
|
||||||
export function getOptions(field: string): { label: string; value: string }[] {
|
export function getOptions(field: string): { label: string; value: string }[] {
|
||||||
const map = VALUE_MAPS[field]
|
const map = VALUE_MAPS[field]
|
||||||
if (!map) return []
|
if (!map) return []
|
||||||
const seen = new Set<string>()
|
const seen = new Set<string>()
|
||||||
const opts: { label: string; value: string }[] = []
|
const opts: { label: string; value: string }[] = []
|
||||||
|
// 先收集中文 key(如 '团购'→'团购'),后收集数字 key(如 '1'→'团购')
|
||||||
|
const chineseKeys: [string, string][] = []
|
||||||
|
const otherKeys: [string, string][] = []
|
||||||
for (const [v, l] of Object.entries(map)) {
|
for (const [v, l] of Object.entries(map)) {
|
||||||
|
if (/^[\u4e00-\u9fa5]/.test(v)) {
|
||||||
|
chineseKeys.push([v, l])
|
||||||
|
} else {
|
||||||
|
otherKeys.push([v, l])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const [v, l] of [...chineseKeys, ...otherKeys]) {
|
||||||
if (!seen.has(l)) {
|
if (!seen.has(l)) {
|
||||||
seen.add(l)
|
seen.add(l)
|
||||||
opts.push({ label: l, value: v })
|
opts.push({ label: l, value: v })
|
||||||
@ -110,37 +135,56 @@ export function translate(field: string, value: any): string {
|
|||||||
return map[String(value)] ?? String(value ?? '—')
|
return map[String(value)] ?? String(value ?? '—')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 格式化时间戳为 YYYY-MM-DD HH:mm:ss */
|
||||||
|
export function formatTime(value: any): string {
|
||||||
|
if (!value) return '—'
|
||||||
|
try {
|
||||||
|
const d = new Date(value)
|
||||||
|
if (isNaN(d.getTime())) return String(value)
|
||||||
|
const pad = (n: number) => String(n).padStart(2, '0')
|
||||||
|
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`
|
||||||
|
} catch {
|
||||||
|
return String(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// TAG_RESOLVERS — 标签颜色解析器
|
// TAG_RESOLVERS — 标签颜色解析器
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
// 颜色规则:未xx=info(灰) 已xx=success(绿) xx中/部分xx=warning(黄) 错误=danger(红)
|
||||||
|
// ============================================================
|
||||||
export const TAG_RESOLVERS: Record<string, (val: any) => string> = {
|
export const TAG_RESOLVERS: Record<string, (val: any) => string> = {
|
||||||
resolveAssignTag(v) {
|
resolveAssignTag(v) {
|
||||||
if (!v) return 'info'
|
if (!v) return 'info'
|
||||||
if (v === '已分配' || v === 'assigned') return 'success'
|
if (v === '已分配' || v === 'assigned') return 'success'
|
||||||
if (v === '部分分配' || v === 'partial') return 'warning'
|
if (v === '部分分配' || v === 'partial') return 'warning'
|
||||||
return 'danger'
|
return 'info' // 未分配 → 灰
|
||||||
},
|
},
|
||||||
resolvePrintTag(v) {
|
resolvePrintTag(v) {
|
||||||
if (!v) return 'info'
|
if (!v) return 'info'
|
||||||
return v === '已打印' || v === 'printed' ? 'success' : 'warning'
|
return v === '已打印' || v === 'printed' ? 'success' : 'info' // 未打印 → 灰
|
||||||
},
|
},
|
||||||
resolvePickTag(v) {
|
resolvePickTag(v) {
|
||||||
if (!v) return 'info'
|
if (!v) return 'info'
|
||||||
if (v === '已拣货') return 'success'
|
if (v === '已拣货') return 'success'
|
||||||
if (v === '部分拣货') return 'warning'
|
if (v === '部分拣货') return 'warning'
|
||||||
return 'danger'
|
return 'info' // 未拣货 → 灰
|
||||||
},
|
},
|
||||||
resolveReviewTag(v) {
|
resolveReviewTag(v) {
|
||||||
if (!v) return 'info'
|
if (!v) return 'info'
|
||||||
return v === '已复核' || v === 'reviewed' ? 'success' : 'warning'
|
return v === '已复核' || v === 'reviewed' ? 'success' : 'info' // 未复核 → 灰
|
||||||
},
|
},
|
||||||
resolveWaveStatusTag(v) {
|
resolveWaveStatusTag(v) {
|
||||||
if (!v) return 'info'
|
if (!v) return 'info'
|
||||||
return v === '已就绪' ? 'success' : 'warning'
|
if (v === '已就绪' || v === '1') return 'success'
|
||||||
|
if (v === '自动加团中' || v === '0') return 'warning' // 进行中 → 黄
|
||||||
|
return 'info'
|
||||||
},
|
},
|
||||||
resolveBoolTag(v) {
|
resolveBoolTag(v) {
|
||||||
if (v === undefined || v === null) return 'info'
|
if (v === undefined || v === null) return 'info'
|
||||||
return v === '是' || v === true || v === 1 ? 'warning' : 'info'
|
if (v === '是' || v === true || v === 1 || v === '1') return 'warning'
|
||||||
|
return 'info'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +197,7 @@ export const FIELD_DICT: Record<string, FieldDefinition> = {
|
|||||||
key: 'wave_no',
|
key: 'wave_no',
|
||||||
label: '波次编号',
|
label: '波次编号',
|
||||||
scanBox: { type: 'text', group: SCANBOX_GROUPS.basic },
|
scanBox: { type: 'text', group: SCANBOX_GROUPS.basic },
|
||||||
table: { minWidth: 180, fixed: 'left' },
|
table: { minWidth: 180, fixed: 'left', copyAction: 'copy', showOverflowTooltip: true },
|
||||||
slot: null,
|
slot: null,
|
||||||
detailLabel: '波次编号'
|
detailLabel: '波次编号'
|
||||||
},
|
},
|
||||||
@ -162,7 +206,7 @@ export const FIELD_DICT: Record<string, FieldDefinition> = {
|
|||||||
label: '波次类型',
|
label: '波次类型',
|
||||||
scanBox: { type: 'select', group: SCANBOX_GROUPS.basic, options: getOptions('wave_type') },
|
scanBox: { type: 'select', group: SCANBOX_GROUPS.basic, options: getOptions('wave_type') },
|
||||||
table: { minWidth: 96, align: 'center' },
|
table: { minWidth: 96, align: 'center' },
|
||||||
slot: { type: 'tag', tagType: 'info' },
|
slot: { type: 'tag', tagType: 'info', translateField: 'wave_type' },
|
||||||
detailLabel: '波次类型'
|
detailLabel: '波次类型'
|
||||||
},
|
},
|
||||||
wave_status: {
|
wave_status: {
|
||||||
@ -170,28 +214,28 @@ export const FIELD_DICT: Record<string, FieldDefinition> = {
|
|||||||
label: '波次状态',
|
label: '波次状态',
|
||||||
scanBox: { type: 'select', group: SCANBOX_GROUPS.basic, options: getOptions('wave_status') },
|
scanBox: { type: 'select', group: SCANBOX_GROUPS.basic, options: getOptions('wave_status') },
|
||||||
table: { minWidth: 110, align: 'center' },
|
table: { minWidth: 110, align: 'center' },
|
||||||
slot: { type: 'tag', tagResolver: 'resolveWaveStatusTag' },
|
slot: { type: 'tag', tagResolver: 'resolveWaveStatusTag', translateField: 'wave_status' },
|
||||||
detailLabel: '波次状态'
|
detailLabel: '波次状态'
|
||||||
},
|
},
|
||||||
total_orders: {
|
total_orders: {
|
||||||
key: 'total_orders',
|
key: 'total_orders',
|
||||||
label: '总订单数',
|
label: '总订单数',
|
||||||
scanBox: null,
|
scanBox: null,
|
||||||
table: { minWidth: 110, align: 'center' },
|
table: { minWidth: 110, align: 'center', sortable: true },
|
||||||
slot: null
|
slot: null
|
||||||
},
|
},
|
||||||
order_count: {
|
order_count: {
|
||||||
key: 'order_count',
|
key: 'order_count',
|
||||||
label: '订单数量',
|
label: '订单数量',
|
||||||
scanBox: null,
|
scanBox: null,
|
||||||
table: { minWidth: 100, align: 'center' },
|
table: { minWidth: 100, align: 'center', sortable: true },
|
||||||
slot: null
|
slot: null
|
||||||
},
|
},
|
||||||
processed_orders: {
|
processed_orders: {
|
||||||
key: 'processed_orders',
|
key: 'processed_orders',
|
||||||
label: '已处理订单',
|
label: '已处理订单',
|
||||||
scanBox: null,
|
scanBox: null,
|
||||||
table: { minWidth: 108, align: 'center' },
|
table: { minWidth: 108, align: 'center', sortable: true },
|
||||||
slot: null
|
slot: null
|
||||||
},
|
},
|
||||||
distinguish_express: {
|
distinguish_express: {
|
||||||
@ -199,14 +243,14 @@ export const FIELD_DICT: Record<string, FieldDefinition> = {
|
|||||||
label: '区分快递',
|
label: '区分快递',
|
||||||
scanBox: { type: 'select', group: SCANBOX_GROUPS.basic, options: getOptions('distinguish_express') },
|
scanBox: { type: 'select', group: SCANBOX_GROUPS.basic, options: getOptions('distinguish_express') },
|
||||||
table: { minWidth: 100, align: 'center' },
|
table: { minWidth: 100, align: 'center' },
|
||||||
slot: { type: 'tag', tagResolver: 'resolveBoolTag' },
|
slot: { type: 'tag', tagResolver: 'resolveBoolTag', translateField: 'distinguish_express' },
|
||||||
detailLabel: '区分快递'
|
detailLabel: '区分快递'
|
||||||
},
|
},
|
||||||
logistics_name: {
|
logistics_name: {
|
||||||
key: 'logistics_name',
|
key: 'logistics_name',
|
||||||
label: '快递',
|
label: '快递',
|
||||||
scanBox: { type: 'text', group: SCANBOX_GROUPS.basic },
|
scanBox: { type: 'text', group: SCANBOX_GROUPS.basic },
|
||||||
table: { minWidth: 120 },
|
table: { minWidth: 120, showOverflowTooltip: true },
|
||||||
slot: null,
|
slot: null,
|
||||||
detailLabel: '快递'
|
detailLabel: '快递'
|
||||||
},
|
},
|
||||||
@ -230,16 +274,16 @@ export const FIELD_DICT: Record<string, FieldDefinition> = {
|
|||||||
key: 'create_time',
|
key: 'create_time',
|
||||||
label: '创建时间',
|
label: '创建时间',
|
||||||
scanBox: { type: 'daterange', group: SCANBOX_GROUPS.time },
|
scanBox: { type: 'daterange', group: SCANBOX_GROUPS.time },
|
||||||
table: { minWidth: 168 },
|
table: { minWidth: 168, sortable: true },
|
||||||
slot: null,
|
slot: { type: 'text', format: 'datetime' },
|
||||||
detailLabel: '创建时间'
|
detailLabel: '创建时间'
|
||||||
},
|
},
|
||||||
update_time: {
|
update_time: {
|
||||||
key: 'update_time',
|
key: 'update_time',
|
||||||
label: '更新时间',
|
label: '更新时间',
|
||||||
scanBox: { type: 'daterange', group: SCANBOX_GROUPS.time },
|
scanBox: { type: 'daterange', group: SCANBOX_GROUPS.time },
|
||||||
table: { minWidth: 168 },
|
table: { minWidth: 168, sortable: true },
|
||||||
slot: null,
|
slot: { type: 'text', format: 'datetime' },
|
||||||
detailLabel: '更新时间'
|
detailLabel: '更新时间'
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -249,7 +293,7 @@ export const FIELD_DICT: Record<string, FieldDefinition> = {
|
|||||||
label: '库位分配',
|
label: '库位分配',
|
||||||
scanBox: { type: 'select', group: SCANBOX_GROUPS.process, options: getOptions('storage_assignment_status') },
|
scanBox: { type: 'select', group: SCANBOX_GROUPS.process, options: getOptions('storage_assignment_status') },
|
||||||
table: { minWidth: 120, align: 'center' },
|
table: { minWidth: 120, align: 'center' },
|
||||||
slot: { type: 'tag', tagResolver: 'resolveAssignTag' },
|
slot: { type: 'tag', tagResolver: 'resolveAssignTag', translateField: 'storage_assignment_status' },
|
||||||
detailLabel: '库位分配状态'
|
detailLabel: '库位分配状态'
|
||||||
},
|
},
|
||||||
express_assignment_status: {
|
express_assignment_status: {
|
||||||
@ -257,7 +301,7 @@ export const FIELD_DICT: Record<string, FieldDefinition> = {
|
|||||||
label: '快递分配',
|
label: '快递分配',
|
||||||
scanBox: { type: 'select', group: SCANBOX_GROUPS.process, options: getOptions('express_assignment_status') },
|
scanBox: { type: 'select', group: SCANBOX_GROUPS.process, options: getOptions('express_assignment_status') },
|
||||||
table: { minWidth: 120, align: 'center' },
|
table: { minWidth: 120, align: 'center' },
|
||||||
slot: { type: 'tag', tagResolver: 'resolveAssignTag' },
|
slot: { type: 'tag', tagResolver: 'resolveAssignTag', translateField: 'express_assignment_status' },
|
||||||
detailLabel: '快递分配状态'
|
detailLabel: '快递分配状态'
|
||||||
},
|
},
|
||||||
print_assignment_status: {
|
print_assignment_status: {
|
||||||
@ -265,7 +309,7 @@ export const FIELD_DICT: Record<string, FieldDefinition> = {
|
|||||||
label: '打印状态',
|
label: '打印状态',
|
||||||
scanBox: { type: 'select', group: SCANBOX_GROUPS.process, options: getOptions('print_assignment_status') },
|
scanBox: { type: 'select', group: SCANBOX_GROUPS.process, options: getOptions('print_assignment_status') },
|
||||||
table: { minWidth: 110, align: 'center' },
|
table: { minWidth: 110, align: 'center' },
|
||||||
slot: { type: 'tag', tagResolver: 'resolvePrintTag' },
|
slot: { type: 'tag', tagResolver: 'resolvePrintTag', translateField: 'print_assignment_status' },
|
||||||
detailLabel: '打印分配状态'
|
detailLabel: '打印分配状态'
|
||||||
},
|
},
|
||||||
pick_assignment_status: {
|
pick_assignment_status: {
|
||||||
@ -273,7 +317,7 @@ export const FIELD_DICT: Record<string, FieldDefinition> = {
|
|||||||
label: '拣货状态',
|
label: '拣货状态',
|
||||||
scanBox: { type: 'select', group: SCANBOX_GROUPS.process, options: getOptions('pick_assignment_status') },
|
scanBox: { type: 'select', group: SCANBOX_GROUPS.process, options: getOptions('pick_assignment_status') },
|
||||||
table: { minWidth: 110, align: 'center' },
|
table: { minWidth: 110, align: 'center' },
|
||||||
slot: { type: 'tag', tagResolver: 'resolvePickTag' },
|
slot: { type: 'tag', tagResolver: 'resolvePickTag', translateField: 'pick_assignment_status' },
|
||||||
detailLabel: '拣货状态'
|
detailLabel: '拣货状态'
|
||||||
},
|
},
|
||||||
review_assignment_status: {
|
review_assignment_status: {
|
||||||
@ -281,14 +325,14 @@ export const FIELD_DICT: Record<string, FieldDefinition> = {
|
|||||||
label: '复核状态',
|
label: '复核状态',
|
||||||
scanBox: { type: 'select', group: SCANBOX_GROUPS.process, options: getOptions('review_assignment_status') },
|
scanBox: { type: 'select', group: SCANBOX_GROUPS.process, options: getOptions('review_assignment_status') },
|
||||||
table: { minWidth: 110, align: 'center' },
|
table: { minWidth: 110, align: 'center' },
|
||||||
slot: { type: 'tag', tagResolver: 'resolveReviewTag' },
|
slot: { type: 'tag', tagResolver: 'resolveReviewTag', translateField: 'review_assignment_status' },
|
||||||
detailLabel: '复核状态'
|
detailLabel: '复核状态'
|
||||||
},
|
},
|
||||||
unreviewed_order_count: {
|
unreviewed_order_count: {
|
||||||
key: 'unreviewed_order_count',
|
key: 'unreviewed_order_count',
|
||||||
label: '未复核数',
|
label: '未复核数',
|
||||||
scanBox: null,
|
scanBox: null,
|
||||||
table: { minWidth: 96, align: 'center' },
|
table: { minWidth: 96, align: 'center', sortable: true },
|
||||||
slot: null,
|
slot: null,
|
||||||
detailLabel: '未复核订单数'
|
detailLabel: '未复核订单数'
|
||||||
},
|
},
|
||||||
@ -298,7 +342,7 @@ export const FIELD_DICT: Record<string, FieldDefinition> = {
|
|||||||
key: 'order_no',
|
key: 'order_no',
|
||||||
label: '订单编号',
|
label: '订单编号',
|
||||||
scanBox: { type: 'text', group: SCANBOX_GROUPS.basic },
|
scanBox: { type: 'text', group: SCANBOX_GROUPS.basic },
|
||||||
table: { minWidth: 180, fixed: 'left' },
|
table: { minWidth: 180, fixed: 'left', copyAction: 'copy', showOverflowTooltip: true },
|
||||||
slot: null
|
slot: null
|
||||||
},
|
},
|
||||||
order_status: {
|
order_status: {
|
||||||
@ -306,42 +350,42 @@ export const FIELD_DICT: Record<string, FieldDefinition> = {
|
|||||||
label: '订单状态',
|
label: '订单状态',
|
||||||
scanBox: { type: 'select', group: SCANBOX_GROUPS.basic, options: getOptions('order_status') },
|
scanBox: { type: 'select', group: SCANBOX_GROUPS.basic, options: getOptions('order_status') },
|
||||||
table: { minWidth: 100, align: 'center' },
|
table: { minWidth: 100, align: 'center' },
|
||||||
slot: { type: 'tag', tagType: { 'pending': 'warning', 'processing': '', 'done': 'success' }, translateField: 'order_status' }
|
slot: { type: 'tag', tagType: { 'pending': 'warning', 'processing': 'warning', 'done': 'success' }, translateField: 'order_status' }
|
||||||
},
|
},
|
||||||
customer_name: {
|
customer_name: {
|
||||||
key: 'customer_name',
|
key: 'customer_name',
|
||||||
label: '客户名称',
|
label: '客户名称',
|
||||||
scanBox: { type: 'text', group: SCANBOX_GROUPS.basic },
|
scanBox: { type: 'text', group: SCANBOX_GROUPS.basic },
|
||||||
table: { minWidth: 120 },
|
table: { minWidth: 120, showOverflowTooltip: true },
|
||||||
slot: null
|
slot: null
|
||||||
},
|
},
|
||||||
sku_count: {
|
sku_count: {
|
||||||
key: 'sku_count',
|
key: 'sku_count',
|
||||||
label: 'SKU数',
|
label: 'SKU数',
|
||||||
scanBox: null,
|
scanBox: null,
|
||||||
table: { minWidth: 80, align: 'center' },
|
table: { minWidth: 80, align: 'center', sortable: true },
|
||||||
slot: null
|
slot: null
|
||||||
},
|
},
|
||||||
total_qty: {
|
total_qty: {
|
||||||
key: 'total_qty',
|
key: 'total_qty',
|
||||||
label: '总数量',
|
label: '总数量',
|
||||||
scanBox: null,
|
scanBox: null,
|
||||||
table: { minWidth: 80, align: 'center' },
|
table: { minWidth: 80, align: 'center', sortable: true },
|
||||||
slot: null
|
slot: null
|
||||||
},
|
},
|
||||||
total_amount: {
|
total_amount: {
|
||||||
key: 'total_amount',
|
key: 'total_amount',
|
||||||
label: '总金额(元)',
|
label: '总金额(元)',
|
||||||
scanBox: null,
|
scanBox: null,
|
||||||
table: { minWidth: 110, align: 'center' },
|
table: { minWidth: 110, align: 'center', sortable: true },
|
||||||
slot: null
|
slot: null
|
||||||
},
|
},
|
||||||
order_time: {
|
order_time: {
|
||||||
key: 'order_time',
|
key: 'order_time',
|
||||||
label: '下单时间',
|
label: '下单时间',
|
||||||
scanBox: { type: 'daterange', group: SCANBOX_GROUPS.time },
|
scanBox: { type: 'daterange', group: SCANBOX_GROUPS.time },
|
||||||
table: { minWidth: 168 },
|
table: { minWidth: 168, sortable: true },
|
||||||
slot: null
|
slot: { type: 'text', format: 'datetime' }
|
||||||
},
|
},
|
||||||
|
|
||||||
// ---- 快递相关 ----
|
// ---- 快递相关 ----
|
||||||
@ -358,28 +402,28 @@ export const FIELD_DICT: Record<string, FieldDefinition> = {
|
|||||||
{ label: '申通快递', value: 'STO' }
|
{ label: '申通快递', value: 'STO' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
table: { minWidth: 120 },
|
table: { minWidth: 120, showOverflowTooltip: true },
|
||||||
slot: null
|
slot: null
|
||||||
},
|
},
|
||||||
express_bill_count: {
|
express_bill_count: {
|
||||||
key: 'express_bill_count',
|
key: 'express_bill_count',
|
||||||
label: '快递单数',
|
label: '快递单数',
|
||||||
scanBox: null,
|
scanBox: null,
|
||||||
table: { minWidth: 100, align: 'center' },
|
table: { minWidth: 100, align: 'center', sortable: true },
|
||||||
slot: null
|
slot: null
|
||||||
},
|
},
|
||||||
assigned_count: {
|
assigned_count: {
|
||||||
key: 'assigned_count',
|
key: 'assigned_count',
|
||||||
label: '已分配数',
|
label: '已分配数',
|
||||||
scanBox: null,
|
scanBox: null,
|
||||||
table: { minWidth: 90, align: 'center' },
|
table: { minWidth: 90, align: 'center', sortable: true },
|
||||||
slot: null
|
slot: null
|
||||||
},
|
},
|
||||||
unassigned_count: {
|
unassigned_count: {
|
||||||
key: 'unassigned_count',
|
key: 'unassigned_count',
|
||||||
label: '未分配数',
|
label: '未分配数',
|
||||||
scanBox: null,
|
scanBox: null,
|
||||||
table: { minWidth: 90, align: 'center' },
|
table: { minWidth: 90, align: 'center', sortable: true },
|
||||||
slot: null
|
slot: null
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -402,29 +446,29 @@ export const FIELD_DICT: Record<string, FieldDefinition> = {
|
|||||||
key: 'picked_sku_count',
|
key: 'picked_sku_count',
|
||||||
label: '已拣SKU',
|
label: '已拣SKU',
|
||||||
scanBox: null,
|
scanBox: null,
|
||||||
table: { minWidth: 90, align: 'center' },
|
table: { minWidth: 90, align: 'center', sortable: true },
|
||||||
slot: null
|
slot: null
|
||||||
},
|
},
|
||||||
unpicked_sku_count: {
|
unpicked_sku_count: {
|
||||||
key: 'unpicked_sku_count',
|
key: 'unpicked_sku_count',
|
||||||
label: '未拣SKU',
|
label: '未拣SKU',
|
||||||
scanBox: null,
|
scanBox: null,
|
||||||
table: { minWidth: 90, align: 'center' },
|
table: { minWidth: 90, align: 'center', sortable: true },
|
||||||
slot: null
|
slot: null
|
||||||
},
|
},
|
||||||
pick_start_time: {
|
pick_start_time: {
|
||||||
key: 'pick_start_time',
|
key: 'pick_start_time',
|
||||||
label: '开始拣货',
|
label: '开始拣货',
|
||||||
scanBox: null,
|
scanBox: null,
|
||||||
table: { minWidth: 168 },
|
table: { minWidth: 168, sortable: true },
|
||||||
slot: null
|
slot: { type: 'text', format: 'datetime' }
|
||||||
},
|
},
|
||||||
pick_end_time: {
|
pick_end_time: {
|
||||||
key: 'pick_end_time',
|
key: 'pick_end_time',
|
||||||
label: '完成拣货',
|
label: '完成拣货',
|
||||||
scanBox: null,
|
scanBox: null,
|
||||||
table: { minWidth: 168 },
|
table: { minWidth: 168, sortable: true },
|
||||||
slot: null
|
slot: { type: 'text', format: 'datetime' }
|
||||||
},
|
},
|
||||||
|
|
||||||
// ---- 复核相关 ----
|
// ---- 复核相关 ----
|
||||||
@ -439,22 +483,22 @@ export const FIELD_DICT: Record<string, FieldDefinition> = {
|
|||||||
key: 'reviewed_order_count',
|
key: 'reviewed_order_count',
|
||||||
label: '已复核单',
|
label: '已复核单',
|
||||||
scanBox: null,
|
scanBox: null,
|
||||||
table: { minWidth: 100, align: 'center' },
|
table: { minWidth: 100, align: 'center', sortable: true },
|
||||||
slot: null
|
slot: null
|
||||||
},
|
},
|
||||||
review_start_time: {
|
review_start_time: {
|
||||||
key: 'review_start_time',
|
key: 'review_start_time',
|
||||||
label: '开始复核',
|
label: '开始复核',
|
||||||
scanBox: null,
|
scanBox: null,
|
||||||
table: { minWidth: 168 },
|
table: { minWidth: 168, sortable: true },
|
||||||
slot: null
|
slot: { type: 'text', format: 'datetime' }
|
||||||
},
|
},
|
||||||
review_end_time: {
|
review_end_time: {
|
||||||
key: 'review_end_time',
|
key: 'review_end_time',
|
||||||
label: '完成复核',
|
label: '完成复核',
|
||||||
scanBox: null,
|
scanBox: null,
|
||||||
table: { minWidth: 168 },
|
table: { minWidth: 168, sortable: true },
|
||||||
slot: null
|
slot: { type: 'text', format: 'datetime' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -466,10 +510,56 @@ export interface ColumnSlotConfig {
|
|||||||
tagType?: string | Record<string, string>
|
tagType?: string | Record<string, string>
|
||||||
tagResolver?: string
|
tagResolver?: string
|
||||||
translateField?: string
|
translateField?: string
|
||||||
|
/** 格式化类型:'datetime' 将时间戳转为 YYYY-MM-DD HH:mm:ss */
|
||||||
|
format?: 'datetime'
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// 四、TabPageRawConfig — 标签页声明配置(仅用 key 引用)
|
// 四、明细面板配置类型(与 DetailPanel 配合)
|
||||||
|
// ============================================================
|
||||||
|
|
||||||
|
/** 明细面板单个字段配置 */
|
||||||
|
export interface DetailFieldConfig {
|
||||||
|
/** 字段 key(对应 row 数据中的属性名) */
|
||||||
|
key: string
|
||||||
|
/** 显示标签(不设则从 FIELD_DICT 取 label) */
|
||||||
|
label?: string
|
||||||
|
/** 列跨度 */
|
||||||
|
span?: number
|
||||||
|
/** 渲染类型 */
|
||||||
|
renderType?: 'text' | 'tag' | 'pre'
|
||||||
|
/** tag 颜色(固定值 或 值→颜色映射) */
|
||||||
|
tagType?: string | Record<string, string>
|
||||||
|
/** tagResolver 函数名 */
|
||||||
|
tagResolver?: string
|
||||||
|
/** 翻译字段名(查 VALUE_MAPS) */
|
||||||
|
translateField?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 明细面板分区配置 */
|
||||||
|
export interface DetailSectionConfig {
|
||||||
|
/** 分区标题 */
|
||||||
|
title: string
|
||||||
|
/** el-descriptions 列数 */
|
||||||
|
columnCount: number
|
||||||
|
/** 分区内字段列表 */
|
||||||
|
fields: DetailFieldConfig[]
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 明细面板标签页配置 */
|
||||||
|
export interface DetailTabConfig {
|
||||||
|
/** 标签页标识 */
|
||||||
|
name: string
|
||||||
|
/** 标签页标题 */
|
||||||
|
label: string
|
||||||
|
/** 标签页组件 key(查 COMPONENT_REGISTRY) */
|
||||||
|
componentKey: string
|
||||||
|
/** 解析后的实际组件(resolveTabConfig 填充) */
|
||||||
|
component?: Component
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 五、TabPageRawConfig — 标签页声明配置(仅用 key 引用)
|
||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
export interface ToolbarButton {
|
export interface ToolbarButton {
|
||||||
@ -480,6 +570,66 @@ export interface ToolbarButton {
|
|||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ============================================================
|
||||||
|
// 五-A、TabPageApiConfig — 标签页接口插槽配置
|
||||||
|
// ============================================================
|
||||||
|
|
||||||
|
/** API 方法泛型签名 */
|
||||||
|
export type ApiMethod = (...args: any[]) => Promise<any>
|
||||||
|
|
||||||
|
/** 组件数据来源 */
|
||||||
|
export type ApiSource = 'api' | 'list'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公共组件的接口配置(联合类型)
|
||||||
|
*
|
||||||
|
* - { source: 'list' } → 组件使用页面 list 接口返回的行数据,无需额外请求
|
||||||
|
* - ApiMethod(函数) → 组件调用独立接口获取数据,与 list 字段写法一致
|
||||||
|
*
|
||||||
|
* 示例:
|
||||||
|
* detail: { source: 'list' } // 明细面板直接用列表行数据
|
||||||
|
* log: orderWaveApi.batchLog // 日志面板调独立接口(写法和 list 一致)
|
||||||
|
*/
|
||||||
|
export type ComponentApiConfig = { source: 'list' } | ApiMethod
|
||||||
|
|
||||||
|
/** 标签页的接口契约:各公共组件通过此配置获取所需 API */
|
||||||
|
export interface TabPageApiConfig {
|
||||||
|
/** 列表查询接口(index.vue loadData 调用) */
|
||||||
|
list: ApiMethod
|
||||||
|
|
||||||
|
/** 明细面板接口配置(DetailPanel),可选——不配时直接用 row 数据 */
|
||||||
|
detail?: ComponentApiConfig
|
||||||
|
|
||||||
|
/** 操作日志接口配置(LogPanel),可选——不配时用 row 生成 mock 日志 */
|
||||||
|
log?: ComponentApiConfig
|
||||||
|
|
||||||
|
/** 导出接口(导出按钮调用),可选 */
|
||||||
|
export?: ApiMethod
|
||||||
|
|
||||||
|
/** 导出进度查询接口,可选 */
|
||||||
|
exportProgress?: ApiMethod
|
||||||
|
|
||||||
|
/** ScanBox 中下拉选项的数据源接口,可选 */
|
||||||
|
scanBoxOptions?: Record<string, ApiMethod>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工具栏按钮 → API 方法映射
|
||||||
|
* key = toolbar button key,value = 对应 API 方法
|
||||||
|
* 例如: { batchAssignExpress: orderWaveApi.assignExpress }
|
||||||
|
*/
|
||||||
|
toolbar?: Record<string, ApiMethod>
|
||||||
|
|
||||||
|
/** 列表响应解析器(原始响应 → { list, total }) */
|
||||||
|
parseListResponse?: (res: any) => { list: any[]; total: number }
|
||||||
|
|
||||||
|
/** 构建列表请求参数(pagination + scanBox conditions → 接口参数),可选 */
|
||||||
|
buildListParams?: (params: {
|
||||||
|
pagination: { page: number; pageSize: number }
|
||||||
|
conditions: Record<string, any>
|
||||||
|
sort?: { prop: string; order: string }
|
||||||
|
}) => Record<string, any>
|
||||||
|
}
|
||||||
|
|
||||||
export interface TabPageRawConfig {
|
export interface TabPageRawConfig {
|
||||||
name: string
|
name: string
|
||||||
label: string
|
label: string
|
||||||
@ -495,8 +645,19 @@ export interface TabPageRawConfig {
|
|||||||
showSelection?: boolean
|
showSelection?: boolean
|
||||||
emptyText?: string
|
emptyText?: string
|
||||||
}
|
}
|
||||||
detailComponent: Component
|
detailComponentKey: string
|
||||||
mock: {
|
/** 明细面板标签页配置(默认仅"波次明细",可追加"操作日志"等) */
|
||||||
|
detailTabs?: { name: string; label: string; componentKey: string }[]
|
||||||
|
/** 明细面板分区配置(各页面按需配置字段 key,resolveTabConfig 展开) */
|
||||||
|
detailSections: {
|
||||||
|
title: string
|
||||||
|
columnCount: number
|
||||||
|
fieldKeys: string[]
|
||||||
|
}[]
|
||||||
|
/** 接口配置(有 api 时优先使用真实接口,mock 作为 fallback) */
|
||||||
|
api?: TabPageApiConfig
|
||||||
|
|
||||||
|
mock?: {
|
||||||
generateList: (count: number) => Record<string, any>[]
|
generateList: (count: number) => Record<string, any>[]
|
||||||
generateDetail: (row: Record<string, any>) => Record<string, any> | null
|
generateDetail: (row: Record<string, any>) => Record<string, any> | null
|
||||||
}
|
}
|
||||||
@ -508,7 +669,7 @@ export interface TabPageRawConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// 五、TabPageConfig — 展开后的完整配置(给 index.vue 使用)
|
// 六、TabPageConfig — 展开后的完整配置(给 index.vue 使用)
|
||||||
// ============================================================
|
// ============================================================
|
||||||
export interface TabPageConfig {
|
export interface TabPageConfig {
|
||||||
name: string
|
name: string
|
||||||
@ -524,8 +685,13 @@ export interface TabPageConfig {
|
|||||||
columns: Record<string, any>[]
|
columns: Record<string, any>[]
|
||||||
}
|
}
|
||||||
columnSlots: Record<string, ColumnSlotConfig>
|
columnSlots: Record<string, ColumnSlotConfig>
|
||||||
detailComponent: Component
|
/** 展开后的明细面板配置(可直接传给 DetailPanel) */
|
||||||
mock: {
|
detailConfig: DetailSectionConfig[]
|
||||||
|
/** 明细面板标签页列表(组件已解析) */
|
||||||
|
detailTabs: DetailTabConfig[]
|
||||||
|
/** 接口配置(透传自 TabPageRawConfig.api) */
|
||||||
|
api?: TabPageApiConfig
|
||||||
|
mock?: {
|
||||||
generateList: (count: number) => Record<string, any>[]
|
generateList: (count: number) => Record<string, any>[]
|
||||||
generateDetail: (row: Record<string, any>) => Record<string, any> | null
|
generateDetail: (row: Record<string, any>) => Record<string, any> | null
|
||||||
}
|
}
|
||||||
@ -537,7 +703,7 @@ export interface TabPageConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// 六、resolveTabConfig — 加载时将 RawConfig 展开为完整配置
|
// 七、resolveTabConfig — 加载时将 RawConfig 展开为完整配置
|
||||||
// ============================================================
|
// ============================================================
|
||||||
export function resolveTabConfig(raw: TabPageRawConfig): TabPageConfig {
|
export function resolveTabConfig(raw: TabPageRawConfig): TabPageConfig {
|
||||||
// 展开 ScanBox 字段
|
// 展开 ScanBox 字段
|
||||||
@ -577,6 +743,37 @@ export function resolveTabConfig(raw: TabPageRawConfig): TabPageConfig {
|
|||||||
columnSlots[def.key] = { ...def.slot }
|
columnSlots[def.key] = { ...def.slot }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 展开明细面板配置
|
||||||
|
const detailConfig: DetailSectionConfig[] = raw.detailSections.map((sec) => ({
|
||||||
|
title: sec.title,
|
||||||
|
columnCount: sec.columnCount,
|
||||||
|
fields: sec.fieldKeys
|
||||||
|
.map((key): DetailFieldConfig | null => {
|
||||||
|
const def = FIELD_DICT[key]
|
||||||
|
if (!def) return null
|
||||||
|
return {
|
||||||
|
key: def.key,
|
||||||
|
label: def.detailLabel ?? def.label,
|
||||||
|
translateField: def.slot?.translateField,
|
||||||
|
tagResolver: def.slot?.tagResolver,
|
||||||
|
tagType: def.slot?.tagType,
|
||||||
|
renderType: def.slot?.type === 'tag' ? 'tag' : 'text'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.filter((f): f is DetailFieldConfig => f !== null)
|
||||||
|
}))
|
||||||
|
|
||||||
|
// 展开明细标签页(解析 componentKey → Component)
|
||||||
|
const defaultComponent = COMPONENT_REGISTRY[raw.detailComponentKey]
|
||||||
|
const detailTabs: DetailTabConfig[] = raw.detailTabs
|
||||||
|
? raw.detailTabs.map((tab) => ({
|
||||||
|
name: tab.name,
|
||||||
|
label: tab.label,
|
||||||
|
componentKey: tab.componentKey,
|
||||||
|
component: COMPONENT_REGISTRY[tab.componentKey]
|
||||||
|
}))
|
||||||
|
: [{ name: 'detail', label: '波次明细', componentKey: raw.detailComponentKey, component: defaultComponent }]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: raw.name,
|
name: raw.name,
|
||||||
label: raw.label,
|
label: raw.label,
|
||||||
@ -591,7 +788,9 @@ export function resolveTabConfig(raw: TabPageRawConfig): TabPageConfig {
|
|||||||
columns
|
columns
|
||||||
},
|
},
|
||||||
columnSlots,
|
columnSlots,
|
||||||
detailComponent: raw.detailComponent,
|
detailConfig,
|
||||||
|
detailTabs,
|
||||||
|
api: raw.api,
|
||||||
mock: raw.mock,
|
mock: raw.mock,
|
||||||
toolbar: raw.toolbar
|
toolbar: raw.toolbar
|
||||||
}
|
}
|
||||||
@ -618,12 +817,12 @@ export function makeBaseMockWaveList(count = 25) {
|
|||||||
return {
|
return {
|
||||||
id: idx,
|
id: idx,
|
||||||
wave_no: `WV202607${pad(Math.floor(idx / 5) + 1)}${pad(idx)}`,
|
wave_no: `WV202607${pad(Math.floor(idx / 5) + 1)}${pad(idx)}`,
|
||||||
wave_type: idx % 3 === 0 ? '1' : '2',
|
wave_type: idx % 3 === 0 ? '团购' : '散单',
|
||||||
wave_status: idx % 4 === 0 ? '0' : '1',
|
wave_status: idx % 4 === 0 ? '自动加团中' : '已就绪',
|
||||||
total_orders: 10 + (idx % 50),
|
total_orders: 10 + (idx % 50),
|
||||||
order_count: 8 + (idx % 45),
|
order_count: 8 + (idx % 45),
|
||||||
processed_orders: idx % 2 === 0 ? 0 : (3 + (idx % 8)),
|
processed_orders: idx % 2 === 0 ? 0 : (3 + (idx % 8)),
|
||||||
distinguish_express: idx % 3 === 0 ? '1' : '0',
|
distinguish_express: idx % 3 === 0 ? '是' : '否',
|
||||||
storage_assignment_status: assignStatuses[idx % 3],
|
storage_assignment_status: assignStatuses[idx % 3],
|
||||||
express_assignment_status: idx % 2 === 0 ? '已分配' : '未分配',
|
express_assignment_status: idx % 2 === 0 ? '已分配' : '未分配',
|
||||||
print_assignment_status: printStatuses[idx % 2],
|
print_assignment_status: printStatuses[idx % 2],
|
||||||
@ -666,11 +865,11 @@ export function makeBaseMockDetail(row: Record<string, any>) {
|
|||||||
// ============================================================
|
// ============================================================
|
||||||
|
|
||||||
export const waveOrder2TabPages: TabPageRawConfig[] = [
|
export const waveOrder2TabPages: TabPageRawConfig[] = [
|
||||||
// ===== 标签页一:波次列表 =====
|
// ===== 标签页一:团购波次(wave_type=1) =====
|
||||||
{
|
{
|
||||||
name: 'tab1',
|
name: 'tab1',
|
||||||
label: '波次列表',
|
label: '团购波次',
|
||||||
scanBoxCacheKey: 'wave-order2-tab1',
|
scanBoxCacheKey: 'wave-order2-group-wave',
|
||||||
scanBoxFieldKeys: [
|
scanBoxFieldKeys: [
|
||||||
'wave_no', 'wave_type', 'wave_status', 'distinguish_express',
|
'wave_no', 'wave_type', 'wave_status', 'distinguish_express',
|
||||||
'logistics_name', 'creator',
|
'logistics_name', 'creator',
|
||||||
@ -688,63 +887,141 @@ export const waveOrder2TabPages: TabPageRawConfig[] = [
|
|||||||
'create_time', 'update_time'
|
'create_time', 'update_time'
|
||||||
],
|
],
|
||||||
upperTableDefaults: {
|
upperTableDefaults: {
|
||||||
title: '波次列表',
|
title: '团购波次列表',
|
||||||
showSelection: true
|
showSelection: true
|
||||||
},
|
},
|
||||||
detailComponent: DetailPanel,
|
detailComponentKey: 'DetailPanel',
|
||||||
|
detailTabs: [
|
||||||
|
{ name: 'detail', label: '波次明细', componentKey: 'DetailPanel' },
|
||||||
|
{ name: 'log', label: '操作日志', componentKey: 'LogPanel' }
|
||||||
|
],
|
||||||
|
detailSections: [
|
||||||
|
{
|
||||||
|
title: '基础信息',
|
||||||
|
columnCount: 4,
|
||||||
|
fieldKeys: ['wave_no', 'wave_type', 'wave_status', 'warehouse_id', 'total_orders', 'processed_orders', 'logistics_name', 'creator']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '分配状态',
|
||||||
|
columnCount: 3,
|
||||||
|
fieldKeys: ['storage_assignment_status', 'express_assignment_status', 'print_assignment_status', 'pick_assignment_status', 'review_assignment_status', 'unreviewed_order_count']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '结构与订单信息',
|
||||||
|
columnCount: 2,
|
||||||
|
fieldKeys: ['create_time', 'update_time']
|
||||||
|
}
|
||||||
|
],
|
||||||
|
api: {
|
||||||
|
list: orderWaveBatchList,
|
||||||
|
// 波次明细数据来自列表行,无需额外接口调用
|
||||||
|
detail: { source: 'list' },
|
||||||
|
parseListResponse(res: any) {
|
||||||
|
const { list, pagination } = unwrapWaveBatchListResponse(res)
|
||||||
|
return { list, total: pagination.total ?? 0 }
|
||||||
|
},
|
||||||
|
buildListParams({ pagination, conditions, sort }) {
|
||||||
|
const where: Record<string, any> = { wave_type: 1 }
|
||||||
|
for (const [key, cond] of Object.entries(conditions)) {
|
||||||
|
if (cond && typeof cond === 'object' && 'value' in cond) {
|
||||||
|
const v = (cond as any).value
|
||||||
|
if (v !== undefined && v !== null && v !== '' && !(Array.isArray(v) && v.length === 0)) {
|
||||||
|
where[key] = v
|
||||||
|
}
|
||||||
|
} else if (cond !== undefined && cond !== null && cond !== '') {
|
||||||
|
where[key] = cond
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const apiParams: Record<string, any> = { pagination, where }
|
||||||
|
if (sort?.prop) {
|
||||||
|
apiParams.sort = { sortField: sort.prop, sortOrder: sort.order === 'ascending' ? 'ASC' : 'DESC' }
|
||||||
|
}
|
||||||
|
return apiParams
|
||||||
|
}
|
||||||
|
},
|
||||||
mock: {
|
mock: {
|
||||||
generateList: makeBaseMockWaveList,
|
generateList: makeBaseMockWaveList,
|
||||||
generateDetail: makeBaseMockDetail
|
generateDetail: makeBaseMockDetail
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// ===== 标签页二:订单汇总 =====
|
// ===== 标签页二:散单波次(wave_type=2) =====
|
||||||
{
|
{
|
||||||
name: 'tab2',
|
name: 'tab2',
|
||||||
label: '订单汇总',
|
label: '散单波次',
|
||||||
scanBoxCacheKey: 'wave-order2-tab2',
|
scanBoxCacheKey: 'wave-order2-sandan-wave',
|
||||||
scanBoxFieldKeys: [
|
scanBoxFieldKeys: [
|
||||||
'order_no', 'order_status', 'creator',
|
'wave_no', 'wave_type', 'wave_status', 'distinguish_express',
|
||||||
'order_time', 'create_time', 'update_time'
|
'logistics_name', 'creator',
|
||||||
|
'storage_assignment_status', 'express_assignment_status',
|
||||||
|
'print_assignment_status', 'pick_assignment_status', 'review_assignment_status',
|
||||||
|
'create_time', 'update_time'
|
||||||
],
|
],
|
||||||
tableColumnKeys: [
|
tableColumnKeys: [
|
||||||
'order_no', 'order_status', 'customer_name',
|
'wave_no', 'wave_type', 'wave_status',
|
||||||
'sku_count', 'total_qty', 'total_amount',
|
'total_orders', 'order_count', 'processed_orders',
|
||||||
'wave_no', 'logistics_name', 'creator',
|
'distinguish_express',
|
||||||
'order_time', 'create_time'
|
'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: {
|
upperTableDefaults: {
|
||||||
title: '订单汇总',
|
title: '散单波次列表',
|
||||||
showSelection: false
|
showSelection: true
|
||||||
},
|
},
|
||||||
detailComponent: DetailPanel,
|
detailComponentKey: 'DetailPanel',
|
||||||
mock: {
|
detailTabs: [
|
||||||
generateList(count) {
|
{ name: 'detail', label: '波次明细', componentKey: 'DetailPanel' },
|
||||||
const customers = ['客户A', '客户B', '客户C', '客户D']
|
{ name: 'log', label: '操作日志', componentKey: 'LogPanel' }
|
||||||
const statusKeys = ['pending', 'processing', 'done']
|
],
|
||||||
const pad = (n: number) => String(n).padStart(3, '0')
|
detailSections: [
|
||||||
return Array.from({ length: count }, (_, i) => {
|
{
|
||||||
const idx = i + 1
|
title: '基础信息',
|
||||||
return {
|
columnCount: 4,
|
||||||
id: idx,
|
fieldKeys: ['wave_no', 'wave_type', 'wave_status', 'warehouse_id', 'total_orders', 'processed_orders', 'logistics_name', 'creator']
|
||||||
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
|
title: '分配状态',
|
||||||
return { ...row, order_info_summary: `订单 ${row.order_no} 明细`, item_snapshot_text: `共 ${row.sku_count} 个SKU,${row.total_qty} 件` }
|
columnCount: 3,
|
||||||
|
fieldKeys: ['storage_assignment_status', 'express_assignment_status', 'print_assignment_status', 'pick_assignment_status', 'review_assignment_status', 'unreviewed_order_count']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '结构与订单信息',
|
||||||
|
columnCount: 2,
|
||||||
|
fieldKeys: ['create_time', 'update_time']
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
api: {
|
||||||
|
list: orderWaveBatchList,
|
||||||
|
// 波次明细数据来自列表行,无需额外接口调用
|
||||||
|
detail: { source: 'list' },
|
||||||
|
parseListResponse(res: any) {
|
||||||
|
const { list, pagination } = unwrapWaveBatchListResponse(res)
|
||||||
|
return { list, total: pagination.total ?? 0 }
|
||||||
|
},
|
||||||
|
buildListParams({ pagination, conditions, sort }) {
|
||||||
|
const where: Record<string, any> = { wave_type: 2 }
|
||||||
|
for (const [key, cond] of Object.entries(conditions)) {
|
||||||
|
if (cond && typeof cond === 'object' && 'value' in cond) {
|
||||||
|
const v = (cond as any).value
|
||||||
|
if (v !== undefined && v !== null && v !== '' && !(Array.isArray(v) && v.length === 0)) {
|
||||||
|
where[key] = v
|
||||||
|
}
|
||||||
|
} else if (cond !== undefined && cond !== null && cond !== '') {
|
||||||
|
where[key] = cond
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const apiParams: Record<string, any> = { pagination, where }
|
||||||
|
if (sort?.prop) {
|
||||||
|
apiParams.sort = { sortField: sort.prop, sortOrder: sort.order === 'ascending' ? 'ASC' : 'DESC' }
|
||||||
|
}
|
||||||
|
return apiParams
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mock: {
|
||||||
|
generateList: makeBaseMockWaveList,
|
||||||
|
generateDetail: makeBaseMockDetail
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -767,7 +1044,19 @@ export const waveOrder2TabPages: TabPageRawConfig[] = [
|
|||||||
title: '快递分配列表',
|
title: '快递分配列表',
|
||||||
showSelection: true
|
showSelection: true
|
||||||
},
|
},
|
||||||
detailComponent: DetailPanel,
|
detailComponentKey: 'DetailPanel',
|
||||||
|
detailSections: [
|
||||||
|
{
|
||||||
|
title: '快递分配信息',
|
||||||
|
columnCount: 3,
|
||||||
|
fieldKeys: ['wave_no', 'wave_type', 'express_company', 'express_assignment_status', 'express_bill_count', 'distinguish_express', 'assigned_count', 'unassigned_count', 'creator']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '时间信息',
|
||||||
|
columnCount: 2,
|
||||||
|
fieldKeys: ['create_time']
|
||||||
|
}
|
||||||
|
],
|
||||||
mock: {
|
mock: {
|
||||||
generateList(count) {
|
generateList(count) {
|
||||||
const companies = ['顺丰速运', '圆通快递', '中通快递', '韵达快递', '申通快递']
|
const companies = ['顺丰速运', '圆通快递', '中通快递', '韵达快递', '申通快递']
|
||||||
@ -779,11 +1068,11 @@ export const waveOrder2TabPages: TabPageRawConfig[] = [
|
|||||||
return {
|
return {
|
||||||
id: idx,
|
id: idx,
|
||||||
wave_no: `WV202607${pad(Math.floor(idx / 5) + 1)}${pad(idx)}`,
|
wave_no: `WV202607${pad(Math.floor(idx / 5) + 1)}${pad(idx)}`,
|
||||||
wave_type: idx % 3 === 0 ? '1' : '2',
|
wave_type: idx % 3 === 0 ? '团购' : '散单',
|
||||||
express_company: companies[idx % companies.length],
|
express_company: companies[idx % companies.length],
|
||||||
express_assignment_status: idx % 2 === 0 ? '已分配' : '未分配',
|
express_assignment_status: idx % 2 === 0 ? '已分配' : '未分配',
|
||||||
express_bill_count: total,
|
express_bill_count: total,
|
||||||
distinguish_express: idx % 3 === 0 ? '1' : '0',
|
distinguish_express: idx % 3 === 0 ? '是' : '否',
|
||||||
assigned_count: assigned,
|
assigned_count: assigned,
|
||||||
unassigned_count: total - assigned,
|
unassigned_count: total - assigned,
|
||||||
creator: ['张三', '李四'][idx % 2],
|
creator: ['张三', '李四'][idx % 2],
|
||||||
@ -818,7 +1107,19 @@ export const waveOrder2TabPages: TabPageRawConfig[] = [
|
|||||||
title: '拣货状态列表',
|
title: '拣货状态列表',
|
||||||
showSelection: true
|
showSelection: true
|
||||||
},
|
},
|
||||||
detailComponent: DetailPanel,
|
detailComponentKey: 'DetailPanel',
|
||||||
|
detailSections: [
|
||||||
|
{
|
||||||
|
title: '拣货信息',
|
||||||
|
columnCount: 3,
|
||||||
|
fieldKeys: ['wave_no', 'wave_type', 'pick_assignment_status', 'picker', 'pick_cart_no', 'picked_sku_count', 'unpicked_sku_count']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '时间信息',
|
||||||
|
columnCount: 2,
|
||||||
|
fieldKeys: ['pick_start_time', 'pick_end_time', 'create_time']
|
||||||
|
}
|
||||||
|
],
|
||||||
mock: {
|
mock: {
|
||||||
generateList(count) {
|
generateList(count) {
|
||||||
const pickers = ['拣货员A', '拣货员B', '拣货员C']
|
const pickers = ['拣货员A', '拣货员B', '拣货员C']
|
||||||
@ -832,7 +1133,7 @@ export const waveOrder2TabPages: TabPageRawConfig[] = [
|
|||||||
return {
|
return {
|
||||||
id: idx,
|
id: idx,
|
||||||
wave_no: `WV202607${pad(Math.floor(idx / 5) + 1)}${pad(idx)}`,
|
wave_no: `WV202607${pad(Math.floor(idx / 5) + 1)}${pad(idx)}`,
|
||||||
wave_type: idx % 3 === 0 ? '1' : '2',
|
wave_type: idx % 3 === 0 ? '团购' : '散单',
|
||||||
pick_assignment_status: statuses[idx % 3],
|
pick_assignment_status: statuses[idx % 3],
|
||||||
picker: statuses[idx % 3] !== '未拣货' ? pickers[idx % pickers.length] : '—',
|
picker: statuses[idx % 3] !== '未拣货' ? pickers[idx % pickers.length] : '—',
|
||||||
pick_cart_no: statuses[idx % 3] !== '未拣货' ? `CART-${pad(idx)}` : '—',
|
pick_cart_no: statuses[idx % 3] !== '未拣货' ? `CART-${pad(idx)}` : '—',
|
||||||
@ -870,7 +1171,19 @@ export const waveOrder2TabPages: TabPageRawConfig[] = [
|
|||||||
title: '复核状态列表',
|
title: '复核状态列表',
|
||||||
showSelection: true
|
showSelection: true
|
||||||
},
|
},
|
||||||
detailComponent: DetailPanel,
|
detailComponentKey: 'DetailPanel',
|
||||||
|
detailSections: [
|
||||||
|
{
|
||||||
|
title: '复核信息',
|
||||||
|
columnCount: 3,
|
||||||
|
fieldKeys: ['wave_no', 'wave_type', 'review_assignment_status', 'reviewer', 'reviewed_order_count', 'unreviewed_order_count']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '时间信息',
|
||||||
|
columnCount: 2,
|
||||||
|
fieldKeys: ['review_start_time', 'review_end_time', 'create_time']
|
||||||
|
}
|
||||||
|
],
|
||||||
mock: {
|
mock: {
|
||||||
generateList(count) {
|
generateList(count) {
|
||||||
const reviewers = ['复核员X', '复核员Y']
|
const reviewers = ['复核员X', '复核员Y']
|
||||||
@ -884,7 +1197,7 @@ export const waveOrder2TabPages: TabPageRawConfig[] = [
|
|||||||
return {
|
return {
|
||||||
id: idx,
|
id: idx,
|
||||||
wave_no: `WV202607${pad(Math.floor(idx / 5) + 1)}${pad(idx)}`,
|
wave_no: `WV202607${pad(Math.floor(idx / 5) + 1)}${pad(idx)}`,
|
||||||
wave_type: idx % 3 === 0 ? '1' : '2',
|
wave_type: idx % 3 === 0 ? '团购' : '散单',
|
||||||
review_assignment_status: statuses[idx % 2],
|
review_assignment_status: statuses[idx % 2],
|
||||||
reviewer: statuses[idx % 2] === '已复核' ? reviewers[idx % reviewers.length] : '—',
|
reviewer: statuses[idx % 2] === '已复核' ? reviewers[idx % reviewers.length] : '—',
|
||||||
reviewed_order_count: total - unreviewed,
|
reviewed_order_count: total - unreviewed,
|
||||||
@ -904,7 +1217,7 @@ export const waveOrder2TabPages: TabPageRawConfig[] = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// 九、向后兼容导出
|
// 十、向后兼容导出
|
||||||
// ============================================================
|
// ============================================================
|
||||||
export const WAVEORDER2_PAGE_CONFIG = { showTabArea: true, singlePage: false }
|
export const WAVEORDER2_PAGE_CONFIG = { showTabArea: true, singlePage: false }
|
||||||
|
|
||||||
@ -930,6 +1243,6 @@ export const waveOrder2Columns = (() => {
|
|||||||
return resolveTabConfig(raw).upperTable.columns
|
return resolveTabConfig(raw).upperTable.columns
|
||||||
})()
|
})()
|
||||||
|
|
||||||
export const generateMockWaveList = waveOrder2TabPages[0]?.mock.generateList ?? makeBaseMockWaveList
|
export const generateMockWaveList = waveOrder2TabPages[0]?.mock?.generateList ?? makeBaseMockWaveList
|
||||||
export const generateMockDetail = waveOrder2TabPages[0]?.mock.generateDetail ?? makeBaseMockDetail
|
export const generateMockDetail = waveOrder2TabPages[0]?.mock?.generateDetail ?? makeBaseMockDetail
|
||||||
|
|
||||||
|
|||||||
@ -36,104 +36,119 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="main-content">
|
<div class="main-content">
|
||||||
<div class="toolbar">
|
<transition name="tab-fade" mode="out-in">
|
||||||
<div class="toolbar-left">
|
<div :key="activeTabName" class="tab-content-inner">
|
||||||
<!-- 默认刷新按钮 -->
|
<div class="toolbar">
|
||||||
<el-button
|
<div class="toolbar-left">
|
||||||
v-if="currentTabConfig?.toolbar?.showRefresh !== false"
|
<!-- 默认刷新按钮 -->
|
||||||
type="primary" size="small" @click="handleRefresh"
|
<el-button
|
||||||
>
|
v-if="currentTabConfig?.toolbar?.showRefresh !== false"
|
||||||
<el-icon><Refresh /></el-icon>
|
type="primary" size="small" @click="handleRefresh"
|
||||||
刷新
|
>
|
||||||
</el-button>
|
<el-icon><Refresh /></el-icon>
|
||||||
<!-- 自定义工具栏按钮 -->
|
刷新
|
||||||
<el-button
|
</el-button>
|
||||||
v-for="btn in currentToolbarButtons"
|
<!-- 自定义工具栏按钮 -->
|
||||||
:key="btn.key"
|
<el-button
|
||||||
:type="btn.type || ''"
|
v-for="btn in currentToolbarButtons"
|
||||||
size="small"
|
:key="btn.key"
|
||||||
:disabled="btn.disabled"
|
:type="btn.type || ''"
|
||||||
@click="handleToolbarAction(btn.key)"
|
size="small"
|
||||||
>
|
:disabled="btn.disabled"
|
||||||
{{ btn.label }}
|
@click="handleToolbarAction(btn.key)"
|
||||||
</el-button>
|
>
|
||||||
<!-- 默认导出按钮 -->
|
{{ btn.label }}
|
||||||
<el-button
|
</el-button>
|
||||||
v-if="currentTabConfig?.toolbar?.showExport !== false"
|
<!-- 默认导出按钮 -->
|
||||||
size="small" @click="handleExport"
|
<el-button
|
||||||
>
|
v-if="currentTabConfig?.toolbar?.showExport !== false"
|
||||||
导出
|
size="small" @click="handleExport"
|
||||||
</el-button>
|
>
|
||||||
</div>
|
导出
|
||||||
</div>
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="split-stack" ref="splitStackRef">
|
<div class="split-stack" ref="splitStackRef">
|
||||||
<div class="upper-wrapper" :style="detailVisible ? upperPaneStyle : upperPaneFullStyle">
|
<div class="upper-wrapper" :style="detailVisible ? upperPaneStyle : upperPaneFullStyle">
|
||||||
<upper-table
|
<upper-table
|
||||||
ref="upperTableRef"
|
ref="upperTableRef"
|
||||||
:title="currentTabConfig?.upperTable.title ?? '列表'"
|
:title="currentTabConfig?.upperTable.title ?? '列表'"
|
||||||
default-align="center"
|
default-align="center"
|
||||||
:enable-column-config="currentTabConfig?.upperTable.enableColumnConfig ?? true"
|
:enable-column-config="currentTabConfig?.upperTable.enableColumnConfig ?? true"
|
||||||
:column-config-schema-version="1"
|
:column-config-schema-version="1"
|
||||||
:table-id="`wave-order2-table-${activeTabName}`"
|
:table-id="`wave-order2-table-${activeTabName}`"
|
||||||
:data="mockList"
|
:data="mockList"
|
||||||
:row-key="'id'"
|
:row-key="'id'"
|
||||||
:columns="currentColumns"
|
:columns="currentColumns"
|
||||||
table-size="small"
|
table-size="small"
|
||||||
:pagination="pagination"
|
:pagination="pagination"
|
||||||
:show-index="currentTabConfig?.upperTable.showIndex ?? true"
|
:show-index="currentTabConfig?.upperTable.showIndex ?? true"
|
||||||
:show-selection="currentTabConfig?.upperTable.showSelection ?? true"
|
:show-selection="currentTabConfig?.upperTable.showSelection ?? true"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:query-time="queryTime"
|
:query-time="queryTime"
|
||||||
@current-change="handleRowClick"
|
@current-change="handleRowClick"
|
||||||
@row-click="handleRowClick"
|
@row-click="handleRowClick"
|
||||||
@page-change="handlePageChange"
|
@page-change="handlePageChange"
|
||||||
@page-size-change="handlePageSizeChange"
|
@page-size-change="handlePageSizeChange"
|
||||||
@refresh="loadMockData"
|
@refresh="loadMockData"
|
||||||
@selection-change="handleSelectionChange"
|
@sort-change="handleSortChange"
|
||||||
>
|
@selection-change="handleSelectionChange"
|
||||||
<!-- 动态列插槽:根据列配置的 columnSlots 自动渲染 -->
|
>
|
||||||
<template
|
<!-- 动态列插槽:根据列配置的 columnSlots 自动渲染 -->
|
||||||
v-for="(slotConfig, colProp) in currentColumnSlots"
|
<template
|
||||||
:key="`${columnSlotsKey}-${colProp}`"
|
v-for="(slotConfig, colProp) in currentColumnSlots"
|
||||||
#[`column-${colProp}`]="{ row }"
|
:key="`${columnSlotsKey}-${colProp}`"
|
||||||
>
|
#[`column-${colProp}`]="{ row }"
|
||||||
<ColumnCellRenderer
|
>
|
||||||
:config="slotConfig"
|
<ColumnCellRenderer
|
||||||
:value="row[colProp]"
|
: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"
|
||||||
/>
|
/>
|
||||||
</template>
|
<div v-if="selectedRow" class="lower-level" :style="lowerPaneStyle">
|
||||||
|
<div class="detail-header">
|
||||||
|
<el-tabs v-model="activeDetailTab" class="detail-tab">
|
||||||
|
<el-tab-pane
|
||||||
|
v-for="tab in currentDetailTabs"
|
||||||
|
:key="tab.name"
|
||||||
|
:label="tab.label"
|
||||||
|
:name="tab.name"
|
||||||
|
/>
|
||||||
|
</el-tabs>
|
||||||
|
</div>
|
||||||
|
<div class="detail-container">
|
||||||
|
<component
|
||||||
|
:is="activeDetailTabComponent"
|
||||||
|
:row="selectedDetail"
|
||||||
|
:detail-config="currentDetailConfig"
|
||||||
|
:api-method="currentDetailTabApiMethod"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<template #empty>
|
<div v-else class="no-selection" :style="lowerPaneStyle">
|
||||||
<div class="empty-tip">{{ currentTabConfig?.upperTable.emptyText ?? '暂无数据' }}</div>
|
<div class="empty-tip">
|
||||||
|
<p>请从上方列表中选择一项查看详情</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</upper-table>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</transition>
|
||||||
<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>
|
||||||
</div>
|
</div>
|
||||||
@ -142,6 +157,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, onMounted, reactive } from 'vue'
|
import { ref, computed, onMounted, reactive } from 'vue'
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
import { useSettingsStore } from '@/stores/modules/settings'
|
import { useSettingsStore } from '@/stores/modules/settings'
|
||||||
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
|
||||||
import ScanBox from '@/components/ScanBox/index.vue'
|
import ScanBox from '@/components/ScanBox/index.vue'
|
||||||
@ -154,7 +170,7 @@ import {
|
|||||||
waveOrder2TabPages,
|
waveOrder2TabPages,
|
||||||
resolveTabConfig
|
resolveTabConfig
|
||||||
} from './config/waveorder-config'
|
} from './config/waveorder-config'
|
||||||
import type { TabPageConfig } from './config/waveorder-config'
|
import type { TabPageConfig, DetailTabConfig } from './config/waveorder-config'
|
||||||
|
|
||||||
defineOptions({ name: 'WaveOrder2' })
|
defineOptions({ name: 'WaveOrder2' })
|
||||||
|
|
||||||
@ -199,9 +215,47 @@ const currentColumnSlots = computed(() => {
|
|||||||
return currentTabConfig.value?.columnSlots ?? {}
|
return currentTabConfig.value?.columnSlots ?? {}
|
||||||
})
|
})
|
||||||
|
|
||||||
/** 当前标签页的明细组件 */
|
/** 当前标签页的明细面板配置 */
|
||||||
const currentDetailComponent = computed(() => {
|
const currentDetailConfig = computed(() => {
|
||||||
return currentTabConfig.value?.detailComponent ?? null
|
return currentTabConfig.value?.detailConfig ?? []
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 当前标签页的明细标签页列表 */
|
||||||
|
const currentDetailTabs = computed<DetailTabConfig[]>(() => {
|
||||||
|
return currentTabConfig.value?.detailTabs ?? []
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 当前激活的明细标签页对应的组件 */
|
||||||
|
const activeDetailTabComponent = computed(() => {
|
||||||
|
const tab = currentDetailTabs.value.find((t) => t.name === activeDetailTab.value)
|
||||||
|
return tab?.component ?? null
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 当前激活明细标签页对应的 API 方法(函数=source='api',对象=source='list'返回 undefined) */
|
||||||
|
const currentDetailTabApiMethod = computed(() => {
|
||||||
|
const cfg = currentTabConfig.value
|
||||||
|
if (!cfg?.api) return undefined
|
||||||
|
const tab = currentDetailTabs.value.find((t) => t.name === activeDetailTab.value)
|
||||||
|
if (!tab) return undefined
|
||||||
|
|
||||||
|
// 根据 componentKey 匹配对应的 API 配置
|
||||||
|
let componentCfg: unknown
|
||||||
|
switch (tab.componentKey) {
|
||||||
|
case 'DetailPanel':
|
||||||
|
componentCfg = cfg.api.detail
|
||||||
|
break
|
||||||
|
case 'LogPanel':
|
||||||
|
componentCfg = cfg.api.log
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
// 函数 → 直接返回作为 apiMethod;对象 { source:'list' } → 组件用行数据
|
||||||
|
if (typeof componentCfg === 'function') {
|
||||||
|
return componentCfg
|
||||||
|
}
|
||||||
|
return undefined
|
||||||
})
|
})
|
||||||
|
|
||||||
/** 当前标签页的自定义工具栏按钮 */
|
/** 当前标签页的自定义工具栏按钮 */
|
||||||
@ -215,9 +269,12 @@ const handleTabChange = (tabName: string) => {
|
|||||||
activeTabName.value = tabName
|
activeTabName.value = tabName
|
||||||
// 重置分页和选中状态
|
// 重置分页和选中状态
|
||||||
pagination.currentPage = 1
|
pagination.currentPage = 1
|
||||||
|
currentSort.prop = ''
|
||||||
|
currentSort.order = ''
|
||||||
selectedRow.value = null
|
selectedRow.value = null
|
||||||
selectedDetail.value = null
|
selectedDetail.value = null
|
||||||
selectedRows.value = []
|
selectedRows.value = []
|
||||||
|
activeDetailTab.value = 'detail'
|
||||||
loadMockData()
|
loadMockData()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,6 +297,13 @@ const handleConditionClear = () => {
|
|||||||
loadMockData()
|
loadMockData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleSortChange({ prop, order }: any) {
|
||||||
|
currentSort.prop = prop
|
||||||
|
currentSort.order = order
|
||||||
|
pagination.currentPage = 1
|
||||||
|
loadMockData()
|
||||||
|
}
|
||||||
|
|
||||||
// ===== 模拟数据 =====
|
// ===== 模拟数据 =====
|
||||||
const mockList = ref<Record<string, any>[]>([])
|
const mockList = ref<Record<string, any>[]>([])
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
@ -251,21 +315,70 @@ const pagination = reactive({
|
|||||||
total: 0
|
total: 0
|
||||||
})
|
})
|
||||||
|
|
||||||
const loadMockData = () => {
|
const currentSort = reactive({ prop: '', order: '' })
|
||||||
|
|
||||||
|
const loadMockData = async () => {
|
||||||
const cfg = currentTabConfig.value
|
const cfg = currentTabConfig.value
|
||||||
if (!cfg) return
|
if (!cfg) return
|
||||||
loading.value = true
|
loading.value = true
|
||||||
const startTime = performance.now()
|
const startTime = performance.now()
|
||||||
|
|
||||||
setTimeout(() => {
|
try {
|
||||||
const full = cfg.mock.generateList(50)
|
// 优先使用真实接口
|
||||||
const { currentPage, pageSize } = pagination
|
if (cfg.api) {
|
||||||
const start = (currentPage - 1) * pageSize
|
const conditions = scanBoxRef.value?.getConditions?.() || {}
|
||||||
mockList.value = full.slice(start, start + pageSize)
|
const params = cfg.api.buildListParams
|
||||||
pagination.total = full.length
|
? cfg.api.buildListParams({
|
||||||
|
pagination: { page: pagination.currentPage, pageSize: pagination.pageSize },
|
||||||
|
conditions,
|
||||||
|
sort: currentSort.prop ? { prop: currentSort.prop, order: currentSort.order } : undefined
|
||||||
|
})
|
||||||
|
: {
|
||||||
|
pagination: { page: pagination.currentPage, pageSize: pagination.pageSize },
|
||||||
|
where: conditions
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await cfg.api.list(params)
|
||||||
|
if (res && (res.code === 1 || res.code === 200)) {
|
||||||
|
const parsed = cfg.api.parseListResponse
|
||||||
|
? cfg.api.parseListResponse(res)
|
||||||
|
: { list: res.data?.list ?? res.list ?? [], total: res.data?.pagination?.total ?? res.total ?? 0 }
|
||||||
|
mockList.value = parsed.list
|
||||||
|
pagination.total = parsed.total
|
||||||
|
} else {
|
||||||
|
throw new Error(res?.message || '接口返回异常')
|
||||||
|
}
|
||||||
|
} else if (cfg.mock) {
|
||||||
|
// fallback 到 mock 数据
|
||||||
|
await new Promise<void>((resolve) => {
|
||||||
|
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
|
||||||
|
resolve()
|
||||||
|
}, 200)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} catch (e: any) {
|
||||||
|
console.error('[WaveOrder2] 加载列表失败:', e)
|
||||||
|
ElMessage.error(e?.message || '获取列表数据失败')
|
||||||
|
// API 失败时尝试 fallback 到 mock
|
||||||
|
if (cfg.mock && !mockList.value.length) {
|
||||||
|
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
|
||||||
|
} else {
|
||||||
|
mockList.value = []
|
||||||
|
pagination.total = 0
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
queryTime.value = Math.round(performance.now() - startTime)
|
queryTime.value = Math.round(performance.now() - startTime)
|
||||||
}, 200)
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const handlePageChange = (page: number) => {
|
const handlePageChange = (page: number) => {
|
||||||
@ -316,11 +429,32 @@ const selectedRow = ref<Record<string, any> | null>(null)
|
|||||||
const selectedDetail = ref<Record<string, any> | null>(null)
|
const selectedDetail = ref<Record<string, any> | null>(null)
|
||||||
const activeDetailTab = ref('detail')
|
const activeDetailTab = ref('detail')
|
||||||
|
|
||||||
const handleRowClick = (row: Record<string, any>) => {
|
const handleRowClick = async (row: Record<string, any>) => {
|
||||||
const cfg = currentTabConfig.value
|
const cfg = currentTabConfig.value
|
||||||
if (!cfg) return
|
if (!cfg) return
|
||||||
selectedRow.value = row
|
selectedRow.value = row
|
||||||
selectedDetail.value = cfg.mock.generateDetail(row)
|
|
||||||
|
// 根据 DetailPanel 的 api 配置决定数据来源
|
||||||
|
const detailCfg = cfg.api?.detail
|
||||||
|
// 直接传函数 = source='api'(与 list 字段写法一致)
|
||||||
|
if (typeof detailCfg === 'function') {
|
||||||
|
try {
|
||||||
|
const detailRes = await detailCfg({ wave_id: row.wave_id ?? row.id, wave_no: row.wave_no })
|
||||||
|
if (detailRes && (detailRes.code === 1 || detailRes.code === 200)) {
|
||||||
|
selectedDetail.value = detailRes.data ?? detailRes
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('[WaveOrder2] 获取明细失败,使用列表行数据:', e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// source='list' 或 API 失败:直接使用列表行数据
|
||||||
|
if (cfg.mock?.generateDetail) {
|
||||||
|
selectedDetail.value = cfg.mock.generateDetail(row)
|
||||||
|
} else {
|
||||||
|
selectedDetail.value = { ...row }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===== 分栏拖拽(使用 useVerticalSplitPane,与 waveOrder 一致) =====
|
// ===== 分栏拖拽(使用 useVerticalSplitPane,与 waveOrder 一致) =====
|
||||||
@ -488,4 +622,39 @@ const columnSlotsKey = computed(() => {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ================================================================
|
||||||
|
标签页切换过渡动画
|
||||||
|
================================================================ */
|
||||||
|
.main-content {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-content-inner {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* fade + slide 混合过渡 */
|
||||||
|
.tab-fade-enter-active,
|
||||||
|
.tab-fade-leave-active {
|
||||||
|
transition: opacity 0.2s ease, transform 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-fade-enter-from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(8px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-fade-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(-8px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-fade-leave-active {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
Loading…
x
Reference in New Issue
Block a user