优化
This commit is contained in:
@@ -385,5 +385,5 @@ export async function listPlatformUnifiedOrderFeeDetails(accountId: string, inbo
|
||||
}
|
||||
|
||||
export function unifiedOrderStatusLabel(status: UnifiedOrderMainStatus) {
|
||||
return unifiedOrderStatusOptions.find((item) => item.value === status)?.label || status
|
||||
return unifiedOrderStatusOptions.find((item) => item.value === status)?.label || '未知状态'
|
||||
}
|
||||
|
||||
@@ -20,4 +20,11 @@ describe('OrderFulfillmentTreePanel contract', () => {
|
||||
expect(source).toContain('暂无拆分分片')
|
||||
expect(source).toContain('@media (max-width: 720px)')
|
||||
})
|
||||
|
||||
it('translates fragment roles and statuses instead of exposing backend enums', () => {
|
||||
expect(source).toContain('unifiedOrderFulfillmentRoleLabel(row.splitRole)')
|
||||
expect(source).toContain('unifiedOrderFulfillmentStatusLabel(row.status, row.splitRole)')
|
||||
expect(source).not.toContain(':status="row.status')
|
||||
expect(source).not.toContain('return role ||')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -5,6 +5,7 @@ import ApiErrorMeta from '@/shared/components/ApiErrorMeta.vue'
|
||||
import LoadErrorState from '@/shared/components/LoadErrorState.vue'
|
||||
import StatusBadge from '@/shared/components/StatusBadge.vue'
|
||||
import { getPlatformOrderFulfillmentTree, type UnifiedOrderFulfillmentTree } from '../api/orderFulfillment'
|
||||
import { unifiedOrderFulfillmentRoleLabel, unifiedOrderFulfillmentStatusLabel } from '../status'
|
||||
|
||||
const props = defineProps<{ tenantId: string; orderId: string; compact?: boolean }>()
|
||||
const tree = ref<UnifiedOrderFulfillmentTree | null>(null)
|
||||
@@ -19,12 +20,6 @@ async function load() {
|
||||
finally { loading.value = false }
|
||||
}
|
||||
|
||||
function roleLabel(role: string | null) {
|
||||
if (role === 'REMAINDER' || role === 'ACTIVE_REMAINDER') return '当前余量'
|
||||
if (role === 'LOADED' || role === 'COMPLETED_FRAGMENT' || role === 'SOURCE_COMPLETED') return '已完成分片'
|
||||
return role || '分片'
|
||||
}
|
||||
|
||||
onMounted(() => { void load() })
|
||||
</script>
|
||||
|
||||
@@ -44,11 +39,11 @@ onMounted(() => { void load() })
|
||||
<el-alert v-if="tree.historicalTwoChildModel" type="info" :closable="false" show-icon title="该记录使用历史双子单模型,仅兼容展示;新拆分不会再生成已装子单。" />
|
||||
<el-table :data="tree.fragments" row-key="orderId" empty-text="暂无拆分分片">
|
||||
<el-table-column label="分片订单" min-width="180"><template #default="{ row }"><strong>{{ row.orderNo || row.orderId }}</strong><small v-if="row.splitSequence != null"> · 第 {{ row.splitSequence }} 次</small></template></el-table-column>
|
||||
<el-table-column label="类型" width="120"><template #default="{ row }">{{ roleLabel(row.splitRole) }}</template></el-table-column>
|
||||
<el-table-column label="类型" width="120"><template #default="{ row }">{{ unifiedOrderFulfillmentRoleLabel(row.splitRole) }}</template></el-table-column>
|
||||
<el-table-column label="本单计划" width="100"><template #default="{ row }">{{ row.plannedPackageCount ?? '—' }} 箱</template></el-table-column>
|
||||
<el-table-column label="已拣" width="90"><template #default="{ row }">{{ row.pickedPackageCount ?? '—' }}</template></el-table-column>
|
||||
<el-table-column label="未拣" width="90"><template #default="{ row }">{{ row.unpickedPackageCount ?? '—' }}</template></el-table-column>
|
||||
<el-table-column label="状态" width="130"><template #default="{ row }"><StatusBadge :status="row.status || roleLabel(row.splitRole)" /></template></el-table-column>
|
||||
<el-table-column label="状态" width="130"><template #default="{ row }"><StatusBadge :status="unifiedOrderFulfillmentStatusLabel(row.status, row.splitRole)" /></template></el-table-column>
|
||||
<el-table-column label="柜次" min-width="150"><template #default="{ row }">{{ row.containerBookingId || '—' }}</template></el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
|
||||
@@ -4,3 +4,12 @@ export {
|
||||
type UnifiedOrderFeeDetailResource,
|
||||
type UnifiedOrderResource,
|
||||
} from './api/unifiedOrders'
|
||||
|
||||
export {
|
||||
unifiedOrderFulfillmentRoleLabel,
|
||||
unifiedOrderFulfillmentStatusLabel,
|
||||
unifiedOrderHistoryActionLabel,
|
||||
unifiedOrderLoadingStatusLabel,
|
||||
unifiedOrderReviewStatusLabel,
|
||||
unifiedOrderStatusLabel,
|
||||
} from './status'
|
||||
|
||||
@@ -79,7 +79,7 @@ describe('UnifiedOrdersView contract', () => {
|
||||
expect(source).toContain('v-model:page-size="pageSize"')
|
||||
expect(source).toContain('slotName: \'orderStatus\'')
|
||||
expect(source).toContain('slotName: \'measurementReviewStatus\'')
|
||||
expect(source).toContain("NOT_SUBMITTED: '未提交'")
|
||||
expect(source).toContain('unifiedOrderReviewStatusLabel(value, \'未录入\')')
|
||||
expect(source).toContain("{ key: 'customerRemark', prop: 'customerRemark', label: '备注'")
|
||||
expect(source).toContain("{ key: 'latestInternalNote', prop: 'latestInternalNote', label: '客服内部备注'")
|
||||
expect(source.match(/<LineClampText v-if="column\.key === 'remark'"/g)).toHaveLength(3)
|
||||
@@ -156,6 +156,10 @@ describe('UnifiedOrdersView contract', () => {
|
||||
expect(source).toContain(':title="moreUnifiedOrderActionsLabel(row as UnifiedOrderResource)"')
|
||||
expect(source).toContain("can('platform:order:note')")
|
||||
expect(source).toContain('await loadOrders()')
|
||||
expect(source).toContain('orderStatusLabel(detail.summary.internalOrderStatus || detail.summary.mainStatus)')
|
||||
expect(source).toContain('feeReviewLabel(detail.summary.feeReviewStatus)')
|
||||
expect(source).toContain('unifiedOrderLoadingStatusLabel(detail.summary.transport?.loadingStatus)')
|
||||
expect(source).not.toContain("value.replaceAll('_', ' ')")
|
||||
})
|
||||
|
||||
it('exposes the single-remainder fulfillment aggregate in row expansion and detail', () => {
|
||||
@@ -196,6 +200,9 @@ describe('UnifiedOrdersView contract', () => {
|
||||
expect(source).not.toContain("partyValue(detail.order.parties, 'CONSIGNEE'")
|
||||
expect(source).toContain("cargoTotal(detail.order.cargoes, 'netWeightKg')")
|
||||
expect(source).toContain('暂无费用数据')
|
||||
expect(source).toContain('firstLegTransportModeLabel(detail.order.order?.transportMode)')
|
||||
expect(source).toContain('firstLegPickupMethodLabel(detail.order.order?.pickupMethod)')
|
||||
expect(source).toContain('firstLegDestinationTypeLabel(detail.order.order?.destinationType)')
|
||||
})
|
||||
|
||||
it('mounts downstream progress inside the existing order detail without opening unsafe writes', () => {
|
||||
|
||||
@@ -30,7 +30,22 @@ import LoadErrorState from '@/shared/components/LoadErrorState.vue'
|
||||
import LineClampText from '@/shared/components/LineClampText.vue'
|
||||
import QueryToolbar, { type QueryField, type QueryModel } from '@/shared/components/QueryToolbar.vue'
|
||||
import StatusBadge from '@/shared/components/StatusBadge.vue'
|
||||
import {
|
||||
firstLegBusinessTypeLabel,
|
||||
firstLegContainerModeLabel,
|
||||
firstLegDestinationTypeLabel,
|
||||
firstLegPickupMethodLabel,
|
||||
firstLegTaxModeLabel,
|
||||
firstLegTradeTermLabel,
|
||||
firstLegTransportModeLabel,
|
||||
} from '@/shared/utils/firstLegBusinessLabels'
|
||||
import { UnifiedOrderWorkflowPanel } from '@/modules/unified-orders/workflows'
|
||||
import {
|
||||
unifiedOrderHistoryActionLabel,
|
||||
unifiedOrderLoadingStatusLabel,
|
||||
unifiedOrderReviewStatusLabel,
|
||||
unifiedOrderStatusLabel,
|
||||
} from '@/modules/unified-orders/status'
|
||||
import {
|
||||
downloadWeightImage,
|
||||
getInboundMeasurement,
|
||||
@@ -345,34 +360,29 @@ function displayField(row: UnifiedOrderResource, property: string | undefined) {
|
||||
if (property.endsWith('At') || property.endsWith('Date')) return formatDate(String(value))
|
||||
if (property === 'measurementReviewStatus') return measurementStatusLabel(String(value))
|
||||
if (property === 'internalOrderStatus') return orderStatusLabel(String(value))
|
||||
if (property === 'feeReviewStatus') return feeReviewLabel(String(value))
|
||||
if (property === 'loadingStatus') return unifiedOrderLoadingStatusLabel(String(value))
|
||||
if (property === 'businessType') return firstLegBusinessTypeLabel(String(value))
|
||||
if (property === 'pickupMethod') return firstLegPickupMethodLabel(String(value))
|
||||
if (property === 'taxMode') return firstLegTaxModeLabel(String(value))
|
||||
if (property === 'destinationType') return firstLegDestinationTypeLabel(String(value))
|
||||
return String(value)
|
||||
}
|
||||
|
||||
function statusLabel(value: UnifiedOrderMainStatus | string | null) {
|
||||
return unifiedOrderStatusOptions.find((item) => item.value === value)?.label || orderStatusLabel(value) || '状态更新'
|
||||
return unifiedOrderStatusLabel(value, '状态更新')
|
||||
}
|
||||
|
||||
function historyActionLabel(value: string | null | undefined) {
|
||||
return ({
|
||||
CREATE: '创建订单', CREATED: '创建订单', SUBMITTED: '提交订单', APPROVED: '审核通过',
|
||||
ORDER_APPROVED: '订单审核通过', REJECTED: '审核驳回', MEASURE_APPROVE: '测量审核通过',
|
||||
MEASURE_REJECT: '测量审核驳回', INBOUND_BEGIN: '开始入库', INBOUND_COMPLETE: '入库完成',
|
||||
UI_FIXTURE_MEASURE_APPROVE: '测量数据审核通过', UI_FIXTURE_INBOUND_BEGIN: '开始入库',
|
||||
STATUS_UPDATE: '状态更新',
|
||||
} as Record<string, string>)[value || ''] || (value ? value.replaceAll('_', ' ') : '状态更新')
|
||||
return unifiedOrderHistoryActionLabel(value)
|
||||
}
|
||||
|
||||
function measurementStatusLabel(value: string | null | undefined) {
|
||||
return ({ NOT_SUBMITTED: '未提交', UNRECORDED: '未录入', PENDING: '待审核', APPROVED: '审核通过', REJECTED: '审核驳回' } as Record<string, string>)[value || ''] || value || '未录入'
|
||||
return unifiedOrderReviewStatusLabel(value, '未录入')
|
||||
}
|
||||
|
||||
function orderStatusLabel(value: string | null | undefined) {
|
||||
return ({
|
||||
DRAFT: '草稿', SUBMITTED: '待审核', APPROVED: '已审核', ACCEPTED: '已受理', REJECTED: '已驳回',
|
||||
PROCESSING: '处理中', COMPLETED: '已完成', CANCELLED: '已取消', PENDING_REVIEW: '待审核',
|
||||
WAIT_MEASURE: '待测量数据', INBOUNDED: '已入库', WAIT_SPLIT: '待分柜', LOADING: '装柜中',
|
||||
LOADED: '装柜完成', DELIVERED: '派送完成',
|
||||
} as Record<string, string>)[value || ''] || value || '—'
|
||||
return unifiedOrderStatusLabel(value)
|
||||
}
|
||||
|
||||
function cargoValue(cargo: Record<string, unknown>, key: string) {
|
||||
@@ -405,11 +415,12 @@ function feeNumber(value: number | null | undefined) {
|
||||
}
|
||||
|
||||
function feeReviewLabel(value: string | null | undefined) {
|
||||
return ({ PENDING: '待审核', APPROVED: '审核通过', REJECTED: '审核驳回', NOT_SUBMITTED: '未提交' } as Record<string, string>)[value || ''] || value || '—'
|
||||
return unifiedOrderReviewStatusLabel(value)
|
||||
}
|
||||
|
||||
function feeDirectionLabel(value: string | null | undefined) {
|
||||
return ({ RECEIVABLE: '应收', PAYABLE: '应付' } as Record<string, string>)[value || ''] || value || '—'
|
||||
if (!value) return '—'
|
||||
return ({ RECEIVABLE: '应收', PAYABLE: '应付' } as Record<string, string>)[value] || '未知方向'
|
||||
}
|
||||
|
||||
async function loadFeeDetails() {
|
||||
@@ -848,9 +859,9 @@ onMounted(() => {
|
||||
<div class="panel-title"><div><h2>订单基本信息</h2><p>{{ detail.summary.orderNo || `订单 ${detail.summary.orderId}` }}</p></div><Box :size="19" /></div>
|
||||
<dl class="order-info-grid">
|
||||
<div><dt>公司</dt><dd>{{ customerName(detail.summary) }}</dd></div>
|
||||
<div><dt>运输方式</dt><dd>{{ detail.order.order?.transportMode || '—' }}</dd></div>
|
||||
<div><dt>运输方式</dt><dd>{{ firstLegTransportModeLabel(detail.order.order?.transportMode) }}</dd></div>
|
||||
<div><dt>当前状态</dt><dd><StatusBadge :status="statusLabel(detail.summary.mainStatus)" /></dd></div>
|
||||
<div><dt>内部订单状态</dt><dd>{{ detail.summary.internalOrderStatus || '—' }}</dd></div>
|
||||
<div><dt>内部订单状态</dt><dd>{{ orderStatusLabel(detail.summary.internalOrderStatus || detail.summary.mainStatus) }}</dd></div>
|
||||
<div><dt>平台收货仓</dt><dd>{{ detail.summary.receivingWarehouseName || '—' }}</dd></div>
|
||||
<div><dt>收货仓地址</dt><dd>{{ detail.order.order?.receivingWarehouseAddress || '—' }}</dd></div>
|
||||
<div><dt>目的仓</dt><dd>{{ detail.summary.destinationWarehouseName || '—' }}</dd></div>
|
||||
@@ -860,13 +871,13 @@ onMounted(() => {
|
||||
<div><dt>目的仓联系人</dt><dd>{{ detail.summary.destinationContact || '—' }}</dd></div>
|
||||
<div><dt>目的仓联系人电话</dt><dd>{{ detail.summary.destinationContactPhone || '—' }}</dd></div>
|
||||
<div><dt>渠道</dt><dd>{{ detail.summary.channelName || '—' }}</dd></div>
|
||||
<div><dt>业务类型</dt><dd>{{ detail.summary.businessType || '—' }}</dd></div>
|
||||
<div><dt>贸易条款</dt><dd>{{ detail.order.order?.tradeTerm || '—' }}</dd></div>
|
||||
<div><dt>买单 / 退税</dt><dd>{{ detail.order.order?.taxMode || '—' }}</dd></div>
|
||||
<div><dt>费用审核状态</dt><dd>{{ detail.summary.feeReviewStatus || '—' }}</dd></div>
|
||||
<div><dt>业务类型</dt><dd>{{ firstLegBusinessTypeLabel(detail.summary.businessType) }}</dd></div>
|
||||
<div><dt>贸易条款</dt><dd>{{ firstLegTradeTermLabel(detail.order.order?.tradeTerm) }}</dd></div>
|
||||
<div><dt>买单 / 退税</dt><dd>{{ firstLegTaxModeLabel(detail.order.order?.taxMode) }}</dd></div>
|
||||
<div><dt>费用审核状态</dt><dd>{{ feeReviewLabel(detail.summary.feeReviewStatus) }}</dd></div>
|
||||
<div><dt>是否扣货</dt><dd>{{ displayBoolean(detail.summary.holdCargo) }}</dd></div>
|
||||
<div><dt>扣货理由</dt><dd>{{ detail.summary.holdReason || '—' }}</dd></div>
|
||||
<div><dt>提货方式</dt><dd>{{ detail.order.order?.pickupMethod || '—' }}</dd></div>
|
||||
<div><dt>提货方式</dt><dd>{{ firstLegPickupMethodLabel(detail.order.order?.pickupMethod) }}</dd></div>
|
||||
<div><dt>提货时间</dt><dd>{{ formatDate(detail.summary.pickupAt) }}</dd></div>
|
||||
<div><dt>到仓时间</dt><dd>{{ detail.order.order?.receivingTime || '—' }}</dd></div>
|
||||
<div><dt>货物到仓时间</dt><dd>{{ formatDate(detail.summary.expectedArrivalAt || detail.summary.inboundCompletedAt) }}</dd></div>
|
||||
@@ -877,9 +888,9 @@ onMounted(() => {
|
||||
<div><dt>船名 / 航次</dt><dd>{{ detail.summary.transport?.vesselName || '—' }} / {{ detail.summary.transport?.voyageNo || '—' }}</dd></div>
|
||||
<div><dt>开船时间</dt><dd>{{ formatDate(detail.summary.transport?.sailingAt) }}</dd></div>
|
||||
<div><dt>到港时间</dt><dd>{{ formatDate(detail.summary.transport?.portArrivalAt) }}</dd></div>
|
||||
<div><dt>配载状态</dt><dd>{{ detail.summary.transport?.loadingStatus || '—' }}</dd></div>
|
||||
<div><dt>目的仓类型</dt><dd>{{ detail.order.order?.destinationType || '—' }}</dd></div>
|
||||
<div><dt>是否整柜</dt><dd>{{ detail.order.order?.containerMode || '—' }}</dd></div>
|
||||
<div><dt>配载状态</dt><dd>{{ unifiedOrderLoadingStatusLabel(detail.summary.transport?.loadingStatus) }}</dd></div>
|
||||
<div><dt>目的仓类型</dt><dd>{{ firstLegDestinationTypeLabel(detail.order.order?.destinationType) }}</dd></div>
|
||||
<div><dt>是否整柜</dt><dd>{{ firstLegContainerModeLabel(detail.order.order?.containerMode) }}</dd></div>
|
||||
<div><dt>商检验</dt><dd>{{ displayBoolean(detail.order.order?.customsInspection) }}</dd></div>
|
||||
<div><dt>总箱数</dt><dd>{{ detail.summary.totalPackageCount ?? '—' }} 箱</dd></div>
|
||||
<div><dt>总托盘数</dt><dd>{{ detail.summary.totalPalletCount ?? '—' }}</dd></div>
|
||||
@@ -1097,7 +1108,7 @@ onMounted(() => {
|
||||
<template #customer="{ row }"><div class="primary-cell"><strong>{{ customerName(row as UnifiedOrderResource) }}</strong><span>客户 ID {{ (row as UnifiedOrderResource).tenantId }}</span></div></template>
|
||||
<template #receivingWarehouseName="{ row }">{{ (row as UnifiedOrderResource).receivingWarehouseName || '—' }}</template>
|
||||
<template #destinationWarehouseName="{ row }">{{ (row as UnifiedOrderResource).destinationWarehouseName || '—' }}</template>
|
||||
<template #transport="{ row }"><div class="primary-cell"><strong>{{ (row as UnifiedOrderResource).transport?.containerNo || (row as UnifiedOrderResource).transport?.loadingStatus || '—' }}</strong><span v-if="(row as UnifiedOrderResource).transport?.vesselName">{{ (row as UnifiedOrderResource).transport?.vesselName }} · {{ (row as UnifiedOrderResource).transport?.voyageNo || '—' }}</span></div></template>
|
||||
<template #transport="{ row }"><div class="primary-cell"><strong>{{ (row as UnifiedOrderResource).transport?.containerNo || unifiedOrderLoadingStatusLabel((row as UnifiedOrderResource).transport?.loadingStatus) }}</strong><span v-if="(row as UnifiedOrderResource).transport?.vesselName">{{ (row as UnifiedOrderResource).transport?.vesselName }} · {{ (row as UnifiedOrderResource).transport?.voyageNo || '—' }}</span></div></template>
|
||||
<template #cargo="{ row }"><span>{{ (row as UnifiedOrderResource).totalPackageCount ?? '—' }} 箱</span><span v-if="(row as UnifiedOrderResource).measurement?.actualGrossWeightKg !== null && (row as UnifiedOrderResource).measurement?.actualGrossWeightKg !== undefined"> · {{ formatNumber((row as UnifiedOrderResource).measurement?.actualGrossWeightKg) }} kg</span><span v-if="(row as UnifiedOrderResource).measurement?.actualVolumeCbm !== null && (row as UnifiedOrderResource).measurement?.actualVolumeCbm !== undefined"> · {{ formatNumber((row as UnifiedOrderResource).measurement?.actualVolumeCbm, 3) }} m³</span></template>
|
||||
<template #expectedShipDate="{ row }">{{ formatDate((row as UnifiedOrderResource).expectedShipDate) }}</template>
|
||||
<template #updatedAt="{ row }">{{ formatDate((row as UnifiedOrderResource).updatedAt) }}</template>
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
unifiedOrderFulfillmentRoleLabel,
|
||||
unifiedOrderFulfillmentStatusLabel,
|
||||
unifiedOrderHistoryActionLabel,
|
||||
unifiedOrderLoadingStatusLabel,
|
||||
unifiedOrderReviewStatusLabel,
|
||||
unifiedOrderStatusLabel,
|
||||
} from './status'
|
||||
|
||||
describe('unified order status labels', () => {
|
||||
it('maps order, review and loading statuses to domain-specific Chinese', () => {
|
||||
expect(unifiedOrderStatusLabel('WAIT_SPLIT')).toBe('待分柜')
|
||||
expect(unifiedOrderReviewStatusLabel('APPROVED')).toBe('审核通过')
|
||||
expect(unifiedOrderLoadingStatusLabel('LOADED')).toBe('已配载')
|
||||
})
|
||||
|
||||
it('never exposes unknown backend enums', () => {
|
||||
expect(unifiedOrderStatusLabel('NEW_ORDER_STATE')).toBe('未知状态')
|
||||
expect(unifiedOrderReviewStatusLabel('NEW_REVIEW_STATE')).toBe('未知状态')
|
||||
expect(unifiedOrderLoadingStatusLabel('NEW_LOADING_STATE')).toBe('未知状态')
|
||||
expect(unifiedOrderHistoryActionLabel('NEW_ACTION')).toBe('状态更新')
|
||||
expect(unifiedOrderFulfillmentRoleLabel('NEW_ROLE')).toBe('未知类型')
|
||||
expect(unifiedOrderFulfillmentStatusLabel('NEW_FRAGMENT_STATE', 'REMAINDER')).toBe('未知状态')
|
||||
})
|
||||
|
||||
it('uses the fragment role when a fulfillment status is absent', () => {
|
||||
expect(unifiedOrderFulfillmentStatusLabel(null, 'ACTIVE_REMAINDER')).toBe('当前余量')
|
||||
expect(unifiedOrderFulfillmentStatusLabel(undefined, 'COMPLETED_FRAGMENT')).toBe('已完成分片')
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,98 @@
|
||||
const orderStatusLabels: Record<string, string> = {
|
||||
DRAFT: '草稿',
|
||||
SUBMITTED: '待审核',
|
||||
APPROVED: '已审核',
|
||||
ACCEPTED: '已受理',
|
||||
REJECTED: '已驳回',
|
||||
PROCESSING: '处理中',
|
||||
COMPLETED: '已完成',
|
||||
CANCELLED: '已取消',
|
||||
PENDING_REVIEW: '待审核',
|
||||
WAIT_MEASURE: '待测量数据',
|
||||
INBOUNDED: '已入库',
|
||||
WAIT_SPLIT: '待分柜',
|
||||
LOADING: '装柜中',
|
||||
LOADED: '装柜完成',
|
||||
DELIVERED: '派送完成',
|
||||
}
|
||||
|
||||
const reviewStatusLabels: Record<string, string> = {
|
||||
NOT_SUBMITTED: '未提交',
|
||||
UNRECORDED: '未录入',
|
||||
PENDING: '待审核',
|
||||
APPROVED: '审核通过',
|
||||
REJECTED: '审核驳回',
|
||||
CONFIRMED: '已确认',
|
||||
}
|
||||
|
||||
const loadingStatusLabels: Record<string, string> = {
|
||||
NOT_LOADED: '未配载',
|
||||
WAIT_LOADING: '待配载',
|
||||
EDITING: '预装柜中',
|
||||
LOADING: '配载中',
|
||||
LOADED: '已配载',
|
||||
COMPLETED: '装柜完成',
|
||||
}
|
||||
|
||||
const historyActionLabels: Record<string, string> = {
|
||||
CREATE: '创建订单',
|
||||
CREATED: '创建订单',
|
||||
SUBMITTED: '提交订单',
|
||||
APPROVED: '审核通过',
|
||||
ORDER_APPROVED: '订单审核通过',
|
||||
REJECTED: '审核驳回',
|
||||
MEASURE_APPROVE: '测量审核通过',
|
||||
MEASURE_REJECT: '测量审核驳回',
|
||||
INBOUND_BEGIN: '开始入库',
|
||||
INBOUND_COMPLETE: '入库完成',
|
||||
UI_FIXTURE_MEASURE_APPROVE: '测量数据审核通过',
|
||||
UI_FIXTURE_INBOUND_BEGIN: '开始入库',
|
||||
STATUS_UPDATE: '状态更新',
|
||||
}
|
||||
|
||||
const fulfillmentRoleLabels: Record<string, string> = {
|
||||
REMAINDER: '当前余量',
|
||||
ACTIVE_REMAINDER: '当前余量',
|
||||
LOADED: '已完成分片',
|
||||
COMPLETED_FRAGMENT: '已完成分片',
|
||||
SOURCE_COMPLETED: '已完成分片',
|
||||
}
|
||||
|
||||
function normalized(value: string | null | undefined) {
|
||||
return value?.trim().toUpperCase() || ''
|
||||
}
|
||||
|
||||
function statusLabel(value: string | null | undefined, labels: Record<string, string>, emptyLabel = '—') {
|
||||
const status = normalized(value)
|
||||
if (!status) return emptyLabel
|
||||
return labels[status] || '未知状态'
|
||||
}
|
||||
|
||||
export function unifiedOrderStatusLabel(value: string | null | undefined, emptyLabel = '—') {
|
||||
return statusLabel(value, orderStatusLabels, emptyLabel)
|
||||
}
|
||||
|
||||
export function unifiedOrderReviewStatusLabel(value: string | null | undefined, emptyLabel = '—') {
|
||||
return statusLabel(value, reviewStatusLabels, emptyLabel)
|
||||
}
|
||||
|
||||
export function unifiedOrderLoadingStatusLabel(value: string | null | undefined, emptyLabel = '—') {
|
||||
return statusLabel(value, loadingStatusLabels, emptyLabel)
|
||||
}
|
||||
|
||||
export function unifiedOrderHistoryActionLabel(value: string | null | undefined) {
|
||||
const action = normalized(value)
|
||||
if (!action) return '状态更新'
|
||||
return historyActionLabels[action] || '状态更新'
|
||||
}
|
||||
|
||||
export function unifiedOrderFulfillmentRoleLabel(value: string | null | undefined) {
|
||||
const role = normalized(value)
|
||||
if (!role) return '分片'
|
||||
return fulfillmentRoleLabels[role] || '未知类型'
|
||||
}
|
||||
|
||||
export function unifiedOrderFulfillmentStatusLabel(status: string | null | undefined, role: string | null | undefined) {
|
||||
if (!status) return unifiedOrderFulfillmentRoleLabel(role)
|
||||
return unifiedOrderStatusLabel(status)
|
||||
}
|
||||
Reference in New Issue
Block a user