Merge branch 'hugo-auto-transfer' into dev
This commit is contained in:
commit
af2658e244
30 files changed
+1913
-93
No files matched your search
@@ -673,6 +673,30 @@ export const confirmWorkspaceShippingOrderReviewCustomer = (
|
||||
},
|
||||
);
|
||||
|
||||
/**
|
||||
* 确认客户改绑:直接修改已确认客户并按新客户重冻结订单快照。
|
||||
* 核心逻辑:携带 expected_order_data_version 乐观锁;Excel 已产生/存在活动 Gate Attempt 时后端 409
|
||||
* (SHIPPING.CUSTOMER_REBIND_BLOCKED),版本漂移返回 SHIPPING.ORDER_DATA_VERSION_MISMATCH,
|
||||
* 均由调用方以 BusinessError localized message 展示。
|
||||
* @param caseNo - 复核 Case 编号
|
||||
* @param payload - 新客户 ID、expected_order_data_version(case 投影 order_data_version)与可选原因
|
||||
*/
|
||||
export const rebindWorkspaceShippingOrderReviewCustomer = (
|
||||
caseNo: string,
|
||||
payload: { customer_id: number; expected_order_data_version: number; reason?: string },
|
||||
) => requestJson<{
|
||||
case: ShippingOrderReviewCase | null;
|
||||
customer_resolution: ShippingOrderReviewCustomerResolution | null;
|
||||
rebind: { previous_customer_id?: number | null; customer_id: number; snapshot_id: number };
|
||||
}>(
|
||||
`/api/workspace/shipping-notice/order-review-cases/${encodeURIComponent(caseNo)}/customer/rebind`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(payload),
|
||||
},
|
||||
);
|
||||
|
||||
/**
|
||||
* 重新检测建单前重复订单。
|
||||
*/
|
||||
|
||||
@@ -25,17 +25,20 @@ watch(() => props.open, (open) => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="open" class="admin-modal-overlay animate-fade-in items-center z-[170]">
|
||||
<div class="admin-modal-panel max-w-xl max-h-[90vh] scale-100">
|
||||
<div class="px-6 py-5 border-b border-subtle"><h3 class="section-title">{{ t('chat.shippingCustomer.title') }}</h3><p class="section-desc mt-1">{{ t('chat.shippingCustomer.subtitle') }}</p></div>
|
||||
<div class="px-6 py-5 space-y-4 overflow-y-auto">
|
||||
<div class="flex gap-2"><input v-model="query" class="input-field text-sm" :placeholder="t('chat.shippingCustomer.searchPlaceholder')" @keyup.enter="emit('search', query)" /><button type="button" class="btn-ghost" @click="emit('search', query)">{{ t('chat.shippingCustomer.search') }}</button></div>
|
||||
<div class="space-y-2 max-h-80 overflow-y-auto">
|
||||
<label v-for="customer in options" :key="customer.id" class="flex items-center gap-3 rounded-xl border border-default p-3 cursor-pointer hover:border-brand-300"><input v-model="selectedId" type="radio" :value="customer.id" /><span class="flex-1"><span class="font-medium text-primary">{{ customer.standard_name }}</span><span class="ml-2 font-mono text-xs text-muted">{{ customer.short_code }}</span></span></label>
|
||||
<div v-if="!loading && !options.length" class="text-sm text-muted py-8 text-center">{{ t('chat.shippingCustomer.empty') }}</div>
|
||||
<!-- Teleport 到 body:面板/工作区子树的层叠上下文会让页内 fixed 遮罩被粘性列表穿透。 -->
|
||||
<Teleport to="body">
|
||||
<div v-if="open" class="admin-modal-overlay animate-fade-in items-center z-[170]">
|
||||
<div class="admin-modal-panel max-w-xl max-h-[90vh] scale-100">
|
||||
<div class="px-6 py-5 border-b border-subtle"><h3 class="section-title">{{ t('chat.shippingCustomer.title') }}</h3><p class="section-desc mt-1">{{ t('chat.shippingCustomer.subtitle') }}</p></div>
|
||||
<div class="px-6 py-5 space-y-4 overflow-y-auto">
|
||||
<div class="flex min-w-0 gap-2"><input v-model="query" class="input-field min-w-0 flex-1 text-sm" :placeholder="t('chat.shippingCustomer.searchPlaceholder')" @keyup.enter="emit('search', query)" /><button type="button" class="btn-ghost shrink-0 whitespace-nowrap" @click="emit('search', query)">{{ t('chat.shippingCustomer.search') }}</button></div>
|
||||
<div class="space-y-2 max-h-80 overflow-y-auto">
|
||||
<label v-for="customer in options" :key="customer.id" class="flex cursor-pointer items-center gap-3 rounded-xl border p-3" :class="selectedId === customer.id ? 'border-brand-500 bg-brand-50' : 'border-default hover:border-brand-300'"><input v-model="selectedId" type="radio" :value="customer.id" class="accent-brand-600" /><span class="flex-1"><span class="font-medium text-primary">{{ customer.standard_name }}</span><span class="ml-2 font-mono text-xs text-muted">{{ customer.short_code }}</span></span></label>
|
||||
<div v-if="!loading && !options.length" class="text-sm text-muted py-8 text-center">{{ t('chat.shippingCustomer.empty') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="admin-modal-footer"><button type="button" class="btn-ghost" @click="emit('close')">{{ t('common.cancel') }}</button><button type="button" class="btn-primary" :disabled="!selectedId || loading" @click="selectedId && emit('confirm', selectedId)">{{ t('chat.shippingCustomer.confirm') }}</button></div>
|
||||
</div>
|
||||
<div class="admin-modal-footer"><button type="button" class="btn-ghost" @click="emit('close')">{{ t('common.cancel') }}</button><button type="button" class="btn-primary" :disabled="!selectedId || loading" @click="selectedId && emit('confirm', selectedId)">{{ t('chat.shippingCustomer.confirm') }}</button></div>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</template>
|
||||
+127
-11
@@ -1,21 +1,52 @@
|
||||
/**
|
||||
* features/chat/components/shipping-review/ReviewCustomerResolutionPanel.spec.ts
|
||||
* 用途:锁定唯一标准客户候选的工作台提示,避免将可自动确认状态误报为未识别。
|
||||
* 依赖:vitest、@vue/test-utils、vue-i18n、ReviewCustomerResolutionPanel。
|
||||
* 逻辑:unique_candidate 显示自动确认说明和明确按钮;其他未确认状态维持人工选择入口。
|
||||
* 用途:锁定客户识别面板两态行为——未确认态保留候选确认流程;已确认态折叠为摘要条并提供「修改客户」改绑入口。
|
||||
* 依赖:vitest、@vue/test-utils、vue-i18n、ReviewCustomerResolutionPanel、shipping.api(mock)。
|
||||
* 逻辑:已确认摘要条默认折叠(已确认徽标 + 标准客户名 + chevron),展开仅显示既有识别详情;
|
||||
* rebindAllowed=false 时改绑按钮禁用并展示原因;选定新客户经影响确认弹窗提交改绑 API 并 emit refreshed。
|
||||
* 改绑 i18n 键由 Task 3 落 chat.json,这里在 vue-i18n mock 中前置补齐同路径键。
|
||||
*/
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { mount } from '@vue/test-utils';
|
||||
import { flushPromises, mount } from '@vue/test-utils';
|
||||
import { createI18n } from 'vue-i18n';
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import ReviewCustomerResolutionPanel from './ReviewCustomerResolutionPanel.vue';
|
||||
import ShippingCustomerConfirmDialog from '@/features/chat/components/ShippingCustomerConfirmDialog.vue';
|
||||
import {
|
||||
listWorkspaceShippingCustomerOptions,
|
||||
rebindWorkspaceShippingOrderReviewCustomer,
|
||||
} from '@/features/chat/api/shipping.api';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
|
||||
const messageSpies = vi.hoisted(() => ({
|
||||
success: vi.fn(),
|
||||
warning: vi.fn(),
|
||||
error: vi.fn(),
|
||||
info: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('@/features/chat/api/shipping.api', () => ({
|
||||
confirmWorkspaceShippingOrderReviewCustomer: vi.fn(),
|
||||
listWorkspaceShippingCustomerOptions: vi.fn(),
|
||||
retryWorkspaceShippingOrderReviewCustomerResolution: vi.fn(),
|
||||
rebindWorkspaceShippingOrderReviewCustomer: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('@/shared/composables/useMessage', () => ({
|
||||
useMessage: () => messageSpies,
|
||||
}));
|
||||
|
||||
const i18n = createI18n({
|
||||
legacy: false,
|
||||
locale: 'zh-CN',
|
||||
messages: {
|
||||
'zh-CN': {
|
||||
common: { cancel: '取消' },
|
||||
chat: {
|
||||
shippingCustomer: { loadFailed: '加载失败', confirmFailed: '确认失败' },
|
||||
shippingCustomer: {
|
||||
loadFailed: '加载失败',
|
||||
confirmFailed: '确认失败',
|
||||
confirm: '确认',
|
||||
},
|
||||
shippingOrderReview: {
|
||||
customerResolution: {
|
||||
title: '客户确认', subtitle: '请选择标准客户', uniqueCandidateHint: '已找到唯一标准客户候选;保存校验时系统会自动确认,也可手动确认。',
|
||||
@@ -24,6 +55,13 @@ const i18n = createI18n({
|
||||
standardCustomer: '标准客户', customerCode: '客户编码', matchedInputs: '匹配输入', candidates: '候选客户', pdfReparseHint: '请重新识别 PDF',
|
||||
inputLabels: { customerCode: '客户编码', customerName: '客户名称', address: '地址', email: '邮箱', domain: '域名', other: '其他' },
|
||||
status: { unique_candidate: '唯一候选', unmatched: '未匹配', confirmed: '已确认' },
|
||||
// 改绑键:与 Task 3 将落入 locales/*/chat.json 的键路径保持一致
|
||||
rebindButton: '修改客户',
|
||||
rebindDisabledExcelExists: '已产生发货通知/Excel,请先走撤销流程',
|
||||
rebindConfirmTitle: '确认修改客户',
|
||||
rebindConfirmImpact: '将更新订单客户并重新冻结订单快照;已生成的发货通知/Excel 需重新生成',
|
||||
rebindSuccessToast: '客户已更新,可回通知准备重新生成 Excel',
|
||||
rebindFailedToast: '修改客户失败,请稍后重试',
|
||||
},
|
||||
resume: { autoCreated: '已自动建单', waitingManualConfirm: '等待人工确认' },
|
||||
},
|
||||
@@ -32,32 +70,110 @@ const i18n = createI18n({
|
||||
},
|
||||
});
|
||||
|
||||
function mountPanel(status: string) {
|
||||
const resolvedResolution = {
|
||||
resolved: true,
|
||||
status: 'confirmed',
|
||||
rebind_allowed: true,
|
||||
customer_id: 11,
|
||||
raw_name: 'acme',
|
||||
standard_name: 'ACME 标准客户',
|
||||
short_code: 'ACME',
|
||||
input_values: [
|
||||
{ definition_code: 'customer_code', definition_label: null, raw_value: 'ACME', normalized_value: 'ACME' },
|
||||
],
|
||||
};
|
||||
|
||||
function mountPanel(resolution: Record<string, unknown>, extraProps: Record<string, unknown> = {}) {
|
||||
return mount(ReviewCustomerResolutionPanel, {
|
||||
props: {
|
||||
caseNo: 'CASE-CUSTOMER-1',
|
||||
editable: true,
|
||||
resolution: { resolved: false, status, raw_name: 'ACME' },
|
||||
orderDataVersion: 4,
|
||||
resolution,
|
||||
...extraProps,
|
||||
},
|
||||
global: {
|
||||
plugins: [i18n],
|
||||
stubs: { ShippingCustomerConfirmDialog: true },
|
||||
// teleport 就地渲染:改绑影响确认弹窗 Teleport 到 body,stub 后断言仍在 wrapper 内可达。
|
||||
stubs: { ShippingCustomerConfirmDialog: true, teleport: true },
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
describe('ReviewCustomerResolutionPanel', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
vi.mocked(listWorkspaceShippingCustomerOptions).mockResolvedValue([]);
|
||||
});
|
||||
|
||||
it('唯一候选展示自动确认说明和明确确认入口', () => {
|
||||
const wrapper = mountPanel('unique_candidate');
|
||||
const wrapper = mountPanel({ resolved: false, status: 'unique_candidate', raw_name: 'ACME' });
|
||||
|
||||
expect(wrapper.text()).toContain('保存校验时系统会自动确认');
|
||||
expect(wrapper.get('[data-testid="review-select-customer"]').text()).toContain('确认唯一候选');
|
||||
});
|
||||
|
||||
it('非唯一未确认状态维持人工选择客户入口', () => {
|
||||
const wrapper = mountPanel('unmatched');
|
||||
const wrapper = mountPanel({ resolved: false, status: 'unmatched', raw_name: 'ACME' });
|
||||
|
||||
expect(wrapper.text()).not.toContain('保存校验时系统会自动确认');
|
||||
expect(wrapper.get('[data-testid="review-select-customer"]').text()).toContain('选择标准客户');
|
||||
});
|
||||
|
||||
it('已确认态默认折叠为摘要条,展开仅显示既有识别详情', async () => {
|
||||
const wrapper = mountPanel(resolvedResolution);
|
||||
|
||||
// 断言意图:摘要条可见(已确认徽标 + 标准客户名),识别详情默认不展开
|
||||
expect(wrapper.get('[data-testid="review-customer-resolution-badge"]').text()).toContain('已确认');
|
||||
expect(wrapper.text()).toContain('ACME 标准客户');
|
||||
expect(wrapper.find('[data-testid="review-customer-resolution-details"]').exists()).toBe(false);
|
||||
// 断言意图:改绑入口在摘要条上存在
|
||||
expect(wrapper.get('[data-testid="review-rebind-customer"]').exists()).toBe(true);
|
||||
|
||||
// 断言意图:chevron 展开后显示既有识别详情(命中输入),不再是整块识别面板
|
||||
await wrapper.get('[data-testid="review-customer-resolution-toggle"]').trigger('click');
|
||||
expect(wrapper.get('[data-testid="review-customer-resolution-details"]').exists()).toBe(true);
|
||||
expect(wrapper.text()).toContain('匹配输入');
|
||||
});
|
||||
|
||||
it('rebindAllowed=false 时改绑按钮禁用并以 tooltip 说明原因', () => {
|
||||
const wrapper = mountPanel({ ...resolvedResolution, rebind_allowed: false });
|
||||
|
||||
const rebindButton = wrapper.get('[data-testid="review-rebind-customer"]');
|
||||
// 断言意图:edit_window.header=false(Excel 已产生/活动 Attempt)时按钮禁用
|
||||
expect(rebindButton.attributes('disabled')).toBeDefined();
|
||||
// 断言意图:禁用原因经 tooltip 透出,而非静默置灰
|
||||
expect(rebindButton.attributes('title')).toContain('撤销');
|
||||
});
|
||||
|
||||
it('选定新客户并确认影响后提交改绑 API 且 emit refreshed', async () => {
|
||||
vi.mocked(rebindWorkspaceShippingOrderReviewCustomer).mockResolvedValue({
|
||||
case: null,
|
||||
customer_resolution: null,
|
||||
rebind: { previous_customer_id: 11, customer_id: 42, snapshot_id: 9 },
|
||||
});
|
||||
const wrapper = mountPanel(resolvedResolution);
|
||||
|
||||
// [STEP 1] 打开复用的客户搜索选择弹窗并选定目标客户
|
||||
await wrapper.get('[data-testid="review-rebind-customer"]').trigger('click');
|
||||
await flushPromises();
|
||||
const selectDialog = wrapper.findComponent(ShippingCustomerConfirmDialog);
|
||||
expect(selectDialog.exists()).toBe(true);
|
||||
selectDialog.vm.$emit('confirm', 42);
|
||||
await flushPromises();
|
||||
|
||||
// [STEP 2] 影响确认弹窗出现后提交
|
||||
await wrapper.get('[data-testid="review-rebind-confirm-submit"]').trigger('click');
|
||||
await flushPromises();
|
||||
|
||||
// 断言意图:携带乐观锁版本调用改绑 API
|
||||
expect(rebindWorkspaceShippingOrderReviewCustomer).toHaveBeenCalledTimes(1);
|
||||
expect(rebindWorkspaceShippingOrderReviewCustomer).toHaveBeenCalledWith(
|
||||
'CASE-CUSTOMER-1',
|
||||
{ customer_id: 42, expected_order_data_version: 4 },
|
||||
);
|
||||
// 断言意图:成功 toast + 复用 refreshed 事件走既有刷新链
|
||||
expect(messageSpies.success).toHaveBeenCalled();
|
||||
expect(wrapper.emitted('refreshed')).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
+199
-26
@@ -1,9 +1,11 @@
|
||||
<!--
|
||||
features/chat/components/shipping-review/ReviewCustomerResolutionPanel.vue
|
||||
用途:复核工作台固定「建单前客户确认」区域(与重新识别 PDF 分层)。
|
||||
依赖:vue-i18n、ShippingCustomerConfirmDialog、shipping.api 客户确认/重识别接口。
|
||||
逻辑:未解决时完整展开置顶;已解决且 compact 时缩为一行摘要;
|
||||
选择标准客户 / 重新识别客户;成功后 emit refreshed 刷新建单资格。
|
||||
用途:复核工作台固定「建单前客户确认」区域,两态渲染:未确认走识别候选确认流程;已确认折叠为一行摘要条并提供「修改客户」改绑入口。
|
||||
依赖:vue-i18n、ShippingCustomerConfirmDialog、shipping.api 客户确认/重识别/改绑接口。
|
||||
逻辑:resolved=false 时完整展开置顶(现状不动);resolved=true 时默认折叠摘要条(已确认徽标+标准客户名+chevron+修改客户按钮),
|
||||
chevron 展开既有识别详情(不含 ODM 范围);改绑走「复用客户搜索选定 → 影响确认弹窗 → rebind API → 成功 toast → emit refreshed」。
|
||||
resolution.rebind_allowed=false(Excel 已产生/活动 Attempt,后端投影下发)时按钮禁用并以 tooltip 说明;
|
||||
后端 fail-closed 兜底,409 的 BusinessError localized message 直接经 toast 展示。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
@@ -14,6 +16,7 @@ import ShippingCustomerConfirmDialog from '@/features/chat/components/ShippingCu
|
||||
import {
|
||||
confirmWorkspaceShippingOrderReviewCustomer,
|
||||
listWorkspaceShippingCustomerOptions,
|
||||
rebindWorkspaceShippingOrderReviewCustomer,
|
||||
retryWorkspaceShippingOrderReviewCustomerResolution,
|
||||
} from '@/features/chat/api/shipping.api';
|
||||
import type {
|
||||
@@ -25,7 +28,10 @@ const props = defineProps<{
|
||||
caseNo: string;
|
||||
resolution: ShippingOrderReviewCustomerResolution | null | undefined;
|
||||
editable: boolean;
|
||||
/** 已解决时缩为一行摘要(放入「更多状态」) */
|
||||
/** 已确认改绑入口可用性:edit_window.header 明确 false 时禁用;缺失/undefined 视为可用(后端权威守卫兜底) */
|
||||
/** 改绑乐观锁版本:case 投影的 order_data_version(正式任务当前版本),缺省时后端按版本冲突拒绝 */
|
||||
orderDataVersion?: number | null;
|
||||
/** 已解决时缩为一行摘要(历史兼容属性;已确认态现在恒为折叠摘要条) */
|
||||
compact?: boolean;
|
||||
}>();
|
||||
|
||||
@@ -39,8 +45,15 @@ const busy = ref(false);
|
||||
const dialogOpen = ref(false);
|
||||
const options = ref<ShippingCustomerOption[]>([]);
|
||||
const loadingOptions = ref(false);
|
||||
/** 已确认态识别详情是否展开(默认折叠为一行摘要条) */
|
||||
const confirmedDetailsExpanded = ref(false);
|
||||
/** 改绑影响确认弹窗显隐与待提交的新客户 */
|
||||
const rebindConfirmOpen = ref(false);
|
||||
const pendingRebindCustomerId = ref<number | null>(null);
|
||||
|
||||
const resolved = computed(() => Boolean(props.resolution?.resolved));
|
||||
/** 改绑可用性:prop 缺省视为可用,与 formalHeaderEditable 的 fail-open 语义对齐(后端 409 兜底) */
|
||||
const rebindAllowed = computed(() => props.resolution?.rebind_allowed === true);
|
||||
const hasUniqueCandidate = computed(() => (
|
||||
!resolved.value
|
||||
&& String(props.resolution?.status || '').trim() === 'unique_candidate'
|
||||
@@ -66,6 +79,15 @@ const displayName = computed(() => {
|
||||
const inputValues = computed(() => props.resolution?.input_values || []);
|
||||
const candidateRows = computed(() => props.resolution?.candidates || []);
|
||||
|
||||
/** 改绑影响确认弹窗中展示的待提交客户名;选项已卸载时回落展示 ID。 */
|
||||
const pendingRebindCustomerLabel = computed(() => {
|
||||
const customerId = pendingRebindCustomerId.value;
|
||||
if (customerId == null) return '—';
|
||||
const match = options.value.find((item) => item.id === customerId);
|
||||
if (match) return `${match.standard_name} (${match.short_code})`;
|
||||
return `#${customerId}`;
|
||||
});
|
||||
|
||||
function inputLabel(definitionCode: string | null | undefined): string {
|
||||
const code = String(definitionCode || '').trim().toLowerCase();
|
||||
if (code.includes('customer') && code.includes('code')) return t('chat.shippingOrderReview.customerResolution.inputLabels.customerCode');
|
||||
@@ -84,8 +106,13 @@ function candidateValue(candidate: unknown, key: string): string {
|
||||
return String(row[key] ?? '').trim() || '—';
|
||||
}
|
||||
|
||||
/** 切换已确认摘要条的识别详情展开/折叠。 */
|
||||
function toggleConfirmedDetails() {
|
||||
confirmedDetailsExpanded.value = !confirmedDetailsExpanded.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开标准客户选择弹窗并加载选项。
|
||||
* 打开标准客户选择弹窗并加载选项(未确认确认流程入口,also 供父级经 ref 外部触发)。
|
||||
*/
|
||||
async function openSelectDialog() {
|
||||
if (!props.editable || busy.value) return;
|
||||
@@ -106,7 +133,25 @@ defineExpose({
|
||||
});
|
||||
|
||||
/**
|
||||
* 按关键词搜索标准客户。
|
||||
* 打开改绑客户选择弹窗(已确认态「修改客户」入口;复用同一搜索选择弹窗)。
|
||||
* AI 触发时机:用户在已确认摘要条点击「修改客户」时进入;rebindAllowed=false 时按钮已禁用,这里仅兜底防抖。
|
||||
*/
|
||||
async function openRebindDialog() {
|
||||
if (!rebindAllowed.value || busy.value) return;
|
||||
dialogOpen.value = true;
|
||||
loadingOptions.value = true;
|
||||
try {
|
||||
options.value = await listWorkspaceShippingCustomerOptions();
|
||||
} catch (error: unknown) {
|
||||
options.value = [];
|
||||
msg.warning(error instanceof Error ? error.message : t('chat.shippingCustomer.loadFailed'));
|
||||
} finally {
|
||||
loadingOptions.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 按关键词搜索标准客户(客户选择弹窗复用入口)。
|
||||
*/
|
||||
async function searchCustomers(query: string) {
|
||||
loadingOptions.value = true;
|
||||
@@ -120,7 +165,20 @@ async function searchCustomers(query: string) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认标准客户并通知父级刷新 Case / 建单资格。
|
||||
* 客户选择弹窗确认分发:已确认态进入改绑影响确认(不重走识别确认);未确认态走既有确认建单链路。
|
||||
*/
|
||||
function onCustomerDialogConfirm(customerId: number) {
|
||||
if (resolved.value) {
|
||||
pendingRebindCustomerId.value = customerId;
|
||||
dialogOpen.value = false;
|
||||
rebindConfirmOpen.value = true;
|
||||
return;
|
||||
}
|
||||
void onConfirm(customerId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认标准客户并通知父级刷新 Case / 建单资格(仅未确认态)。
|
||||
*/
|
||||
async function onConfirm(customerId: number) {
|
||||
if (!props.caseNo || busy.value) return;
|
||||
@@ -152,6 +210,34 @@ async function onConfirm(customerId: number) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交改绑:携带 case 投影的 order_data_version 乐观锁调用 rebind API;成功后 toast 并 emit refreshed 走既有刷新链。
|
||||
* 失败:BusinessError(含 409 守卫/版本冲突)展示后端 localized message;其余错误回落 rebindFailedToast。
|
||||
*/
|
||||
async function onRebindConfirmSubmit() {
|
||||
const customerId = pendingRebindCustomerId.value;
|
||||
if (!props.caseNo || customerId == null || busy.value) return;
|
||||
busy.value = true;
|
||||
try {
|
||||
await rebindWorkspaceShippingOrderReviewCustomer(props.caseNo, {
|
||||
customer_id: customerId,
|
||||
expected_order_data_version: Number(props.orderDataVersion ?? 0),
|
||||
});
|
||||
rebindConfirmOpen.value = false;
|
||||
pendingRebindCustomerId.value = null;
|
||||
confirmedDetailsExpanded.value = false;
|
||||
msg.success(t('chat.shippingOrderReview.customerResolution.rebindSuccessToast'));
|
||||
emit('refreshed');
|
||||
} catch (error: unknown) {
|
||||
const message = error instanceof BusinessError
|
||||
? resolveLocalizedErrorMessage(error.code, error.message)
|
||||
: t('chat.shippingOrderReview.customerResolution.rebindFailedToast');
|
||||
msg.warning(message);
|
||||
} finally {
|
||||
busy.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新识别客户(不触发 PDF 重识别)。
|
||||
*/
|
||||
@@ -178,26 +264,74 @@ async function onRetry() {
|
||||
class="rounded-xl border border-default bg-surface p-3 shadow-sm"
|
||||
data-testid="review-customer-resolution-panel"
|
||||
:data-compact="compact && resolved ? 'true' : 'false'"
|
||||
:data-state="resolved ? 'resolved' : 'pending'"
|
||||
>
|
||||
<!-- 已解决摘要:一行展示客户与状态,避免占满侧栏首位 -->
|
||||
<!-- 已确认态:折叠摘要条(已确认徽标 + 标准客户名 + chevron + 修改客户入口),不整体占位 -->
|
||||
<template v-if="resolved">
|
||||
<div
|
||||
v-if="compact && resolved"
|
||||
class="flex flex-wrap items-center justify-between gap-2"
|
||||
data-testid="review-customer-resolution-compact"
|
||||
>
|
||||
<p class="text-xs text-secondary">
|
||||
<span class="font-medium text-primary">{{ t('chat.shippingOrderReview.customerResolution.title') }}</span>
|
||||
<span class="mx-1 text-muted">·</span>
|
||||
<span>{{ displayName }}</span>
|
||||
</p>
|
||||
<span
|
||||
class="rounded-full bg-emerald-100 px-2 py-0.5 text-[11px] font-medium text-emerald-800 dark:bg-emerald-950 dark:text-emerald-100"
|
||||
data-testid="review-customer-resolution-badge"
|
||||
<button
|
||||
type="button"
|
||||
class="flex min-w-0 flex-1 items-center gap-2 text-left"
|
||||
data-testid="review-customer-resolution-toggle"
|
||||
:aria-expanded="confirmedDetailsExpanded"
|
||||
@click="toggleConfirmedDetails"
|
||||
>
|
||||
{{ statusLabel }}
|
||||
</span>
|
||||
<span
|
||||
class="shrink-0 rounded-full bg-emerald-100 px-2 py-0.5 text-[11px] font-medium text-emerald-800 dark:bg-emerald-950 dark:text-emerald-100"
|
||||
data-testid="review-customer-resolution-badge"
|
||||
>
|
||||
{{ statusLabel }}
|
||||
</span>
|
||||
<span class="truncate text-xs font-medium text-primary">{{ displayName }}</span>
|
||||
<span class="shrink-0 text-[10px] text-muted" aria-hidden="true">{{ confirmedDetailsExpanded ? '▲' : '▼' }}</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="shrink-0 rounded-xl border border-default bg-surface px-3 py-1.5 text-sm text-secondary hover:bg-surface-soft disabled:opacity-60"
|
||||
data-testid="review-rebind-customer"
|
||||
:disabled="!rebindAllowed || busy"
|
||||
:title="rebindAllowed ? undefined : t('chat.shippingOrderReview.customerResolution.rebindDisabledExcelExists')"
|
||||
@click="openRebindDialog"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.customerResolution.rebindButton') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- 已确认展开区:既有识别详情(标准客户/编码/命中输入/候选),不含 ODM 范围 -->
|
||||
<dl
|
||||
v-if="confirmedDetailsExpanded"
|
||||
class="mt-2 space-y-1 text-xs text-secondary"
|
||||
data-testid="review-customer-resolution-details"
|
||||
>
|
||||
<div class="flex flex-wrap gap-x-2">
|
||||
<dt class="text-muted">{{ t('chat.shippingOrderReview.customerResolution.standardCustomer') }}</dt>
|
||||
<dd class="font-medium text-primary">{{ displayName }}</dd>
|
||||
</div>
|
||||
<div v-if="resolution?.short_code" class="flex flex-wrap gap-x-2">
|
||||
<dt class="text-muted">{{ t('chat.shippingOrderReview.customerResolution.customerCode') }}</dt>
|
||||
<dd class="font-mono font-medium text-primary">{{ resolution.short_code }}</dd>
|
||||
</div>
|
||||
<div v-if="inputValues.length" class="mt-2 border-t border-default pt-2">
|
||||
<dt class="text-muted">{{ t('chat.shippingOrderReview.customerResolution.matchedInputs') }}</dt>
|
||||
<dd v-for="item in inputValues" :key="`${item.definition_code}:${item.normalized_value}`" class="mt-1 flex flex-wrap gap-x-2">
|
||||
<span class="text-muted">{{ inputLabel(item.definition_label || item.definition_code) }}</span>
|
||||
<span class="font-mono text-primary">{{ item.raw_value || item.normalized_value || '—' }}</span>
|
||||
</dd>
|
||||
</div>
|
||||
<div v-if="candidateRows.length > 1" class="mt-2 border-t border-default pt-2">
|
||||
<dt class="text-muted">{{ t('chat.shippingOrderReview.customerResolution.candidates') }}</dt>
|
||||
<dd v-for="candidate in candidateRows" :key="String(candidate.customer_id)" class="mt-1 flex flex-wrap gap-x-2">
|
||||
<span class="text-primary">{{ candidateValue(candidate, 'standard_name') }}</span>
|
||||
<span class="font-mono text-muted">{{ candidateValue(candidate, 'short_code') }}</span>
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
</template>
|
||||
<!-- 未确认态:既有识别候选确认流程(现状不动) -->
|
||||
<template v-else>
|
||||
<header class="flex flex-wrap items-start justify-between gap-2">
|
||||
<div>
|
||||
@@ -209,10 +343,7 @@ async function onRetry() {
|
||||
</p>
|
||||
</div>
|
||||
<span
|
||||
class="rounded-full px-2.5 py-1 text-xs font-medium"
|
||||
:class="resolved
|
||||
? 'bg-emerald-100 text-emerald-800 dark:bg-emerald-950 dark:text-emerald-100'
|
||||
: 'bg-amber-100 text-amber-900 dark:bg-amber-950 dark:text-amber-100'"
|
||||
class="rounded-full px-2.5 py-1 text-xs font-medium bg-amber-100 text-amber-900 dark:bg-amber-950 dark:text-amber-100"
|
||||
data-testid="review-customer-resolution-badge"
|
||||
>
|
||||
{{ statusLabel }}
|
||||
@@ -269,15 +400,57 @@ async function onRetry() {
|
||||
<p class="mt-2 text-[11px] text-muted">
|
||||
{{ t('chat.shippingOrderReview.customerResolution.pdfReparseHint') }}
|
||||
</p>
|
||||
</template>
|
||||
|
||||
<!-- 客户搜索选择弹窗:未确认态确认 / 已确认态改绑共用 -->
|
||||
<ShippingCustomerConfirmDialog
|
||||
:open="dialogOpen"
|
||||
:options="options"
|
||||
:loading="loadingOptions || busy"
|
||||
@close="dialogOpen = false"
|
||||
@search="searchCustomers"
|
||||
@confirm="onConfirm"
|
||||
@confirm="onCustomerDialogConfirm"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<!-- 改绑影响确认弹窗:明示快照重冻结与通知/Excel 重生成影响后再提交。Teleport 到 body 避免粘性列穿透。 -->
|
||||
<Teleport to="body">
|
||||
<div
|
||||
v-if="rebindConfirmOpen"
|
||||
class="admin-modal-overlay animate-fade-in items-center z-[180]"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
data-testid="review-rebind-confirm-dialog"
|
||||
>
|
||||
<div class="admin-modal-panel max-w-md scale-100">
|
||||
<div class="px-6 py-5 border-b border-subtle">
|
||||
<h3 class="section-title">{{ t('chat.shippingOrderReview.customerResolution.rebindConfirmTitle') }}</h3>
|
||||
</div>
|
||||
<div class="px-6 py-5 space-y-3 text-sm">
|
||||
<p class="text-secondary">{{ t('chat.shippingOrderReview.customerResolution.rebindConfirmImpact') }}</p>
|
||||
<p class="font-medium text-primary" data-testid="review-rebind-confirm-customer">{{ pendingRebindCustomerLabel }}</p>
|
||||
</div>
|
||||
<div class="admin-modal-footer">
|
||||
<button
|
||||
type="button"
|
||||
class="btn-ghost"
|
||||
data-testid="review-rebind-confirm-cancel"
|
||||
:disabled="busy"
|
||||
@click="rebindConfirmOpen = false"
|
||||
>
|
||||
{{ t('common.cancel') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-primary"
|
||||
data-testid="review-rebind-confirm-submit"
|
||||
:disabled="busy"
|
||||
@click="onRebindConfirmSubmit"
|
||||
>
|
||||
{{ t('chat.shippingCustomer.confirm') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</section>
|
||||
</template>
|
||||
@@ -2556,6 +2556,8 @@ export interface ShippingOrderReviewCustomerResolution {
|
||||
resolved: boolean;
|
||||
status: string;
|
||||
role?: string;
|
||||
/** 「修改客户」按钮谓词(后端按 editable_scope.header 下发);缺省视为不可改绑。 */
|
||||
rebind_allowed?: boolean;
|
||||
extraction_id?: number | null;
|
||||
raw_name?: string | null;
|
||||
customer_id?: number | null;
|
||||
|
||||
@@ -3130,6 +3130,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
vi.mocked(taskApi.getWorkspaceShippingTask).mockResolvedValue({
|
||||
task_no: 'SN-READY', status: 'processing', lines: [], events: [],
|
||||
ui_state: {
|
||||
edit_window: { header: true },
|
||||
lifecycle_stage: 'fulfillment_prep', lifecycle_entries: [{ code: 'fulfillment_prep', state: 'current' }],
|
||||
stage_context: {
|
||||
preparation: {
|
||||
@@ -3201,6 +3202,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
vi.mocked(taskApi.getWorkspaceShippingTask).mockResolvedValue({
|
||||
task_no: 'SN-READY', status: 'processing', lines: [], events: [],
|
||||
ui_state: {
|
||||
edit_window: { header: true },
|
||||
lifecycle_stage: 'fulfillment_prep', lifecycle_entries: [{ code: 'fulfillment_prep', state: 'current' }],
|
||||
stage_context: {
|
||||
preparation: {
|
||||
@@ -3259,6 +3261,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
vi.mocked(taskApi.getWorkspaceShippingTask).mockResolvedValue({
|
||||
task_no: 'SN-READY', status: 'processing', lines: [], events: [],
|
||||
ui_state: {
|
||||
edit_window: { header: true },
|
||||
lifecycle_stage: 'fulfillment_prep', lifecycle_entries: [{ code: 'fulfillment_prep', state: 'current' }],
|
||||
stage_context: {
|
||||
preparation: {
|
||||
|
||||
@@ -463,12 +463,12 @@ const isReviewContentReadOnly = computed(() => (
|
||||
isReadOnly.value || isCompletedFormalTask.value || isStpAutoCreateInProgress.value
|
||||
));
|
||||
|
||||
/** 二期编辑窗(D10):读正式任务 ui_state.edit_window;前端 fail-closed,锁定字段禁用/提示。 */
|
||||
/** 二期编辑窗(D10):读正式任务 ui_state.edit_window(后端权威下发,见 ui_state._build_edit_window)。 */
|
||||
const formalEditWindow = computed(() => formalTaskDetail.value?.ui_state?.edit_window ?? null);
|
||||
|
||||
/** 头字段可编辑:edit_window.header 缺省视为可编辑(后端为权威守卫)。 */
|
||||
/** 头字段可编辑:仅 edit_window.header 显式为 true(无 Export Artifact 且无活动 Attempt)时显示。 */
|
||||
function formalHeaderEditable(): boolean {
|
||||
return formalEditWindow.value?.header !== false;
|
||||
return formalEditWindow.value?.header === true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -522,8 +522,9 @@ async function retryCurrentIntakeParse(): Promise<void> {
|
||||
* 只切换前端工作面并同步可分享深链;禁止在导航点击中修改任何订单生命周期字段。
|
||||
*/
|
||||
const lifecycleStagePinnedByUserForCase = ref<string | null>(null);
|
||||
/** 仅库存短缺放行可建立一次性自动推进许可,避免通用 Gate 恢复抢占用户导航。 */
|
||||
/** 用户触发的推进类 Gate 动作可建立一次性自动推进许可(动作时阶段→新阶段),避免通用 Gate 恢复抢占用户导航。 */
|
||||
const pendingReleaseAutoAdvanceCaseNo = ref<string | null>(null);
|
||||
const pendingReleaseAutoAdvanceFromStage = ref<ReviewLifecycleStageCode | null>(null);
|
||||
/**
|
||||
* 当前重解析完成前的一次性导航许可。
|
||||
*
|
||||
@@ -561,34 +562,41 @@ function cancelPendingReparseNavigation() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 消费库存短缺放行后的自动推进许可。
|
||||
* 消费用户触发的推进类 Gate 动作(缺口放行、重新生成 Excel 等)建立的一次性推进许可。
|
||||
*
|
||||
* 仅当同一 Case 仍停留在放行前的通知准备路由、用户未在放行后手动选阶段,且后端
|
||||
* 权威投影已推进时替换深链。异步 Job 的首个投影可直接到目标阶段,不能依赖 watch
|
||||
* 是否曾观察到旧阶段。
|
||||
* 仅当同一 Case 仍停留在动作发生时的阶段路由、用户未在动作后手动选阶段,且后端
|
||||
* 权威投影已越过动作时阶段时替换深链。异步 Job 的首个投影可直接到目标阶段,不能
|
||||
* 依赖 watch 是否曾观察到旧阶段。
|
||||
*/
|
||||
async function syncPendingReleaseAutoAdvance(): Promise<boolean> {
|
||||
const caseNo = String(activeCase.value?.case_no || '').trim();
|
||||
if (!caseNo || pendingReleaseAutoAdvanceCaseNo.value !== caseNo) return false;
|
||||
const fromStage = pendingReleaseAutoAdvanceFromStage.value;
|
||||
if (!caseNo || !fromStage || pendingReleaseAutoAdvanceCaseNo.value !== caseNo) return false;
|
||||
const requested = String(route.query.lifecycle_stage || '').trim();
|
||||
if (
|
||||
requested !== 'fulfillment_prep'
|
||||
requested !== fromStage
|
||||
|| lifecycleStagePinnedByUserForCase.value === caseNo
|
||||
) {
|
||||
pendingReleaseAutoAdvanceCaseNo.value = null;
|
||||
pendingReleaseAutoAdvanceFromStage.value = null;
|
||||
return false;
|
||||
}
|
||||
const current = lifecycleCurrentStageCode.value;
|
||||
const currentIndex = current ? LIFECYCLE_STAGE_CODES.indexOf(current) : -1;
|
||||
if (currentIndex <= LIFECYCLE_STAGE_CODES.indexOf('fulfillment_prep')) return false;
|
||||
if (currentIndex <= LIFECYCLE_STAGE_CODES.indexOf(fromStage)) return false;
|
||||
pendingReleaseAutoAdvanceCaseNo.value = null;
|
||||
pendingReleaseAutoAdvanceFromStage.value = null;
|
||||
await selectLifecycleStage(current!, { replace: true });
|
||||
return true;
|
||||
}
|
||||
|
||||
async function selectLifecycleStage(code: ReviewLifecycleStageCode, options: { replace?: boolean } = {}) {
|
||||
async function selectLifecycleStage(
|
||||
code: ReviewLifecycleStageCode,
|
||||
options: { replace?: boolean; followThrough?: boolean } = {},
|
||||
) {
|
||||
const target = lifecycleStageItems.value.find((item) => item.code === code);
|
||||
if (!target || target.state === 'blocked') return;
|
||||
// followThrough:提交订单入队后允许进入尚未点亮的目标阶段(任务去向确定,阶段条随后端刷新点亮)。
|
||||
if (!target || (target.state === 'blocked' && !options.followThrough)) return;
|
||||
// 用户主动回看后端 available 或已完成阶段时,异步投影抵达不得将其强制带回当前阶段。
|
||||
// 自动推进均使用 replace,不会写入该意图。
|
||||
if (!options.replace) {
|
||||
@@ -597,6 +605,7 @@ async function selectLifecycleStage(code: ReviewLifecycleStageCode, options: { r
|
||||
rememberPendingReparseStage(code);
|
||||
if (pendingReleaseAutoAdvanceCaseNo.value === caseNo) {
|
||||
pendingReleaseAutoAdvanceCaseNo.value = null;
|
||||
pendingReleaseAutoAdvanceFromStage.value = null;
|
||||
}
|
||||
}
|
||||
if (code === 'intake_parse' && intakeParseContextAuthorized.value && intakeTargetCaseNo.value) {
|
||||
@@ -658,6 +667,7 @@ watch(
|
||||
if (caseNo !== previousCaseNo) {
|
||||
lifecycleStagePinnedByUserForCase.value = null;
|
||||
pendingReleaseAutoAdvanceCaseNo.value = null;
|
||||
pendingReleaseAutoAdvanceFromStage.value = null;
|
||||
}
|
||||
},
|
||||
);
|
||||
@@ -1779,6 +1789,8 @@ function handleGateRecoveryAccepted(options: { releaseAutoAdvance?: boolean } =
|
||||
// 放行前可能是用户手动进入通知准备;该历史意图不能阻止本次放行后的自动推进。
|
||||
lifecycleStagePinnedByUserForCase.value = null;
|
||||
pendingReleaseAutoAdvanceCaseNo.value = caseNo;
|
||||
// 记录动作时阶段:只跟随「越过动作时阶段」的一次推进,且用户主动换页会取消。
|
||||
pendingReleaseAutoAdvanceFromStage.value = lifecycleCurrentStageCode.value;
|
||||
}
|
||||
page.bumpWorkflowRefresh?.();
|
||||
startWorkflowProgressPolling();
|
||||
@@ -1876,7 +1888,7 @@ async function executeFormalTaskAction(
|
||||
if (!formalGate) return;
|
||||
const result = await submitProcessGatePrimaryAction(formalGate, { actionCode: action.code });
|
||||
if (result.outcome === 'submitted' || result.outcome === 'refresh_needed') {
|
||||
handleGateRecoveryAccepted();
|
||||
handleGateRecoveryAccepted({ releaseAutoAdvance: true });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1946,7 +1958,7 @@ async function handleCurrentTaskAction(
|
||||
if (serverAuthorizedGateAction) {
|
||||
const result = await submitProcessGatePrimaryAction(processGate, { actionCode: normalizedCode });
|
||||
if (result.outcome === 'submitted' || result.outcome === 'refresh_needed') {
|
||||
handleGateRecoveryAccepted();
|
||||
handleGateRecoveryAccepted({ releaseAutoAdvance: true });
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -2011,7 +2023,7 @@ async function handleCurrentTaskAction(
|
||||
if (!summary) return;
|
||||
const result = await submitProcessGatePrimaryAction(summary, { actionCode: code });
|
||||
if (result.outcome === 'submitted' || result.outcome === 'refresh_needed') {
|
||||
handleGateRecoveryAccepted();
|
||||
handleGateRecoveryAccepted({ releaseAutoAdvance: true });
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2937,7 +2949,7 @@ async function confirmCloseLine() {
|
||||
expected_draft_version: activeCase.value?.draft?.draft_version,
|
||||
});
|
||||
closeLineDialogLine.value = null;
|
||||
handleGateRecoveryAccepted();
|
||||
handleGateRecoveryAccepted({ releaseAutoAdvance: true });
|
||||
} catch (error) {
|
||||
msg.warning(error instanceof Error ? error.message : t('chat.shippingOrderReview.workbench.resultNotReady'));
|
||||
} finally {
|
||||
@@ -4082,7 +4094,8 @@ const submitFormalGateAction = async (
|
||||
});
|
||||
if (result.outcome === 'submitted' || result.outcome === 'refresh_needed') {
|
||||
progressRetrying.value = false;
|
||||
handleGateRecoveryAccepted();
|
||||
// 用户触发的推进类动作(重新生成 Excel 等)成功后允许自动跳到新阶段一次。
|
||||
handleGateRecoveryAccepted({ releaseAutoAdvance: true });
|
||||
}
|
||||
} catch (error) {
|
||||
msg.error(resolveReviewErrorMessage(error));
|
||||
@@ -4113,7 +4126,7 @@ const retryStpAutoCreate = async () => {
|
||||
} else {
|
||||
await reloadLatestDraft();
|
||||
}
|
||||
handleGateRecoveryAccepted();
|
||||
handleGateRecoveryAccepted({ releaseAutoAdvance: true });
|
||||
msg.success(t('chat.shippingOrderReview.autoProgress.retryStpSuccess'));
|
||||
} catch (error) {
|
||||
msg.error(resolveReviewErrorMessage(error));
|
||||
@@ -4330,7 +4343,7 @@ const onUnifiedProcessingAction = async (item: ActionPresentationItem) => {
|
||||
if (!formalGate) return;
|
||||
const result = await submitProcessGatePrimaryAction(formalGate, { actionCode: authorized.code });
|
||||
if (result.outcome === 'submitted' || result.outcome === 'refresh_needed') {
|
||||
handleGateRecoveryAccepted();
|
||||
handleGateRecoveryAccepted({ releaseAutoAdvance: true });
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -4353,6 +4366,15 @@ const onValidate = async () => {
|
||||
try {
|
||||
const resume = await validate();
|
||||
showReviewResumeOutcome(resume, msg, t, t('chat.shippingOrderReview.saveOrderAndValidateSuccess'));
|
||||
// 入队即确定去向:正式任务创建后进入通知准备工作面(产品确认 2026-10-13),
|
||||
// 不再回放提交前「接收解析」的初始阶段快照;后续获取库存/货代上传推进继续跟随。
|
||||
const outcome = String(resume?.outcome || '').trim();
|
||||
if (['auto_create_enqueued', 'already_queued', 'already_running'].includes(outcome)) {
|
||||
lifecycleStagePinnedByUserForCase.value = null;
|
||||
pendingReleaseAutoAdvanceCaseNo.value = null;
|
||||
pendingReleaseAutoAdvanceFromStage.value = null;
|
||||
await selectLifecycleStage('fulfillment_prep', { replace: true, followThrough: true });
|
||||
}
|
||||
} catch (error) {
|
||||
msg.error(resolveReviewErrorMessage(error));
|
||||
}
|
||||
@@ -6000,14 +6022,16 @@ watch(
|
||||
@open-details="openEligibilityDetails"
|
||||
@navigate-exception="navigateExceptionField"
|
||||
/>
|
||||
<!-- 订单复核 Gate 统一收敛至右栏;主编辑列只保留字段、明细与证据。 -->
|
||||
<!-- 订单复核 Gate 统一收敛至右栏;主编辑列只保留字段、明细与证据。
|
||||
客户识别面板两态渲染(resolved 与否由面板内部分态):已确认折叠为摘要条并提供改绑入口,
|
||||
不再在 resolved 后整体消失。 -->
|
||||
<template v-if="showOrderReviewEditor && activeCase">
|
||||
<ReviewCustomerResolutionPanel
|
||||
v-if="!activeCase.customer_resolution?.resolved"
|
||||
ref="customerResolutionWideRef"
|
||||
:case-no="activeCase.case_no"
|
||||
:resolution="activeCase.customer_resolution"
|
||||
:editable="editable"
|
||||
:order-data-version="activeCase.order_data_version"
|
||||
@refreshed="handleReviewGateDataRefreshed"
|
||||
/>
|
||||
<ReviewFieldConflictPanel
|
||||
|
||||
@@ -2243,6 +2243,12 @@
|
||||
"retrying": "Identifying…",
|
||||
"retryDone": "Customer re-identified",
|
||||
"retryFailed": "Failed to re-identify customer",
|
||||
"rebindButton": "Change customer",
|
||||
"rebindDisabledExcelExists": "Notice/Excel already generated — undo it first",
|
||||
"rebindConfirmTitle": "Confirm customer change",
|
||||
"rebindConfirmImpact": "The order customer will be updated and the snapshot re-frozen; generated notice/Excel must be regenerated",
|
||||
"rebindSuccessToast": "Customer updated — regenerate the Excel in notice preparation",
|
||||
"rebindFailedToast": "Failed to change customer",
|
||||
"uniqueCandidateHint": "One standard customer candidate was found. Saving and validating will confirm it automatically, or you can confirm it manually.",
|
||||
"confirmUniqueCandidate": "Confirm unique candidate",
|
||||
"confirmed": "Customer confirmed",
|
||||
|
||||
@@ -605,6 +605,13 @@
|
||||
"TRANSFER.DOCUMENT_NOT_FOUND": "Transfer ticket not found.",
|
||||
"INTEGRATION.BINDING_LEGACY_PUT_REJECTED": "Legacy single-step fields would truncate this binding's multi-step recipe; submit ordered steps via steps_json instead.",
|
||||
"INTEGRATION.CALL_NOT_FOUND": "Integration call not found.",
|
||||
"INTEGRATION.BINDING_STEPS_INVALID": "Binding steps invalid: steps_json is required, must be a non-empty array of objects."
|
||||
"INTEGRATION.BINDING_STEPS_INVALID": "Binding steps invalid: steps_json is required, must be a non-empty array of objects.",
|
||||
"SHIPPING.CUSTOMER_REBIND_BLOCKED": "Customer cannot be changed after a shipping notice/Excel has been generated — undo it first",
|
||||
"SHIPPING.CUSTOMER_REBIND_SAME_CUSTOMER": "The selected customer is already the confirmed customer",
|
||||
"SHIPPING.CUSTOMER_RESOLUTION_REQUIRED": "Confirm the customer identification first",
|
||||
"SHIPPING.FORMAL_OT_REQUIRED": "Create the formal task first",
|
||||
"SHIPPING.CUSTOMER_REBIND_CUSTOMER_REQUIRED": "Select a target customer",
|
||||
"SHIPPING.CUSTOMER_REBIND_VERSION_REQUIRED": "Order version has changed — refresh and retry",
|
||||
"SHIPPING.CUSTOMER_REBIND_ACTOR_REQUIRED": "Customer rebind requires an operator"
|
||||
}
|
||||
}
|
||||
@@ -2243,6 +2243,12 @@
|
||||
"retrying": "กำลังระบุ…",
|
||||
"retryDone": "ระบุลูกค้าใหม่แล้ว",
|
||||
"retryFailed": "ระบุลูกค้าใหม่ไม่สำเร็จ",
|
||||
"rebindButton": "เปลี่ยนลูกค้า",
|
||||
"rebindDisabledExcelExists": "มีการแจ้งเตือน/Excel แล้ว โปรดยกเลิกก่อน",
|
||||
"rebindConfirmTitle": "ยืนยันการเปลี่ยนลูกค้า",
|
||||
"rebindConfirmImpact": "ลูกค้าจะถูกอัปเดตและ snapshot จะถูก freeze ใหม่",
|
||||
"rebindSuccessToast": "อัปเดตลูกค้าแล้ว สร้าง Excel ใหม่ได้",
|
||||
"rebindFailedToast": "เปลี่ยนลูกค้าไม่สำเร็จ",
|
||||
"uniqueCandidateHint": "พบผู้สมัครลูกค้ามาตรฐานเพียงรายเดียว การบันทึกและตรวจสอบจะยืนยันโดยอัตโนมัติ หรือยืนยันด้วยตนเองได้",
|
||||
"confirmUniqueCandidate": "ยืนยันผู้สมัครรายเดียว",
|
||||
"confirmed": "ยืนยันลูกค้าแล้ว",
|
||||
|
||||
@@ -605,6 +605,13 @@
|
||||
"TRANSFER.DOCUMENT_NOT_FOUND": "ไม่พบตั๋วโอนย้าย",
|
||||
"INTEGRATION.BINDING_LEGACY_PUT_REJECTED": "ฟิลด์ขั้นตอนเดียวแบบเดิมจะตัดทอนสูตรหลายขั้นตอนของการผูกนี้ โปรดส่งขั้นตอนตามลำดับด้วย steps_json แทน",
|
||||
"INTEGRATION.CALL_NOT_FOUND": "ไม่พบระเบียนการเรียกใช้งานการผสานรวม",
|
||||
"INTEGRATION.BINDING_STEPS_INVALID": "การกำหนดค่าขั้นตอนการเชื่อมโยงไม่ถูกต้อง: steps_json จำเป็นต้องมีและเป็นอาร์เรย์ที่ไม่ว่าง โดยแต่ละรายการต้องเป็นออบเจกต์"
|
||||
"INTEGRATION.BINDING_STEPS_INVALID": "การกำหนดค่าขั้นตอนการเชื่อมโยงไม่ถูกต้อง: steps_json จำเป็นต้องมีและเป็นอาร์เรย์ที่ไม่ว่าง โดยแต่ละรายการต้องเป็นออบเจกต์",
|
||||
"SHIPPING.CUSTOMER_REBIND_BLOCKED": "มีการแจ้งเตือน/Excel แล้ว ไม่สามารถเปลี่ยนลูกค้าได้ โปรดยกเลิกก่อน",
|
||||
"SHIPPING.CUSTOMER_REBIND_SAME_CUSTOMER": "ลูกค้าที่เลือกเป็นลูกค้าที่ยืนยันอยู่แล้ว",
|
||||
"SHIPPING.CUSTOMER_RESOLUTION_REQUIRED": "โปรดยืนยันการระบุลูกค้าก่อน",
|
||||
"SHIPPING.FORMAL_OT_REQUIRED": "โปรดสร้างงานอย่างเป็นทางการก่อน",
|
||||
"SHIPPING.CUSTOMER_REBIND_CUSTOMER_REQUIRED": "โปรดเลือกลูกค้าเป้าหมาย",
|
||||
"SHIPPING.CUSTOMER_REBIND_VERSION_REQUIRED": "เวอร์ชันออเดอร์เปลี่ยนแปลง โปรดรีเฟรชแล้วลองใหม่",
|
||||
"SHIPPING.CUSTOMER_REBIND_ACTOR_REQUIRED": "การเปลี่ยนลูกค้าต้องระบุผู้ดำเนินการ"
|
||||
}
|
||||
}
|
||||
@@ -2277,6 +2277,12 @@
|
||||
"retrying": "识别中…",
|
||||
"retryDone": "已重新识别客户",
|
||||
"retryFailed": "重新识别客户失败",
|
||||
"rebindButton": "修改客户",
|
||||
"rebindDisabledExcelExists": "已产生发货通知/Excel,请先走撤销流程",
|
||||
"rebindConfirmTitle": "确认修改客户",
|
||||
"rebindConfirmImpact": "将更新订单客户并重新冻结订单快照;已生成的发货通知/Excel 需重新生成",
|
||||
"rebindSuccessToast": "客户已更新,可回通知准备重新生成 Excel",
|
||||
"rebindFailedToast": "客户修改失败",
|
||||
"uniqueCandidateHint": "已找到唯一标准客户候选;保存校验时系统会自动确认,也可手动确认。",
|
||||
"confirmUniqueCandidate": "确认唯一候选",
|
||||
"confirmed": "客户已确认",
|
||||
|
||||
@@ -605,6 +605,13 @@
|
||||
"TRANSFER.DOCUMENT_NOT_FOUND": "调拨票不存在。",
|
||||
"INTEGRATION.BINDING_LEGACY_PUT_REJECTED": "旧单步字段会截断该绑定的多步配方,请改用 steps_json 提交有序步骤。",
|
||||
"INTEGRATION.CALL_NOT_FOUND": "集成调用记录不存在。",
|
||||
"INTEGRATION.BINDING_STEPS_INVALID": "绑定步骤配置不合法:steps_json 必填且为非空数组,每项须为对象。"
|
||||
"INTEGRATION.BINDING_STEPS_INVALID": "绑定步骤配置不合法:steps_json 必填且为非空数组,每项须为对象。",
|
||||
"SHIPPING.CUSTOMER_REBIND_BLOCKED": "已产生发货通知/Excel,无法修改客户,请先走撤销流程",
|
||||
"SHIPPING.CUSTOMER_REBIND_SAME_CUSTOMER": "新客户与当前确认客户相同",
|
||||
"SHIPPING.CUSTOMER_RESOLUTION_REQUIRED": "请先完成客户识别确认",
|
||||
"SHIPPING.FORMAL_OT_REQUIRED": "请先创建正式任务",
|
||||
"SHIPPING.CUSTOMER_REBIND_CUSTOMER_REQUIRED": "请选择目标客户",
|
||||
"SHIPPING.CUSTOMER_REBIND_VERSION_REQUIRED": "订单版本已变化,请刷新后重试",
|
||||
"SHIPPING.CUSTOMER_REBIND_ACTOR_REQUIRED": "缺少操作人信息,无法修改客户"
|
||||
}
|
||||
}
|
||||
@@ -2243,6 +2243,12 @@
|
||||
"retrying": "識別中…",
|
||||
"retryDone": "已重新識別客戶",
|
||||
"retryFailed": "重新識別客戶失敗",
|
||||
"rebindButton": "修改客戶",
|
||||
"rebindDisabledExcelExists": "已產生發貨通知/Excel,請先走撤銷流程",
|
||||
"rebindConfirmTitle": "確認修改客戶",
|
||||
"rebindConfirmImpact": "將更新訂單客戶並重新凍結訂單快照;已產生的發貨通知/Excel 需重新生成",
|
||||
"rebindSuccessToast": "客戶已更新,可回通知準備重新產生 Excel",
|
||||
"rebindFailedToast": "客戶修改失敗",
|
||||
"uniqueCandidateHint": "已找到唯一標準客戶候選;儲存校驗時系統會自動確認,也可手動確認。",
|
||||
"confirmUniqueCandidate": "確認唯一候選",
|
||||
"confirmed": "客戶已確認",
|
||||
|
||||
@@ -605,6 +605,13 @@
|
||||
"TRANSFER.DOCUMENT_NOT_FOUND": "調撥票不存在。",
|
||||
"INTEGRATION.BINDING_LEGACY_PUT_REJECTED": "舊單步欄位會截斷該繫結的多步配方,請改用 steps_json 提交有序步驟。",
|
||||
"INTEGRATION.CALL_NOT_FOUND": "整合調用記錄不存在。",
|
||||
"INTEGRATION.BINDING_STEPS_INVALID": "綁定步驟配置不合法:steps_json 必填且為非空陣列,每項須為物件。"
|
||||
"INTEGRATION.BINDING_STEPS_INVALID": "綁定步驟配置不合法:steps_json 必填且為非空陣列,每項須為物件。",
|
||||
"SHIPPING.CUSTOMER_REBIND_BLOCKED": "已產生發貨通知/Excel,無法修改客戶,請先走撤銷流程",
|
||||
"SHIPPING.CUSTOMER_REBIND_SAME_CUSTOMER": "新客戶與當前確認客戶相同",
|
||||
"SHIPPING.CUSTOMER_RESOLUTION_REQUIRED": "請先完成客戶識別確認",
|
||||
"SHIPPING.FORMAL_OT_REQUIRED": "請先建立正式任務",
|
||||
"SHIPPING.CUSTOMER_REBIND_CUSTOMER_REQUIRED": "請選擇目標客戶",
|
||||
"SHIPPING.CUSTOMER_REBIND_VERSION_REQUIRED": "訂單版本已變化,請重新整理後重試",
|
||||
"SHIPPING.CUSTOMER_REBIND_ACTOR_REQUIRED": "缺少操作人資訊,無法修改客戶"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user