feat(shipping-notice): 完善发货通知自动推进与多库存源复核闭环
This commit is contained in:
1 parent
cfa19a0b7b
commit
8e0bbf7a81
180 files changed
+31210
-1864
No files matched your search
@@ -67,8 +67,8 @@ const ACTION_CODE_TO_INTENT: Record<string, ShippingProcessingActionIntent> = {
|
||||
|
||||
const AUTOMATING_STATUSES = new Set(['processing', 'automating', 'queued']);
|
||||
const NEEDS_ACTION_STATUSES = new Set([
|
||||
'blocked', 'waiting_review', 'pending_review', 'failed', 'reparse_failed',
|
||||
'manual_upload_pending', 'upload_rpa_failed',
|
||||
'blocked', 'waiting_review', 'pending_review', 'waiting_human',
|
||||
'failed', 'reparse_failed', 'manual_upload_pending', 'upload_rpa_failed',
|
||||
]);
|
||||
/** 永不升为主 CTA 的动作码(仍可作次要/溢出)。 */
|
||||
const NEVER_PRIMARY_CODES = new Set(['cancel_task', 'cancel_run', 'view_details']);
|
||||
@@ -217,7 +217,7 @@ export function resolveProcessingActionPresentation(
|
||||
items.push(toItem(code, intent, surface));
|
||||
};
|
||||
|
||||
pushCode(projection.currentGate?.nextActionCode);
|
||||
pushCode(projection.primaryAction?.code || projection.currentGate?.nextActionCode);
|
||||
// [ORDER-STABLE] 对 availableActions 标准化(去重 + 字典序排序),确保后端返回顺序不影响前端按钮顺序。
|
||||
const normalizedAvailableActions = normalizeActionCodes(projection.availableActions || []);
|
||||
for (const action of normalizedAvailableActions) {
|
||||
@@ -250,7 +250,9 @@ export function resolveConversationTaskActionPresentation(
|
||||
if (!task) return empty;
|
||||
|
||||
const surface = options?.surface || 'right';
|
||||
const status = String(task.status_label || '').trim().toLowerCase();
|
||||
const userStatus = String(task.userStatus ?? '').trim().toLowerCase();
|
||||
const legacyStatus = String(task.status_label ?? '').trim().toLowerCase();
|
||||
const status = userStatus || legacyStatus;
|
||||
const isNeedsAction = task.group === 'needs_action' || NEEDS_ACTION_STATUSES.has(status);
|
||||
const isProcessing = task.group === 'processing' || AUTOMATING_STATUSES.has(status);
|
||||
if (task.group === 'history' || status === 'cancelled') {
|
||||
@@ -270,7 +272,7 @@ export function resolveConversationTaskActionPresentation(
|
||||
items.push(toItem(code, intent, surface));
|
||||
};
|
||||
|
||||
pushCode(task.primary_action);
|
||||
pushCode(task.primaryAction?.code || task.primary_action);
|
||||
// [ORDER-STABLE] 对 available_actions 标准化排序,确保后端顺序变化不影响按钮渲染顺序。
|
||||
const normalizedTaskActions = normalizeActionCodes(task.available_actions || []);
|
||||
for (const action of normalizedTaskActions) {
|
||||
|
||||
@@ -69,10 +69,12 @@ function mountStrip(projection: ShippingProcessingProjection, polling = false) {
|
||||
},
|
||||
shippingProcessing: {
|
||||
progress: {
|
||||
completedOfTotal: '已完成 {done} / {total}',
|
||||
currentNeedLabel: '当前需要:',
|
||||
title: '订单处理进度',
|
||||
currentStage: '当前阶段:{stage}',
|
||||
progressTitleWithStage: '订单处理进度 · {stage}',
|
||||
systemProcessingWithStage: '系统处理中 · {stage}',
|
||||
completedOfTotal: '已完成 {done} / {total}',
|
||||
currentNeedLabel: '当前需要:',
|
||||
viewProcessDetails: '查看流程详情',
|
||||
viewFullProcess: '查看完整流程',
|
||||
stageNodesUnavailable: '进度详情暂不可用',
|
||||
@@ -86,6 +88,7 @@ function mountStrip(projection: ShippingProcessingProjection, polling = false) {
|
||||
shippingNotice: {
|
||||
processGate: {
|
||||
actions: { confirm_customer: '确认客户', retry_freight_upload_rpa: '重试货代上传' },
|
||||
actionCodes: { confirm_customer: '确认客户', retry_freight_upload_rpa: '重试货代上传' },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -56,9 +56,49 @@ const isAutomating = computed(() => {
|
||||
});
|
||||
|
||||
/**
|
||||
* 标题仅「订单处理进度」,阶段名由节点/窄屏摘要表达。
|
||||
* 标题:默认「订单处理进度 · 当前阶段」;自动推进状态切换为「系统处理中 · 当前阶段」;
|
||||
* 无阶段名时退化为纯标题,保证标题行至少可读。
|
||||
*/
|
||||
const titleLine = computed(() => t('chat.shippingProcessing.progress.title'));
|
||||
const titleLine = computed(() => {
|
||||
const stage = currentStageName.value;
|
||||
if (isAutomating.value) {
|
||||
const withStage = te('chat.shippingProcessing.progress.systemProcessingWithStage');
|
||||
if (withStage && stage && stage !== '—') {
|
||||
return t('chat.shippingProcessing.progress.systemProcessingWithStage', { stage });
|
||||
}
|
||||
const fallback = t('chat.shippingProcessing.progress.title');
|
||||
return fallback;
|
||||
}
|
||||
const withStage = te('chat.shippingProcessing.progress.progressTitleWithStage');
|
||||
if (withStage && stage && stage !== '—') {
|
||||
return t('chat.shippingProcessing.progress.progressTitleWithStage', { stage });
|
||||
}
|
||||
return t('chat.shippingProcessing.progress.title');
|
||||
});
|
||||
|
||||
/**
|
||||
* 当前需要文案:优先 blockingReasonCode → gateReasons;无则回退 nextActionCode → actionCodes;
|
||||
* 自动推进状态 / 已生成正式 OT / 无有效 label 时不渲染。
|
||||
*/
|
||||
const currentNeedLabel = computed<string | null>(() => {
|
||||
if (props.hasFormalOt) return null;
|
||||
if (isAutomating.value) return null;
|
||||
const gate = props.projection.currentGate;
|
||||
if (!gate) return null;
|
||||
const reasonCode = String(gate.blockingReasonCode || '').trim();
|
||||
if (reasonCode) {
|
||||
const reasonKey = `chat.shippingProcessing.gateReasons.${reasonCode}`;
|
||||
if (te(reasonKey)) return t(reasonKey);
|
||||
}
|
||||
const nextCode = String(gate.nextActionCode || '').trim();
|
||||
if (nextCode) {
|
||||
const actionKey = `workspace.shippingNotice.processGate.actionCodes.${nextCode}`;
|
||||
if (te(actionKey)) return t(actionKey);
|
||||
const chatActionKey = `chat.shippingProcessing.action.${nextCode}`;
|
||||
if (te(chatActionKey)) return t(chatActionKey);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
/**
|
||||
* 窄屏当前阶段名:只用 stage code → 阶段 i18n,不用 waiting_system_start 等自动化 label_key。
|
||||
@@ -115,6 +155,13 @@ function nodeShortLabel(stage: string): string {
|
||||
data-testid="review-progress-title"
|
||||
>
|
||||
{{ titleLine }}
|
||||
<span
|
||||
v-if="currentNeedLabel"
|
||||
class="ml-2 font-normal text-secondary"
|
||||
data-testid="review-progress-current-need"
|
||||
>
|
||||
{{ t('chat.shippingProcessing.progress.currentNeedLabel') }}{{ currentNeedLabel }}
|
||||
</span>
|
||||
<span
|
||||
class="ml-2 font-normal text-secondary md:hidden"
|
||||
data-testid="review-progress-current-stage-narrow"
|
||||
|
||||
Reference in new issue
Block a user