feat(shipping-notice): 收敛复核状态隔离、STP 重试幂等与 XFA 合成预览标注
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
84a881b554
commit
74270adc22
149 files changed
+20111
-3871
No files matched your search
+185
-1
@@ -27,6 +27,10 @@ function mountSummary(eligibility: ShippingOrderReviewBuildEligibility, customer
|
||||
canBuildYes: '可建单',
|
||||
canBuildNo: '待处理',
|
||||
blockReasons: { require_manual_review: '需人工确认', unknown: '未知阻断' },
|
||||
gates: {
|
||||
customer_confirmed: '客户已确认',
|
||||
required_fields_complete: '必填字段完整',
|
||||
},
|
||||
},
|
||||
workbench: {
|
||||
primaryBlock: '首要阻断原因',
|
||||
@@ -95,6 +99,25 @@ describe('ReviewBuildEligibilitySummary', () => {
|
||||
expect(wrapper.find('[data-testid="review-eligibility-gate-checklist"]').text()).toContain('✓');
|
||||
});
|
||||
|
||||
it('ignores failed_gates customer_confirmed when customer is already resolved', () => {
|
||||
// 关键断言:客户已确认后不得再把「客户已确认」门禁文案投影为优先处理。
|
||||
const wrapper = mountSummary({
|
||||
can_build: false,
|
||||
status: 'blocked',
|
||||
issues: [],
|
||||
failed_gates: ['customer_confirmed', 'required_fields_complete'],
|
||||
gates: {
|
||||
customer_confirmed: true,
|
||||
required_fields_complete: false,
|
||||
},
|
||||
line_projections: [],
|
||||
}, true);
|
||||
|
||||
const block = wrapper.find('[data-testid="review-eligibility-primary-block"]');
|
||||
expect(block.exists()).toBe(true);
|
||||
expect(block.text()).not.toContain('客户已确认');
|
||||
});
|
||||
|
||||
it('projects concrete manual review facts before falling back to generic copy', () => {
|
||||
const wrapper = mountSummary({
|
||||
can_build: false,
|
||||
@@ -122,8 +145,9 @@ describe('ReviewBuildEligibilitySummary', () => {
|
||||
line_projections: [],
|
||||
});
|
||||
|
||||
// 有门禁 i18n 时优先展示业务门禁名,禁止露出内部 gate code。
|
||||
expect(wrapper.find('[data-testid="review-eligibility-primary-block"]').text())
|
||||
.toContain('未知问题');
|
||||
.toContain('必填字段完整');
|
||||
expect(wrapper.text()).not.toContain('required_fields_complete');
|
||||
});
|
||||
|
||||
@@ -140,4 +164,164 @@ describe('ReviewBuildEligibilitySummary', () => {
|
||||
expect(wrapper.text()).not.toContain('can_build');
|
||||
expect(wrapper.text()).not.toContain('can_auto_create');
|
||||
});
|
||||
|
||||
it('hides primary-block under focusBuildability for inventory combo (UI-03)', () => {
|
||||
// 关键断言:库存阻断由 Gate 卡表达时,资格摘要不得再输出首要阻断标题。
|
||||
const i18n = createI18n({
|
||||
legacy: false,
|
||||
locale: 'zh-CN',
|
||||
messages: {
|
||||
'zh-CN': {
|
||||
chat: {
|
||||
shippingOrderReview: {
|
||||
issues: '问题',
|
||||
exceptionNav: { prev: '上', next: '下', prevHint: '', nextHint: '' },
|
||||
issueCodes: { unknown: '未知问题' },
|
||||
buildEligibility: {
|
||||
title: '订单检查',
|
||||
canBuildYes: '可建单',
|
||||
canBuildNo: '待处理',
|
||||
blockReasons: { require_manual_review: '需人工确认', unknown: '未知阻断' },
|
||||
gates: { required_fields_complete: '必填字段完整' },
|
||||
},
|
||||
workbench: {
|
||||
primaryBlock: '首要阻断原因',
|
||||
blockCount: '阻断项 {count} 项',
|
||||
viewFullChecks: '查看完整检查',
|
||||
manualReview: {
|
||||
customer: '请确认客户',
|
||||
field: '请确认字段:{field}',
|
||||
lineInventory: '第 {line} 行:请确认库存来源(候选:{candidates})',
|
||||
noCandidates: '暂无候选',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
const wrapper = mount(ReviewBuildEligibilitySummary, {
|
||||
props: {
|
||||
eligibility: {
|
||||
can_build: false,
|
||||
status: 'blocked',
|
||||
issues: [{
|
||||
code: 'require_manual_review',
|
||||
severity: 'blocking',
|
||||
explainability: { message: '库存来源待确认' },
|
||||
}],
|
||||
line_projections: [],
|
||||
},
|
||||
focusBuildability: true,
|
||||
exceptionCount: 2,
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
expect(wrapper.find('[data-testid="review-build-eligibility-summary"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="review-eligibility-primary-block"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="review-eligibility-gate-checklist"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="review-exception-nav"]').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('hides primary-block under focusBuildability for field completeness combo (UI-03)', () => {
|
||||
// 关键断言:字段阻断组合态下资格卡只保留摘要与异常导航,不输出第二份首要阻断。
|
||||
const wrapper = mount(ReviewBuildEligibilitySummary, {
|
||||
props: {
|
||||
eligibility: {
|
||||
can_build: false,
|
||||
status: 'blocked',
|
||||
issues: [{
|
||||
code: 'required_field_missing',
|
||||
severity: 'blocking',
|
||||
field_code: 'po_number',
|
||||
}],
|
||||
assessment: { missing_required_fields: ['po_number'], invalid_lines: [] },
|
||||
line_projections: [],
|
||||
},
|
||||
fieldLabels: { po_number: 'PO' },
|
||||
focusBuildability: true,
|
||||
exceptionCount: 1,
|
||||
},
|
||||
global: {
|
||||
plugins: [createI18n({
|
||||
legacy: false,
|
||||
locale: 'zh-CN',
|
||||
messages: {
|
||||
'zh-CN': {
|
||||
chat: {
|
||||
shippingOrderReview: {
|
||||
issueCodes: { unknown: '未知' },
|
||||
issues: '问题',
|
||||
exceptionNav: { prev: '上', next: '下', prevHint: '', nextHint: '' },
|
||||
buildEligibility: {
|
||||
title: '订单检查',
|
||||
canBuildYes: '可建单',
|
||||
canBuildNo: '待处理',
|
||||
gates: {},
|
||||
blockReasons: { unknown: '未知' },
|
||||
},
|
||||
workbench: {
|
||||
primaryBlock: '首要阻断原因',
|
||||
blockCount: '{count}',
|
||||
viewFullChecks: '查看完整检查',
|
||||
missingRequiredFields: '缺失必填',
|
||||
conflictFields: '冲突',
|
||||
manualReview: {
|
||||
customer: '',
|
||||
field: '请确认字段:{field}',
|
||||
lineInventory: '',
|
||||
noCandidates: '',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})],
|
||||
},
|
||||
});
|
||||
expect(wrapper.find('[data-testid="review-eligibility-primary-block"]').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('hides primary-block when technical_auto_only leaves business gate inactive (UI-03)', () => {
|
||||
// 关键断言:仅技术 Gate pending 时 focusBuildability=false,资格卡可展示阻断;本测验证开启 focus 时仍唯一。
|
||||
const wrapper = mount(ReviewBuildEligibilitySummary, {
|
||||
props: {
|
||||
eligibility: {
|
||||
can_build: true,
|
||||
can_auto_create: true,
|
||||
status: 'qualified',
|
||||
issues: [],
|
||||
line_projections: [],
|
||||
},
|
||||
focusBuildability: true,
|
||||
},
|
||||
global: {
|
||||
plugins: [createI18n({
|
||||
legacy: false,
|
||||
locale: 'zh-CN',
|
||||
messages: {
|
||||
'zh-CN': {
|
||||
chat: {
|
||||
shippingOrderReview: {
|
||||
buildEligibility: {
|
||||
title: '订单检查',
|
||||
canBuildYes: '可建单',
|
||||
canBuildNo: '待处理',
|
||||
gates: {},
|
||||
},
|
||||
workbench: {
|
||||
primaryBlock: '首要阻断原因',
|
||||
viewFullChecks: '查看完整检查',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})],
|
||||
},
|
||||
});
|
||||
expect(wrapper.find('[data-testid="review-eligibility-primary-block"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="review-build-eligibility-badge"]').text()).toContain('可建单');
|
||||
});
|
||||
});
|
||||
+15
-3
@@ -66,7 +66,7 @@ const blockingIssueCount = computed(() => {
|
||||
return blocking.length || issues.length;
|
||||
});
|
||||
|
||||
/** 首要阻断文案。 */
|
||||
/** 首要阻断文案:仅来自当前未解决业务问题;客户已确认时不得再显示客户确认阻断。 */
|
||||
const primaryBlockMessage = computed(() => {
|
||||
const issues = effectiveIssues.value;
|
||||
const primary = issues.find((item) => String(item.severity || '') === 'blocking') || issues[0];
|
||||
@@ -78,7 +78,13 @@ const primaryBlockMessage = computed(() => {
|
||||
return !reason.startsWith('customer_');
|
||||
});
|
||||
if (!blockedLines.length) {
|
||||
const failedGate = (props.eligibility?.failed_gates || [])[0];
|
||||
const failedGate = (props.eligibility?.failed_gates || []).find((gate) => {
|
||||
const code = String(gate || '').trim().toLowerCase();
|
||||
if (props.customerResolved === true && (code === 'customer_confirmed' || code === 'customer_resolution')) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
if (!failedGate) return '';
|
||||
const gateKey = `chat.shippingOrderReview.buildEligibility.gates.${failedGate}`;
|
||||
return te(gateKey) ? t(gateKey) : t('chat.shippingOrderReview.issueCodes.unknown');
|
||||
@@ -116,7 +122,13 @@ const primaryBlockMessage = computed(() => {
|
||||
if (message) return message;
|
||||
const key = `chat.shippingOrderReview.issueCodes.${code}`;
|
||||
if (code && te(key)) return t(key);
|
||||
const failedGate = (props.eligibility?.failed_gates || [])[0];
|
||||
const failedGate = (props.eligibility?.failed_gates || []).find((gate) => {
|
||||
const gateCode = String(gate || '').trim().toLowerCase();
|
||||
if (props.customerResolved === true && (gateCode === 'customer_confirmed' || gateCode === 'customer_resolution')) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
if (failedGate) {
|
||||
const gateKey = `chat.shippingOrderReview.buildEligibility.gates.${failedGate}`;
|
||||
return te(gateKey) ? t(gateKey) : t('chat.shippingOrderReview.issueCodes.unknown');
|
||||
|
||||
+4
@@ -97,6 +97,10 @@ async function openSelectDialog() {
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
openSelectDialog,
|
||||
});
|
||||
|
||||
/**
|
||||
* 按关键词搜索标准客户。
|
||||
*/
|
||||
|
||||
@@ -117,6 +117,24 @@ async function onRefresh() {
|
||||
busy.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 聚焦裁决区并短暂高亮动作按钮(Footer / Resolver 委托)。
|
||||
*/
|
||||
function focusAdjudication() {
|
||||
const root = document.querySelector('[data-testid="review-duplicate-panel"]');
|
||||
root?.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
||||
const actions = document.querySelector('[data-testid="review-duplicate-actions"]');
|
||||
if (!(actions instanceof HTMLElement)) return;
|
||||
actions.classList.add('ring-2', 'ring-amber-400');
|
||||
window.setTimeout(() => {
|
||||
actions.classList.remove('ring-2', 'ring-amber-400');
|
||||
}, 1600);
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
focusAdjudication,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -168,7 +186,11 @@ async function onRefresh() {
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<div v-if="editable && duplicate?.needs_adjudication" class="mt-3 space-y-2">
|
||||
<div
|
||||
v-if="editable && duplicate?.needs_adjudication"
|
||||
class="mt-3 space-y-2 rounded-lg transition-shadow"
|
||||
data-testid="review-duplicate-actions"
|
||||
>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<button
|
||||
v-if="allowed.has('open_existing')"
|
||||
|
||||
@@ -71,6 +71,24 @@ function onFocus(conflict: ShippingOrderReviewFieldConflict) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 聚焦第一个未解决冲突(Footer / Resolver 委托)。
|
||||
*/
|
||||
function focusFirstConflict() {
|
||||
const first = openConflicts.value[0];
|
||||
if (!first) return;
|
||||
onFocus(first);
|
||||
void Promise.resolve().then(() => {
|
||||
document
|
||||
.querySelector(`[data-testid="review-field-conflict-${first.conflict_key}"]`)
|
||||
?.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
||||
});
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
focusFirstConflict,
|
||||
});
|
||||
|
||||
/**
|
||||
* 采用某一候选值。
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<!--
|
||||
features/chat/components/shipping-review/ReviewWorkbenchFooter.vue
|
||||
用途:订单处理工作台底部唯一写操作栏(处置 / 保存 / 流程恢复动作)。
|
||||
用途:订单处理工作台底部唯一写操作栏(处置 / 保存 / 统一流程动作)。
|
||||
依赖:vue-i18n、lucide-vue-next、ActionPresentation。
|
||||
逻辑:ShippingOrderReviewView 传入 available_actions 与流程动作投影;sticky bottom;
|
||||
系统自动推进中隐藏无效主写按钮;流程写操作经 flow-action emit。
|
||||
只读查看时仍可展示 view_result/view_record;写按钮受 actionsExecutable 约束;
|
||||
流程写操作经 flow-action emit(与 Resolver 同链);flowBusy||saving 时禁用。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
@@ -17,19 +18,34 @@ const props = withDefaults(defineProps<{
|
||||
saving: boolean;
|
||||
isReadOnly: boolean;
|
||||
hasDraft: boolean;
|
||||
/** can_build && can_auto_create 时隐藏确认按钮并展示自动推进提示 */
|
||||
/** queued|running 时隐藏确认按钮 */
|
||||
hideConfirmBecauseAutoGate?: boolean;
|
||||
/** waiting/queued/running 时展示自动建单提示(可与确认按钮并存) */
|
||||
showAutoGateHint?: boolean;
|
||||
/** failed/manual_fallback 时展示「重试自动推进」 */
|
||||
showStpRetry?: boolean;
|
||||
/** 自动资格提示文案(等待启动 / 正在推进);由父级按真实 Job 状态计算 */
|
||||
autoGateHint?: string;
|
||||
/** 未保存本地修改计数(硬拦截与底栏提示同源) */
|
||||
unsavedCount?: number;
|
||||
/** 统一流程动作(原进度条 ActionBar);surface=review */
|
||||
flowPresentation?: ActionPresentation | null;
|
||||
/** 系统自动推进中:隐藏主写按钮 */
|
||||
automating?: boolean;
|
||||
/** 是否允许业务写(只读查看为 false) */
|
||||
actionsExecutable?: boolean;
|
||||
/** 统一流程动作提交中 */
|
||||
flowBusy?: boolean;
|
||||
}>(), {
|
||||
unsavedCount: 0,
|
||||
flowPresentation: null,
|
||||
automating: false,
|
||||
hideConfirmBecauseAutoGate: false,
|
||||
showAutoGateHint: false,
|
||||
showStpRetry: false,
|
||||
autoGateHint: '',
|
||||
actionsExecutable: true,
|
||||
flowBusy: false,
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -39,6 +55,7 @@ const emit = defineEmits<{
|
||||
'upload-replacement': [event: Event];
|
||||
validate: [];
|
||||
confirm: [];
|
||||
'retry-stp': [];
|
||||
'flow-action': [item: ActionPresentationItem];
|
||||
}>();
|
||||
|
||||
@@ -51,8 +68,6 @@ function hasAction(action: string): boolean {
|
||||
return props.availableActions.includes(action);
|
||||
}
|
||||
|
||||
const showFooter = computed(() => props.hasDraft && !props.isReadOnly);
|
||||
|
||||
const flowItems = computed((): ActionPresentationItem[] => {
|
||||
const presentation = props.flowPresentation;
|
||||
if (!presentation) return [];
|
||||
@@ -64,6 +79,20 @@ const flowItems = computed((): ActionPresentationItem[] => {
|
||||
return items.filter((item) => item.intent !== 'refresh');
|
||||
});
|
||||
|
||||
const hasViewOnlyFlow = computed(() => flowItems.value.some((item) => (
|
||||
item.intent === 'view_result'
|
||||
|| item.intent === 'view_record'
|
||||
|| item.intent === 'open_profile_review'
|
||||
)));
|
||||
|
||||
/** 可编辑底栏,或只读但仍有导航/查看类流程动作。 */
|
||||
const showFooter = computed(() => (
|
||||
props.hasDraft && (!props.isReadOnly || hasViewOnlyFlow.value)
|
||||
));
|
||||
|
||||
const controlsBusy = computed(() => props.saving || props.flowBusy);
|
||||
const canWriteCaseActions = computed(() => props.actionsExecutable && !props.isReadOnly);
|
||||
|
||||
/**
|
||||
* 流程动作文案。
|
||||
*/
|
||||
@@ -71,7 +100,7 @@ function flowLabel(item: ActionPresentationItem): string {
|
||||
if (te(item.labelKey)) return t(item.labelKey);
|
||||
const gateKey = `workspace.shippingNotice.processGate.actions.${item.actionCode}`;
|
||||
if (te(gateKey)) return t(gateKey);
|
||||
return item.actionCode;
|
||||
return t('chat.shippingProcessing.action.none');
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -81,13 +110,15 @@ function flowLabel(item: ActionPresentationItem): string {
|
||||
class="sticky bottom-0 z-20 flex shrink-0 flex-col gap-3 border-t border-slate-200 bg-white/95 p-3 shadow-[0_-4px_12px_rgba(15,23,42,0.06)] backdrop-blur sm:flex-row sm:items-center sm:justify-between dark:border-slate-800 dark:bg-slate-900/95"
|
||||
data-testid="review-footer-actions"
|
||||
:data-automating="automating ? '1' : '0'"
|
||||
:data-flow-busy="flowBusy ? '1' : '0'"
|
||||
:data-actions-executable="actionsExecutable ? '1' : '0'"
|
||||
>
|
||||
<div class="order-1 flex flex-wrap items-center gap-2 sm:order-1">
|
||||
<template v-if="!automating">
|
||||
<template v-if="!automating && canWriteCaseActions">
|
||||
<button
|
||||
v-if="hasAction('mark_non_order')"
|
||||
type="button"
|
||||
:disabled="saving"
|
||||
:disabled="controlsBusy"
|
||||
class="rounded border border-rose-200 px-3 py-2 text-sm text-rose-700 hover:bg-rose-50 disabled:opacity-50 dark:border-rose-900 dark:text-rose-300 dark:hover:bg-rose-950/40"
|
||||
@click="emit('mark-non-order')"
|
||||
>
|
||||
@@ -96,7 +127,7 @@ function flowLabel(item: ActionPresentationItem): string {
|
||||
<button
|
||||
v-if="hasAction('mark_quality_issue')"
|
||||
type="button"
|
||||
:disabled="saving"
|
||||
:disabled="controlsBusy"
|
||||
class="rounded border border-amber-200 px-3 py-2 text-sm text-amber-800 hover:bg-amber-50 disabled:opacity-50 dark:border-amber-900 dark:text-amber-200 dark:hover:bg-amber-950/40"
|
||||
@click="emit('mark-quality-issue')"
|
||||
>
|
||||
@@ -105,7 +136,7 @@ function flowLabel(item: ActionPresentationItem): string {
|
||||
<button
|
||||
v-if="hasAction('reparse')"
|
||||
type="button"
|
||||
:disabled="saving"
|
||||
:disabled="controlsBusy"
|
||||
class="inline-flex items-center gap-1 rounded border border-slate-300 px-3 py-2 text-sm text-slate-600 hover:bg-slate-50 disabled:opacity-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800"
|
||||
@click="emit('reparse')"
|
||||
>
|
||||
@@ -114,12 +145,13 @@ function flowLabel(item: ActionPresentationItem): string {
|
||||
<label
|
||||
v-if="hasAction('mark_quality_issue')"
|
||||
class="cursor-pointer rounded border border-slate-300 px-3 py-2 text-sm text-slate-600 hover:bg-slate-50 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800"
|
||||
:class="controlsBusy ? 'pointer-events-none opacity-50' : ''"
|
||||
>
|
||||
<input
|
||||
class="sr-only"
|
||||
type="file"
|
||||
accept="application/pdf,.pdf"
|
||||
:disabled="saving"
|
||||
:disabled="controlsBusy"
|
||||
@change="emit('upload-replacement', $event)"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.uploadReplacement') }}
|
||||
@@ -130,7 +162,7 @@ function flowLabel(item: ActionPresentationItem): string {
|
||||
v-for="item in flowItems"
|
||||
:key="`${item.intent}-${item.actionCode}`"
|
||||
type="button"
|
||||
:disabled="saving"
|
||||
:disabled="controlsBusy"
|
||||
class="rounded border border-slate-300 px-3 py-2 text-sm text-slate-700 hover:bg-slate-50 disabled:opacity-50 dark:border-slate-700 dark:text-slate-200 dark:hover:bg-slate-800"
|
||||
:data-testid="`review-footer-flow-${item.intent}`"
|
||||
:data-intent="item.intent"
|
||||
@@ -156,17 +188,27 @@ function flowLabel(item: ActionPresentationItem): string {
|
||||
{{ t('chat.shippingOrderReview.workflowProgress.automatingFooterHint') }}
|
||||
</p>
|
||||
<p
|
||||
v-else-if="hideConfirmBecauseAutoGate"
|
||||
v-else-if="showAutoGateHint && canWriteCaseActions"
|
||||
class="text-xs text-muted"
|
||||
data-testid="review-auto-gate-hint"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.buildEligibility.autoGateProgressHint') }}
|
||||
{{ autoGateHint || t('chat.shippingOrderReview.buildEligibility.autoGateWaitingHint') }}
|
||||
</p>
|
||||
<template v-if="!automating">
|
||||
<template v-if="!automating && canWriteCaseActions">
|
||||
<button
|
||||
v-if="showStpRetry || hasAction('retry_stp_auto_create')"
|
||||
type="button"
|
||||
:disabled="controlsBusy"
|
||||
class="inline-flex items-center gap-1 rounded border border-amber-400 bg-amber-50 px-3 py-2 text-sm text-amber-950 disabled:opacity-50 dark:border-amber-700 dark:bg-amber-950/40 dark:text-amber-100"
|
||||
data-testid="review-retry-stp-auto-create"
|
||||
@click="emit('retry-stp')"
|
||||
>
|
||||
<RefreshCw class="h-4 w-4" />{{ t('chat.shippingOrderReview.autoProgress.retryStp') }}
|
||||
</button>
|
||||
<button
|
||||
v-if="hasAction('validate')"
|
||||
type="button"
|
||||
:disabled="saving"
|
||||
:disabled="controlsBusy"
|
||||
class="inline-flex items-center gap-1 rounded bg-sky-600 px-3 py-2 text-sm text-white disabled:opacity-50"
|
||||
@click="emit('validate')"
|
||||
>
|
||||
@@ -175,7 +217,7 @@ function flowLabel(item: ActionPresentationItem): string {
|
||||
<button
|
||||
v-if="hasAction('confirm') && !hideConfirmBecauseAutoGate"
|
||||
type="button"
|
||||
:disabled="saving || !canConfirmBuild"
|
||||
:disabled="controlsBusy || !canConfirmBuild"
|
||||
class="rounded bg-emerald-600 px-3 py-2 text-sm font-medium text-white disabled:opacity-50"
|
||||
data-testid="review-confirm-create"
|
||||
:title="!canConfirmBuild ? t('chat.shippingOrderReview.buildEligibility.confirmBlocked') : undefined"
|
||||
|
||||
+65
-17
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* features/chat/components/shipping-review/ReviewWorkflowProgressPanel.spec.ts
|
||||
* 用途:订单处理台进度面板——紧凑五域条;人工入口仅 Gate 动作。
|
||||
* 用途:订单处理台进度面板——压缩 Strip;人工入口仅 Gate 动作。
|
||||
* 依赖:vitest、@vue/test-utils、vue-i18n stub、RouterLink stub。
|
||||
* 逻辑:有 processingProjection 才渲染 ReviewProgressStrip;无页内 15 阶展开;manual upload 入口需 nextActionCode。
|
||||
* 逻辑:有 processingProjection 才渲染 ReviewProgressStrip;无五域芯片;manual upload 入口需 nextActionCode。
|
||||
*/
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { mount } from '@vue/test-utils';
|
||||
@@ -12,6 +12,7 @@ import type {
|
||||
ShippingProcessingProjection,
|
||||
ShippingReviewProgressContext,
|
||||
} from '@/features/chat/types/shipping.api.types';
|
||||
import { SHIPPING_PROCESSING_STAGES } from '@/features/chat/types/shipping.api.types';
|
||||
|
||||
const messages = {
|
||||
en: {
|
||||
@@ -36,14 +37,12 @@ const messages = {
|
||||
completedOfTotal: '{done} of {total} done',
|
||||
remainingHint: '{count} remaining',
|
||||
positionOfTotal: '{current} / {total}',
|
||||
domainReceiveParse: 'Receive',
|
||||
domainCandidateIdentity: 'Candidate',
|
||||
domainOrderConfirm: 'Confirm',
|
||||
domainInventoryHandle: 'Inventory',
|
||||
domainFulfillmentShip: 'Ship',
|
||||
currentNeedLabel: 'Need: ',
|
||||
systemProcessingNeed: 'System processing',
|
||||
progressTitleWithStage: 'Order processing · {stage}',
|
||||
systemProcessingWithStage: 'System processing · {stage}',
|
||||
viewProcessDetails: 'View process details',
|
||||
viewFullProcess: 'View full process',
|
||||
stageNodesUnavailable: 'Progress details unavailable',
|
||||
},
|
||||
gateReasons: { generic: 'Needs action' },
|
||||
status: {
|
||||
@@ -51,10 +50,7 @@ const messages = {
|
||||
blocked: 'Blocked',
|
||||
processing: 'Processing',
|
||||
},
|
||||
stage: {
|
||||
freight_uploading: 'Uploading to freight',
|
||||
excel_generating: 'Generating Excel',
|
||||
},
|
||||
stage: Object.fromEntries(SHIPPING_PROCESSING_STAGES.map((s) => [s, s])),
|
||||
action: {
|
||||
refresh: 'Refresh',
|
||||
},
|
||||
@@ -72,6 +68,20 @@ const messages = {
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* 构造含权威 15 阶的最小投影片段。
|
||||
*/
|
||||
function withStageNodes(
|
||||
partial: Partial<ShippingProcessingProjection>,
|
||||
): Partial<ShippingProcessingProjection> {
|
||||
const stageNodes = SHIPPING_PROCESSING_STAGES.map((stage, absoluteIndex) => ({
|
||||
stage,
|
||||
absoluteIndex,
|
||||
status: (absoluteIndex < 5 ? 'passed' : absoluteIndex === 5 ? 'running' : 'pending') as const,
|
||||
}));
|
||||
return { stageNodes, ...partial };
|
||||
}
|
||||
|
||||
/**
|
||||
* 挂载进度面板。
|
||||
*/
|
||||
@@ -81,12 +91,17 @@ function mountPanel(extras?: {
|
||||
processingProjection?: Partial<ShippingProcessingProjection> | null;
|
||||
}) {
|
||||
const i18n = createI18n({ legacy: false, locale: 'en', messages });
|
||||
const projection = extras?.processingProjection === null
|
||||
? null
|
||||
: extras?.processingProjection
|
||||
? withStageNodes(extras.processingProjection)
|
||||
: null;
|
||||
return mount(ReviewWorkflowProgressPanel, {
|
||||
props: {
|
||||
item: null as ShippingReviewProgressContext | null,
|
||||
taskNo: extras?.taskNo ?? 'SN-1',
|
||||
polling: extras?.polling ?? true,
|
||||
processingProjection: (extras?.processingProjection || null) as ShippingProcessingProjection | null,
|
||||
processingProjection: projection as ShippingProcessingProjection | null,
|
||||
},
|
||||
global: {
|
||||
plugins: [i18n],
|
||||
@@ -109,21 +124,29 @@ describe('ReviewWorkflowProgressPanel', () => {
|
||||
expect(wrapper.find('[data-testid="review-open-task-workbench"]').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('renders compact domain strip without inline 15-node expand', () => {
|
||||
it('renders compressed strip with 15 nodes and without domain chips', () => {
|
||||
const wrapper = mountPanel({
|
||||
polling: false,
|
||||
processingProjection: {
|
||||
status: 'processing',
|
||||
stage: 'excel_generating',
|
||||
status: 'waiting_review',
|
||||
stage: 'waiting_review',
|
||||
sourceType: 'eml',
|
||||
currentGate: {
|
||||
gateCode: 'order_review',
|
||||
status: 'blocked',
|
||||
nextActionCode: 'confirm_customer',
|
||||
blockingReasonCode: 'generic',
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(wrapper.find('[data-testid="review-progress-unavailable"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="review-progress-strip"]').exists()).toBe(true);
|
||||
expect(wrapper.findAll('[data-testid="review-progress-domains"] [data-domain]').length).toBe(5);
|
||||
expect(wrapper.find('[data-testid="review-progress-domains"]').exists()).toBe(false);
|
||||
expect(wrapper.findAll('[data-testid="review-progress-stage-nodes"] [data-stage]')).toHaveLength(15);
|
||||
expect(wrapper.find('[data-testid="review-progress-expand-full"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="unified-action-bar"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="review-progress-open-details"]').exists()).toBe(true);
|
||||
expect(wrapper.get('[data-testid="review-progress-title"]').text()).toContain('Order processing');
|
||||
});
|
||||
|
||||
it('hides manual CTA while automating freight upload', () => {
|
||||
@@ -133,9 +156,13 @@ describe('ReviewWorkflowProgressPanel', () => {
|
||||
status: 'automating',
|
||||
stage: 'freight_uploading',
|
||||
sourceType: 'eml',
|
||||
currentGate: null,
|
||||
},
|
||||
});
|
||||
expect(wrapper.find('[data-testid="review-progress-strip"]').exists()).toBe(true);
|
||||
expect(wrapper.get('[data-testid="review-progress-title"]').text()).toContain('System processing');
|
||||
expect(wrapper.find('[data-testid="review-progress-refresh"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="review-progress-current-need"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="review-open-task-workbench"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="review-manual-upload-next-steps"]').exists()).toBe(false);
|
||||
});
|
||||
@@ -178,5 +205,26 @@ describe('ReviewWorkflowProgressPanel', () => {
|
||||
});
|
||||
expect(wrapper.find('[data-testid="review-manual-upload-next-steps"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="review-open-task-workbench"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="review-generic-next-steps"]').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('never renders generic next-steps for blocked non-upload gates', () => {
|
||||
const wrapper = mountPanel({
|
||||
polling: false,
|
||||
processingProjection: {
|
||||
status: 'blocked',
|
||||
stage: 'waiting_review',
|
||||
sourceType: 'eml',
|
||||
currentGate: {
|
||||
gateCode: 'order_review',
|
||||
status: 'blocked',
|
||||
nextActionCode: 'confirm_customer',
|
||||
blockingReasonCode: 'generic',
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(wrapper.find('[data-testid="review-progress-current-need"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="review-generic-next-steps"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="review-manual-upload-next-steps"]').exists()).toBe(false);
|
||||
});
|
||||
});
|
||||
+19
-92
@@ -1,8 +1,9 @@
|
||||
<!--
|
||||
features/chat/components/shipping-review/ReviewWorkflowProgressPanel.vue
|
||||
用途:订单处理工作台只读进度区(ReviewProgressStrip)+ Gate / 人工上传下一步提示。
|
||||
依赖:vue-i18n、ShippingProcessingProjection、ReviewProgressStrip。
|
||||
逻辑:节点高亮只读统一投影;打开流程详情 / 刷新 emit 给宿主;写操作不在本面板。
|
||||
用途:订单处理工作台只读进度区外壳——挂载压缩版 ReviewProgressStrip + 人工上传入口。
|
||||
依赖:vue-i18n、ShippingProcessingProjection、ReviewProgressStrip、shippingProcessingFulfillment。
|
||||
逻辑:标题与「当前需要」由 Strip 统一渲染;surface=review 永不渲染 review-generic-next-steps;
|
||||
仅人工上传保留任务台跳转;其他 Gate 只靠 Strip + Footer;写操作不在本面板。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
@@ -15,10 +16,6 @@ import type {
|
||||
import {
|
||||
projectionRequiresManualUploadWorkbench,
|
||||
} from '@/features/chat/shipping/shippingProcessingFulfillment';
|
||||
import {
|
||||
resolveShippingProcessingStatusLabel,
|
||||
shippingProcessingStageKey,
|
||||
} from '@/features/chat/shipping/shippingProcessingLabels';
|
||||
import ReviewProgressStrip from '@/features/shipping-progress/components/ReviewProgressStrip.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -34,52 +31,18 @@ const emit = defineEmits<{
|
||||
refresh: [];
|
||||
}>();
|
||||
|
||||
const { t, te } = useI18n();
|
||||
const { t } = useI18n();
|
||||
|
||||
const hasProjection = computed(() => Boolean(props.processingProjection));
|
||||
|
||||
const unifiedStatusLabel = computed(() => {
|
||||
const status = props.processingProjection?.status;
|
||||
if (!status) return '';
|
||||
return resolveShippingProcessingStatusLabel(status, te, t);
|
||||
});
|
||||
|
||||
const unifiedStageLabel = computed(() => {
|
||||
const stage = props.processingProjection?.stage;
|
||||
if (!stage) return '';
|
||||
const key = shippingProcessingStageKey(stage);
|
||||
return te(key) ? t(key) : stage;
|
||||
});
|
||||
|
||||
/**
|
||||
* 仅当 Gate next_action 明确指人工上传且非 RPA 阶段时展示任务台入口。
|
||||
* 仅当 Gate next_action 明确指人工上传且非 RPA 阶段时展示任务台入口(非纯文案重复)。
|
||||
*/
|
||||
const showTaskWorkbenchLink = computed(() => {
|
||||
if (!props.processingProjection) return false;
|
||||
if (!projectionRequiresManualUploadWorkbench(props.processingProjection)) return false;
|
||||
return Boolean(String(props.taskNo || '').trim());
|
||||
});
|
||||
|
||||
/**
|
||||
* blocked 且非人工上传时展示通用下一步提示(来自 Gate 动作 i18n)。
|
||||
*/
|
||||
const showGenericNextSteps = computed(() => {
|
||||
const projection = props.processingProjection;
|
||||
if (!projection || showTaskWorkbenchLink.value) return false;
|
||||
const nextAction = String(projection.currentGate?.nextActionCode || '').trim();
|
||||
if (!nextAction) return false;
|
||||
const status = String(projection.status || '').trim().toLowerCase();
|
||||
return status === 'blocked' || status === 'needs_action';
|
||||
});
|
||||
|
||||
const genericNextStepMessage = computed(() => {
|
||||
const code = String(props.processingProjection?.currentGate?.nextActionCode || '').trim();
|
||||
if (code) {
|
||||
const gateKey = `workspace.shippingNotice.processGate.actions.${code}`;
|
||||
if (te(gateKey)) return t(gateKey);
|
||||
}
|
||||
return t('chat.shippingOrderReview.workflowProgress.nextStepsGeneric');
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -87,50 +50,21 @@ const genericNextStepMessage = computed(() => {
|
||||
class="rounded-xl border border-default bg-surface-soft/60 p-3"
|
||||
data-testid="review-workflow-progress-panel"
|
||||
>
|
||||
<div class="flex items-start justify-between gap-2">
|
||||
<div class="min-w-0">
|
||||
<div class="text-sm font-semibold text-primary">
|
||||
{{ t('chat.shippingOrderReview.workflowProgress.title') }}
|
||||
</div>
|
||||
<div
|
||||
v-if="hasProjection && (unifiedStatusLabel || unifiedStageLabel)"
|
||||
class="mt-0.5 text-[11px] text-secondary"
|
||||
data-testid="review-progress-unified-label"
|
||||
>
|
||||
<span v-if="unifiedStatusLabel">{{ unifiedStatusLabel }}</span>
|
||||
<span v-if="unifiedStageLabel"> · {{ unifiedStageLabel }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-else-if="!hasProjection"
|
||||
class="mt-0.5 text-[11px] text-amber-700 dark:text-amber-300"
|
||||
data-testid="review-progress-unavailable"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.workflowProgress.progressUnavailable') }}
|
||||
</div>
|
||||
<div v-else class="mt-0.5 text-[11px] text-secondary">
|
||||
{{ t('chat.shippingOrderReview.workflowProgress.subtitle') }}
|
||||
</div>
|
||||
</div>
|
||||
<span
|
||||
v-if="polling"
|
||||
class="shrink-0 text-[11px] text-muted"
|
||||
data-testid="review-workflow-progress-polling"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.workflowProgress.polling') }}
|
||||
</span>
|
||||
<div
|
||||
v-if="!hasProjection"
|
||||
class="text-[11px] text-amber-700 dark:text-amber-300"
|
||||
data-testid="review-progress-unavailable"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.workflowProgress.progressUnavailable') }}
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="processingProjection"
|
||||
class="mt-3"
|
||||
data-testid="review-progress-nodes"
|
||||
>
|
||||
<ReviewProgressStrip
|
||||
:projection="processingProjection"
|
||||
@open-process-details="emit('open-process-details')"
|
||||
@refresh="emit('refresh')"
|
||||
/>
|
||||
</div>
|
||||
<ReviewProgressStrip
|
||||
v-else-if="processingProjection"
|
||||
:projection="processingProjection"
|
||||
:polling="polling"
|
||||
@open-process-details="emit('open-process-details')"
|
||||
@refresh="emit('refresh')"
|
||||
/>
|
||||
|
||||
<div
|
||||
v-if="showTaskWorkbenchLink"
|
||||
@@ -146,12 +80,5 @@ const genericNextStepMessage = computed(() => {
|
||||
{{ t('chat.shippingOrderReview.workflowProgress.openTaskWorkbench') }}
|
||||
</RouterLink>
|
||||
</div>
|
||||
<div
|
||||
v-else-if="showGenericNextSteps"
|
||||
class="mt-3 rounded-md border border-default bg-surface-soft px-2.5 py-2 text-[11px] text-secondary"
|
||||
data-testid="review-generic-next-steps"
|
||||
>
|
||||
<p>{{ genericNextStepMessage }}</p>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
Reference in new issue
Block a user