优化
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { Check, CircleDot, Clock3, Paperclip } from '@lucide/vue'
|
||||
import { Check, CircleDot } from '@lucide/vue'
|
||||
import type { FirstLegOrder } from '@/modules/first-leg/types/firstLegOrder'
|
||||
import {
|
||||
FIRST_LEG_PROGRESS_STAGES,
|
||||
@@ -11,27 +11,11 @@ import {
|
||||
const props = defineProps<{ order: FirstLegOrder }>()
|
||||
|
||||
const currentIndex = computed(() => getFirstLegProgressIndex(props.order.status))
|
||||
const timeline = computed(() => [...props.order.timeline].reverse())
|
||||
|
||||
function stageState(index: number) {
|
||||
if (index < currentIndex.value) return 'is-complete'
|
||||
if (index === currentIndex.value) return 'is-current'
|
||||
return 'is-pending'
|
||||
}
|
||||
|
||||
function formatDateTime(value: string) {
|
||||
if (!value) return '时间待更新'
|
||||
const date = new Date(value)
|
||||
if (Number.isNaN(date.getTime())) return value
|
||||
return date.toLocaleString('zh-CN', {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
hour12: false,
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -54,37 +38,17 @@ function formatDateTime(value: string) {
|
||||
</ol>
|
||||
<p v-if="order.status === 'DRAFT'" class="draft-progress-note">订单提交后开始记录主状态进度。</p>
|
||||
|
||||
<div class="timeline-heading">
|
||||
<h4>进度记录</h4>
|
||||
<span>{{ timeline.length }} 条</span>
|
||||
</div>
|
||||
<el-empty v-if="timeline.length === 0" class="timeline-empty" description="暂无进度记录" :image-size="52" />
|
||||
<el-timeline v-else class="order-timeline">
|
||||
<el-timeline-item v-for="item in timeline" :key="item.id" :timestamp="formatDateTime(item.occurredAt)" placement="top" :type="item.kind === 'MAIN_STATUS' ? 'primary' : 'info'">
|
||||
<div class="timeline-title">
|
||||
<strong>{{ item.title }}</strong>
|
||||
<el-tag v-if="item.kind === 'CUSTOM_NODE'" size="small" effect="plain">业务节点</el-tag>
|
||||
<el-tag v-else-if="item.status" size="small" effect="plain">{{ getFirstLegStatusLabel(item.status) }}</el-tag>
|
||||
</div>
|
||||
<p v-if="item.description">{{ item.description }}</p>
|
||||
<div class="timeline-meta">
|
||||
<span>{{ item.operatorName || '平台' }}</span>
|
||||
<span v-if="item.kind === 'CUSTOM_NODE' && item.plannedAt"><Clock3 :size="13" />计划 {{ formatDateTime(item.plannedAt) }}</span>
|
||||
<span v-if="item.attachmentCount"><Paperclip :size="13" />{{ item.attachmentCount }} 个附件</span>
|
||||
</div>
|
||||
</el-timeline-item>
|
||||
</el-timeline>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.order-progress { margin-top: 22px; }
|
||||
.progress-heading, .timeline-heading, .timeline-title, .timeline-meta { display: flex; align-items: center; }
|
||||
.progress-heading { display: flex; align-items: center; }
|
||||
.progress-heading { justify-content: space-between; gap: 14px; }
|
||||
.progress-heading > div { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
|
||||
.progress-heading h3, .timeline-heading h4 { margin: 0; color: var(--navy); }
|
||||
.progress-heading h3 { margin: 0; color: var(--navy); }
|
||||
.progress-heading h3 { font-size: 15px; }
|
||||
.progress-heading span, .timeline-heading span { color: var(--muted); font-size: 11px; }
|
||||
.progress-heading span { color: var(--muted); font-size: 11px; }
|
||||
.progress-stages { display: grid; grid-template-columns: repeat(7, minmax(76px, 1fr)); margin: 16px 0 0; padding: 0; overflow-x: auto; list-style: none; }
|
||||
.progress-stages li { position: relative; display: flex; min-width: 76px; align-items: center; flex-direction: column; gap: 7px; color: #96a0a6; font-size: 10px; text-align: center; }
|
||||
.progress-stages li::before { position: absolute; top: 10px; right: 50%; left: -50%; height: 2px; background: #e1e6e8; content: ''; }
|
||||
@@ -95,15 +59,6 @@ function formatDateTime(value: string) {
|
||||
.is-complete .stage-marker { background: var(--primary); color: #fff; }
|
||||
.is-current .stage-label { color: var(--navy); font-weight: 700; }
|
||||
.draft-progress-note { margin: 12px 0 0; padding: 10px 12px; background: #f6f8f8; color: var(--muted); font-size: 11px; }
|
||||
.timeline-heading { justify-content: space-between; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); }
|
||||
.timeline-heading h4 { font-size: 13px; }
|
||||
.order-timeline { margin-top: 14px; padding-left: 5px; }
|
||||
.timeline-title { flex-wrap: wrap; gap: 8px; }
|
||||
.timeline-title strong { color: var(--navy); font-size: 12px; }
|
||||
.order-timeline p { margin: 6px 0; overflow-wrap: anywhere; color: var(--muted); font-size: 11px; line-height: 1.55; white-space: pre-wrap; }
|
||||
.timeline-meta { flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 10px; }
|
||||
.timeline-meta span { display: inline-flex; align-items: center; gap: 4px; }
|
||||
.timeline-empty { padding: 12px 0 0; }
|
||||
@media (max-width: 720px) {
|
||||
.progress-stages { grid-template-columns: repeat(7, 82px); padding-bottom: 8px; }
|
||||
.progress-heading { align-items: flex-start; }
|
||||
|
||||
Reference in New Issue
Block a user