This commit is contained in:
2026-08-04 21:01:39 +08:00
parent 88bd939170
commit 5cb1ca307d
77 changed files with 9914 additions and 131 deletions
@@ -10,7 +10,7 @@ describe('PlatformFirstLegOrdersPanel review queue', () => {
expect(source).toContain("tenantId: filters.value.tenantId || undefined")
expect(source).toContain('listPlatformTenants')
expect(source).toContain("key: 'tenantId'")
expect(source).toContain('tenantName((row as PlatformFirstLegOrderResource).tenantId)')
expect(source).toContain('customerDisplay(row as PlatformFirstLegOrderResource).name')
expect(source).toContain('result.pages')
})
@@ -34,6 +34,16 @@ describe('PlatformFirstLegOrdersPanel review queue', () => {
expect(source).toContain("minWidth: 224, fixed: 'left'")
})
it('prioritizes order status and removes noisy customer and time metadata', () => {
const statusColumn = source.indexOf("{ key: 'status', label: '状态'")
const orderColumn = source.indexOf("{ key: 'orderInfo', label: '订单信息'")
expect(statusColumn).toBeGreaterThan(0)
expect(statusColumn).toBeLessThan(orderColumn)
expect(source).toContain("replace('T', ' ').slice(0, 16)")
expect(source).toContain('客户编码 ${code}')
expect(source).not.toContain('customerName }} · {{ (row as PlatformFirstLegOrderResource).tenantId')
})
it('passes the order tenant through detail and lifecycle actions', () => {
expect(source).toContain('tenantId: String(order.tenantId)')
expect(source).toContain('getPlatformFirstLegOrder(tenantId, orderId)')
@@ -65,14 +65,15 @@ const queryFields = computed<QueryField[]>(() => [
{
key: 'tenantId',
type: 'select',
width: 160,
placeholder: tenantLoadError.value ? '企业列表加载失败' : '全部企业',
props: { 'aria-label': '企业客户', filterable: true, disabled: Boolean(tenantLoadError.value) },
options: tenants.value.map((tenant) => ({ value: String(tenant.id), label: `${tenant.tenantName}(${tenant.tenantCode || tenant.id})` })),
},
{ key: 'keyword', type: 'input', placeholder: '订单号或发货客户名称', props: { 'aria-label': '订单关键词' } },
{
key: 'status',
type: 'select',
width: 120,
placeholder: '全部状态',
props: { 'aria-label': '订单状态' },
options: [
@@ -86,18 +87,19 @@ const queryFields = computed<QueryField[]>(() => [
{ value: 'REJECTED', label: '已驳回(旧契约)' },
],
},
{ key: 'keyword', type: 'input', placeholder: '订单号或发货客户名称', props: { 'aria-label': '订单关键词' } },
{ key: 'dateRange', type: 'daterange', props: { 'aria-label': '订单创建日期' } },
])
const orderColumns: DataTableColumn[] = [
{ key: 'actions', label: '操作', minWidth: 224, fixed: 'left', slotName: 'actions' },
{ key: 'status', label: '状态', width: 108, slotName: 'status' },
{ key: 'orderInfo', label: '订单信息', minWidth: 210, slotName: 'orderInfo' },
{ key: 'customer', label: '客户', minWidth: 190, showOverflowTooltip: true, slotName: 'customer' },
{ key: 'transport', label: '运输方案', minWidth: 180, slotName: 'transport' },
{ key: 'destination', label: '目的地', minWidth: 150, slotName: 'destination' },
{ key: 'receivingWarehouse', label: '平台收货仓', minWidth: 180, slotName: 'receivingWarehouse' },
{ key: 'express', label: '履约快递', minWidth: 160, slotName: 'express' },
{ key: 'status', label: '状态', width: 120, slotName: 'status' },
]
const expressRules: FormRules = {
@@ -145,11 +147,23 @@ function transportLabel(order: PlatformFirstLegOrderResource) {
}
function formattedDate(value: string | null | undefined) {
return value ? value.replace('T', ' ') : '-'
return value ? value.replace('T', ' ').slice(0, 16) : '-'
}
function tenantFor(tenantId: number | string) {
return tenants.value.find((tenant) => String(tenant.id) === String(tenantId))
}
function tenantName(tenantId: number | string) {
return tenants.value.find((tenant) => String(tenant.id) === String(tenantId))?.tenantName || `企业 ${tenantId}`
return tenantFor(tenantId)?.tenantName || `企业 ${tenantId}`
}
function customerDisplay(order: PlatformFirstLegOrderResource) {
const tenant = tenantFor(order.tenantId)
const name = tenant?.legalName?.trim() || tenant?.tenantName?.trim() || order.customerName?.trim() || '未命名企业'
const code = tenant?.tenantCode?.trim()
const secondary = code ? `客户编码 ${code}` : order.customerName?.trim()
return { name, secondary: secondary && secondary !== name ? secondary : '' }
}
async function loadTenants() {
@@ -535,13 +549,13 @@ onMounted(() => void loadTenants())
</el-dropdown>
</div>
</template>
<template #status="{ row }"><StatusBadge :status="statusLabel((row as PlatformFirstLegOrderResource).status)" /></template>
<template #orderInfo="{ row }"><div class="primary-cell"><strong>{{ (row as PlatformFirstLegOrderResource).orderNo || '-' }}</strong><span>{{ (row as PlatformFirstLegOrderResource).referenceId || '无客户参考号' }} · {{ formattedDate((row as PlatformFirstLegOrderResource).createdAt) }}</span></div></template>
<template #customer="{ row }"><div class="primary-cell"><strong>{{ tenantName((row as PlatformFirstLegOrderResource).tenantId) }}</strong><span>{{ (row as PlatformFirstLegOrderResource).customerName }} · {{ (row as PlatformFirstLegOrderResource).tenantId }}</span></div></template>
<template #customer="{ row }"><div class="primary-cell"><strong>{{ customerDisplay(row as PlatformFirstLegOrderResource).name }}</strong><span v-if="customerDisplay(row as PlatformFirstLegOrderResource).secondary">{{ customerDisplay(row as PlatformFirstLegOrderResource).secondary }}</span></div></template>
<template #transport="{ row }"><div class="primary-cell"><strong>{{ transportLabel(row as PlatformFirstLegOrderResource) }}</strong><span>{{ (row as PlatformFirstLegOrderResource).channelName || '未填写渠道' }}</span></div></template>
<template #destination="{ row }"><div class="primary-cell"><strong>{{ (row as PlatformFirstLegOrderResource).destinationWarehouseName || '-' }}</strong><span>{{ (row as PlatformFirstLegOrderResource).destinationCountryCode || '-' }}</span></div></template>
<template #receivingWarehouse="{ row }"><div class="primary-cell"><strong>{{ (row as PlatformFirstLegOrderResource).receivingWarehouseName || '-' }}</strong><span>{{ (row as PlatformFirstLegOrderResource).receivingWarehouseAddress || '-' }}</span></div></template>
<template #express="{ row }"><div class="primary-cell"><strong>{{ (row as PlatformFirstLegOrderResource).expressCompany || '未维护' }}</strong><span>{{ (row as PlatformFirstLegOrderResource).expressTrackingNo || '—' }}</span></div></template>
<template #status="{ row }"><StatusBadge :status="statusLabel((row as PlatformFirstLegOrderResource).status)" /></template>
<template #empty><el-empty description="当前没有符合条件的头程订单" /></template>
</DataTable>
</section>