chore(shipping-notice): 统一货代发货生命周期阶段命名并优化全链路业务逻辑

This commit is contained in:
hugo committed 2026-08-17 19:56:51 +08:00
1 parent 5ef8329bd8
commit 4ec4e57005
183 files changed
+14653 -3936

No files matched your search

@@ -1,8 +1,8 @@
<!--
features/chat/components/shipping-review/ReviewDocumentNavigation.vue
用途:订单处理工作台 OT/PDF 导航(按数量响应式:隐藏 / 顶栏标签 / 左侧列表 / 窄屏抽屉)。
用途:订单处理工作台 OT/PDF 导航(按数量响应式:隐藏 / 紧凑标签 / 左侧列表 / 窄屏抽屉)。
依赖:vue-i18n、lucide-vue-next。
逻辑:1 份隐藏;2–4 顶栏;≥5 左侧列表(可收起);20+ 搜索过滤;窄屏「订单 i/n」抽屉。
逻辑:1 份隐藏;桌面端 2–4 紧凑标签、5–20 左侧列表(可收起);20+ 搜索过滤;窄屏「订单 i/n」抽屉。
-->
<script setup lang="ts">
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
@@ -26,8 +26,12 @@ export type ReviewDocumentNavItem = {
po_number?: string | null;
customer_name?: string | null;
stage_label?: string | null;
/** 队列接口下发的生命周期码;仅用于本地化展示,不参与阶段裁决。 */
lifecycle_stage?: ReviewLifecycleStageCode | null;
};
type ReviewLifecycleStageCode = 'intake_parse' | 'order_review' | 'fulfillment_prep' | 'upload_complete';
export type ReviewDocumentNavMode = 'hidden' | 'tabs' | 'sidebar' | 'sidebar_search' | 'narrow';
const props = defineProps<{
@@ -82,6 +86,7 @@ const mode = computed<ReviewDocumentNavMode>(() => {
const count = props.items.length;
if (count <= 1) return 'hidden';
if (isNarrow.value) return 'narrow';
// 多文件先选文件、后查看阶段;2–4 用紧凑标签,5+ 才占用左侧工作列。
if (count <= 4) return 'tabs';
if (count <= 20) return 'sidebar';
return 'sidebar_search';
@@ -102,6 +107,14 @@ function caseStatusLabel(status: string): string {
return te(key) ? t(key) : t('chat.shippingOrderReview.caseStatuses.unknown');
}
/** 后端阶段码只做 i18n 投影;缺失时保留空白,禁止按 Case 状态补造阶段。 */
function lifecycleStageLabel(item: ReviewDocumentNavItem): string | null {
const code = String(item.lifecycle_stage || '').trim() as ReviewLifecycleStageCode;
if (!['intake_parse', 'order_review', 'fulfillment_prep', 'upload_complete'].includes(code)) return null;
const key = `chat.shippingOrderReview.lifecycle.stages.${code}`;
return te(key) ? t(key) : null;
}
/**
* 导航状态图标语义。
*/
@@ -208,11 +221,15 @@ function onSelect(caseNo: string) {
class="h-3 w-3 shrink-0 text-slate-400"
aria-hidden="true"
/>
<span class="truncate">{{ item.po_number || item.file_name || t('chat.shippingOrderReview.unnamedDocument') }}</span>
<span class="truncate">{{ item.file_name || t('chat.shippingOrderReview.unnamedDocument') }}</span>
</span>
<span class="truncate text-[10px] text-slate-500 dark:text-slate-400">
{{ item.customer_name || caseStatusLabel(item.status) }}
<template v-if="item.stage_label"> · {{ item.stage_label }}</template>
{{ [
item.po_number,
lifecycleStageLabel(item),
item.stage_label,
item.customer_name || caseStatusLabel(item.status),
].filter(Boolean).join(' · ') }}
</span>
</button>
</div>
@@ -310,10 +327,14 @@ function onSelect(caseNo: string) {
/>
<span class="min-w-0 flex-1">
<span class="block truncate font-medium text-primary">
{{ item.po_number || item.file_name || t('chat.shippingOrderReview.unnamedDocument') }}
{{ item.file_name || t('chat.shippingOrderReview.unnamedDocument') }}
</span>
<span class="block truncate text-[10px] text-muted">
{{ item.customer_name || caseStatusLabel(item.status) }}
{{ [
item.po_number,
lifecycleStageLabel(item),
item.customer_name || caseStatusLabel(item.status),
].filter(Boolean).join(' · ') }}
</span>
</span>
</template>
@@ -367,7 +388,9 @@ function onSelect(caseNo: string) {
@click="onSelect(item.case_no)"
>
<span class="font-medium">{{ item.file_name || t('chat.shippingOrderReview.unnamedDocument') }}</span>
<span class="text-[10px] text-muted">{{ caseStatusLabel(item.status) }}</span>
<span class="text-[10px] text-muted">
{{ [lifecycleStageLabel(item), caseStatusLabel(item.status)].filter(Boolean).join(' · ') }}
</span>
</button>
</div>
</aside>