This commit is contained in:
2026-08-11 19:35:28 +08:00
parent 886c7d3529
commit c690a30422
48 changed files with 935 additions and 171 deletions
@@ -73,4 +73,10 @@ describe('PlatformFirstLegOrdersPanel review queue', () => {
expect(source).toContain('approvePlatformFirstLegOrder(tenantId, String(order.id))')
expect(source).not.toContain('loadedTenantId.value')
})
it('does not expose unknown backend status or history action codes', () => {
expect(source).toContain("?.label || '未知状态'")
expect(source).toContain('item.reason || historyActionLabel(item.action)')
expect(source).not.toContain('item.reason || item.action')
})
})
@@ -141,7 +141,15 @@ const statusOptions: Array<{ value: PlatformFirstLegOrderStatus; label: string }
]
function statusLabel(status: PlatformFirstLegOrderStatus) {
return statusOptions.find((item) => item.value === status)?.label || status
return statusOptions.find((item) => item.value === status)?.label || '未知状态'
}
function historyActionLabel(action: string | null | undefined) {
return ({
CREATE: '创建订单', CREATED: '创建订单', SUBMIT: '提交订单', SUBMITTED: '提交订单',
APPROVE: '审核通过', APPROVED: '审核通过', REJECT: '审核驳回', REJECTED: '审核驳回',
CANCEL: '取消订单', CANCELLED: '取消订单', STATUS_UPDATE: '状态更新',
} as Record<string, string>)[action || ''] || '状态已更新。'
}
function transportLabel(order: PlatformFirstLegOrderResource) {
@@ -535,7 +543,7 @@ onMounted(() => void loadTenants())
<div class="detail-section">
<h3>状态历史</h3>
<el-timeline><el-timeline-item v-for="item in detail.statusHistory" :key="item.id" :timestamp="`${formattedDate(item.occurredAt)} · ${item.operatorName || '系统'}`" placement="top"><strong>{{ statusLabel(item.toStatus) }}</strong><p>{{ item.reason || item.action || '状态已更新。' }}</p></el-timeline-item></el-timeline>
<el-timeline><el-timeline-item v-for="item in detail.statusHistory" :key="item.id" :timestamp="`${formattedDate(item.occurredAt)} · ${item.operatorName || '系统'}`" placement="top"><strong>{{ statusLabel(item.toStatus) }}</strong><p>{{ item.reason || historyActionLabel(item.action) }}</p></el-timeline-item></el-timeline>
</div>
</template>
<el-empty v-else-if="!detailLoading" description="订单详情暂不可用"><el-button type="primary" @click="closeDetailPage"><ArrowLeft :size="16" />返回订单列表</el-button></el-empty>