feat(shipping-notice): 完善发货通知自动推进与多库存源复核闭环
This commit is contained in:
1 parent
cfa19a0b7b
commit
8e0bbf7a81
180 files changed
+31210
-1864
No files matched your search
@@ -61,6 +61,8 @@ const ShippingAuditCenterPage = () =>
|
||||
import("@/features/admin/modules/shipping-audit/ShippingAuditCenterPage.vue");
|
||||
const ShippingProcessGateDiagnosticsPage = () =>
|
||||
import("@/features/admin/modules/shipping-process-gates/ShippingProcessGateDiagnosticsPage.vue");
|
||||
const ShippingLegacyStpJobsPage = () =>
|
||||
import("@/features/admin/modules/shipping-legacy-stp-jobs/ShippingLegacyStpJobsPage.vue");
|
||||
const ShippingOrderDocumentProfilesPage = () =>
|
||||
import("@/features/admin/modules/shipping-order-document-profiles/ShippingOrderDocumentProfilesPage.vue");
|
||||
const OrderProfileVersionDetailPage = () =>
|
||||
@@ -215,6 +217,12 @@ export const adminRoutes: RouteRecordRaw[] = [
|
||||
component: ShippingProcessGateDiagnosticsPage,
|
||||
meta: { requiresAdmin: true, adminModule: "shipping_inventory", adminSubModule: 'process_gates', title: "门禁诊断" },
|
||||
},
|
||||
{
|
||||
path: "shipping-legacy-stp-jobs",
|
||||
name: "AdminShippingLegacyStpJobs",
|
||||
component: ShippingLegacyStpJobsPage,
|
||||
meta: { requiresAdmin: true, adminModule: "shipping_inventory", adminSubModule: 'legacy_stp_jobs', title: "历史 STP Job" },
|
||||
},
|
||||
{
|
||||
path: "shipping-order-document-profiles",
|
||||
name: "AdminShippingOrderDocumentProfiles",
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
/**
|
||||
* features/admin/api/shipping-legacy-stp-jobs.api.ts
|
||||
* 用途:Phase 5-1 —— 管理员历史 STP Job(928/929 面板)HTTP API 客户端。
|
||||
* 依赖:requestJson / getAuthHeaders(shared/api/client & shared/utils/auth)。
|
||||
* 逻辑:GET list / GET detail;后端 URL 为 /api/admin/shipping-notice/legacy-stp-jobs。
|
||||
*/
|
||||
import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
import { requestJson } from '@/shared/api/client';
|
||||
import type { PaginatedResult } from '@/shared/types/pagination.types';
|
||||
|
||||
const auth = () => ({ headers: getAuthHeaders() });
|
||||
|
||||
export type LegacyStpJobRow = {
|
||||
job_id: number;
|
||||
domain: string;
|
||||
job_type: string;
|
||||
status: 'failed' | 'dead' | string;
|
||||
business_ref: string | null;
|
||||
reference_key: string | null;
|
||||
case_no: string | null;
|
||||
priority: number;
|
||||
attempts: number;
|
||||
max_attempts: number;
|
||||
message: string | null;
|
||||
error_message: string | null;
|
||||
error_code: string | null;
|
||||
blocking_reason: string | null;
|
||||
retryable: boolean | null;
|
||||
next_action: string | string[] | null;
|
||||
retry_of_job_id: number | null;
|
||||
created_by_id: number | null;
|
||||
result_json_masked: Record<string, unknown> | null;
|
||||
payload_json_masked: Record<string, unknown> | null;
|
||||
created_at: string | null;
|
||||
updated_at: string | null;
|
||||
started_at: string | null;
|
||||
finished_at: string | null;
|
||||
};
|
||||
|
||||
export type LegacyStpJobCaseBacklink = {
|
||||
case_id: number;
|
||||
case_no: string;
|
||||
status: string;
|
||||
candidate_id: number | null;
|
||||
confirmed_task_id: number | null;
|
||||
document_id: number | null;
|
||||
owner_user_id: number | null;
|
||||
created_at: string | null;
|
||||
updated_at: string | null;
|
||||
};
|
||||
|
||||
export type LegacyStpJobReplayPlan = {
|
||||
supported: boolean;
|
||||
recommended_user_action: 'force_create' | 'create_revision' | string;
|
||||
needs_replay_mode: boolean;
|
||||
reconcile_and_progress_endpoint: string | null;
|
||||
};
|
||||
|
||||
export type LegacyStpJobDetailPayload = {
|
||||
job: LegacyStpJobRow;
|
||||
case: LegacyStpJobCaseBacklink | null;
|
||||
replay_plan: LegacyStpJobReplayPlan;
|
||||
};
|
||||
|
||||
export type LegacyStpJobListFilters = {
|
||||
status?: '' | 'failed' | 'dead';
|
||||
job_type?: string;
|
||||
q?: string;
|
||||
case_no?: string;
|
||||
error_code?: string;
|
||||
blocking_reason?: string;
|
||||
created_from?: string;
|
||||
created_to?: string;
|
||||
sort?: string;
|
||||
};
|
||||
|
||||
const EMPTY_FILTERS: Required<LegacyStpJobListFilters> = {
|
||||
status: '',
|
||||
job_type: '',
|
||||
q: '',
|
||||
case_no: '',
|
||||
error_code: '',
|
||||
blocking_reason: '',
|
||||
created_from: '',
|
||||
created_to: '',
|
||||
sort: '-created_at',
|
||||
};
|
||||
|
||||
export const DEFAULT_LEGACY_STP_JOB_FILTERS = EMPTY_FILTERS;
|
||||
|
||||
export const LEGACY_STP_JOB_STATUS_OPTIONS = ['failed', 'dead'] as const;
|
||||
|
||||
function normalizeDateTimeFilter(value?: string): string {
|
||||
const raw = String(value || '').trim();
|
||||
if (!raw) return '';
|
||||
const date = new Date(raw);
|
||||
if (Number.isNaN(date.getTime())) return raw;
|
||||
return date.toISOString();
|
||||
}
|
||||
|
||||
function buildListSearchParams(filters: LegacyStpJobListFilters, page: number, pageSize: number): URLSearchParams {
|
||||
const params = new URLSearchParams({
|
||||
page: String(page),
|
||||
page_size: String(pageSize),
|
||||
});
|
||||
if (filters.status) params.set('status', filters.status);
|
||||
if (filters.job_type) params.set('job_type', filters.job_type);
|
||||
if (filters.q) params.set('q', filters.q);
|
||||
if (filters.case_no) params.set('case_no', filters.case_no);
|
||||
if (filters.error_code) params.set('error_code', filters.error_code);
|
||||
if (filters.blocking_reason) params.set('blocking_reason', filters.blocking_reason);
|
||||
if (filters.created_from) params.set('created_from', normalizeDateTimeFilter(filters.created_from));
|
||||
if (filters.created_to) params.set('created_to', normalizeDateTimeFilter(filters.created_to));
|
||||
if (filters.sort) params.set('sort', filters.sort);
|
||||
return params;
|
||||
}
|
||||
|
||||
export function listAdminLegacyStpJobs(
|
||||
page = 1,
|
||||
pageSize = 25,
|
||||
filters: LegacyStpJobListFilters = {},
|
||||
): Promise<PaginatedResult<LegacyStpJobRow> & {
|
||||
filters: { domain: string; job_types: string[]; statuses: string[] };
|
||||
}> {
|
||||
const params = buildListSearchParams(filters, page, pageSize);
|
||||
return requestJson(`/api/admin/shipping-notice/legacy-stp-jobs?${params}`, auth());
|
||||
}
|
||||
|
||||
export function getAdminLegacyStpJob(jobId: number): Promise<LegacyStpJobDetailPayload> {
|
||||
return requestJson(`/api/admin/shipping-notice/legacy-stp-jobs/${encodeURIComponent(String(jobId))}`, auth());
|
||||
}
|
||||
@@ -23,6 +23,7 @@ export interface ShippingConfigSubModuleMeta {
|
||||
| 'AdminShippingOrderExtractionRuns'
|
||||
| 'AdminShippingAudit'
|
||||
| 'AdminShippingProcessGates'
|
||||
| 'AdminShippingLegacyStpJobs'
|
||||
| 'AdminShippingOrderDocumentProfiles';
|
||||
path:
|
||||
| 'shipping-notice'
|
||||
@@ -32,6 +33,7 @@ export interface ShippingConfigSubModuleMeta {
|
||||
| 'shipping-order-extraction-runs'
|
||||
| 'shipping-audit'
|
||||
| 'shipping-process-gates'
|
||||
| 'shipping-legacy-stp-jobs'
|
||||
| 'shipping-order-document-profiles';
|
||||
labelKey: string;
|
||||
groupKey: 'admin.nav.shippingOrderRecognition' | 'admin.nav.shippingInventoryManagement' | 'admin.nav.shippingRunAudit';
|
||||
@@ -75,6 +77,7 @@ export const SHIPPING_CONFIG_SUB_MODULE_METAS: ShippingConfigSubModuleMeta[] = [
|
||||
{ id: 'shipping_templates', routeName: 'AdminShippingInventory', path: 'shipping-notice', labelKey: 'admin.shippingInventory.excelTemplates', groupKey: 'admin.nav.shippingInventoryManagement', query: { section: 'templates' } },
|
||||
{ id: 'shipping_audit', routeName: 'AdminShippingAudit', path: 'shipping-audit', labelKey: 'admin.nav.shippingAudit', groupKey: 'admin.nav.shippingRunAudit' },
|
||||
{ id: 'process_gates', routeName: 'AdminShippingProcessGates', path: 'shipping-process-gates', labelKey: 'admin.nav.shippingProcessGates', groupKey: 'admin.nav.shippingRunAudit' },
|
||||
{ id: 'legacy_stp_jobs', routeName: 'AdminShippingLegacyStpJobs', path: 'shipping-legacy-stp-jobs', labelKey: 'admin.nav.shippingLegacyStpJobs', groupKey: 'admin.nav.shippingRunAudit' },
|
||||
{ id: 'inventory_snapshots', routeName: 'AdminShippingInventory', path: 'shipping-notice', labelKey: 'admin.shippingInventory.snapshots', groupKey: 'admin.nav.shippingRunAudit', query: { section: 'snapshots' } },
|
||||
{ id: 'export_records', routeName: 'AdminShippingInventory', path: 'shipping-notice', labelKey: 'admin.shippingInventory.exports', groupKey: 'admin.nav.shippingRunAudit', query: { section: 'exports' } },
|
||||
];
|
||||
|
||||
+420
@@ -0,0 +1,420 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-legacy-stp-jobs/ShippingLegacyStpJobsPage.vue
|
||||
用途:Phase 5-1 —— 管理员「历史 STP Job(928/929 回放)」运维面板。
|
||||
依赖:shipping-legacy-stp-jobs.api、Vue Router、Vue I18n、workspace.shippingNotice.actions 键。
|
||||
逻辑:
|
||||
[STEP 1] 左侧 ~38%:分页列表(筛选 q/case_no/error_code/blocking_reason/status/created_from/to)
|
||||
按创建时间倒序;
|
||||
[STEP 2] 右侧 sticky:详情 —— Job 摘要、回链 Review Case(case 非空时跳转工作台 Case 详情)、
|
||||
replay_plan(推荐 user_action)、
|
||||
「一键回放 Reconcile And Progress」按钮直接走
|
||||
POST /api/workspace/shipping-notice/order-review-cases/<case_no>/reconcile-and-progress
|
||||
带 legacy_job_id + replay_mode。
|
||||
全部只读 + 一个写操作(回放按钮),写操作必须管理员;非管理员会被后端 422。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import {
|
||||
DEFAULT_LEGACY_STP_JOB_FILTERS,
|
||||
LEGACY_STP_JOB_STATUS_OPTIONS,
|
||||
getAdminLegacyStpJob,
|
||||
listAdminLegacyStpJobs,
|
||||
type LegacyStpJobDetailPayload,
|
||||
type LegacyStpJobListFilters,
|
||||
type LegacyStpJobRow,
|
||||
} from '@/features/admin/api/shipping-legacy-stp-jobs.api';
|
||||
import { requestJson } from '@/shared/api/client';
|
||||
import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
|
||||
const { t, te } = useI18n();
|
||||
const router = useRouter();
|
||||
const message = useMessage();
|
||||
|
||||
const loading = ref(false);
|
||||
const detailLoading = ref(false);
|
||||
const replaying = ref(false);
|
||||
const error = ref('');
|
||||
const page = ref(1);
|
||||
const pageSize = ref(25);
|
||||
const total = ref(0);
|
||||
const filters = ref<LegacyStpJobListFilters>({ ...DEFAULT_LEGACY_STP_JOB_FILTERS });
|
||||
const rows = ref<LegacyStpJobRow[]>([]);
|
||||
const selectedJobId = ref<number | null>(null);
|
||||
const detail = ref<LegacyStpJobDetailPayload | null>(null);
|
||||
const replayUserAction = ref<'auto' | 'reuse_existing' | 'create_revision' | 'force_create' | 'adjudicate'>('create_revision');
|
||||
const replayLastResult = ref<{ ok: boolean; outcome?: string | null; message?: string | null } | null>(null);
|
||||
|
||||
const formatTime = (value?: string | null) => (value ? new Date(value).toLocaleString() : '—');
|
||||
function jsonFormat(value: unknown): string {
|
||||
if (value == null) return '—';
|
||||
try { return JSON.stringify(value, null, 2); } catch { return String(value); }
|
||||
}
|
||||
type CodeLabelNs = 'admin.legacyStpJobs.statusLabels' | 'admin.legacyStpJobs.reasonCodes' | 'workspace.shippingNotice.processGate.actionCodes';
|
||||
|
||||
function codeLabel(code?: string | null, ns: CodeLabelNs = 'admin.legacyStpJobs.statusLabels'): string {
|
||||
const key = String(code || '').trim();
|
||||
if (!key) return '—';
|
||||
const i18nKey = `${ns}.${key}`;
|
||||
return te(i18nKey) ? t(i18nKey) : key;
|
||||
}
|
||||
function actionLabel(code?: string | null): string { return codeLabel(code, 'workspace.shippingNotice.processGate.actionCodes'); }
|
||||
|
||||
function resetFilters() {
|
||||
filters.value = { ...DEFAULT_LEGACY_STP_JOB_FILTERS };
|
||||
page.value = 1;
|
||||
selectedJobId.value = null;
|
||||
detail.value = null;
|
||||
}
|
||||
|
||||
async function loadList() {
|
||||
loading.value = true;
|
||||
error.value = '';
|
||||
try {
|
||||
const payload = await listAdminLegacyStpJobs(page.value, pageSize.value, filters.value);
|
||||
const items = (payload as any).items ?? [];
|
||||
rows.value = Array.isArray(items) ? items : [];
|
||||
total.value = Number((payload as any).pagination?.total ?? 0);
|
||||
} catch (exc: any) {
|
||||
error.value = exc?.message || String(exc);
|
||||
rows.value = [];
|
||||
total.value = 0;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function loadDetail(jobId: number) {
|
||||
detailLoading.value = true;
|
||||
detail.value = null;
|
||||
replayLastResult.value = null;
|
||||
replayUserAction.value = 'create_revision';
|
||||
try {
|
||||
detail.value = await getAdminLegacyStpJob(jobId);
|
||||
const plan = detail.value.replay_plan;
|
||||
if (plan?.recommended_user_action === 'force_create') {
|
||||
replayUserAction.value = 'force_create';
|
||||
} else if (plan?.recommended_user_action === 'create_revision') {
|
||||
replayUserAction.value = 'create_revision';
|
||||
}
|
||||
} catch (exc: any) {
|
||||
message.error(exc?.message || String(exc));
|
||||
} finally {
|
||||
detailLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function onRowClick(row: LegacyStpJobRow) {
|
||||
selectedJobId.value = Number(row.job_id);
|
||||
loadDetail(Number(row.job_id)).catch(() => {});
|
||||
}
|
||||
|
||||
function openCaseInWorkspace(caseNo: string) {
|
||||
router.push({
|
||||
name: 'WorkspaceShippingNotice',
|
||||
query: { case_no: caseNo, focus: 'review_case' },
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 【回放按钮】严格只走 /workspace/shipping-notice/order-review-cases/<case_no>/reconcile-and-progress,
|
||||
* 携带 operation_id / legacy_job_id / replay_mode / user_action 四参数。
|
||||
* 禁止任何绕过该 API 的直接 SQL/Job.status 修改。
|
||||
*/
|
||||
async function replaySelected() {
|
||||
if (!detail.value || !detail.value.job.case_no) {
|
||||
message.error(t('admin.legacyStpJobs.replayError_noCaseNo'));
|
||||
return;
|
||||
}
|
||||
const caseNo = String(detail.value.job.case_no).trim();
|
||||
const legacyJobId = Number(detail.value.job.job_id);
|
||||
const replayMode = Boolean(detail.value.replay_plan?.needs_replay_mode);
|
||||
const action = replayUserAction.value;
|
||||
const operationId = crypto.randomUUID
|
||||
? crypto.randomUUID()
|
||||
: String(Date.now()) + '-' + Math.random().toString(36).slice(2);
|
||||
const url = `/api/workspace/shipping-notice/order-review-cases/${encodeURIComponent(caseNo)}/reconcile-and-progress`;
|
||||
const headers = { 'Content-Type': 'application/json', ...getAuthHeaders() };
|
||||
const body = JSON.stringify({
|
||||
operation_id: operationId,
|
||||
user_action: action,
|
||||
legacy_job_id: legacyJobId,
|
||||
replay_mode: replayMode || action === 'force_create',
|
||||
});
|
||||
replaying.value = true;
|
||||
replayLastResult.value = null;
|
||||
try {
|
||||
const resp = await requestJson<any>(url, { method: 'POST', headers, body });
|
||||
const outcome = (resp as any)?.data?.outcome ?? null;
|
||||
const ok = !!(resp as any)?.success && String(outcome || '') !== 'ERROR';
|
||||
replayLastResult.value = {
|
||||
ok,
|
||||
outcome: outcome,
|
||||
message: (resp as any)?.data?.message ?? null,
|
||||
};
|
||||
if (ok) {
|
||||
message.success(t('admin.legacyStpJobs.replaySuccess', { outcome: String(outcome || '') }));
|
||||
} else {
|
||||
message.error(t('admin.legacyStpJobs.replayRejected', { outcome: String(outcome || '') }));
|
||||
}
|
||||
} catch (exc: any) {
|
||||
const err = exc?.message || String(exc);
|
||||
replayLastResult.value = { ok: false, outcome: 'ERROR', message: err };
|
||||
message.error(err);
|
||||
} finally {
|
||||
replaying.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(loadList);
|
||||
watch([page, pageSize], loadList);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex flex-col h-full gap-4 lg:gap-6 p-4 lg:p-6">
|
||||
<div class="flex items-center justify-between flex-wrap gap-3">
|
||||
<div>
|
||||
<h2 class="text-xl font-semibold">{{ t('admin.legacyStpJobs.pageTitle') }}</h2>
|
||||
<p class="text-sm text-gray-600">{{ t('admin.legacyStpJobs.pageSubtitle') }}</p>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<button
|
||||
class="px-3 py-1.5 text-sm rounded border border-gray-300 hover:bg-gray-50"
|
||||
type="button"
|
||||
@click="resetFilters"
|
||||
>
|
||||
{{ t('common.reset') }}
|
||||
</button>
|
||||
<button
|
||||
class="px-3 py-1.5 text-sm rounded bg-indigo-600 text-white hover:bg-indigo-700"
|
||||
type="button"
|
||||
@click="loadList"
|
||||
:disabled="loading"
|
||||
>
|
||||
{{ t('common.refresh') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-5 gap-3">
|
||||
<input
|
||||
v-model="filters.q"
|
||||
class="px-3 py-2 border rounded text-sm"
|
||||
:placeholder="t('admin.legacyStpJobs.filterQ')"
|
||||
@keyup.enter="page = 1, loadList()"
|
||||
/>
|
||||
<input
|
||||
v-model="filters.case_no"
|
||||
class="px-3 py-2 border rounded text-sm"
|
||||
:placeholder="t('admin.legacyStpJobs.filterCaseNo')"
|
||||
@keyup.enter="page = 1, loadList()"
|
||||
/>
|
||||
<input
|
||||
v-model="filters.error_code"
|
||||
class="px-3 py-2 border rounded text-sm"
|
||||
:placeholder="t('admin.legacyStpJobs.filterErrorCode')"
|
||||
@keyup.enter="page = 1, loadList()"
|
||||
/>
|
||||
<select
|
||||
v-model="filters.status"
|
||||
class="px-3 py-2 border rounded text-sm"
|
||||
@change="page = 1, loadList()"
|
||||
>
|
||||
<option value="">{{ t('admin.legacyStpJobs.statusAll') }}</option>
|
||||
<option v-for="s in LEGACY_STP_JOB_STATUS_OPTIONS" :key="s" :value="s">{{ codeLabel(s) }}</option>
|
||||
</select>
|
||||
<input
|
||||
v-model="filters.created_from"
|
||||
type="datetime-local"
|
||||
class="px-3 py-2 border rounded text-sm"
|
||||
@change="page = 1, loadList()"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 lg:grid-cols-[minmax(0,38%)_1fr] gap-4 lg:gap-6 min-h-0 flex-1">
|
||||
<!-- 左侧列表 -->
|
||||
<section class="flex flex-col min-h-0 border rounded bg-white/60">
|
||||
<div class="flex items-center justify-between px-4 py-2 border-b">
|
||||
<span class="text-sm font-medium">{{ t('admin.legacyStpJobs.listTitle', { count: total }) }}</span>
|
||||
<span v-if="loading" class="text-xs text-gray-500">{{ t('common.loading') }}</span>
|
||||
</div>
|
||||
<div v-if="error" class="p-3 text-sm text-red-700 bg-red-50 border-b">{{ error }}</div>
|
||||
<div class="overflow-auto min-h-0 max-h-[72vh] divide-y">
|
||||
<div
|
||||
v-for="row in rows"
|
||||
:key="row.job_id"
|
||||
class="px-4 py-3 cursor-pointer hover:bg-indigo-50/60"
|
||||
:class="selectedJobId === row.job_id ? 'bg-indigo-50 ring-2 ring-inset ring-indigo-300' : ''"
|
||||
@click="onRowClick(row)"
|
||||
>
|
||||
<div class="flex items-center justify-between gap-3">
|
||||
<div class="min-w-0">
|
||||
<div class="flex items-center gap-2 text-sm">
|
||||
<span class="font-mono text-xs bg-gray-100 px-2 py-0.5 rounded">#{{ row.job_id }}</span>
|
||||
<span
|
||||
class="text-xs px-2 py-0.5 rounded"
|
||||
:class="row.status === 'failed' ? 'bg-red-100 text-red-700' : 'bg-gray-200 text-gray-700'"
|
||||
>{{ codeLabel(row.status) }}</span>
|
||||
<span class="truncate text-xs text-gray-500">{{ row.case_no || row.business_ref || '—' }}</span>
|
||||
</div>
|
||||
<div class="mt-1.5 text-sm">
|
||||
<span class="text-gray-700">{{ codeLabel(row.blocking_reason || row.error_code || '', 'admin.legacyStpJobs.reasonCodes') }}</span>
|
||||
<span class="mx-2 text-gray-300">·</span>
|
||||
<span class="text-xs text-gray-500">{{ row.attempts }}/{{ row.max_attempts }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-right text-xs text-gray-500 leading-5 shrink-0">
|
||||
<div>{{ formatTime(row.created_at) }}</div>
|
||||
<div v-if="row.finished_at">→ {{ formatTime(row.finished_at) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="!rows.length && !loading" class="p-8 text-center text-sm text-gray-500">
|
||||
{{ t('admin.legacyStpJobs.empty') }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center justify-between px-4 py-2 border-t text-sm">
|
||||
<span class="text-gray-500">{{ t('common.pageOf', { page, total: Math.max(1, Math.ceil(total / pageSize)) }) }}</span>
|
||||
<div class="flex items-center gap-1">
|
||||
<button
|
||||
class="px-2 py-1 rounded border disabled:opacity-50"
|
||||
:disabled="page <= 1"
|
||||
type="button"
|
||||
@click="page -= 1"
|
||||
>{{ t('common.prev') }}</button>
|
||||
<button
|
||||
class="px-2 py-1 rounded border disabled:opacity-50"
|
||||
:disabled="page * pageSize >= total"
|
||||
type="button"
|
||||
@click="page += 1"
|
||||
>{{ t('common.next') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 右侧详情 -->
|
||||
<section class="flex flex-col min-h-0 border rounded bg-white/60">
|
||||
<div class="flex items-center justify-between px-4 py-2 border-b">
|
||||
<span class="text-sm font-medium">{{ t('admin.legacyStpJobs.detailTitle') }}</span>
|
||||
<span v-if="detailLoading" class="text-xs text-gray-500">{{ t('common.loading') }}</span>
|
||||
</div>
|
||||
<div v-if="!detail && !detailLoading" class="p-8 text-center text-sm text-gray-500">
|
||||
{{ t('admin.legacyStpJobs.detailEmpty') }}
|
||||
</div>
|
||||
<div v-else-if="detail" class="overflow-auto min-h-0 max-h-[72vh] px-5 py-4 space-y-5">
|
||||
<!-- 摘要行 -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-3 text-sm">
|
||||
<div class="border rounded p-3">
|
||||
<div class="text-xs text-gray-500 mb-1">{{ t('admin.legacyStpJobs.job') }}</div>
|
||||
<div class="font-mono">#{{ detail.job.job_id }} · {{ codeLabel(detail.job.status) }}</div>
|
||||
<div class="mt-1 text-xs text-gray-500">attempts: {{ detail.job.attempts }}/{{ detail.job.max_attempts }}</div>
|
||||
</div>
|
||||
<div class="border rounded p-3">
|
||||
<div class="text-xs text-gray-500 mb-1">{{ t('admin.legacyStpJobs.reviewCase') }}</div>
|
||||
<button
|
||||
v-if="detail.job.case_no"
|
||||
class="text-indigo-600 hover:underline font-mono"
|
||||
type="button"
|
||||
@click="openCaseInWorkspace(detail.job.case_no!)"
|
||||
>{{ detail.job.case_no }}</button>
|
||||
<span v-else class="text-gray-400">—</span>
|
||||
<div class="mt-1 text-xs text-gray-500 truncate">{{ detail.job.business_ref || '—' }}</div>
|
||||
</div>
|
||||
<div class="border rounded p-3">
|
||||
<div class="text-xs text-gray-500 mb-1">{{ t('admin.legacyStpJobs.blocking') }}</div>
|
||||
<div class="font-medium">{{ codeLabel(detail.job.blocking_reason || detail.job.error_code || '', 'admin.legacyStpJobs.reasonCodes') }}</div>
|
||||
<div class="mt-1 text-xs text-gray-500 truncate">{{ detail.job.message || detail.job.error_message || '—' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 回链 Case:若存在则展示 8 字段 -->
|
||||
<div v-if="detail.case" class="border rounded p-4">
|
||||
<div class="text-sm font-medium mb-2">{{ t('admin.legacyStpJobs.linkedCase') }}</div>
|
||||
<dl class="grid grid-cols-2 md:grid-cols-4 gap-3 text-sm">
|
||||
<div><dt class="text-xs text-gray-500">case_id</dt><dd class="font-mono">{{ detail.case.case_id }}</dd></div>
|
||||
<div><dt class="text-xs text-gray-500">{{ t('admin.legacyStpJobs.caseStatus') }}</dt><dd>{{ detail.case.status }}</dd></div>
|
||||
<div><dt class="text-xs text-gray-500">candidate_id</dt><dd class="font-mono">{{ detail.case.candidate_id ?? '—' }}</dd></div>
|
||||
<div><dt class="text-xs text-gray-500">confirmed_task_id</dt><dd class="font-mono">{{ detail.case.confirmed_task_id ?? '—' }}</dd></div>
|
||||
<div><dt class="text-xs text-gray-500">document_id</dt><dd class="font-mono">{{ detail.case.document_id ?? '—' }}</dd></div>
|
||||
<div><dt class="text-xs text-gray-500">owner_user_id</dt><dd class="font-mono">{{ detail.case.owner_user_id ?? '—' }}</dd></div>
|
||||
<div><dt class="text-xs text-gray-500">{{ t('common.createdAt') }}</dt><dd>{{ formatTime(detail.case.created_at) }}</dd></div>
|
||||
<div><dt class="text-xs text-gray-500">{{ t('common.updatedAt') }}</dt><dd>{{ formatTime(detail.case.updated_at) }}</dd></div>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<!-- 回放计划:推荐动作 + 回放按钮 -->
|
||||
<div class="border rounded p-4 bg-amber-50/60">
|
||||
<div class="text-sm font-medium mb-2">{{ t('admin.legacyStpJobs.replayPlan') }}</div>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 items-center">
|
||||
<div class="text-sm space-y-1">
|
||||
<div>
|
||||
<span class="text-gray-500 mr-2">{{ t('admin.legacyStpJobs.recommendedAction') }}:</span>
|
||||
<span class="px-2 py-0.5 rounded bg-white border text-sm">
|
||||
{{ actionLabel(detail.replay_plan.recommended_user_action) }}
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="text-gray-500 mr-2">{{ t('admin.legacyStpJobs.needsReplayMode') }}:</span>
|
||||
<span :class="detail.replay_plan.needs_replay_mode ? 'text-amber-700 font-medium' : 'text-gray-500'">
|
||||
{{ detail.replay_plan.needs_replay_mode ? t('common.yes') : t('common.no') }}
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="detail.replay_plan.reconcile_and_progress_endpoint" class="font-mono text-xs text-gray-500 break-all">
|
||||
POST {{ detail.replay_plan.reconcile_and_progress_endpoint }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-2 md:items-end">
|
||||
<label class="flex items-center gap-2 text-sm md:justify-end">
|
||||
<span class="text-gray-600 w-32">{{ t('admin.legacyStpJobs.userAction') }}</span>
|
||||
<select v-model="replayUserAction" class="px-3 py-1.5 border rounded text-sm">
|
||||
<option value="auto">{{ actionLabel('auto') }}</option>
|
||||
<option value="reuse_existing">{{ actionLabel('reuse_existing') }}</option>
|
||||
<option value="create_revision">{{ actionLabel('create_revision') }}</option>
|
||||
<option value="force_create">{{ actionLabel('force_create') }}</option>
|
||||
<option value="adjudicate">{{ actionLabel('adjudicate') }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<button
|
||||
class="px-4 py-2 rounded bg-indigo-600 text-white hover:bg-indigo-700 disabled:opacity-60 max-w-xs"
|
||||
type="button"
|
||||
:disabled="replaying || !detail.job.case_no"
|
||||
@click="replaySelected"
|
||||
>
|
||||
{{ replaying ? t('common.loading') : t('admin.legacyStpJobs.replayButton') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="replayLastResult" class="mt-3 text-sm border-t pt-3">
|
||||
<div class="flex items-center gap-2">
|
||||
<span
|
||||
class="text-xs px-2 py-0.5 rounded"
|
||||
:class="replayLastResult.ok ? 'bg-green-100 text-green-700' : 'bg-red-100 text-red-700'"
|
||||
>
|
||||
{{ replayLastResult.ok ? t('common.ok') : t('common.error') }}
|
||||
</span>
|
||||
<span class="font-mono text-xs bg-white border rounded px-2 py-0.5">{{ replayLastResult.outcome ?? '—' }}</span>
|
||||
</div>
|
||||
<div v-if="replayLastResult.message" class="mt-1.5 text-xs text-gray-600 whitespace-pre-wrap break-all">
|
||||
{{ replayLastResult.message }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 原始 JSON:payload / result(masked) -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div class="border rounded p-3">
|
||||
<div class="text-xs text-gray-500 mb-1">{{ t('admin.legacyStpJobs.payloadJson') }}</div>
|
||||
<pre class="text-xs whitespace-pre-wrap break-all bg-gray-50 p-2 rounded max-h-64 overflow-auto">{{ jsonFormat(detail.job.payload_json_masked) }}</pre>
|
||||
</div>
|
||||
<div class="border rounded p-3">
|
||||
<div class="text-xs text-gray-500 mb-1">{{ t('admin.legacyStpJobs.resultJson') }}</div>
|
||||
<pre class="text-xs whitespace-pre-wrap break-all bg-gray-50 p-2 rounded max-h-64 overflow-auto">{{ jsonFormat(detail.job.result_json_masked) }}</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
+4
-4
@@ -99,17 +99,17 @@ describe('OrderProfileXfaConfirmStep', () => {
|
||||
});
|
||||
|
||||
const wrapper = mountStep();
|
||||
await vi.waitFor(() => expect(wrapper.text()).toContain('datasets / data / ITEMS / DATA'));
|
||||
await vi.waitFor(() => expect(wrapper.text()).toContain('datasets / data / ITEMS / DATA'), { timeout: 10000 });
|
||||
expect(wrapper.find('input[type="radio"]').exists()).toBe(true);
|
||||
expect(wrapper.text()).toContain('创建前阻断项');
|
||||
});
|
||||
}, 15000);
|
||||
|
||||
it('没有任何候选集合时才显示空状态', async () => {
|
||||
getFieldTree.mockResolvedValue({ tree: {} });
|
||||
getCollections.mockResolvedValue({ collection_candidates: [], excluded_collection_candidates: [] });
|
||||
|
||||
const wrapper = mountStep();
|
||||
await vi.waitFor(() => expect(wrapper.text()).toContain('没有可用数据集'));
|
||||
await vi.waitFor(() => expect(wrapper.text()).toContain('没有可用数据集'), { timeout: 10000 });
|
||||
expect(wrapper.find('input[type="radio"]').exists()).toBe(false);
|
||||
});
|
||||
}, 15000);
|
||||
});
|
||||
+280
@@ -0,0 +1,280 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-document-profiles/components/VcMergePreviewTable.vue
|
||||
用途:三来源候选合并预览表。严格后端决定 UI,只按后端返回的 resolution/decision_status 着色,
|
||||
绝不 if/else 推导合并结果。
|
||||
依赖:shipping-order-document-profile.vc.types.ts Section E(VCMergedObservationCandidate);
|
||||
所有着色规则由 resolutionClass 查表映射,禁止前端自行推导业务状态。
|
||||
逻辑:只读展示,无 emit。空态显示「暂无预览数据,请点击预览按钮」。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import type { VCMergedObservationCandidate } from '@/features/admin/types/shipping-order-document-profile.vc.types';
|
||||
|
||||
defineProps<{
|
||||
candidates: VCMergedObservationCandidate[];
|
||||
loading?: boolean;
|
||||
}>();
|
||||
|
||||
function sourceColorClass(source: string): string {
|
||||
if (source === 'header_region') return 'vc-map__src-header';
|
||||
if (source === 'table_column') return 'vc-map__src-table';
|
||||
if (source === 'vendor_comments') return 'vc-map__src-vc';
|
||||
return '';
|
||||
}
|
||||
|
||||
function resolutionClass(resolution: string, decisionStatus: string): string {
|
||||
const key = `${resolution}|${decisionStatus}`;
|
||||
const classMap: Record<string, string> = {
|
||||
'needs_review|pending': 'bg-red-50 text-red-700 border-red-200',
|
||||
'needs_review|needs_review': 'bg-red-50 text-red-700 border-red-200',
|
||||
'same_value_merged|accepted': 'bg-emerald-50 text-emerald-700 border-emerald-200',
|
||||
'single_source_direct|accepted': 'bg-green-50 text-green-700 border-green-200',
|
||||
'fill_missing|accepted': 'bg-sky-50 text-sky-700 border-sky-200',
|
||||
'annotation_only_dropped|accepted': 'bg-gray-50 text-gray-500 line-through',
|
||||
'annotation_only_dropped|missing': 'bg-gray-50 text-gray-500 line-through',
|
||||
'invalid_line_reference|blocked': 'bg-gray-50 text-gray-500 line-through',
|
||||
'no_value|missing': 'bg-gray-50 text-gray-500 line-through',
|
||||
};
|
||||
return classMap[key] ?? '';
|
||||
}
|
||||
|
||||
function resolutionBadge(resolution: string): string {
|
||||
const labelMap: Record<string, string> = {
|
||||
same_value_merged: '同值合并',
|
||||
fill_missing: '补空',
|
||||
needs_review: '需复核',
|
||||
no_value: '无值',
|
||||
single_source_direct: '单源直达',
|
||||
annotation_only_dropped: '仅备注(丢弃)',
|
||||
};
|
||||
return labelMap[resolution] ?? resolution;
|
||||
}
|
||||
|
||||
function conflictGroupKey(cand: VCMergedObservationCandidate): string {
|
||||
return `[${cand.target_scope}] ${cand.target_field_code} #${cand.effective_line_no ?? 'H'}`;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="vc-merge-preview">
|
||||
<div v-if="candidates.length === 0" class="vc-merge-preview__empty">
|
||||
<p v-if="loading">预览加载中…</p>
|
||||
<p v-else>暂无预览数据,请点击预览按钮</p>
|
||||
</div>
|
||||
<div v-else class="vc-merge-preview__body">
|
||||
<div
|
||||
v-for="(cand, i) in candidates"
|
||||
:key="i"
|
||||
class="vc-merge-preview__row"
|
||||
:class="resolutionClass(cand.resolution, cand.decision_status)"
|
||||
>
|
||||
<div class="vc-merge-preview__row-main">
|
||||
<div class="vc-merge-preview__key">
|
||||
<strong>{{ conflictGroupKey(cand) }}</strong>
|
||||
</div>
|
||||
<div class="vc-merge-preview__badge">
|
||||
<span class="vc-merge-preview__resolution" :class="`vc-merge-preview__resolution--${cand.resolution}`">
|
||||
{{ resolutionBadge(cand.resolution) }}
|
||||
</span>
|
||||
<span class="vc-merge-preview__status">
|
||||
{{ cand.decision_status }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="vc-merge-preview__accepted">
|
||||
<template v-if="cand.decision_status === 'needs_review' || cand.resolution === 'needs_review'">
|
||||
<span class="vc-merge-preview__needs-review">
|
||||
⚠ 需人工复核
|
||||
</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span v-if="cand.accepted_value !== null && cand.accepted_value !== undefined">
|
||||
accepted_value:<code>{{ cand.accepted_value }}</code>
|
||||
</span>
|
||||
<span v-else class="vc-merge-preview__muted">
|
||||
accepted_value:—
|
||||
</span>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="vc-merge-preview__conflicts">
|
||||
<div class="vc-merge-preview__conflicts-title">
|
||||
来源快照 ({{ cand.source_observations.length }})
|
||||
</div>
|
||||
<ul class="vc-map__src-list">
|
||||
<li
|
||||
v-for="(obs, j) in cand.source_observations"
|
||||
:key="j"
|
||||
:class="sourceColorClass(obs.source)"
|
||||
>
|
||||
<span class="vc-map__src-tag">{{ obs.source }}</span>
|
||||
<code>{{ obs.normalized_value }}</code>
|
||||
<small v-if="obs.format_valid === false" class="vc-map__format-invalid">
|
||||
(format: {{ obs.format_reason_code }})
|
||||
</small>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div v-if="cand.conflicts && cand.conflicts.length > 0" class="vc-merge-preview__conflicts-detail">
|
||||
<details>
|
||||
<summary>冲突详情 ({{ cand.conflicts.length }})</summary>
|
||||
<pre>{{ JSON.stringify(cand.conflicts, null, 2) }}</pre>
|
||||
</details>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.vc-merge-preview {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
.vc-merge-preview__empty {
|
||||
padding: 20px 10px;
|
||||
text-align: center;
|
||||
color: var(--text-muted);
|
||||
font-size: 0.82rem;
|
||||
border: 1px dashed var(--border-default);
|
||||
border-radius: 6px;
|
||||
}
|
||||
.vc-merge-preview__body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
.vc-merge-preview__row {
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 8px;
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
background: var(--bg-primary);
|
||||
}
|
||||
.vc-merge-preview__row-main {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.vc-merge-preview__key {
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
.vc-merge-preview__badge {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
.vc-merge-preview__resolution {
|
||||
display: inline-block;
|
||||
padding: 2px 8px;
|
||||
border-radius: 10px;
|
||||
font-size: 0.72rem;
|
||||
font-weight: 600;
|
||||
border: 1px solid;
|
||||
}
|
||||
.vc-merge-preview__resolution--same_value_merged {
|
||||
background: rgba(16, 185, 129, 0.1);
|
||||
border-color: rgba(16, 185, 129, 0.3);
|
||||
color: #047857;
|
||||
}
|
||||
.vc-merge-preview__resolution--single_source_direct {
|
||||
background: rgba(34, 197, 94, 0.1);
|
||||
border-color: rgba(34, 197, 94, 0.3);
|
||||
color: #15803d;
|
||||
}
|
||||
.vc-merge-preview__resolution--fill_missing {
|
||||
background: rgba(14, 165, 233, 0.1);
|
||||
border-color: rgba(14, 165, 233, 0.3);
|
||||
color: #0369a1;
|
||||
}
|
||||
.vc-merge-preview__resolution--needs_review {
|
||||
background: rgba(239, 68, 68, 0.1);
|
||||
border-color: rgba(239, 68, 68, 0.3);
|
||||
color: #b91c1c;
|
||||
}
|
||||
.vc-merge-preview__resolution--annotation_only_dropped,
|
||||
.vc-merge-preview__resolution--no_value {
|
||||
background: rgba(107, 114, 128, 0.1);
|
||||
border-color: rgba(107, 114, 128, 0.3);
|
||||
color: #4b5563;
|
||||
}
|
||||
.vc-merge-preview__status {
|
||||
font-size: 0.72rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
.vc-merge-preview__accepted {
|
||||
font-size: 0.82rem;
|
||||
}
|
||||
.vc-merge-preview__needs-review {
|
||||
color: #b91c1c;
|
||||
font-weight: 600;
|
||||
}
|
||||
.vc-merge-preview__muted {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
.vc-merge-preview__conflicts {
|
||||
padding-top: 6px;
|
||||
border-top: 1px dashed var(--border-default);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
.vc-merge-preview__conflicts-title {
|
||||
font-size: 0.78rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
.vc-map__src-list {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
.vc-map__src-tag {
|
||||
display: inline-block;
|
||||
padding: 1px 6px;
|
||||
border-radius: 10px;
|
||||
font-size: 0.7rem;
|
||||
margin-right: 4px;
|
||||
color: white;
|
||||
}
|
||||
.vc-map__src-header .vc-map__src-tag { background: #3b82f6; }
|
||||
.vc-map__src-table .vc-map__src-tag { background: #10b981; }
|
||||
.vc-map__src-vc .vc-map__src-tag { background: #f59e0b; }
|
||||
.vc-map__format-invalid {
|
||||
color: var(--text-danger);
|
||||
margin-left: 4px;
|
||||
}
|
||||
code {
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
||||
background: var(--bg-elevated);
|
||||
padding: 1px 4px;
|
||||
border-radius: 3px;
|
||||
font-size: 0.78rem;
|
||||
}
|
||||
.vc-merge-preview__conflicts-detail {
|
||||
margin-top: 4px;
|
||||
}
|
||||
.vc-merge-preview__conflicts-detail summary {
|
||||
cursor: pointer;
|
||||
font-size: 0.75rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
.vc-merge-preview__conflicts-detail pre {
|
||||
margin: 6px 0 0 0;
|
||||
padding: 6px;
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 4px;
|
||||
background: var(--bg-elevated);
|
||||
font-size: 0.72rem;
|
||||
max-height: 160px;
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
+432
@@ -0,0 +1,432 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-document-profiles/components/VcNamedRegionBox.vue
|
||||
用途:Vendor Comments 命名区域圈选框——薄封装 OrderProfileDocumentCanvas,维护 dedicated regions。
|
||||
依赖:shipping-order-document-profile.vc.types.ts Section A/H、OrderProfileDocumentCanvas。
|
||||
逻辑:不做任何 save,所有写操作走 emit 父级;region/page_scope/selection_mode 四元组变更触发
|
||||
VCProfileDraftTrigger(reasons: named_region_*),仅负责前端门禁,真实判定在后端。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import OrderProfileDocumentCanvas from './OrderProfileDocumentCanvas.vue';
|
||||
import type {
|
||||
OrderProfileCanvasRegion,
|
||||
OrderProfilePreviewPageGrant,
|
||||
OrderProfileRelativeRegion,
|
||||
} from '@/features/admin/types/shipping-order-document-profile.types';
|
||||
import type {
|
||||
VCNamedRegion,
|
||||
VCNamedRegionPageScope,
|
||||
VCNamedRegionSelectionMode,
|
||||
VCProfileDraftTrigger,
|
||||
} from '@/features/admin/types/shipping-order-document-profile.vc.types';
|
||||
|
||||
type VCNamedRegionCreatePartial = {
|
||||
label: string;
|
||||
page_scope: VCNamedRegionPageScope;
|
||||
selection_mode: VCNamedRegionSelectionMode;
|
||||
region: OrderProfileRelativeRegion;
|
||||
};
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
profileId: number | null;
|
||||
grant?: OrderProfilePreviewPageGrant | null;
|
||||
pageNo: number;
|
||||
pageCount: number;
|
||||
previewPagePath?: string | null;
|
||||
namedRegions: Record<string, VCNamedRegion>;
|
||||
selectedRegionId: string | null;
|
||||
regionOptions?: {
|
||||
page_scope_options?: { value: string; label: string }[];
|
||||
};
|
||||
readonly?: boolean;
|
||||
}>(), {
|
||||
regionOptions: () => ({}),
|
||||
readonly: false,
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:namedRegions': [regions: Record<string, VCNamedRegion>];
|
||||
select: [regionId: string];
|
||||
create: [partial: VCNamedRegionCreatePartial];
|
||||
change: [regionId: string, patch: Partial<VCNamedRegion>];
|
||||
delete: [regionId: string];
|
||||
draftRequired: [trigger: VCProfileDraftTrigger];
|
||||
}>();
|
||||
|
||||
const defaultPageScopeOptions = computed(() => {
|
||||
if (props.regionOptions?.page_scope_options?.length) {
|
||||
return props.regionOptions.page_scope_options;
|
||||
}
|
||||
return [
|
||||
{ value: 'first_page', label: '首页' },
|
||||
{ value: 'last_page', label: '末页' },
|
||||
{ value: 'exact_page', label: '指定页' },
|
||||
];
|
||||
});
|
||||
|
||||
const selectionModeOptions: { value: VCNamedRegionSelectionMode; label: string }[] = [
|
||||
{ value: 'fixed_region', label: '固定区域 (box)' },
|
||||
{ value: 'auto_take_last_qualified', label: '取末段合格 (paragraph)' },
|
||||
];
|
||||
|
||||
const selectedOrderRegionId = computed(() => {
|
||||
return props.selectedRegionId ? `vc:${props.selectedRegionId}` : null;
|
||||
});
|
||||
|
||||
const canvasRegions = computed<OrderProfileCanvasRegion[]>(() => {
|
||||
const regions: OrderProfileCanvasRegion[] = [];
|
||||
Object.values(props.namedRegions || {}).forEach((nr) => {
|
||||
let pageNo = props.pageNo;
|
||||
if (nr.page_scope === 'exact_page' && nr.page_no) {
|
||||
pageNo = nr.page_no;
|
||||
}
|
||||
regions.push({
|
||||
id: `vc:${nr.region_id}`,
|
||||
kind: 'xfa_visual',
|
||||
label: nr.label,
|
||||
region: { ...nr.region },
|
||||
pageNo,
|
||||
});
|
||||
});
|
||||
return regions;
|
||||
});
|
||||
|
||||
const priorSnapshot = ref<string>('');
|
||||
|
||||
function snapshotRegions(): string {
|
||||
const entries = Object.entries(props.namedRegions || {})
|
||||
.sort(([a], [b]) => a.localeCompare(b))
|
||||
.map(([id, r]) => `${id}|${r.label}|${r.page_scope}|${r.selection_mode}|${JSON.stringify(r.region)}`);
|
||||
return entries.join('||');
|
||||
}
|
||||
|
||||
watch(() => snapshotRegions(), (next, prev) => {
|
||||
if (!prev || !next || next === prev) return;
|
||||
const prevMap = props.namedRegions || {};
|
||||
const reasons: VCProfileDraftTrigger['reasons'] = [];
|
||||
const prevIds = new Set(Object.keys(prevMap));
|
||||
const nextIds = new Set(Object.keys(prevMap));
|
||||
prevIds.forEach((id) => {
|
||||
if (!nextIds.has(id)) {
|
||||
reasons.push({ kind: 'named_region_removed', region_id: id });
|
||||
}
|
||||
});
|
||||
nextIds.forEach((id) => {
|
||||
if (!prevIds.has(id)) {
|
||||
reasons.push({ kind: 'named_region_added', region_id: id });
|
||||
}
|
||||
});
|
||||
nextIds.forEach((id) => {
|
||||
if (!prevIds.has(id)) return;
|
||||
const prev = prevMap[id];
|
||||
const nextR = prevMap[id];
|
||||
if (!prev || !nextR) return;
|
||||
if (prev.page_scope !== nextR.page_scope) {
|
||||
reasons.push({ kind: 'named_region_scope', region_id: id });
|
||||
}
|
||||
const prevGeo = `${prev.region.x0},${prev.region.y0},${prev.region.x1},${prev.region.y1}`;
|
||||
const nextGeo = `${nextR.region.x0},${nextR.region.y0},${nextR.region.x1},${nextR.region.y1}`;
|
||||
if (prevGeo !== nextGeo) {
|
||||
reasons.push({ kind: 'named_region_geometry', region_id: id });
|
||||
}
|
||||
});
|
||||
if (reasons.length > 0) {
|
||||
emit('draftRequired', {
|
||||
named_regions_changed: true,
|
||||
field_source_mappings_changed: false,
|
||||
requires_draft_reset: true,
|
||||
reasons,
|
||||
});
|
||||
}
|
||||
}, { flush: 'post' });
|
||||
|
||||
priorSnapshot.value = snapshotRegions();
|
||||
|
||||
function onCanvasSelect(regionId: string): void {
|
||||
if (!regionId.startsWith('vc:')) return;
|
||||
emit('select', regionId.slice(3));
|
||||
}
|
||||
|
||||
function onCanvasCreate(region: OrderProfileCanvasRegion['region']): void {
|
||||
const count = Object.keys(props.namedRegions || {}).length;
|
||||
emit('create', {
|
||||
label: `Vendor Comments ${count + 1}`,
|
||||
page_scope: 'first_page',
|
||||
selection_mode: 'fixed_region',
|
||||
region,
|
||||
});
|
||||
}
|
||||
|
||||
function onCanvasChange(regionId: string, region: OrderProfileCanvasRegion['region']): void {
|
||||
if (!regionId.startsWith('vc:')) return;
|
||||
const id = regionId.slice(3);
|
||||
emit('change', id, { region });
|
||||
}
|
||||
|
||||
function updateLabel(regionId: string, label: string): void {
|
||||
emit('change', regionId, { label });
|
||||
}
|
||||
|
||||
function updatePageScope(regionId: string, pageScope: VCNamedRegionPageScope): void {
|
||||
emit('change', regionId, { page_scope: pageScope });
|
||||
}
|
||||
|
||||
function updateSelectionMode(regionId: string, mode: VCNamedRegionSelectionMode): void {
|
||||
emit('change', regionId, { selection_mode: mode });
|
||||
}
|
||||
|
||||
function updatePageNo(regionId: string, pageNo: number | null): void {
|
||||
emit('change', regionId, { page_no: pageNo });
|
||||
}
|
||||
|
||||
function addRegion(): void {
|
||||
const count = Object.keys(props.namedRegions || {}).length;
|
||||
emit('create', {
|
||||
label: `Vendor Comments ${count + 1}`,
|
||||
page_scope: 'first_page',
|
||||
selection_mode: 'fixed_region',
|
||||
region: { x0: 0.1, y0: 0.1, x1: 0.9, y1: 0.15 },
|
||||
});
|
||||
}
|
||||
|
||||
const orderedRegions = computed(() => {
|
||||
return Object.values(props.namedRegions || {}).sort((a, b) => (
|
||||
a.label.localeCompare(b.label)
|
||||
));
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="vc-named-region-box">
|
||||
<div class="vc-named-region-box__toolbar">
|
||||
<button
|
||||
type="button"
|
||||
:disabled="readonly"
|
||||
class="vc-named-region-box__add-btn"
|
||||
@click="addRegion"
|
||||
>
|
||||
新增 Vendor Comments 区域
|
||||
</button>
|
||||
</div>
|
||||
<div class="vc-named-region-box__body">
|
||||
<aside class="vc-named-region-box__sidebar">
|
||||
<ul v-if="orderedRegions.length" class="vc-named-region-box__list">
|
||||
<li
|
||||
v-for="nr in orderedRegions"
|
||||
:key="nr.region_id"
|
||||
class="vc-named-region-box__item"
|
||||
:class="{ 'is-selected': selectedRegionId === nr.region_id }"
|
||||
@click="emit('select', nr.region_id)"
|
||||
>
|
||||
<div class="vc-named-region-box__item-header">
|
||||
<input
|
||||
class="vc-named-region-box__label-input"
|
||||
:disabled="readonly"
|
||||
:value="nr.label"
|
||||
@input="updateLabel(nr.region_id, ($event.target as HTMLInputElement).value)"
|
||||
@click.stop
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
class="vc-named-region-box__delete-btn"
|
||||
:disabled="readonly"
|
||||
@click.stop="emit('delete', nr.region_id)"
|
||||
>
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
<div class="vc-named-region-box__item-fields">
|
||||
<label>
|
||||
页范围
|
||||
<select
|
||||
:disabled="readonly"
|
||||
:value="nr.page_scope"
|
||||
@change.stop="updatePageScope(nr.region_id, ($event.target as HTMLSelectElement).value as VCNamedRegionPageScope)"
|
||||
>
|
||||
<option
|
||||
v-for="opt in defaultPageScopeOptions"
|
||||
:key="opt.value"
|
||||
:value="opt.value"
|
||||
>
|
||||
{{ opt.label }}
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
<label v-if="nr.page_scope === 'exact_page'">
|
||||
页码
|
||||
<input
|
||||
type="number"
|
||||
min="1"
|
||||
:max="pageCount || undefined"
|
||||
:disabled="readonly"
|
||||
:value="nr.page_no ?? ''"
|
||||
@input.stop="updatePageNo(nr.region_id, ($event.target as HTMLInputElement).value === '' ? null : Number(($event.target as HTMLInputElement).value))"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
选择模式
|
||||
<select
|
||||
:disabled="readonly"
|
||||
:value="nr.selection_mode"
|
||||
@change.stop="updateSelectionMode(nr.region_id, ($event.target as HTMLSelectElement).value as VCNamedRegionSelectionMode)"
|
||||
>
|
||||
<option
|
||||
v-for="opt in selectionModeOptions"
|
||||
:key="opt.value"
|
||||
:value="opt.value"
|
||||
>
|
||||
{{ opt.label }}
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<p v-else class="vc-named-region-box__empty">
|
||||
暂无命名区域,点击上方按钮新增或在画布上拖动圈选。
|
||||
</p>
|
||||
</aside>
|
||||
<div class="vc-named-region-box__canvas">
|
||||
<OrderProfileDocumentCanvas
|
||||
:profile-id="profileId"
|
||||
:grant="grant"
|
||||
:preview-page-path="previewPagePath"
|
||||
:mode="readonly ? 'readonly' : 'edit'"
|
||||
:regions="canvasRegions"
|
||||
:selected-region-id="selectedOrderRegionId"
|
||||
:creation-kind="readonly ? null : 'xfa_visual'"
|
||||
:page-no="pageNo"
|
||||
:page-count="pageCount"
|
||||
annotation-tool-set="xfa_visual"
|
||||
@select="onCanvasSelect"
|
||||
@create="onCanvasCreate"
|
||||
@change="onCanvasChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.vc-named-region-box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
}
|
||||
.vc-named-region-box__toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
.vc-named-region-box__add-btn {
|
||||
padding: 6px 12px;
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 6px;
|
||||
background: var(--bg-primary);
|
||||
cursor: pointer;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
.vc-named-region-box__add-btn:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.vc-named-region-box__body {
|
||||
display: grid;
|
||||
grid-template-columns: 280px 1fr;
|
||||
gap: 8px;
|
||||
min-height: 0;
|
||||
flex: 1;
|
||||
}
|
||||
.vc-named-region-box__sidebar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
overflow: auto;
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 6px;
|
||||
padding: 8px;
|
||||
background: var(--bg-elevated);
|
||||
}
|
||||
.vc-named-region-box__list {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
.vc-named-region-box__item {
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 6px;
|
||||
padding: 8px;
|
||||
cursor: pointer;
|
||||
background: var(--bg-primary);
|
||||
}
|
||||
.vc-named-region-box__item.is-selected {
|
||||
border-color: var(--accent-primary);
|
||||
box-shadow: 0 0 0 1px var(--accent-primary);
|
||||
}
|
||||
.vc-named-region-box__item-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
.vc-named-region-box__label-input {
|
||||
flex: 1;
|
||||
padding: 4px 6px;
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 4px;
|
||||
font-size: 0.85rem;
|
||||
min-width: 0;
|
||||
}
|
||||
.vc-named-region-box__delete-btn {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 4px;
|
||||
background: var(--bg-primary);
|
||||
cursor: pointer;
|
||||
color: var(--text-danger);
|
||||
}
|
||||
.vc-named-region-box__delete-btn:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.vc-named-region-box__item-fields {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
font-size: 0.78rem;
|
||||
}
|
||||
.vc-named-region-box__item-fields label {
|
||||
display: grid;
|
||||
grid-template-columns: 56px 1fr;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
.vc-named-region-box__item-fields select,
|
||||
.vc-named-region-box__item-fields input {
|
||||
padding: 3px 6px;
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 4px;
|
||||
font-size: 0.78rem;
|
||||
min-width: 0;
|
||||
}
|
||||
.vc-named-region-box__empty {
|
||||
margin: 0;
|
||||
color: var(--text-muted);
|
||||
font-size: 0.8rem;
|
||||
text-align: center;
|
||||
padding: 16px 8px;
|
||||
}
|
||||
.vc-named-region-box__canvas {
|
||||
min-height: 0;
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
background: var(--bg-primary);
|
||||
}
|
||||
</style>
|
||||
+544
@@ -0,0 +1,544 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-document-profiles/components/VcSourceMappingPanel.vue
|
||||
用途:薄编排主面板——只做顶层三开关 + 引入 VcSourceMappingSection * 3 + VcSplitRuleEditor
|
||||
(抽屉/modal)+ VcMergePreviewTable。
|
||||
依赖:shipping-order-document-profile.vc.types.ts Section B/C/D/E/H/I;
|
||||
子组件:VcSourceMappingSection、VcSplitRuleEditor、VcMergePreviewTable。
|
||||
逻辑:emit update:definition 写回完整 patch;field_source_mappings 任何改动 + split_rules
|
||||
改动触发 VCProfileDraftTrigger(聚合所有子 trigger)。
|
||||
Props / Emits 保留原来的契约,确保父级零修改可切换。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import type {
|
||||
VCMergedObservationCandidate,
|
||||
VCProfileDefinitionExtensions,
|
||||
VCProfileDraftTrigger,
|
||||
VCProfileFieldSourceMapping,
|
||||
VCSplitRuleSet,
|
||||
} from '@/features/admin/types/shipping-order-document-profile.vc.types';
|
||||
import VcSourceMappingSection from './VcSourceMappingSection.vue';
|
||||
import VcSplitRuleEditor from './VcSplitRuleEditor.vue';
|
||||
import VcMergePreviewTable from './VcMergePreviewTable.vue';
|
||||
|
||||
type VCProfileFieldSourceMappingPatch = Partial<VCProfileFieldSourceMapping>;
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
definition: VCProfileDefinitionExtensions;
|
||||
selectedFieldCode: string;
|
||||
targetScopes?: Array<'header' | 'line'>;
|
||||
readonly?: boolean;
|
||||
documentId: number;
|
||||
profileId: number;
|
||||
dirtyUnsaved?: boolean;
|
||||
persistedConfirmed?: boolean;
|
||||
canPreview?: boolean;
|
||||
}>(), {
|
||||
selectedFieldCode: 'reservation_id',
|
||||
targetScopes: () => ['header', 'line'],
|
||||
readonly: false,
|
||||
dirtyUnsaved: false,
|
||||
persistedConfirmed: false,
|
||||
canPreview: true,
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:definition': [patch: VCProfileDefinitionExtensions];
|
||||
draftRequired: [trigger: VCProfileDraftTrigger];
|
||||
'vc:split-panel-confirmed': [
|
||||
rules: VCSplitRuleSet[],
|
||||
confirmationTokens: Record<string, string>,
|
||||
fieldCode: string,
|
||||
];
|
||||
}>();
|
||||
|
||||
function newClientId(): string {
|
||||
return `map-${crypto.randomUUID().replace(/-/g, '')}`;
|
||||
}
|
||||
|
||||
const DEFAULT_FORMAT_POLICY = {
|
||||
mode: 'inherit_global' as const,
|
||||
pattern: null,
|
||||
max_capture_groups: 1,
|
||||
timeout_ms: 500,
|
||||
case_sensitive: false,
|
||||
};
|
||||
|
||||
const EMPTY_MAPPING_BASE = (fieldCode: string, targetScope: 'header' | 'line'): VCProfileFieldSourceMapping => ({
|
||||
mapping_id: newClientId(),
|
||||
target_scope: targetScope,
|
||||
target_field_code: fieldCode,
|
||||
target_field_id: '',
|
||||
header_source_enabled: false,
|
||||
header_source_ref: null,
|
||||
header_normalizer_key: null,
|
||||
table_source_enabled: false,
|
||||
table_column_code: null,
|
||||
vendor_comments_enabled: false,
|
||||
vendor_comments_region_ref: null,
|
||||
vendor_comments_split_rule_set: null,
|
||||
relation_policy: 'bind_target_line',
|
||||
missing_relation_policy: 'default_all_lines',
|
||||
line_reference_basis: 'classified_logical_line_no',
|
||||
fill_missing_from_other_sources: true,
|
||||
format_policy: { ...DEFAULT_FORMAT_POLICY },
|
||||
});
|
||||
|
||||
const activeMappings = computed(() => {
|
||||
const list = props.definition?.field_source_mappings || [];
|
||||
return list.filter((m) => m.target_field_code === props.selectedFieldCode);
|
||||
});
|
||||
|
||||
const headerMapping = computed(() => activeMappings.value.find((m) => m.target_scope === 'header') || null);
|
||||
const lineMapping = computed(() => activeMappings.value.find((m) => m.target_scope === 'line') || null);
|
||||
|
||||
const scopeOptions = computed(() => (
|
||||
props.targetScopes.map((s) => ({
|
||||
value: s,
|
||||
label: s === 'header' ? 'Header (订单头)' : 'Line (明细行)',
|
||||
}))
|
||||
));
|
||||
|
||||
const splitEditorVisible = ref(false);
|
||||
const splitEditorScope = ref<'header' | 'line'>('line');
|
||||
|
||||
const splitEditorRuleSet = computed<VCSplitRuleSet | null>(() => {
|
||||
const mapping = splitEditorScope.value === 'header' ? headerMapping.value : lineMapping.value;
|
||||
return mapping?.vendor_comments_split_rule_set ?? null;
|
||||
});
|
||||
|
||||
const mergeLoading = ref(false);
|
||||
const mergePreviewResults = ref<VCMergedObservationCandidate[]>([]);
|
||||
|
||||
function cloneDefinitionForWrite(): VCProfileDefinitionExtensions {
|
||||
return {
|
||||
named_regions: props.definition?.named_regions ? { ...props.definition.named_regions } : null,
|
||||
field_source_mappings: props.definition?.field_source_mappings
|
||||
? props.definition.field_source_mappings.map((m) => ({ ...m }))
|
||||
: [],
|
||||
};
|
||||
}
|
||||
|
||||
function ensureMapping(scope: 'header' | 'line'): VCProfileFieldSourceMapping {
|
||||
const existing = scope === 'header' ? headerMapping.value : lineMapping.value;
|
||||
if (existing) return existing;
|
||||
const fresh = EMPTY_MAPPING_BASE(props.selectedFieldCode, scope);
|
||||
const patch = cloneDefinitionForWrite();
|
||||
patch.field_source_mappings = [...(patch.field_source_mappings || []), fresh];
|
||||
emit('update:definition', patch);
|
||||
emitDraftTriggerAggregated({
|
||||
reasons: [{ kind: 'field_source_mapping_added', mapping_id: fresh.mapping_id }],
|
||||
changed: true,
|
||||
});
|
||||
return fresh;
|
||||
}
|
||||
|
||||
function updateMapping(mappingId: string, patchFields: VCProfileFieldSourceMappingPatch): void {
|
||||
const patch = cloneDefinitionForWrite();
|
||||
const list = patch.field_source_mappings || [];
|
||||
const idx = list.findIndex((m) => m.mapping_id === mappingId);
|
||||
if (idx < 0) return;
|
||||
const current = list[idx];
|
||||
if (!current) return;
|
||||
const before = JSON.stringify(current);
|
||||
list[idx] = { ...current, ...patchFields };
|
||||
patch.field_source_mappings = list;
|
||||
emit('update:definition', patch);
|
||||
const after = JSON.stringify(list[idx]);
|
||||
if (before === after) return;
|
||||
|
||||
const beforeObj = JSON.parse(before) as VCProfileFieldSourceMapping;
|
||||
const afterObj = JSON.parse(after) as VCProfileFieldSourceMapping;
|
||||
const reasons: VCProfileDraftTrigger['reasons'] = [];
|
||||
|
||||
if (
|
||||
beforeObj.format_policy?.mode !== afterObj.format_policy?.mode
|
||||
|| beforeObj.format_policy?.pattern !== afterObj.format_policy?.pattern
|
||||
|| beforeObj.format_policy?.max_capture_groups !== afterObj.format_policy?.max_capture_groups
|
||||
) {
|
||||
reasons.push({
|
||||
kind: 'field_source_mapping_format_policy_changed',
|
||||
mapping_id: mappingId,
|
||||
});
|
||||
}
|
||||
|
||||
const enabledKeys = [
|
||||
'header_source_enabled',
|
||||
'table_source_enabled',
|
||||
'vendor_comments_enabled',
|
||||
] as const;
|
||||
let hasEnabledChange = false;
|
||||
for (const k of enabledKeys) {
|
||||
if (beforeObj[k] !== afterObj[k]) {
|
||||
hasEnabledChange = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (hasEnabledChange) {
|
||||
reasons.push({
|
||||
kind: 'field_source_mapping_format_policy_changed',
|
||||
mapping_id: mappingId,
|
||||
});
|
||||
}
|
||||
|
||||
if (
|
||||
beforeObj.vendor_comments_region_ref !== afterObj.vendor_comments_region_ref
|
||||
|| beforeObj.table_column_code !== afterObj.table_column_code
|
||||
) {
|
||||
reasons.push({
|
||||
kind: 'field_source_mapping_format_policy_changed',
|
||||
mapping_id: mappingId,
|
||||
});
|
||||
}
|
||||
|
||||
if (reasons.length === 0) {
|
||||
reasons.push({
|
||||
kind: 'field_source_mapping_format_policy_changed',
|
||||
mapping_id: mappingId,
|
||||
});
|
||||
}
|
||||
|
||||
emitDraftTriggerAggregated({ reasons, changed: true });
|
||||
}
|
||||
|
||||
function emitDraftTriggerAggregated(opts: {
|
||||
reasons: VCProfileDraftTrigger['reasons'];
|
||||
changed: boolean;
|
||||
}): void {
|
||||
emit('draftRequired', {
|
||||
named_regions_changed: false,
|
||||
field_source_mappings_changed: opts.changed,
|
||||
requires_draft_reset: true,
|
||||
reasons: opts.reasons,
|
||||
});
|
||||
}
|
||||
|
||||
function handleSectionMappingUpdate(
|
||||
scope: 'header' | 'line',
|
||||
updatedMapping: VCProfileFieldSourceMapping,
|
||||
): void {
|
||||
const patch = cloneDefinitionForWrite();
|
||||
const list = patch.field_source_mappings || [];
|
||||
const idx = list.findIndex((m) => m.mapping_id === updatedMapping.mapping_id);
|
||||
if (idx < 0) {
|
||||
ensureMapping(scope);
|
||||
return;
|
||||
}
|
||||
const before = JSON.stringify(list[idx]);
|
||||
list[idx] = { ...updatedMapping };
|
||||
patch.field_source_mappings = list;
|
||||
emit('update:definition', patch);
|
||||
const after = JSON.stringify(list[idx]);
|
||||
if (before === after) return;
|
||||
|
||||
const beforeObj = JSON.parse(before) as VCProfileFieldSourceMapping;
|
||||
const afterObj = JSON.parse(after) as VCProfileFieldSourceMapping;
|
||||
const reasons: VCProfileDraftTrigger['reasons'] = [];
|
||||
|
||||
if (
|
||||
beforeObj.format_policy?.mode !== afterObj.format_policy?.mode
|
||||
|| beforeObj.format_policy?.pattern !== afterObj.format_policy?.pattern
|
||||
|| beforeObj.format_policy?.max_capture_groups !== afterObj.format_policy?.max_capture_groups
|
||||
) {
|
||||
reasons.push({
|
||||
kind: 'field_source_mapping_format_policy_changed',
|
||||
mapping_id: updatedMapping.mapping_id,
|
||||
});
|
||||
}
|
||||
|
||||
const enabledKeys = [
|
||||
'header_source_enabled',
|
||||
'table_source_enabled',
|
||||
'vendor_comments_enabled',
|
||||
] as const;
|
||||
for (const k of enabledKeys) {
|
||||
if (beforeObj[k] !== afterObj[k]) {
|
||||
reasons.push({
|
||||
kind: 'field_source_mapping_format_policy_changed',
|
||||
mapping_id: updatedMapping.mapping_id,
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
beforeObj.vendor_comments_region_ref !== afterObj.vendor_comments_region_ref
|
||||
|| beforeObj.table_column_code !== afterObj.table_column_code
|
||||
) {
|
||||
reasons.push({
|
||||
kind: 'field_source_mapping_format_policy_changed',
|
||||
mapping_id: updatedMapping.mapping_id,
|
||||
});
|
||||
}
|
||||
|
||||
if (reasons.length === 0) {
|
||||
reasons.push({
|
||||
kind: 'field_source_mapping_format_policy_changed',
|
||||
mapping_id: updatedMapping.mapping_id,
|
||||
});
|
||||
}
|
||||
|
||||
emitDraftTriggerAggregated({ reasons, changed: true });
|
||||
}
|
||||
|
||||
function openSplitEditor(scope: 'header' | 'line'): void {
|
||||
ensureMapping(scope);
|
||||
splitEditorScope.value = scope;
|
||||
splitEditorVisible.value = true;
|
||||
}
|
||||
|
||||
function handleSplitRuleSetUpdate(updated: VCSplitRuleSet): void {
|
||||
const scope = splitEditorScope.value;
|
||||
const mapping = scope === 'header' ? headerMapping.value : lineMapping.value;
|
||||
if (!mapping) return;
|
||||
updateMapping(mapping.mapping_id, { vendor_comments_split_rule_set: updated });
|
||||
}
|
||||
|
||||
function handleSplitEditorConfirmed(ruleSet: VCSplitRuleSet, previewToken: string): void {
|
||||
emit('vc:split-panel-confirmed',
|
||||
[ruleSet],
|
||||
{ [ruleSet.rule_set_id]: previewToken },
|
||||
props.selectedFieldCode,
|
||||
);
|
||||
splitEditorVisible.value = false;
|
||||
}
|
||||
|
||||
function handleSplitEditorDraftRequired(trigger: VCProfileDraftTrigger): void {
|
||||
emit('draftRequired', {
|
||||
...trigger,
|
||||
reasons: trigger.reasons.map((r) => ({ ...r })),
|
||||
});
|
||||
}
|
||||
|
||||
async function runMergePreview(): Promise<void> {
|
||||
if (props.canPreview === false) return;
|
||||
mergeLoading.value = true;
|
||||
try {
|
||||
// TODO: 后端 API stub,后续接入实际 endpoint
|
||||
// 预期:POST /admin/shipping/document-profiles/{profileId}/documents/{documentId}/preview-merge
|
||||
// 请求体:{ field_code: selectedFieldCode, definition }
|
||||
// 响应:VCMergedObservationCandidate[]
|
||||
mergePreviewResults.value = [];
|
||||
} finally {
|
||||
mergeLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
watch(splitEditorVisible, (v) => {
|
||||
if (!v) {
|
||||
// 关闭编辑器时无需特殊处理,ruleSet 已通过 update:ruleSet 实时同步
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="vc-source-mapping">
|
||||
<header class="vc-map__header">
|
||||
<h3 class="vc-map__title">字段来源映射 · {{ selectedFieldCode }}</h3>
|
||||
<div class="vc-map__scope-tabs">
|
||||
<span
|
||||
v-for="s in scopeOptions"
|
||||
:key="s.value"
|
||||
class="vc-map__scope-tab"
|
||||
:class="{ active: (s.value === 'header' ? headerMapping : lineMapping) != null }"
|
||||
>
|
||||
{{ s.label }}
|
||||
</span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="vc-map__scopes">
|
||||
<div
|
||||
v-for="scope in scopeOptions"
|
||||
:key="scope.value"
|
||||
class="vc-map__scope-panel"
|
||||
>
|
||||
<div class="vc-map__scope-header">
|
||||
<strong>{{ scope.label }}</strong>
|
||||
<small v-if="!(scope.value === 'header' ? headerMapping : lineMapping)">
|
||||
(未启用——开启任一来源将自动创建)
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<div class="vc-map__source-groups">
|
||||
<VcSourceMappingSection
|
||||
kind="header_region"
|
||||
:mapping="scope.value === 'header' ? headerMapping : lineMapping"
|
||||
:definition="definition"
|
||||
:readonly="readonly"
|
||||
:mapping-id="(scope.value === 'header' ? headerMapping : lineMapping)?.mapping_id || 'pending'"
|
||||
@update:mapping="(m) => handleSectionMappingUpdate(scope.value, m)"
|
||||
/>
|
||||
|
||||
<VcSourceMappingSection
|
||||
kind="table_column"
|
||||
:mapping="scope.value === 'header' ? headerMapping : lineMapping"
|
||||
:definition="definition"
|
||||
:readonly="readonly"
|
||||
:mapping-id="(scope.value === 'header' ? headerMapping : lineMapping)?.mapping_id || 'pending'"
|
||||
@update:mapping="(m) => handleSectionMappingUpdate(scope.value, m)"
|
||||
/>
|
||||
|
||||
<VcSourceMappingSection
|
||||
kind="vendor_comments"
|
||||
:mapping="scope.value === 'header' ? headerMapping : lineMapping"
|
||||
:definition="definition"
|
||||
:readonly="readonly"
|
||||
:show-split-rules="true"
|
||||
:mapping-id="(scope.value === 'header' ? headerMapping : lineMapping)?.mapping_id || 'pending'"
|
||||
@update:mapping="(m) => handleSectionMappingUpdate(scope.value, m)"
|
||||
@split-editor-open="openSplitEditor(scope.value)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="splitEditorVisible" class="vc-map__split-editor-wrapper">
|
||||
<VcSplitRuleEditor
|
||||
:rule-set="splitEditorRuleSet"
|
||||
:selected-field-code="selectedFieldCode"
|
||||
:document-id="documentId"
|
||||
:profile-id="profileId"
|
||||
:readonly="readonly"
|
||||
:dirty-unsaved="dirtyUnsaved"
|
||||
:persisted-confirmed="persistedConfirmed"
|
||||
:visible="splitEditorVisible"
|
||||
@update:rule-set="handleSplitRuleSetUpdate"
|
||||
@confirmed="handleSplitEditorConfirmed"
|
||||
@draft-required="handleSplitEditorDraftRequired"
|
||||
/>
|
||||
<div class="vc-map__split-editor-close">
|
||||
<button type="button" @click="splitEditorVisible = false">
|
||||
关闭编辑器
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="vc-map__merge-preview">
|
||||
<div class="vc-map__merge-toolbar">
|
||||
<h4>合并预览(后端决定 UI,禁止前端 if/else 推导)</h4>
|
||||
<button
|
||||
type="button"
|
||||
:disabled="!canPreview || mergeLoading"
|
||||
@click="runMergePreview"
|
||||
>
|
||||
{{ mergeLoading ? '预览中…' : '拉取合并裁决 (stub)' }}
|
||||
</button>
|
||||
</div>
|
||||
<VcMergePreviewTable
|
||||
:candidates="mergePreviewResults"
|
||||
:loading="mergeLoading"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.vc-source-mapping {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
}
|
||||
.vc-map__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
}
|
||||
.vc-map__title {
|
||||
margin: 0;
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
.vc-map__scope-tabs {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
}
|
||||
.vc-map__scope-tab {
|
||||
padding: 4px 10px;
|
||||
border-radius: 12px;
|
||||
border: 1px solid var(--border-default);
|
||||
font-size: 0.78rem;
|
||||
background: var(--bg-elevated);
|
||||
}
|
||||
.vc-map__scope-tab.active {
|
||||
border-color: var(--accent-primary);
|
||||
color: var(--accent-primary);
|
||||
}
|
||||
.vc-map__scopes {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
|
||||
gap: 10px;
|
||||
}
|
||||
.vc-map__scope-panel {
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 8px;
|
||||
padding: 10px;
|
||||
background: var(--bg-primary);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
.vc-map__scope-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
.vc-map__scope-header small {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
.vc-map__source-groups {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
.vc-map__split-editor-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
padding: 10px;
|
||||
border: 2px solid var(--accent-primary);
|
||||
border-radius: 8px;
|
||||
background: var(--bg-elevated);
|
||||
}
|
||||
.vc-map__split-editor-close {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.vc-map__split-editor-close button {
|
||||
padding: 4px 12px;
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 4px;
|
||||
background: var(--bg-primary);
|
||||
cursor: pointer;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
.vc-map__merge-preview {
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 8px;
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
.vc-map__merge-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
}
|
||||
.vc-map__merge-toolbar h4 {
|
||||
margin: 0;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
.vc-map__merge-toolbar button {
|
||||
padding: 6px 12px;
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 6px;
|
||||
background: var(--bg-primary);
|
||||
cursor: pointer;
|
||||
}
|
||||
.vc-map__merge-toolbar button:disabled { opacity: 0.6; cursor: not-allowed; }
|
||||
</style>
|
||||
+393
@@ -0,0 +1,393 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-document-profiles/components/VcSourceMappingSection.vue
|
||||
用途:三来源通用配置区(Header/Table/Vendor Comments 每来源的开关+target_scope+relation_policy+missing_relation+format_policy),
|
||||
不包含拆分规则编辑器(Vendor Comments 区的拆分规则编辑按钮仅触发 emit)。
|
||||
依赖:shipping-order-document-profile.vc.types.ts Section B/D/I;
|
||||
由 VcSourceMappingPanel.vue 薄编排主面板统一编排事件。
|
||||
逻辑:任何字段变化通过 update:mapping 发射完整 mapping 对象;
|
||||
Vendor Comments 点击「编辑拆分规则」时触发 split-editor-open。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import type {
|
||||
VCLineReferenceBasis,
|
||||
VCMissingRelationPolicy,
|
||||
VCProfileDefinitionExtensions,
|
||||
VCProfileFieldSourceMapping,
|
||||
VCRelationPolicy,
|
||||
VCReservationFormatPolicy,
|
||||
} from '@/features/admin/types/shipping-order-document-profile.vc.types';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
kind: 'header_region' | 'table_column' | 'vendor_comments';
|
||||
mapping: VCProfileFieldSourceMapping | null;
|
||||
definition: VCProfileDefinitionExtensions;
|
||||
readonly?: boolean;
|
||||
showSplitRules?: boolean;
|
||||
mappingId: string;
|
||||
}>(), {
|
||||
readonly: false,
|
||||
showSplitRules: false,
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:mapping': [mapping: VCProfileFieldSourceMapping];
|
||||
'split-editor-open': [];
|
||||
}>();
|
||||
|
||||
const enabledKey = computed<'header_source_enabled' | 'table_source_enabled' | 'vendor_comments_enabled'>(() => {
|
||||
if (props.kind === 'header_region') return 'header_source_enabled';
|
||||
if (props.kind === 'table_column') return 'table_source_enabled';
|
||||
return 'vendor_comments_enabled';
|
||||
});
|
||||
|
||||
const isEnabled = computed(() => props.mapping?.[enabledKey.value] ?? false);
|
||||
|
||||
function emitPatch(patch: Partial<VCProfileFieldSourceMapping>): void {
|
||||
if (!props.mapping) return;
|
||||
emit('update:mapping', { ...props.mapping, ...patch });
|
||||
}
|
||||
|
||||
function toggleEnabled(enabled: boolean): void {
|
||||
emitPatch({ [enabledKey.value]: enabled } as Partial<VCProfileFieldSourceMapping>);
|
||||
}
|
||||
|
||||
const namedRegionOptions = computed(() => {
|
||||
const map = props.definition?.named_regions || {};
|
||||
return Object.values(map).map((nr) => ({
|
||||
value: nr.region_id,
|
||||
label: nr.label,
|
||||
}));
|
||||
});
|
||||
|
||||
const scopeOptions = [
|
||||
{ value: 'header' as const, label: 'Header (订单头)' },
|
||||
{ value: 'line' as const, label: 'Line (明细行)' },
|
||||
];
|
||||
|
||||
const relationPolicyOptions: { value: VCRelationPolicy; label: string }[] = [
|
||||
{ value: 'bind_target_line', label: '绑定目标行 (bind_target_line)' },
|
||||
{ value: 'annotation_only', label: '仅备注 (annotation_only)' },
|
||||
{ value: 'no_relation', label: '无关联 (no_relation)' },
|
||||
];
|
||||
|
||||
const missingRelationPolicyOptions: { value: VCMissingRelationPolicy; label: string }[] = [
|
||||
{ value: 'default_all_lines', label: '默认所有行 (default_all_lines)' },
|
||||
{ value: 'default_header_only', label: '默认仅 Header (default_header_only)' },
|
||||
{ value: 'fallback_single_line_when_no_reference', label: '无参考回退单行 (fallback_single_line_when_no_reference)' },
|
||||
];
|
||||
|
||||
const lineReferenceBasisOptions: { value: VCLineReferenceBasis; label: string }[] = [
|
||||
{ value: 'explicit_line_column', label: '显式行列号 (explicit)' },
|
||||
{ value: 'profile_business_line_no', label: '业务行号 (profile_business_line_no)' },
|
||||
{ value: 'classified_logical_line_no', label: '分类逻辑行号 (classified_logical_line_no)' },
|
||||
];
|
||||
|
||||
const kindLabel = computed(() => {
|
||||
if (props.kind === 'header_region') return 'Header 来源';
|
||||
if (props.kind === 'table_column') return 'Table 来源';
|
||||
return 'Vendor Comments 来源';
|
||||
});
|
||||
|
||||
const sourceClass = computed(() => {
|
||||
if (props.kind === 'header_region') return 'vc-map__source--header';
|
||||
if (props.kind === 'table_column') return 'vc-map__source--table';
|
||||
return 'vc-map__source--vc';
|
||||
});
|
||||
|
||||
function updateFormatPolicy(policy: Partial<VCReservationFormatPolicy>): void {
|
||||
if (!props.mapping) return;
|
||||
const next: VCReservationFormatPolicy = {
|
||||
...props.mapping.format_policy,
|
||||
...policy,
|
||||
};
|
||||
emitPatch({ format_policy: next });
|
||||
}
|
||||
|
||||
const targetScopeDisabled = computed(() => {
|
||||
if (props.kind === 'table_column' || props.kind === 'vendor_comments') return true;
|
||||
return false;
|
||||
});
|
||||
|
||||
const showLineReferenceBasis = computed(() => {
|
||||
return props.kind === 'table_column' || props.kind === 'vendor_comments';
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<fieldset class="vc-map__source" :class="sourceClass">
|
||||
<legend>
|
||||
<label class="vc-map__toggle-label">
|
||||
<input
|
||||
type="checkbox"
|
||||
:disabled="readonly"
|
||||
:checked="isEnabled"
|
||||
@change="toggleEnabled(($event.target as HTMLInputElement).checked)"
|
||||
/>
|
||||
{{ kindLabel }}
|
||||
</label>
|
||||
</legend>
|
||||
<template v-if="isEnabled && mapping">
|
||||
<template v-if="kind === 'header_region'">
|
||||
<label>
|
||||
Header 引用键
|
||||
<input
|
||||
:disabled="readonly"
|
||||
:value="mapping.header_source_ref ?? ''"
|
||||
placeholder="header_ref / 留空走自动检测"
|
||||
@input="emitPatch({ header_source_ref: ($event.target as HTMLInputElement).value || null })"
|
||||
/>
|
||||
</label>
|
||||
</template>
|
||||
<template v-else-if="kind === 'table_column'">
|
||||
<label>
|
||||
列 column_code
|
||||
<input
|
||||
:disabled="readonly"
|
||||
:value="mapping.table_column_code ?? ''"
|
||||
placeholder="例如:reservation_id"
|
||||
@input="emitPatch({ table_column_code: ($event.target as HTMLInputElement).value || null })"
|
||||
/>
|
||||
</label>
|
||||
</template>
|
||||
<template v-else-if="kind === 'vendor_comments'">
|
||||
<label>
|
||||
命名区域
|
||||
<select
|
||||
:disabled="readonly"
|
||||
:value="mapping.vendor_comments_region_ref ?? ''"
|
||||
@change="emitPatch({ vendor_comments_region_ref: ($event.target as HTMLSelectElement).value || null })"
|
||||
>
|
||||
<option value="">— 请选择命名区域 —</option>
|
||||
<option v-for="opt in namedRegionOptions" :key="opt.value" :value="opt.value">{{ opt.label }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<div v-if="showSplitRules" class="vc-map__split-open-row">
|
||||
<button
|
||||
type="button"
|
||||
:disabled="readonly"
|
||||
class="vc-map__split-open-btn"
|
||||
@click="emit('split-editor-open')"
|
||||
>
|
||||
编辑拆分规则…
|
||||
</button>
|
||||
<span v-if="mapping.vendor_comments_split_rule_set" class="vc-map__split-status-inline">
|
||||
规则集:v{{ mapping.vendor_comments_split_rule_set.rule_version }}
|
||||
· {{ mapping.vendor_comments_split_rule_set.status || 'draft' }}
|
||||
</span>
|
||||
<span v-else class="vc-map__split-status-inline vc-map__split-status--muted">
|
||||
尚未配置规则集
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<label>
|
||||
目标作用域
|
||||
<select
|
||||
:disabled="readonly || targetScopeDisabled"
|
||||
:value="targetScopeDisabled ? 'line' : mapping.target_scope"
|
||||
@change="emitPatch({ target_scope: ($event.target as HTMLSelectElement).value as 'header' | 'line' })"
|
||||
>
|
||||
<option v-for="opt in scopeOptions" :key="opt.value" :value="opt.value">
|
||||
{{ opt.label }}{{ targetScopeDisabled && opt.value === 'line' ? ' (默认)' : '' }}
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
关联策略
|
||||
<select
|
||||
:disabled="readonly"
|
||||
:value="mapping.relation_policy"
|
||||
@change="emitPatch({ relation_policy: ($event.target as HTMLSelectElement).value as VCRelationPolicy })"
|
||||
>
|
||||
<option v-for="opt in relationPolicyOptions" :key="opt.value" :value="opt.value">{{ opt.label }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<template v-if="showLineReferenceBasis">
|
||||
<label>
|
||||
行参考基准
|
||||
<select
|
||||
:disabled="readonly"
|
||||
:value="mapping.line_reference_basis"
|
||||
@change="emitPatch({ line_reference_basis: ($event.target as HTMLSelectElement).value as VCLineReferenceBasis })"
|
||||
>
|
||||
<option v-for="opt in lineReferenceBasisOptions" :key="opt.value" :value="opt.value">{{ opt.label }}</option>
|
||||
</select>
|
||||
</label>
|
||||
</template>
|
||||
<label>
|
||||
缺关联策略
|
||||
<select
|
||||
:disabled="readonly"
|
||||
:value="mapping.missing_relation_policy"
|
||||
@change="emitPatch({ missing_relation_policy: ($event.target as HTMLSelectElement).value as VCMissingRelationPolicy })"
|
||||
>
|
||||
<option v-for="opt in missingRelationPolicyOptions" :key="opt.value" :value="opt.value">{{ opt.label }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="vc-map__checkbox">
|
||||
<input
|
||||
type="checkbox"
|
||||
:disabled="readonly"
|
||||
:checked="mapping.fill_missing_from_other_sources ?? true"
|
||||
@change="emitPatch({ fill_missing_from_other_sources: ($event.target as HTMLInputElement).checked })"
|
||||
/>
|
||||
fill_missing_from_other_sources(从其他来源补空)
|
||||
</label>
|
||||
|
||||
<div class="vc-map__format-block">
|
||||
<div class="vc-map__format-title">格式策略</div>
|
||||
<div class="vc-map__format-radios">
|
||||
<label class="vc-map__radio">
|
||||
<input
|
||||
type="radio"
|
||||
:disabled="readonly"
|
||||
:name="`format-mode-${kind}-${mappingId}`"
|
||||
value="inherit_global"
|
||||
:checked="mapping.format_policy.mode === 'inherit_global'"
|
||||
@change="updateFormatPolicy({ mode: 'inherit_global' })"
|
||||
/>
|
||||
inherit_global(使用 Profile 全局设置)
|
||||
</label>
|
||||
<label class="vc-map__radio">
|
||||
<input
|
||||
type="radio"
|
||||
:disabled="readonly"
|
||||
:name="`format-mode-${kind}-${mappingId}`"
|
||||
value="numeric_5_or_10"
|
||||
:checked="mapping.format_policy.mode === 'numeric_5_or_10'"
|
||||
@change="updateFormatPolicy({ mode: 'numeric_5_or_10' })"
|
||||
/>
|
||||
numeric_5_or_10(单号 5 或 10 位数字)
|
||||
</label>
|
||||
<label class="vc-map__radio">
|
||||
<input
|
||||
type="radio"
|
||||
:disabled="readonly"
|
||||
:name="`format-mode-${kind}-${mappingId}`"
|
||||
value="custom_safe_regex"
|
||||
:checked="mapping.format_policy.mode === 'custom_safe_regex'"
|
||||
@change="updateFormatPolicy({ mode: 'custom_safe_regex' })"
|
||||
/>
|
||||
custom_safe_regex(自定义安全正则)
|
||||
</label>
|
||||
</div>
|
||||
<template v-if="mapping.format_policy.mode === 'custom_safe_regex'">
|
||||
<label>
|
||||
pattern
|
||||
<input
|
||||
:disabled="readonly"
|
||||
:value="mapping.format_policy.pattern ?? ''"
|
||||
placeholder="例如:^[A-Z]?\d{5,10}$"
|
||||
@input="updateFormatPolicy({ pattern: ($event.target as HTMLInputElement).value || null })"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
max_capture_groups
|
||||
<input
|
||||
type="number"
|
||||
min="0"
|
||||
:disabled="readonly"
|
||||
:value="mapping.format_policy.max_capture_groups ?? 1"
|
||||
@input="updateFormatPolicy({ max_capture_groups: Number(($event.target as HTMLInputElement).value) || 0 })"
|
||||
/>
|
||||
</label>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
</fieldset>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.vc-map__source {
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 6px;
|
||||
padding: 8px 10px;
|
||||
margin: 0;
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
}
|
||||
.vc-map__source--header { border-left: 4px solid #3b82f6; }
|
||||
.vc-map__source--table { border-left: 4px solid #10b981; }
|
||||
.vc-map__source--vc { border-left: 4px solid #f59e0b; }
|
||||
.vc-map__source legend {
|
||||
font-size: 0.82rem;
|
||||
font-weight: 600;
|
||||
padding: 0 4px;
|
||||
}
|
||||
.vc-map__toggle-label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
}
|
||||
.vc-map__source label {
|
||||
display: grid;
|
||||
grid-template-columns: 110px 1fr;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
.vc-map__checkbox {
|
||||
grid-template-columns: auto 1fr !important;
|
||||
align-items: center;
|
||||
}
|
||||
.vc-map__radio {
|
||||
grid-template-columns: auto 1fr !important;
|
||||
align-items: center;
|
||||
}
|
||||
.vc-map__format-block {
|
||||
grid-column: 1 / -1;
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
padding: 6px;
|
||||
border: 1px dashed var(--border-default);
|
||||
border-radius: 6px;
|
||||
background: var(--bg-elevated);
|
||||
}
|
||||
.vc-map__format-title {
|
||||
font-size: 0.8rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
.vc-map__format-radios {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
.vc-map__source select,
|
||||
.vc-map__source input {
|
||||
padding: 4px 6px;
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 4px;
|
||||
font-size: 0.8rem;
|
||||
min-width: 0;
|
||||
}
|
||||
.vc-map__split-open-row {
|
||||
grid-column: 1 / -1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.vc-map__split-open-btn {
|
||||
padding: 4px 12px;
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 4px;
|
||||
background: var(--bg-primary);
|
||||
cursor: pointer;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
.vc-map__split-open-btn:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.vc-map__split-status-inline {
|
||||
font-size: 0.75rem;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
.vc-map__split-status--muted {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
</style>
|
||||
+921
@@ -0,0 +1,921 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-document-profiles/components/VcSplitRuleEditor.vue
|
||||
用途:VC 专用拆分规则编辑器(只处理 Section C VCSplit* 类型,不引入任何 XfaSplit*)。
|
||||
复用 XfaSplitRulePanel 的 addRule/matcherFromExtraction/preview/dirty banner 交互模式,
|
||||
但所有类型、常量、stages 全部本地化,类型只用 vc.types.ts Section C。
|
||||
依赖:shipping-order-document-profile.vc.types.ts Section C/J;
|
||||
preview API 为本地 stub,标注后续接入 endpoint。
|
||||
逻辑:split_rules 变化时 emit draftRequired,reason=split_rule_changed;
|
||||
确认前必须先预览(needs_preview → diagnostics → confirm dialog → emit confirmed)。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, computed } from 'vue';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import type {
|
||||
VCProfileDraftTrigger,
|
||||
VCSplitEnginePreviewResult,
|
||||
VCSplitMatcher,
|
||||
VCSplitNormalization,
|
||||
VCSplitRule,
|
||||
VCSplitRuleSet,
|
||||
VCSplitSegment,
|
||||
} from '@/features/admin/types/shipping-order-document-profile.vc.types';
|
||||
|
||||
type ExtractionMode = 'select_line' | 'select_line_range' | 'extract_prefix' | 'regex_capture' | 'substring';
|
||||
|
||||
type VCSplitStageType =
|
||||
| 'split_lines'
|
||||
| 'select_line'
|
||||
| 'select_line_range'
|
||||
| 'extract_prefix'
|
||||
| 'regex_capture'
|
||||
| 'replace'
|
||||
| 'substring'
|
||||
| 'normalize';
|
||||
|
||||
interface VCSplitStage {
|
||||
stage_id: string;
|
||||
type: VCSplitStageType;
|
||||
trim?: boolean;
|
||||
remove_empty_lines?: boolean;
|
||||
line_breaks?: string[];
|
||||
line_index?: number;
|
||||
line_start?: number;
|
||||
line_end?: number;
|
||||
join_with?: 'newline' | 'space' | 'comma';
|
||||
value?: string;
|
||||
separators?: string[];
|
||||
case_sensitive?: boolean;
|
||||
pattern?: string;
|
||||
capture_group?: number;
|
||||
find?: string;
|
||||
replace_with?: string;
|
||||
start?: number;
|
||||
end?: number | null;
|
||||
}
|
||||
|
||||
interface VCSplitRulePatch {
|
||||
order?: number;
|
||||
matcher?: VCSplitMatcher | null;
|
||||
segment?: Partial<VCSplitSegment>;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
ruleSet: VCSplitRuleSet | null;
|
||||
selectedFieldCode: string;
|
||||
documentId: number;
|
||||
profileId: number;
|
||||
readonly?: boolean;
|
||||
dirtyUnsaved?: boolean;
|
||||
persistedConfirmed?: boolean;
|
||||
visible: boolean;
|
||||
}>(), {
|
||||
selectedFieldCode: 'reservation_id',
|
||||
readonly: false,
|
||||
dirtyUnsaved: false,
|
||||
persistedConfirmed: false,
|
||||
visible: false,
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:ruleSet': [ruleSet: VCSplitRuleSet];
|
||||
confirmed: [ruleSet: VCSplitRuleSet, previewToken: string];
|
||||
draftRequired: [trigger: VCProfileDraftTrigger];
|
||||
}>();
|
||||
|
||||
const message = useMessage();
|
||||
|
||||
function newClientId(prefix: 'rs' | 'rule' | 'seg' | 'stage'): string {
|
||||
return `${prefix}-${crypto.randomUUID().replace(/-/g, '')}`;
|
||||
}
|
||||
|
||||
const splitLoading = ref(false);
|
||||
const splitPreview = ref<VCSplitEnginePreviewResult | null>(null);
|
||||
const splitPreviewRuleSetHash = ref<string | null>(null);
|
||||
const splitPreviewConfirmationToken = ref<string | null>(null);
|
||||
const splitCollapsedRules = ref(new Set<string>());
|
||||
const splitAdvancedRules = ref(new Set<string>());
|
||||
|
||||
const showUnsavedConfirmBanner = computed(() => props.dirtyUnsaved && props.persistedConfirmed === false);
|
||||
|
||||
function createDefaultStage(type: VCSplitStageType): VCSplitStage {
|
||||
const stageId = newClientId('stage');
|
||||
if (type === 'split_lines') {
|
||||
return {
|
||||
stage_id: stageId,
|
||||
type,
|
||||
trim: true,
|
||||
remove_empty_lines: true,
|
||||
line_breaks: ['\r\n', '\r', '\n'],
|
||||
};
|
||||
}
|
||||
if (type === 'select_line') return { stage_id: stageId, type, line_index: 1 };
|
||||
if (type === 'select_line_range') return { stage_id: stageId, type, line_start: 1, line_end: 2, join_with: 'newline' };
|
||||
if (type === 'extract_prefix') return {
|
||||
stage_id: stageId,
|
||||
type,
|
||||
value: '',
|
||||
separators: [':', ':'],
|
||||
case_sensitive: false,
|
||||
};
|
||||
if (type === 'regex_capture') return { stage_id: stageId, type, pattern: '', capture_group: 1 };
|
||||
if (type === 'replace') return { stage_id: stageId, type, find: '', replace_with: '' };
|
||||
if (type === 'substring') return { stage_id: stageId, type, start: 0, end: null };
|
||||
return { stage_id: stageId, type: 'normalize', trim: true, remove_empty_lines: true };
|
||||
}
|
||||
|
||||
function createDefaultPipelineStages(lineIndex = 1): VCSplitStage[] {
|
||||
return [
|
||||
createDefaultStage('split_lines'),
|
||||
{ ...createDefaultStage('select_line'), line_index: lineIndex },
|
||||
];
|
||||
}
|
||||
|
||||
function matcherFromExtraction(mode: ExtractionMode, stage: Partial<VCSplitStage>, order: number): VCSplitMatcher {
|
||||
if (mode === 'extract_prefix') {
|
||||
return {
|
||||
type: 'prefix',
|
||||
value: String(stage.value || ''),
|
||||
separators: (stage.separators && stage.separators.length) ? stage.separators : [':', ':'],
|
||||
case_sensitive: Boolean(stage.case_sensitive),
|
||||
};
|
||||
}
|
||||
if (mode === 'regex_capture') {
|
||||
return {
|
||||
type: 'regex',
|
||||
pattern: String(stage.pattern || ''),
|
||||
capture_group: stage.capture_group ?? 1,
|
||||
case_sensitive: Boolean(stage.case_sensitive),
|
||||
};
|
||||
}
|
||||
return {
|
||||
type: 'position',
|
||||
line_index: Number(stage.line_index || stage.line_start || order || 1),
|
||||
};
|
||||
}
|
||||
|
||||
function hashRuleSet(ruleSet: VCSplitRuleSet | null | undefined): string {
|
||||
if (!ruleSet) return '';
|
||||
return JSON.stringify(ruleSet);
|
||||
}
|
||||
|
||||
function invalidatePreview(): void {
|
||||
splitPreview.value = null;
|
||||
splitPreviewRuleSetHash.value = null;
|
||||
splitPreviewConfirmationToken.value = null;
|
||||
}
|
||||
|
||||
function ensureRuleSet(): VCSplitRuleSet {
|
||||
if (props.ruleSet) return props.ruleSet;
|
||||
const ruleSet: VCSplitRuleSet = {
|
||||
rule_set_id: newClientId('rs'),
|
||||
rule_version: 1,
|
||||
normalization: { trim: true, remove_empty_lines: true, line_breaks: ['\r\n', '\r', '\n'] },
|
||||
rules: [],
|
||||
unmatched_line_policy: 'evidence_only',
|
||||
duplicate_match_policy: 'needs_review',
|
||||
same_field_multiple_segment_policy: 'needs_review',
|
||||
source: 'user',
|
||||
status: 'draft',
|
||||
requires_confirmation: true,
|
||||
};
|
||||
emit('update:ruleSet', ruleSet);
|
||||
invalidatePreview();
|
||||
emitDraftTriggerForSplitChanged();
|
||||
return ruleSet;
|
||||
}
|
||||
|
||||
function markRuleSetDirty(ruleSet: VCSplitRuleSet): VCSplitRuleSet {
|
||||
const wasConfirmed = ruleSet.status === 'confirmed' || ruleSet.status === 'published';
|
||||
return {
|
||||
...ruleSet,
|
||||
status: 'draft',
|
||||
requires_confirmation: true,
|
||||
rule_version: wasConfirmed ? ruleSet.rule_version + 1 : ruleSet.rule_version,
|
||||
};
|
||||
}
|
||||
|
||||
function normalizeRuleOrders(rules: VCSplitRule[]): VCSplitRule[] {
|
||||
return [...rules]
|
||||
.sort((a, b) => (a.order ?? 0) - (b.order ?? 0))
|
||||
.map((rule, index) => ({ ...rule, order: index + 1 }));
|
||||
}
|
||||
|
||||
function writeRuleSet(ruleSet: VCSplitRuleSet, emitDraft = true): void {
|
||||
emit('update:ruleSet', ruleSet);
|
||||
invalidatePreview();
|
||||
if (emitDraft) {
|
||||
emitDraftTriggerForSplitChanged();
|
||||
}
|
||||
}
|
||||
|
||||
function applyRuleSetChange(updater: (ruleSet: VCSplitRuleSet) => VCSplitRuleSet): void {
|
||||
const current = ensureRuleSet();
|
||||
writeRuleSet(markRuleSetDirty(updater(current)));
|
||||
}
|
||||
|
||||
function emitDraftTriggerForSplitChanged(): void {
|
||||
const trigger: VCProfileDraftTrigger = {
|
||||
named_regions_changed: false,
|
||||
field_source_mappings_changed: true,
|
||||
requires_draft_reset: true,
|
||||
reasons: [{ kind: 'field_source_mapping_split_rule_changed' }],
|
||||
};
|
||||
emit('draftRequired', trigger);
|
||||
}
|
||||
|
||||
function addRule(): void {
|
||||
if (props.readonly) return;
|
||||
const ruleSet = ensureRuleSet();
|
||||
const order = (ruleSet.rules?.length || 0) + 1;
|
||||
const stages = createDefaultPipelineStages(order);
|
||||
const nextRule: VCSplitRule = {
|
||||
rule_id: newClientId('rule'),
|
||||
order,
|
||||
matcher: matcherFromExtraction('select_line', stages[1] || {}, order),
|
||||
segment: {
|
||||
segment_id: newClientId('seg'),
|
||||
segment_code: '',
|
||||
display_name: '',
|
||||
handling: 'evidence_only',
|
||||
target_field_id: null,
|
||||
target_field_code: props.selectedFieldCode,
|
||||
note: null,
|
||||
},
|
||||
};
|
||||
writeRuleSet(markRuleSetDirty({
|
||||
...ruleSet,
|
||||
rules: normalizeRuleOrders([...(ruleSet.rules || []), nextRule]),
|
||||
}));
|
||||
const next = new Set(splitCollapsedRules.value);
|
||||
next.delete(nextRule.rule_id);
|
||||
splitCollapsedRules.value = next;
|
||||
}
|
||||
|
||||
function deleteRule(ruleId: string): void {
|
||||
applyRuleSetChange((current) => ({
|
||||
...current,
|
||||
rules: normalizeRuleOrders(current.rules.filter((r) => r.rule_id !== ruleId)),
|
||||
}));
|
||||
const next = new Set(splitCollapsedRules.value);
|
||||
next.delete(ruleId);
|
||||
splitCollapsedRules.value = next;
|
||||
}
|
||||
|
||||
function moveRule(ruleId: string, direction: 'up' | 'down'): void {
|
||||
const current = ensureRuleSet();
|
||||
const rules = [...current.rules];
|
||||
const idx = rules.findIndex((r) => r.rule_id === ruleId);
|
||||
if (idx < 0) return;
|
||||
const swapIdx = direction === 'up' ? idx - 1 : idx + 1;
|
||||
if (swapIdx < 0 || swapIdx >= rules.length) return;
|
||||
const currentRule = rules[idx];
|
||||
const swapRule = rules[swapIdx];
|
||||
if (!currentRule || !swapRule) return;
|
||||
[rules[idx], rules[swapIdx]] = [swapRule, currentRule];
|
||||
applyRuleSetChange((rs) => ({ ...rs, rules: normalizeRuleOrders(rules) }));
|
||||
}
|
||||
|
||||
function toggleRule(ruleId: string): void {
|
||||
const next = new Set(splitCollapsedRules.value);
|
||||
if (next.has(ruleId)) next.delete(ruleId);
|
||||
else next.add(ruleId);
|
||||
splitCollapsedRules.value = next;
|
||||
}
|
||||
|
||||
function toggleAdvanced(ruleId: string): void {
|
||||
const next = new Set(splitAdvancedRules.value);
|
||||
if (next.has(ruleId)) next.delete(ruleId);
|
||||
else next.add(ruleId);
|
||||
splitAdvancedRules.value = next;
|
||||
}
|
||||
|
||||
function extractionStage(rule: VCSplitRule): VCSplitStage {
|
||||
if (rule.matcher?.type === 'prefix') {
|
||||
return {
|
||||
...createDefaultStage('extract_prefix'),
|
||||
value: rule.matcher.value ?? undefined,
|
||||
separators: rule.matcher.separators,
|
||||
case_sensitive: rule.matcher.case_sensitive,
|
||||
};
|
||||
}
|
||||
if (rule.matcher?.type === 'regex') {
|
||||
return {
|
||||
...createDefaultStage('regex_capture'),
|
||||
pattern: rule.matcher.pattern ?? undefined,
|
||||
capture_group: rule.matcher.capture_group ?? undefined,
|
||||
case_sensitive: rule.matcher.case_sensitive,
|
||||
};
|
||||
}
|
||||
if (rule.matcher?.type === 'position') {
|
||||
return {
|
||||
...createDefaultStage('select_line'),
|
||||
line_index: rule.matcher.line_index ?? rule.order ?? 1,
|
||||
};
|
||||
}
|
||||
return { ...createDefaultStage('select_line'), line_index: rule.order ?? 1 };
|
||||
}
|
||||
|
||||
function extractionMode(rule: VCSplitRule): ExtractionMode {
|
||||
if (rule.matcher?.type === 'prefix') return 'extract_prefix';
|
||||
if (rule.matcher?.type === 'regex') return 'regex_capture';
|
||||
if (rule.matcher?.type === 'position') return 'select_line';
|
||||
return 'select_line';
|
||||
}
|
||||
|
||||
function updateRule(ruleId: string, patch: VCSplitRulePatch): void {
|
||||
applyRuleSetChange((current) => ({
|
||||
...current,
|
||||
rules: current.rules.map((rule) => {
|
||||
if (rule.rule_id !== ruleId) return rule;
|
||||
return {
|
||||
...rule,
|
||||
...patch,
|
||||
segment: patch.segment ? { ...rule.segment, ...patch.segment } : rule.segment,
|
||||
matcher: patch.matcher !== undefined ? patch.matcher : rule.matcher,
|
||||
};
|
||||
}),
|
||||
}));
|
||||
}
|
||||
|
||||
function changeExtractionMode(rule: VCSplitRule, mode: ExtractionMode): void {
|
||||
const extraction = createDefaultStage(mode);
|
||||
if (mode === 'select_line') extraction.line_index = rule.order ?? 1;
|
||||
if (mode === 'select_line_range') {
|
||||
extraction.line_start = rule.order ?? 1;
|
||||
extraction.line_end = (rule.order ?? 1) + 1;
|
||||
}
|
||||
updateRule(rule.rule_id, {
|
||||
matcher: matcherFromExtraction(mode, extraction, rule.order ?? 1),
|
||||
});
|
||||
}
|
||||
|
||||
function updateExtraction(rule: VCSplitRule, patch: Partial<VCSplitStage>): void {
|
||||
const current = extractionStage(rule);
|
||||
const nextStage = { ...current, ...patch };
|
||||
const mode = extractionMode(rule);
|
||||
updateRule(rule.rule_id, {
|
||||
matcher: matcherFromExtraction(mode, nextStage, rule.order ?? 1),
|
||||
});
|
||||
}
|
||||
|
||||
function updateUnmatchedPolicy(policy: 'evidence_only' | 'needs_review'): void {
|
||||
applyRuleSetChange((current) => ({ ...current, unmatched_line_policy: policy }));
|
||||
}
|
||||
|
||||
function updateNormalization(patch: Partial<VCSplitNormalization>): void {
|
||||
applyRuleSetChange((current) => ({
|
||||
...current,
|
||||
normalization: { ...(current.normalization || {}), ...patch },
|
||||
}));
|
||||
}
|
||||
|
||||
function previewValueFor(rule: VCSplitRule): string | null {
|
||||
const segment = splitPreview.value?.segments?.find((s) => s.rule_id === rule.rule_id);
|
||||
return segment ? (segment.normalized_text || segment.raw_text) : null;
|
||||
}
|
||||
|
||||
function previewLineLabel(lineStart?: number | null, lineEnd?: number | null): string {
|
||||
if (!lineStart) return '—';
|
||||
return lineEnd && lineEnd !== lineStart ? `${lineStart}–${lineEnd}` : String(lineStart);
|
||||
}
|
||||
|
||||
async function runPreview(): Promise<void> {
|
||||
const ruleSet = ensureRuleSet();
|
||||
splitLoading.value = true;
|
||||
try {
|
||||
// TODO: 后端 API stub,后续接入实际 endpoint
|
||||
// 预期:POST /admin/shipping/document-profiles/{profileId}/documents/{documentId}/preview-split
|
||||
// 请求体:{ rule_set: ruleSet, field_code: selectedFieldCode }
|
||||
splitPreview.value = {
|
||||
status: 'parsed',
|
||||
rule_set_id: ruleSet.rule_set_id,
|
||||
rule_version: ruleSet.rule_version,
|
||||
mapped_fields: {},
|
||||
segments: [],
|
||||
evidence_only_segments: [],
|
||||
diagnostics: [],
|
||||
};
|
||||
splitPreviewRuleSetHash.value = hashRuleSet(ruleSet);
|
||||
splitPreviewConfirmationToken.value = `stub-${Date.now()}`;
|
||||
} catch (error) {
|
||||
message.error(error instanceof BusinessError ? error.message : '预览失败');
|
||||
} finally {
|
||||
splitLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function confirmRules(): void {
|
||||
const ruleSet = ensureRuleSet();
|
||||
const currentHash = hashRuleSet(ruleSet);
|
||||
if (!splitPreview.value || splitPreviewRuleSetHash.value !== currentHash || !splitPreviewConfirmationToken.value) {
|
||||
message.error('确认前请先预览当前规则集');
|
||||
return;
|
||||
}
|
||||
if (splitPreview.value.status === 'needs_review' || (splitPreview.value.diagnostics || []).length > 0) {
|
||||
message.error('存在 needs_review 或诊断错误,无法确认');
|
||||
return;
|
||||
}
|
||||
const confirmedRuleSet: VCSplitRuleSet = {
|
||||
...ruleSet,
|
||||
source: 'user',
|
||||
status: 'confirmed',
|
||||
requires_confirmation: false,
|
||||
};
|
||||
emit('update:ruleSet', confirmedRuleSet);
|
||||
emit('confirmed', confirmedRuleSet, splitPreviewConfirmationToken.value);
|
||||
}
|
||||
|
||||
function lineBreaksToDisplay(breaks: string[] | undefined): string {
|
||||
return (breaks || []).map((item) => item
|
||||
.replace(/\\/g, '\\\\')
|
||||
.replace(/\r/g, '\\r')
|
||||
.replace(/\n/g, '\\n')
|
||||
.replace(/\t/g, '\\t')).join(', ');
|
||||
}
|
||||
|
||||
function parseLineBreaks(value: string): string[] {
|
||||
return value.split(',')
|
||||
.map((item) => item.trim())
|
||||
.filter(Boolean)
|
||||
.map((token) => token
|
||||
.replace(/\\r\\n/g, '\r\n')
|
||||
.replace(/\\n/g, '\n')
|
||||
.replace(/\\r/g, '\r')
|
||||
.replace(/\\t/g, '\t')
|
||||
.replace(/\\\\/g, '\\'));
|
||||
}
|
||||
|
||||
function separatorsToString(separators: string[] | undefined): string {
|
||||
return (separators || []).join(', ');
|
||||
}
|
||||
|
||||
function parseSeparators(value: string): string[] {
|
||||
return value.split(',').map((item) => item.trim()).filter(Boolean);
|
||||
}
|
||||
|
||||
watch(() => props.visible, (v) => {
|
||||
if (v) {
|
||||
ensureRuleSet();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="visible" class="vc-split-editor">
|
||||
<div v-if="showUnsavedConfirmBanner" class="vc-map__banner" role="status">
|
||||
已确认的规则集有未保存改动,保存后将重置为 Draft。
|
||||
</div>
|
||||
|
||||
<div class="vc-split-editor__header">
|
||||
<h4>拆分规则编辑器 · {{ selectedFieldCode }}</h4>
|
||||
<div class="vc-split-editor__toolbar">
|
||||
<button
|
||||
type="button"
|
||||
:disabled="readonly"
|
||||
@click="addRule()"
|
||||
>
|
||||
新增拆分规则
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
:disabled="splitLoading"
|
||||
@click="runPreview()"
|
||||
>
|
||||
{{ splitLoading ? '预览中…' : '预览拆分' }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
:disabled="readonly || !splitPreview || !splitPreviewConfirmationToken"
|
||||
@click="confirmRules()"
|
||||
>
|
||||
确认规则
|
||||
</button>
|
||||
<span class="vc-map__split-status">
|
||||
状态:{{ ruleSet?.status || 'draft' }}
|
||||
· v{{ ruleSet?.rule_version || 1 }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<fieldset class="vc-map__split-ruleset">
|
||||
<legend>规则集设置</legend>
|
||||
<label>
|
||||
未匹配策略
|
||||
<select
|
||||
:disabled="readonly"
|
||||
:value="ruleSet?.unmatched_line_policy || 'evidence_only'"
|
||||
@change="updateUnmatchedPolicy(($event.target as HTMLSelectElement).value as 'evidence_only' | 'needs_review')"
|
||||
>
|
||||
<option value="evidence_only">仅留证据 (evidence_only)</option>
|
||||
<option value="needs_review">需复核 (needs_review)</option>
|
||||
</select>
|
||||
</label>
|
||||
<div class="vc-map__split-normalization">
|
||||
<label class="vc-map__checkbox">
|
||||
<input
|
||||
type="checkbox"
|
||||
:disabled="readonly"
|
||||
:checked="ruleSet?.normalization?.trim ?? true"
|
||||
@change="updateNormalization({ trim: ($event.target as HTMLInputElement).checked })"
|
||||
/>
|
||||
trim
|
||||
</label>
|
||||
<label class="vc-map__checkbox">
|
||||
<input
|
||||
type="checkbox"
|
||||
:disabled="readonly"
|
||||
:checked="ruleSet?.normalization?.remove_empty_lines ?? true"
|
||||
@change="updateNormalization({ remove_empty_lines: ($event.target as HTMLInputElement).checked })"
|
||||
/>
|
||||
去空行
|
||||
</label>
|
||||
<label>
|
||||
换行
|
||||
<input
|
||||
:disabled="readonly"
|
||||
:value="lineBreaksToDisplay(ruleSet?.normalization?.line_breaks)"
|
||||
:placeholder="'\r\n, \r, \n'"
|
||||
@change="updateNormalization({ line_breaks: parseLineBreaks(($event.target as HTMLInputElement).value) })"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div v-if="splitPreview" class="vc-map__split-preview">
|
||||
<h5>拆分预览(stub,后端 API 待接入)</h5>
|
||||
<p>status: {{ splitPreview.status }}</p>
|
||||
<table v-if="splitPreview.segments?.length" class="vc-map__table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>行</th><th>segment_code</th><th>提取方式</th><th>识别值</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="seg in splitPreview.segments" :key="seg.segment_id">
|
||||
<td>{{ previewLineLabel(seg.line_no, seg.line_end_no) }}</td>
|
||||
<td>{{ seg.segment_code }}</td>
|
||||
<td>{{ seg.matcher_type }}</td>
|
||||
<td>{{ seg.normalized_text || seg.raw_text }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<ul v-if="splitPreview.diagnostics?.length" class="vc-map__diagnostics">
|
||||
<li v-for="(d, i) in splitPreview.diagnostics" :key="i">
|
||||
<strong>{{ d.code }}</strong>: {{ d.message }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<ul class="vc-map__split-rules">
|
||||
<li
|
||||
v-for="(rule, idx) in (ruleSet?.rules || [])"
|
||||
:key="rule.rule_id"
|
||||
>
|
||||
<div class="vc-map__split-rule-header">
|
||||
<button type="button" class="vc-map__split-rule-title" @click="toggleRule(rule.rule_id)">
|
||||
<span>{{ splitCollapsedRules.has(rule.rule_id) ? '›' : '⌄' }}</span>
|
||||
<strong>规则 {{ idx + 1 }}</strong>
|
||||
<span>{{ rule.segment.display_name || rule.segment.segment_code || '未命名' }}</span>
|
||||
</button>
|
||||
<div class="vc-map__split-rule-actions">
|
||||
<button
|
||||
type="button"
|
||||
:disabled="readonly || idx === 0"
|
||||
@click="moveRule(rule.rule_id, 'up')"
|
||||
>
|
||||
↑
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
:disabled="readonly || idx === (ruleSet?.rules?.length || 0) - 1"
|
||||
@click="moveRule(rule.rule_id, 'down')"
|
||||
>
|
||||
↓
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
:disabled="readonly"
|
||||
@click="toggleAdvanced(rule.rule_id)"
|
||||
>
|
||||
{{ splitAdvancedRules.has(rule.rule_id) ? '高级 ▾' : '高级 ▸' }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="danger"
|
||||
:disabled="readonly"
|
||||
@click="deleteRule(rule.rule_id)"
|
||||
>
|
||||
删除
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="!splitCollapsedRules.has(rule.rule_id)" class="vc-map__split-rule-detail">
|
||||
<label>
|
||||
segment_code
|
||||
<input
|
||||
:disabled="readonly"
|
||||
:value="rule.segment.segment_code"
|
||||
@input="updateRule(rule.rule_id, { segment: { segment_code: ($event.target as HTMLInputElement).value } })"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
display_name
|
||||
<input
|
||||
:disabled="readonly"
|
||||
:value="rule.segment.display_name"
|
||||
@input="updateRule(rule.rule_id, { segment: { display_name: ($event.target as HTMLInputElement).value } })"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
提取方式
|
||||
<select
|
||||
:disabled="readonly"
|
||||
:value="extractionMode(rule)"
|
||||
@change="changeExtractionMode(rule, ($event.target as HTMLSelectElement).value as ExtractionMode)"
|
||||
>
|
||||
<option value="select_line">按行号 (position)</option>
|
||||
<option value="extract_prefix">按前缀标签 (prefix)</option>
|
||||
<option value="regex_capture">按正则捕获 (regex)</option>
|
||||
</select>
|
||||
</label>
|
||||
<label v-if="extractionMode(rule) === 'select_line'">
|
||||
行号
|
||||
<input
|
||||
type="number"
|
||||
min="1"
|
||||
:disabled="readonly"
|
||||
:value="extractionStage(rule).line_index ?? (rule.order ?? 1)"
|
||||
@input="updateExtraction(rule, { line_index: Number(($event.target as HTMLInputElement).value) || 1 })"
|
||||
/>
|
||||
</label>
|
||||
<template v-if="extractionMode(rule) === 'extract_prefix'">
|
||||
<label>
|
||||
前缀
|
||||
<input
|
||||
:disabled="readonly"
|
||||
:value="extractionStage(rule).value || ''"
|
||||
@input="updateExtraction(rule, { value: ($event.target as HTMLInputElement).value })"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
分隔符
|
||||
<input
|
||||
:disabled="readonly"
|
||||
:value="separatorsToString(extractionStage(rule).separators)"
|
||||
@input="updateExtraction(rule, { separators: parseSeparators(($event.target as HTMLInputElement).value) })"
|
||||
/>
|
||||
</label>
|
||||
</template>
|
||||
<template v-if="extractionMode(rule) === 'regex_capture'">
|
||||
<label>
|
||||
正则
|
||||
<input
|
||||
:disabled="readonly"
|
||||
:value="extractionStage(rule).pattern || ''"
|
||||
@input="updateExtraction(rule, { pattern: ($event.target as HTMLInputElement).value })"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
捕获组
|
||||
<input
|
||||
type="number"
|
||||
min="0"
|
||||
:disabled="readonly"
|
||||
:value="extractionStage(rule).capture_group ?? 1"
|
||||
@input="updateExtraction(rule, { capture_group: Number(($event.target as HTMLInputElement).value) || 0 })"
|
||||
/>
|
||||
</label>
|
||||
</template>
|
||||
<div v-if="splitAdvancedRules.has(rule.rule_id)" class="vc-map__split-rule-advanced">
|
||||
<label>
|
||||
handling
|
||||
<select
|
||||
:disabled="readonly"
|
||||
:value="rule.segment.handling"
|
||||
@change="updateRule(rule.rule_id, { segment: { handling: ($event.target as HTMLSelectElement).value as 'mapped' | 'evidence_only' } })"
|
||||
>
|
||||
<option value="evidence_only">仅证据 (evidence_only)</option>
|
||||
<option value="mapped">映射字段 (mapped)</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
note
|
||||
<input
|
||||
:disabled="readonly"
|
||||
:value="rule.segment.note || ''"
|
||||
@input="updateRule(rule.rule_id, { segment: { note: ($event.target as HTMLInputElement).value || null } })"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<div class="vc-map__split-inline-preview">
|
||||
<span>识别值:</span>
|
||||
<strong v-if="previewValueFor(rule)">{{ previewValueFor(rule) }}</strong>
|
||||
<span v-else>需预览</span>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.vc-split-editor {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
padding: 10px;
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 8px;
|
||||
background: var(--bg-primary);
|
||||
}
|
||||
.vc-split-editor__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.vc-split-editor__header h4 {
|
||||
margin: 0;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
.vc-split-editor__toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.vc-split-editor__toolbar button {
|
||||
padding: 4px 10px;
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 4px;
|
||||
background: var(--bg-primary);
|
||||
cursor: pointer;
|
||||
font-size: 0.78rem;
|
||||
}
|
||||
.vc-split-editor__toolbar button:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.vc-map__banner {
|
||||
padding: 8px 10px;
|
||||
border-radius: 6px;
|
||||
background: var(--status-warning-bg);
|
||||
color: var(--status-warning-fg);
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
.vc-map__split-status {
|
||||
margin-left: auto;
|
||||
font-size: 0.75rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
.vc-map__split-ruleset {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
padding: 6px;
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 6px;
|
||||
}
|
||||
.vc-map__split-ruleset legend {
|
||||
font-size: 0.8rem;
|
||||
font-weight: 600;
|
||||
padding: 0 4px;
|
||||
}
|
||||
.vc-map__split-normalization {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
.vc-map__checkbox {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
.vc-map__split-preview {
|
||||
padding: 6px;
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 6px;
|
||||
font-size: 0.78rem;
|
||||
background: var(--bg-primary);
|
||||
}
|
||||
.vc-map__split-preview h5 {
|
||||
margin: 0 0 6px 0;
|
||||
font-size: 0.82rem;
|
||||
}
|
||||
.vc-map__table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 0.78rem;
|
||||
}
|
||||
.vc-map__table th,
|
||||
.vc-map__table td {
|
||||
border: 1px solid var(--border-default);
|
||||
padding: 4px 6px;
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
}
|
||||
.vc-map__table th {
|
||||
background: var(--bg-elevated);
|
||||
}
|
||||
.vc-map__diagnostics {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 6px 0 0 0;
|
||||
color: var(--text-danger);
|
||||
}
|
||||
.vc-map__split-rules {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
.vc-map__split-rules > li {
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 6px;
|
||||
background: var(--bg-primary);
|
||||
}
|
||||
.vc-map__split-rule-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 6px;
|
||||
padding: 6px 8px;
|
||||
}
|
||||
.vc-map__split-rule-title {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
padding: 2px 4px;
|
||||
font-size: 0.82rem;
|
||||
}
|
||||
.vc-map__split-rule-title span {
|
||||
font-family: monospace;
|
||||
}
|
||||
.vc-map__split-rule-actions {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
}
|
||||
.vc-map__split-rule-actions button {
|
||||
padding: 2px 8px;
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 4px;
|
||||
background: var(--bg-primary);
|
||||
cursor: pointer;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
.vc-map__split-rule-actions button:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.vc-map__split-rule-actions .danger {
|
||||
color: var(--text-danger);
|
||||
}
|
||||
.vc-map__split-rule-detail {
|
||||
padding: 6px 8px;
|
||||
border-top: 1px dashed var(--border-default);
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
.vc-map__split-rule-detail label {
|
||||
display: grid;
|
||||
grid-template-columns: 100px 1fr;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 0.78rem;
|
||||
}
|
||||
.vc-map__split-rule-detail select,
|
||||
.vc-map__split-rule-detail input,
|
||||
.vc-map__split-ruleset select,
|
||||
.vc-map__split-ruleset input {
|
||||
padding: 4px 6px;
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 4px;
|
||||
font-size: 0.78rem;
|
||||
}
|
||||
.vc-map__split-rule-advanced {
|
||||
grid-column: 1 / -1;
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
padding: 6px;
|
||||
border: 1px dashed var(--border-default);
|
||||
border-radius: 4px;
|
||||
background: var(--bg-elevated);
|
||||
}
|
||||
.vc-map__split-inline-preview {
|
||||
grid-column: 1 / -1;
|
||||
font-size: 0.78rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
.danger { color: var(--text-danger); }
|
||||
</style>
|
||||
@@ -29,6 +29,7 @@ export type ShippingConfigSubModuleId =
|
||||
| 'order_extraction_runs'
|
||||
| 'shipping_audit'
|
||||
| 'process_gates'
|
||||
| 'legacy_stp_jobs'
|
||||
| 'inventory_fields'
|
||||
| 'connections'
|
||||
| 'inventory_sites'
|
||||
|
||||
@@ -0,0 +1,365 @@
|
||||
/**
|
||||
* features/admin/types/shipping-order-document-profile.vc.types.ts
|
||||
* 用途:Vendor Comments(普通 PDF 物理区域 + 三来源合并)阶段 2/3 前端契约类型定义。
|
||||
* 不修改既有 shipping-order-document-profile.types.ts(单文件不超 1000 行红线)。
|
||||
* 依赖:BaseSplit* 对齐 field_split_core.py;NamedRegion / FieldSourceMapping 严格对齐
|
||||
* profile_vendor_comments_contract.py;format_policy 对齐 reservation_format_policy_service.py。
|
||||
* 逻辑:后端决定 UI —— 所有稳定诊断码、合并决议枚举、冲突分组键、回 Draft 标志位
|
||||
* 全部通过后端 API 返回,前端不得自行 if/else 推导业务状态。
|
||||
*/
|
||||
|
||||
import type { OrderProfileRelativeRegion } from './shipping-order-document-profile.types';
|
||||
|
||||
// =========================================================================
|
||||
// Section A: named_regions 契约(Q14)——Profile 顶层命名区域
|
||||
// =========================================================================
|
||||
|
||||
export type VCNamedRegionPageScope =
|
||||
| 'first_page'
|
||||
| 'last_page'
|
||||
| 'all_pages'
|
||||
| 'exact_page';
|
||||
|
||||
export type VCNamedRegionSelectionMode =
|
||||
| 'fixed_region'
|
||||
| 'auto_take_last_qualified';
|
||||
|
||||
export interface VCNamedRegion {
|
||||
region_id: string;
|
||||
label: string;
|
||||
region: OrderProfileRelativeRegion;
|
||||
page_scope: VCNamedRegionPageScope;
|
||||
page_no?: number | null;
|
||||
selection_mode: VCNamedRegionSelectionMode;
|
||||
}
|
||||
|
||||
export type VCNamedRegionsMap = Record<string, VCNamedRegion>;
|
||||
|
||||
// =========================================================================
|
||||
// Section B: Reservation format_policy 契约(Q15)——Profile 级校验策略
|
||||
// =========================================================================
|
||||
|
||||
export type VCFormatPolicyMode =
|
||||
| 'inherit_global'
|
||||
| 'numeric_5_or_10'
|
||||
| 'custom_safe_regex';
|
||||
|
||||
export interface VCReservationFormatPolicy {
|
||||
mode: VCFormatPolicyMode;
|
||||
pattern?: string | null;
|
||||
/** custom_safe_regex 发布前必须过 Pydantic 的捕获组限制门禁 */
|
||||
max_capture_groups: number;
|
||||
timeout_ms: number;
|
||||
case_sensitive: boolean;
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// Section C: Base Split Core(共享引擎)契约——对齐 field_split_core.py
|
||||
// 前端类型必须完全复用 XfaSplit*;为避免引入 XFA 专属 path_id 歧义,
|
||||
// 这里新建轻量别名。未来与 XfaSplit 统一后移除别名。
|
||||
// =========================================================================
|
||||
|
||||
export type VCSplitMatcherType = 'prefix' | 'regex' | 'position';
|
||||
export type VCSplitHandling = 'mapped' | 'evidence_only';
|
||||
|
||||
export interface VCSplitRelationCaptureDef {
|
||||
type: 'line_reference' | string;
|
||||
capture_group: number;
|
||||
labels?: string[] | null;
|
||||
}
|
||||
|
||||
export interface VCSplitMatcher {
|
||||
type: VCSplitMatcherType;
|
||||
line_index?: number | null;
|
||||
value?: string | null;
|
||||
separators?: string[];
|
||||
case_sensitive?: boolean;
|
||||
pattern?: string | null;
|
||||
capture_group?: number | null;
|
||||
relation_capture?: VCSplitRelationCaptureDef | null;
|
||||
}
|
||||
|
||||
export interface VCSplitSegment {
|
||||
segment_id: string;
|
||||
segment_code: string;
|
||||
display_name: string;
|
||||
handling: VCSplitHandling;
|
||||
target_field_id?: string | null;
|
||||
target_field_code?: string | null;
|
||||
note?: string | null;
|
||||
}
|
||||
|
||||
export interface VCSplitRule {
|
||||
rule_id: string;
|
||||
matcher?: VCSplitMatcher | null;
|
||||
segment: VCSplitSegment;
|
||||
order: number;
|
||||
}
|
||||
|
||||
export interface VCSplitNormalization {
|
||||
trim?: boolean;
|
||||
remove_empty_lines?: boolean;
|
||||
line_breaks?: string[];
|
||||
}
|
||||
|
||||
export interface VCSplitRuleSet {
|
||||
rule_set_id: string;
|
||||
rule_version: number;
|
||||
normalization?: VCSplitNormalization;
|
||||
rules: VCSplitRule[];
|
||||
unmatched_line_policy?: 'evidence_only' | 'needs_review';
|
||||
duplicate_match_policy?: 'needs_review';
|
||||
same_field_multiple_segment_policy?: 'needs_review';
|
||||
source?: 'system_suggestion' | 'user' | 'imported';
|
||||
status?: 'draft' | 'confirmed' | 'published';
|
||||
requires_confirmation?: boolean;
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// Section D: field_source_mappings 契约(Q9/Q18)——三来源字段来源映射
|
||||
// =========================================================================
|
||||
|
||||
export type VCRelationPolicy =
|
||||
| 'no_relation'
|
||||
| 'bind_target_line'
|
||||
| 'annotation_only';
|
||||
|
||||
export type VCMissingRelationPolicy =
|
||||
| 'default_all_lines'
|
||||
| 'default_header_only'
|
||||
| 'fallback_single_line_when_no_reference';
|
||||
|
||||
export type VCLineReferenceBasis =
|
||||
| 'explicit_line_column'
|
||||
| 'profile_business_line_no'
|
||||
| 'classified_logical_line_no';
|
||||
|
||||
export interface VCProfileFieldSourceMapping {
|
||||
mapping_id: string;
|
||||
target_scope: 'header' | 'line';
|
||||
target_field_code: string;
|
||||
target_field_id: string;
|
||||
|
||||
header_source_enabled: boolean;
|
||||
header_source_ref?: string | null;
|
||||
header_normalizer_key?: string | null;
|
||||
|
||||
table_source_enabled: boolean;
|
||||
table_column_code?: string | null;
|
||||
|
||||
vendor_comments_enabled: boolean;
|
||||
vendor_comments_region_ref?: string | null;
|
||||
vendor_comments_split_rule_set?: VCSplitRuleSet | null;
|
||||
|
||||
relation_policy: VCRelationPolicy;
|
||||
missing_relation_policy: VCMissingRelationPolicy;
|
||||
line_reference_basis: VCLineReferenceBasis;
|
||||
|
||||
fill_missing_from_other_sources: boolean;
|
||||
format_policy: VCReservationFormatPolicy;
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// Section E: 三来源候选 + 合并结果(SourceMergeService)——后端决定 UI
|
||||
// 后端返回结构化决议,前端只负责渲染按钮/高亮,不推导状态。
|
||||
// =========================================================================
|
||||
|
||||
export type VCFieldSourceKind =
|
||||
| 'header_region'
|
||||
| 'table_column'
|
||||
| 'vendor_comments';
|
||||
|
||||
export type VCMergeResolution =
|
||||
| 'same_value_merged'
|
||||
| 'fill_missing'
|
||||
| 'needs_review'
|
||||
| 'no_value'
|
||||
| 'single_source_direct'
|
||||
| 'annotation_only_dropped';
|
||||
|
||||
export type VCObservationDecisionStatus =
|
||||
| 'accepted'
|
||||
| 'needs_review'
|
||||
| 'blocked'
|
||||
| 'missing';
|
||||
|
||||
export interface VCSourceObservationSnapshot {
|
||||
source: VCFieldSourceKind;
|
||||
value: string;
|
||||
normalized_value: string;
|
||||
evidence_ref: string | null;
|
||||
evidence_quote: string | null;
|
||||
line_no_in_source: number | null;
|
||||
format_valid: boolean | null;
|
||||
format_reason_code: string | null;
|
||||
extra: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface VCMergedObservationCandidate {
|
||||
target_scope: 'header' | 'line';
|
||||
target_field_code: string;
|
||||
target_field_id: string;
|
||||
effective_line_no: number | null;
|
||||
accepted_value: string | null;
|
||||
decision_status: VCObservationDecisionStatus;
|
||||
resolution: VCMergeResolution;
|
||||
source_observations: VCSourceObservationSnapshot[];
|
||||
conflicts: Array<Record<string, unknown>>;
|
||||
evidence_quote: string | null;
|
||||
evidence_ref: string | null;
|
||||
evidence_metadata: {
|
||||
source_observations: VCSourceObservationSnapshot[];
|
||||
resolution: VCMergeResolution;
|
||||
accepted_value: string | null;
|
||||
conflicts: Array<Record<string, unknown>>;
|
||||
resolution_meta: Record<string, unknown>;
|
||||
primary?: {
|
||||
source: VCFieldSourceKind;
|
||||
evidence_ref: string | null;
|
||||
line_no: number | null;
|
||||
} | null;
|
||||
};
|
||||
source_type: string;
|
||||
extractor: string;
|
||||
/** 前端只读门禁:是否允许作为有效 Observation 落库 */
|
||||
should_persist_observation: boolean;
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// Section F: 关系投影诊断码(Q2/Q12)——invalid_line_reference 独立审计链
|
||||
// =========================================================================
|
||||
|
||||
export type VCRelationProjectionResolution =
|
||||
| 'bound_to_line'
|
||||
| 'annotation_only'
|
||||
| 'default_all_lines'
|
||||
| 'default_header_only'
|
||||
| 'invalid_line_reference'
|
||||
| 'conflict_unresolved';
|
||||
|
||||
export interface VCRelationProjectionResult {
|
||||
line_reference_basis: VCLineReferenceBasis;
|
||||
resolution: VCRelationProjectionResolution;
|
||||
resolved_logical_line_no: number | null;
|
||||
annotation_reason: string | null;
|
||||
invalid_reference_raw_value: string | null;
|
||||
invalid_reference_line_no: number | null;
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// Section G: 区域预览诊断(CoordinateRegionSourceAdapter)
|
||||
// =========================================================================
|
||||
|
||||
export type VCCoordinateRegionStatus = 'available' | 'unavailable';
|
||||
|
||||
export interface VCCoordinateRegionEvidenceToken {
|
||||
page_no: number;
|
||||
text: string;
|
||||
x0: number;
|
||||
y0: number;
|
||||
x1: number;
|
||||
y1: number;
|
||||
}
|
||||
|
||||
export interface VCCoordinateRegionSourceResult {
|
||||
region_id: string;
|
||||
label: string;
|
||||
status: VCCoordinateRegionStatus;
|
||||
page_no: number | null;
|
||||
raw_text: string;
|
||||
lines: string[];
|
||||
evidence_tokens: VCCoordinateRegionEvidenceToken[];
|
||||
diagnostic_code: string | null;
|
||||
diagnostic_message: string | null;
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// Section H: Profile 变更回 Draft 判定(前端门禁标志位,真实判定在后端)
|
||||
// 前端只展示警告,不阻断保存(最终拦截在 service 层)。
|
||||
// =========================================================================
|
||||
|
||||
export interface VCProfileDraftTrigger {
|
||||
named_regions_changed: boolean;
|
||||
field_source_mappings_changed: boolean;
|
||||
requires_draft_reset: boolean;
|
||||
/** 前端展示给管理员的中文/英文说明;实际文案通过 t() 取 i18n */
|
||||
reasons: Array<{
|
||||
kind:
|
||||
| 'named_region_added'
|
||||
| 'named_region_removed'
|
||||
| 'named_region_geometry'
|
||||
| 'named_region_scope'
|
||||
| 'field_source_mapping_added'
|
||||
| 'field_source_mapping_removed'
|
||||
| 'field_source_mapping_split_rule_changed'
|
||||
| 'field_source_mapping_format_policy_changed';
|
||||
region_id?: string;
|
||||
mapping_id?: string;
|
||||
}>;
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// Section I: definition_json 顶层 VC 扩展(OrderCoordinateProfileDefinition
|
||||
// 和 OrderXfaDatasetProfileDefinition 都通过交叉引用)。
|
||||
// 不修改既有 definition 接口,单独 export 用于 patch 合并。
|
||||
// =========================================================================
|
||||
|
||||
export interface VCProfileDefinitionExtensions {
|
||||
named_regions?: VCNamedRegionsMap | null;
|
||||
field_source_mappings?: VCProfileFieldSourceMapping[] | null;
|
||||
}
|
||||
|
||||
export type VCProfileDefinitionWithExtensions =
|
||||
& { named_regions?: VCNamedRegionsMap | null; field_source_mappings?: VCProfileFieldSourceMapping[] | null }
|
||||
& Record<string, unknown>;
|
||||
|
||||
// =========================================================================
|
||||
// Section J: 合成预览 DTO(后端返回,前端只读)
|
||||
// =========================================================================
|
||||
|
||||
export interface VCSplitEngineSegmentPreview {
|
||||
segment_id: string;
|
||||
segment_code: string;
|
||||
display_name: string;
|
||||
line_no?: number | null;
|
||||
line_end_no?: number | null;
|
||||
raw_text: string;
|
||||
normalized_text: string;
|
||||
handling: VCSplitHandling;
|
||||
target_field_id?: string | null;
|
||||
target_field_code?: string | null;
|
||||
rule_id: string;
|
||||
status: string;
|
||||
matcher_type: string;
|
||||
captured_relation?: {
|
||||
type: string;
|
||||
line_no: number | null;
|
||||
raw_text: string | null;
|
||||
} | null;
|
||||
}
|
||||
|
||||
export interface VCSplitEnginePreviewResult {
|
||||
status: 'parsed' | 'needs_review' | 'unavailable';
|
||||
rule_set_id: string | null;
|
||||
rule_version: number | null;
|
||||
mapped_fields: Record<string, string>;
|
||||
segments: VCSplitEngineSegmentPreview[];
|
||||
evidence_only_segments: VCSplitEngineSegmentPreview[];
|
||||
diagnostics: Array<{
|
||||
code: string;
|
||||
message: string;
|
||||
line_no?: number | null;
|
||||
field_code?: string | null;
|
||||
rule_ids?: string[];
|
||||
}>;
|
||||
}
|
||||
|
||||
export interface VCMergePreviewResponse {
|
||||
document_id: number;
|
||||
region_id: string;
|
||||
mapping_id: string;
|
||||
region_result: VCCoordinateRegionSourceResult | null;
|
||||
split_preview: VCSplitEnginePreviewResult | null;
|
||||
relation_projection: VCRelationProjectionResult | null;
|
||||
merged_observation: VCMergedObservationCandidate | null;
|
||||
}
|
||||
@@ -33,9 +33,11 @@ import type {
|
||||
OrderExtractionSubmissionRequest,
|
||||
OrderExtractionSubmissionResponse,
|
||||
ConversationProcessingProjection,
|
||||
ConversationProcessingAppendBlockReason,
|
||||
ShippingOrderReviewAuditTimelinePage,
|
||||
ShippingTaskAuditTimelinePage,
|
||||
ShippingOrderReviewCase,
|
||||
ShippingOrderReviewCaseSnapshot,
|
||||
ShippingOrderReviewCustomerResolution,
|
||||
ShippingOrderReviewDuplicate,
|
||||
ShippingOrderReviewFieldConflict,
|
||||
@@ -55,6 +57,7 @@ import type {
|
||||
ShippingOrderReviewLlmSuggestionResponse,
|
||||
ShippingOrderReviewReparseResponse,
|
||||
ShippingOrderReviewRun,
|
||||
ShippingTaskInventoryCandidatesResponse,
|
||||
ShippingTaskUiState,
|
||||
} from '../types/shipping.api.types';
|
||||
|
||||
@@ -70,6 +73,8 @@ type ShippingApiStatusPayload = {
|
||||
/** 批次重试等接口返回的跳过任务数 */
|
||||
skipped?: number;
|
||||
batch_no?: string;
|
||||
/** 后端返回的语义化原因码(对齐 noop / needs_human / already_running 等状态分支) */
|
||||
reason_code?: ConversationProcessingAppendBlockReason | string | null;
|
||||
};
|
||||
|
||||
export type ShippingChatAgentOption = {
|
||||
@@ -379,7 +384,7 @@ export const getWorkspaceShippingOrderReviewRun = (runNo: string) =>
|
||||
|
||||
/** 获取一份 PDF 的冻结 Schema 与只读机器/草稿投影。 */
|
||||
export const getWorkspaceShippingOrderReviewCase = (caseNo: string) =>
|
||||
requestJson<ShippingOrderReviewCase>(
|
||||
requestJson<ShippingOrderReviewCaseSnapshot>(
|
||||
`/api/workspace/shipping-notice/order-review-cases/${encodeURIComponent(caseNo)}`,
|
||||
);
|
||||
|
||||
@@ -491,6 +496,22 @@ export const putWorkspaceShippingOrderReviewInventoryCandidates = (
|
||||
{ method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) },
|
||||
);
|
||||
|
||||
/**
|
||||
* 读取正式 Task 当前库存候选版本与历史摘要。
|
||||
*/
|
||||
export const getWorkspaceTaskInventoryCandidates = (
|
||||
taskNo: string,
|
||||
options?: { version?: 'current' | number; includeHistory?: boolean },
|
||||
) => {
|
||||
const params = new URLSearchParams();
|
||||
if (options?.version != null) params.set('version', String(options.version));
|
||||
if (options?.includeHistory != null) params.set('include_history', String(options.includeHistory));
|
||||
const query = params.toString();
|
||||
return requestJson<ShippingTaskInventoryCandidatesResponse>(
|
||||
`/api/workspace/shipping-notice/tasks/${encodeURIComponent(taskNo)}/inventory-candidates${query ? `?${query}` : ''}`,
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* 重新匹配整单或指定明细的库存路由规则。
|
||||
* 核心逻辑:携带 expected_draft_version 与幂等键;可选 line_key 限定单行。
|
||||
|
||||
+257
-62
@@ -1,43 +1,71 @@
|
||||
<!--
|
||||
features/chat/components/shipping-review/ReviewCurrentProcessingCard.vue
|
||||
用途:正式 OT 创建后的右侧「当前处理状态」主卡(阶段 + 自动推进合并)。
|
||||
依赖:vue-i18n、ShippingOrderReviewAutomation、resolveShippingProcessingStageLabel。
|
||||
逻辑:优先消费 Progress 同源的 stageCode + stageLabelKey;Case current_stage 仅降级;
|
||||
禁止把阶段码直接当用户文案;Job 明细与 task_missing 诊断仅管理员区;
|
||||
由 ShippingOrderReviewView 在 has_formal_ot / task_missing 时置顶渲染。
|
||||
用途:发货通知工作台右侧唯一的「当前任务」主卡(阶段 + 用户状态 + 阻断 + 动作)。
|
||||
依赖:vue-i18n、ShippingProcessingBlockingReason/PrimaryAction 类型、resolveShippingProcessingStageLabel。
|
||||
逻辑:主卡内部 section = 「当前阶段/状态/正式OT → 下一步 → 动作区」;
|
||||
状态文案严格绑定 user_status;blocking_reason 只作下一步问题说明;按钮显隐由后端 retryable + primary_action.parameters 决定;
|
||||
由 ShippingOrderReviewView 在 mountCurrentProcessingCard 时挂载。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { RefreshCw } from 'lucide-vue-next';
|
||||
import { RefreshCw, Crosshair } from 'lucide-vue-next';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import type { ShippingOrderReviewAutomation } from '@/features/chat/types/shipping.api.types';
|
||||
import type {
|
||||
ShippingProcessingBlockingReason,
|
||||
ShippingProcessingPrimaryAction,
|
||||
} from '@/features/chat/types/shipping.api.types';
|
||||
import { resolveShippingProcessingStageLabel } from '@/features/chat/shipping/shippingProcessingLabels';
|
||||
|
||||
const props = defineProps<{
|
||||
stageCode?: string | null;
|
||||
stageLabelKey?: string | null;
|
||||
stageInconsistent?: boolean;
|
||||
|
||||
hasFormalOt?: boolean;
|
||||
shippingNoticeNo?: string | null;
|
||||
|
||||
userStatus?:
|
||||
| 'running'
|
||||
| 'waiting_human'
|
||||
| 'retryable'
|
||||
| 'failed'
|
||||
| 'completed'
|
||||
| 'cancelled'
|
||||
| null;
|
||||
retryable?: boolean;
|
||||
blockingReason?: ShippingProcessingBlockingReason | null;
|
||||
primaryAction?: ShippingProcessingPrimaryAction | null;
|
||||
|
||||
taskMissing?: boolean;
|
||||
taskNo?: string | null;
|
||||
confirmedTaskId?: number | null;
|
||||
showAdminDiagnosis?: boolean;
|
||||
automation?: ShippingOrderReviewAutomation | null;
|
||||
showRetry?: boolean;
|
||||
retrying?: boolean;
|
||||
locating?: boolean;
|
||||
/** 题7A:自动次数已耗尽但允许人工继续的源;不为空时按钮语义提示「人工继续」+ tooltip 列名。 */
|
||||
retryExhaustedSources?: string[] | null;
|
||||
/** 仅 UI 展示的 running 文案(如 inventory_preparation 正在跑时主卡按钮 loading 附加信息)。 */
|
||||
automation?: {
|
||||
status?: string | null;
|
||||
message?: string | null;
|
||||
} | null;
|
||||
showRetry?: boolean;
|
||||
loading?: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
retry: [];
|
||||
locate: [lineKey?: string | null, fieldId?: string | null];
|
||||
action: [code: string, parameters?: Record<string, unknown>];
|
||||
}>();
|
||||
|
||||
const { t, te } = useI18n();
|
||||
|
||||
/**
|
||||
* 当前处理阶段展示文案:消费 label_key,禁止直接展示阶段码。
|
||||
* 当前阶段展示文案:优先消费 stage_label_key,禁止直接展示 stage 码。
|
||||
*/
|
||||
const stageLabel = computed(() => {
|
||||
if (props.taskMissing) {
|
||||
return t('chat.shippingOrderReview.currentProcessing.taskMissing');
|
||||
if (props.loading) {
|
||||
return t('chat.shippingOrderReview.caseSwitchLoading');
|
||||
}
|
||||
if (props.stageInconsistent) {
|
||||
return t('chat.shippingOrderReview.currentProcessing.stateInconsistent');
|
||||
@@ -51,68 +79,196 @@ const stageLabel = computed(() => {
|
||||
});
|
||||
|
||||
/**
|
||||
* 自动推进用户态文案(消费 phase,禁止前端猜建单/推进)。
|
||||
* 「状态」行用户态文案:严格绑定 user_status,不再由前端推断。
|
||||
*/
|
||||
const statusLabel = computed(() => {
|
||||
const automation = props.automation;
|
||||
const status = String(automation?.status || '').trim().toLowerCase();
|
||||
const phase = String(automation?.phase || '').trim();
|
||||
if (props.loading) {
|
||||
return t('chat.shippingOrderReview.currentTask.statusRunning');
|
||||
}
|
||||
const s = String(props.userStatus || '').trim() as ReviewCurrentUserStatus | '';
|
||||
const map: Record<ReviewCurrentUserStatus, string> = {
|
||||
running: t('chat.shippingOrderReview.currentTask.statusRunning'),
|
||||
waiting_human: t('chat.shippingOrderReview.currentTask.statusWaitingHuman'),
|
||||
retryable: t('chat.shippingOrderReview.currentTask.statusRetryable'),
|
||||
failed: t('chat.shippingOrderReview.currentTask.statusFailed'),
|
||||
completed: t('chat.shippingOrderReview.currentTask.statusCompleted'),
|
||||
cancelled: t('chat.shippingOrderReview.currentTask.statusCancelled'),
|
||||
};
|
||||
if (props.taskMissing) {
|
||||
return t('chat.shippingOrderReview.currentProcessing.statusTaskMissing');
|
||||
return t('chat.shippingOrderReview.currentProcessing.taskMissing');
|
||||
}
|
||||
if (status === 'waiting_to_start') {
|
||||
return phase === 'pre_ot_stp'
|
||||
? t('chat.shippingOrderReview.automation.waitingPreOt')
|
||||
: t('chat.shippingOrderReview.automation.waitingPostOt');
|
||||
}
|
||||
if (status === 'queued' || status === 'running') {
|
||||
return t('chat.shippingOrderReview.currentProcessing.statusRunning');
|
||||
}
|
||||
if (status === 'failed' || status === 'manual_fallback') {
|
||||
return t('chat.shippingOrderReview.currentProcessing.statusFailedRetryable');
|
||||
}
|
||||
if (status === 'completed') {
|
||||
return t('chat.shippingOrderReview.currentProcessing.statusCompleted');
|
||||
}
|
||||
return t('chat.shippingOrderReview.currentProcessing.statusIdle');
|
||||
if (!s) return t('chat.shippingOrderReview.currentProcessing.statusIdle');
|
||||
return map[s] ?? t('chat.shippingOrderReview.currentProcessing.statusIdle');
|
||||
});
|
||||
|
||||
/**
|
||||
* 主卡重试:对象级;建单前无 task_no 也可重试 STP;正式 OT 需 task_no。
|
||||
* 下一步(「下一步」section 的问题/说明文案):优先展示 blocking_reason,否则按 user_status 给系统态文案。
|
||||
*/
|
||||
const canShowRetry = computed(() => {
|
||||
if (!props.showRetry || props.taskMissing) return false;
|
||||
if (String(props.taskNo || '').trim()) return true;
|
||||
// 建单前 STP:无 OT 号也可重试。
|
||||
return String(props.automation?.phase || '').trim() !== 'post_ot_progress';
|
||||
const nextStepText = computed(() => {
|
||||
if (props.loading) {
|
||||
return String(props.automation?.message || '').trim() || t('chat.shippingOrderReview.currentTask.nextStepRunning');
|
||||
}
|
||||
// 1) blocking_reason → 用后端给的 i18n_key 渲染具体阻断
|
||||
const br = props.blockingReason;
|
||||
if (br) {
|
||||
const i18nKey = String(br.i18nKey || '').trim();
|
||||
if (i18nKey && te(i18nKey)) {
|
||||
return t(i18nKey);
|
||||
}
|
||||
// i18n 键缺失时回落为 code(不裸露给普通用户,最终 QA 期间应全部补齐)
|
||||
return String(br.code || '').trim() || t('chat.shippingOrderReview.currentTask.nextStepUnknown');
|
||||
}
|
||||
// 2) 无阻断时,按 user_status 给系统说明文案
|
||||
const s = String(props.userStatus || '').trim() as ReviewCurrentUserStatus | '';
|
||||
if (s === 'running') {
|
||||
return t('chat.shippingOrderReview.currentTask.nextStepRunning');
|
||||
}
|
||||
if (s === 'completed') {
|
||||
return t('chat.shippingOrderReview.currentTask.nextStepCompleted');
|
||||
}
|
||||
if (s === 'cancelled') {
|
||||
return t('chat.shippingOrderReview.currentTask.nextStepCancelled');
|
||||
}
|
||||
if (s === 'failed' && !props.retryable) {
|
||||
return t('chat.shippingOrderReview.currentTask.nextStepFailedNoRetry');
|
||||
}
|
||||
if (s === 'waiting_human') {
|
||||
return t('chat.shippingOrderReview.currentTask.nextStepWaitingHumanDefault');
|
||||
}
|
||||
if (s === 'retryable') {
|
||||
return t('chat.shippingOrderReview.currentTask.nextStepRetryableDefault');
|
||||
}
|
||||
return t('chat.shippingOrderReview.currentTask.nextStepUnknown');
|
||||
});
|
||||
|
||||
/**
|
||||
* 业务动作按钮:后端确认 retryable=true → 主按钮为「重试」;
|
||||
* 否则若 primary_action.code 非 retry → 用 primary_action.code + i18n_key 渲染对应人工动作(进入复核/确认客户等)。
|
||||
*/
|
||||
const showBusinessAction = computed(() => {
|
||||
if (props.loading) return false;
|
||||
if (props.taskMissing) return false;
|
||||
if (props.retryable) return true;
|
||||
const code = String(props.primaryAction?.code || '').trim();
|
||||
if (!code) return false;
|
||||
// retry 仅当 retryable=true 时展示(避免按钮闪烁矛盾)
|
||||
if (code === 'retry') return false;
|
||||
return true;
|
||||
});
|
||||
|
||||
const businessActionLabel = computed(() => {
|
||||
if (props.retryable) {
|
||||
if ((props.retryExhaustedSources || []).length > 0) {
|
||||
return t('chat.shippingOrderReview.currentTask.actionRetryWithExhausted');
|
||||
}
|
||||
return t('chat.shippingOrderReview.currentTask.actionRetry');
|
||||
}
|
||||
const pa = props.primaryAction;
|
||||
if (!pa) return '';
|
||||
const i18nKey = String(pa.i18nKey || '').trim();
|
||||
if (i18nKey && te(i18nKey)) {
|
||||
return t(i18nKey);
|
||||
}
|
||||
// fallback 到 legacy chat.shippingProcessing.action
|
||||
const legacyKey = `chat.shippingProcessing.action.${pa.code}`;
|
||||
if (te(legacyKey)) {
|
||||
return t(legacyKey);
|
||||
}
|
||||
return pa.code;
|
||||
});
|
||||
|
||||
/** 题7A:按钮 tooltip(exhausted_sources 列表与文案)。 */
|
||||
const businessActionTitle = computed(() => {
|
||||
const exhausted = Array.isArray(props.retryExhaustedSources) ? props.retryExhaustedSources.filter(Boolean) : [];
|
||||
if (exhausted.length > 0) {
|
||||
return t('chat.shippingOrderReview.currentTask.actionRetryExhaustedTooltip', {
|
||||
sources: exhausted.join(', '),
|
||||
});
|
||||
}
|
||||
const retryingFlag = Boolean(props.retrying);
|
||||
if (retryingFlag) {
|
||||
return t('chat.shippingOrderReview.currentTask.actionRetryRunningTooltip');
|
||||
}
|
||||
return '';
|
||||
});
|
||||
|
||||
const actionIsRetry = computed(() => Boolean(props.retryable) || String(props.primaryAction?.code || '') === 'retry');
|
||||
|
||||
function handleBusinessActionClick() {
|
||||
if (actionIsRetry.value) {
|
||||
emit('retry');
|
||||
return;
|
||||
}
|
||||
emit('action', String(props.primaryAction?.code || ''), props.primaryAction?.parameters ?? {});
|
||||
}
|
||||
|
||||
/**
|
||||
* 辅助导航「定位明细」:仅当后端在 primary_action.parameters 里提供 line_key 或 field_id 才显示。
|
||||
*/
|
||||
const showLocateAction = computed(() => {
|
||||
if (props.loading) return false;
|
||||
if (props.taskMissing) return false;
|
||||
const params = (props.primaryAction?.parameters ?? {}) as Record<string, unknown>;
|
||||
const hasLineKey = typeof params.line_key === 'string' && params.line_key.length > 0;
|
||||
const hasFieldId = typeof params.field_id === 'string' && params.field_id.length > 0;
|
||||
return hasLineKey || hasFieldId;
|
||||
});
|
||||
|
||||
const locateTargetLineKey = computed(() => {
|
||||
const params = (props.primaryAction?.parameters ?? {}) as Record<string, unknown>;
|
||||
return typeof params.line_key === 'string' ? params.line_key : null;
|
||||
});
|
||||
|
||||
const locateTargetFieldId = computed(() => {
|
||||
const params = (props.primaryAction?.parameters ?? {}) as Record<string, unknown>;
|
||||
return typeof params.field_id === 'string' ? params.field_id : null;
|
||||
});
|
||||
|
||||
function handleLocateClick() {
|
||||
emit('locate', locateTargetLineKey.value, locateTargetFieldId.value);
|
||||
}
|
||||
|
||||
type ReviewCurrentUserStatus =
|
||||
| 'running'
|
||||
| 'waiting_human'
|
||||
| 'retryable'
|
||||
| 'failed'
|
||||
| 'completed'
|
||||
| 'cancelled';
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section
|
||||
class="rounded-xl border border-sky-200 bg-sky-50/80 p-3 shadow-sm dark:border-sky-900 dark:bg-sky-950/30"
|
||||
data-testid="review-current-processing-card"
|
||||
:data-user-status="String(userStatus || '')"
|
||||
:data-task-missing="taskMissing ? '1' : '0'"
|
||||
:data-automation-status="String(automation?.status || '')"
|
||||
:data-automation-phase="String(automation?.phase || '')"
|
||||
:data-loading="loading ? '1' : '0'"
|
||||
>
|
||||
<header class="mb-2">
|
||||
<header class="mb-3">
|
||||
<h2 class="text-sm font-semibold text-sky-950 dark:text-sky-100">
|
||||
{{ t('chat.shippingOrderReview.currentProcessing.title') }}
|
||||
{{ t('chat.shippingOrderReview.currentTask.title') }}
|
||||
</h2>
|
||||
<p class="mt-0.5 text-xs text-sky-900/80 dark:text-sky-200/80">
|
||||
{{ stageLabel }}
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<dl class="space-y-1 text-xs text-sky-950 dark:text-sky-100">
|
||||
<div class="flex flex-wrap gap-x-2">
|
||||
<dt class="text-muted">{{ t('chat.shippingOrderReview.currentProcessing.status') }}</dt>
|
||||
<dd data-testid="review-current-processing-status">{{ statusLabel }}</dd>
|
||||
<dt class="text-muted">{{ t('chat.shippingOrderReview.currentTask.labelStage') }}</dt>
|
||||
<dd data-testid="review-current-task-stage" :class="loading ? 'animate-pulse' : ''">{{ stageLabel }}</dd>
|
||||
</div>
|
||||
<div v-if="taskNo" class="flex flex-wrap gap-x-2">
|
||||
<dt class="text-muted">{{ t('chat.shippingOrderReview.currentProcessing.formalOt') }}</dt>
|
||||
<dd class="font-mono" data-testid="review-current-processing-ot">{{ taskNo }}</dd>
|
||||
<div class="flex flex-wrap gap-x-2">
|
||||
<dt class="text-muted">{{ t('chat.shippingOrderReview.currentProcessing.status') }}</dt>
|
||||
<dd data-testid="review-current-task-status" :class="loading ? 'animate-pulse' : ''">{{ statusLabel }}</dd>
|
||||
</div>
|
||||
<div
|
||||
v-if="hasFormalOt && shippingNoticeNo"
|
||||
class="flex flex-wrap gap-x-2"
|
||||
>
|
||||
<dt class="text-muted">{{ t('chat.shippingOrderReview.currentTask.labelFormalSn') }}</dt>
|
||||
<dd
|
||||
class="font-mono"
|
||||
data-testid="review-current-processing-ot"
|
||||
>{{ shippingNoticeNo }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
@@ -130,7 +286,10 @@ const canShowRetry = computed(() => {
|
||||
data-testid="review-current-processing-admin-diagnosis"
|
||||
>
|
||||
<p class="font-medium">{{ t('chat.shippingOrderReview.currentProcessing.adminDiagnosisTitle') }}</p>
|
||||
<p v-if="confirmedTaskId != null" class="mt-1 font-mono">
|
||||
<p
|
||||
v-if="confirmedTaskId != null"
|
||||
class="mt-1 font-mono"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.currentProcessing.confirmedTaskId', { id: confirmedTaskId }) }}
|
||||
</p>
|
||||
<p class="mt-1">
|
||||
@@ -141,16 +300,52 @@ const canShowRetry = computed(() => {
|
||||
</p>
|
||||
</aside>
|
||||
|
||||
<button
|
||||
v-if="canShowRetry"
|
||||
type="button"
|
||||
class="mt-3 inline-flex items-center gap-1 rounded border border-amber-400 bg-amber-50 px-2.5 py-1.5 text-xs text-amber-950 disabled:opacity-50 dark:border-amber-700 dark:bg-amber-950/40 dark:text-amber-100"
|
||||
data-testid="review-current-processing-retry"
|
||||
:disabled="retrying"
|
||||
@click="emit('retry')"
|
||||
<div
|
||||
class="mt-3 border-t border-sky-200/70 pt-3 dark:border-sky-800/60"
|
||||
data-testid="review-current-task-next-step-section"
|
||||
>
|
||||
<RefreshCw class="h-3.5 w-3.5" />
|
||||
{{ t('chat.shippingOrderReview.autoProgress.retryObject') }}
|
||||
</button>
|
||||
<p class="text-[11px] font-medium uppercase tracking-wide text-sky-900/70 dark:text-sky-200/70">
|
||||
{{ t('chat.shippingOrderReview.currentTask.nextStepTitle') }}
|
||||
</p>
|
||||
<p
|
||||
class="mt-1 text-xs text-sky-950 dark:text-sky-100"
|
||||
data-testid="review-current-task-next-step-text"
|
||||
:class="loading ? 'animate-pulse' : ''"
|
||||
>{{ nextStepText }}</p>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="showBusinessAction || showLocateAction"
|
||||
class="mt-3 flex flex-wrap items-center gap-2"
|
||||
data-testid="review-current-task-actions"
|
||||
>
|
||||
<button
|
||||
v-if="showBusinessAction"
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1 rounded-md bg-sky-700 px-3 py-1.5 text-xs font-medium text-white shadow-sm transition hover:bg-sky-800 disabled:opacity-50 dark:bg-sky-600 dark:hover:bg-sky-500"
|
||||
:data-testid="actionIsRetry ? 'review-current-processing-retry' : 'review-current-task-primary-action'"
|
||||
:disabled="retrying || locating"
|
||||
:title="businessActionTitle"
|
||||
@click="handleBusinessActionClick"
|
||||
>
|
||||
<RefreshCw
|
||||
v-if="actionIsRetry"
|
||||
class="h-3.5 w-3.5"
|
||||
:class="{ 'animate-spin': Boolean(retrying) }"
|
||||
/>
|
||||
{{ businessActionLabel }}
|
||||
</button>
|
||||
<button
|
||||
v-if="showLocateAction"
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1 rounded-md border border-sky-300 bg-white px-2.5 py-1.5 text-xs font-medium text-sky-800 shadow-sm transition hover:bg-sky-50 disabled:opacity-50 dark:border-sky-700 dark:bg-sky-900 dark:text-sky-100 dark:hover:bg-sky-800"
|
||||
data-testid="review-current-task-locate-action"
|
||||
:disabled="locating"
|
||||
@click="handleLocateClick"
|
||||
>
|
||||
<Crosshair class="h-3.5 w-3.5" />
|
||||
{{ t('chat.shippingOrderReview.currentTask.actionLocateLine') }}
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
+1
-1
@@ -57,7 +57,7 @@ describe('ReviewInventoryCandidatesPanel', () => {
|
||||
expect(text).toContain('DSV360_AWSDU');
|
||||
expect(text).toContain('DSV360_AWSSG');
|
||||
expect(text).toContain('ROUTE_HINT_AWSSG');
|
||||
expect(text).toContain('命中规则');
|
||||
expect(text).toContain('匹配规则');
|
||||
expect(text).toContain('库存源未启用');
|
||||
expect(wrapper.find('[data-testid="review-inventory-unavailable-sources"]').text()).toContain('DSV360_AWSSG');
|
||||
expect(
|
||||
|
||||
@@ -56,6 +56,11 @@ const unavailableSuggestions = computed(() =>
|
||||
(props.suggestions || []).filter((item) => String(item.status || '') === 'provider_unavailable'),
|
||||
);
|
||||
|
||||
/** 前门禁失败(未调用 Dify)的记录必须明确展示,错误码指向 i18n errors.json;避免用户误认为 AI 已跑过。 */
|
||||
const gatedFailedSuggestions = computed(() =>
|
||||
(props.suggestions || []).filter((item) => String(item.status || '') === 'gated_failed'),
|
||||
);
|
||||
|
||||
/** 将 Provider 失败码转成可执行的业务提示,不向用户暴露底层地址或异常正文。 */
|
||||
function unavailableMessage(item?: ShippingOrderReviewLlmSuggestion): string {
|
||||
if (String(item?.error_code || '') === 'SHIPPING.REVIEW_LLM_DISABLED') {
|
||||
@@ -64,6 +69,31 @@ function unavailableMessage(item?: ShippingOrderReviewLlmSuggestion): string {
|
||||
return t('chat.shippingOrderReview.llmSuggestion.unavailableProvider');
|
||||
}
|
||||
|
||||
/**
|
||||
* 门禁失败 short 提示(一层标题):用 errors.json 本地化;缺失时给通用提示避免裸 code。
|
||||
* 完全消费后端投影的 item.error_code,前端绝对不推导「为什么失败」。
|
||||
*/
|
||||
function gatedShortMessage(item: ShippingOrderReviewLlmSuggestion): string {
|
||||
const code = String(item.error_code || '');
|
||||
const key = `errors.${code}`;
|
||||
if (code && te(key)) return t(key);
|
||||
return t('chat.shippingOrderReview.llmSuggestion.status.gated_failed');
|
||||
}
|
||||
|
||||
/**
|
||||
* 门禁失败 detail 提示(二层详情):查 errors.json 的 `${code}Detail` 或通用 hint。
|
||||
* 同样不推导原因,纯 i18n 查表。
|
||||
*/
|
||||
function gatedDetailMessage(item: ShippingOrderReviewLlmSuggestion): string | null {
|
||||
const code = String(item.error_code || '');
|
||||
if (!code) return null;
|
||||
const detailKey = `errors.${code}Detail`;
|
||||
if (te(detailKey)) return t(detailKey);
|
||||
const hintKey = `chat.shippingOrderReview.llmSuggestion.gateDetail.${code.replace(/^SHIPPING\./, '')}`;
|
||||
if (te(hintKey)) return t(hintKey);
|
||||
return null;
|
||||
}
|
||||
|
||||
const statusLabel = computed(() => {
|
||||
if (props.suggestionLoading) return t('chat.shippingOrderReview.llmSuggestion.status.pending');
|
||||
const latest = (props.suggestions || [])[0];
|
||||
@@ -218,8 +248,59 @@ function onDecide(payload: { decision: 'accept' | 'modify' | 'reject'; reason: s
|
||||
>
|
||||
{{ unavailableMessage(unavailableSuggestions[0]) }}
|
||||
</div>
|
||||
<ul
|
||||
v-if="gatedFailedSuggestions.length"
|
||||
class="mt-3 space-y-2"
|
||||
data-testid="review-llm-gated-failed-list"
|
||||
>
|
||||
<li
|
||||
v-for="item in gatedFailedSuggestions"
|
||||
:key="item.suggestion_no"
|
||||
class="rounded border border-sky-200 bg-sky-50/60 px-2 py-2 text-xs text-sky-800 dark:border-sky-900 dark:bg-sky-950/30 dark:text-sky-200"
|
||||
role="note"
|
||||
>
|
||||
<div class="flex items-start justify-between gap-2">
|
||||
<div class="min-w-0 flex-1">
|
||||
<div class="font-medium leading-snug">{{ suggestionFieldLabel(item) }}</div>
|
||||
<p class="mt-1 leading-snug">{{ gatedShortMessage(item) }}</p>
|
||||
<p
|
||||
v-if="gatedDetailMessage(item)"
|
||||
class="mt-1 text-[11px] leading-relaxed opacity-80"
|
||||
>
|
||||
{{ gatedDetailMessage(item) }}
|
||||
</p>
|
||||
<p
|
||||
v-if="item.evidence_summary"
|
||||
class="mt-1 flex flex-wrap gap-x-3 gap-y-0.5 text-[11px] opacity-80"
|
||||
>
|
||||
<span v-if="item.evidence_summary.level">
|
||||
{{ t('chat.shippingOrderReview.llmSuggestion.evidenceLevelLabel') }}:{{ evidenceLevelLabel(item.evidence_summary.level) }}
|
||||
</span>
|
||||
<span v-if="item.evidence_summary.auto_upgraded">
|
||||
{{ t('chat.shippingOrderReview.llmSuggestion.autoUpgradedLabel') }}
|
||||
</span>
|
||||
<span v-if="typeof item.evidence_summary.field_count === 'number'">
|
||||
{{ t('chat.shippingOrderReview.llmSuggestion.fieldCountLabel') }}:{{ item.evidence_summary.field_count }}
|
||||
</span>
|
||||
<span v-if="item.evidence_summary.context_truncated">
|
||||
{{ t('chat.shippingOrderReview.llmSuggestion.contextTruncatedLabel') }}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="shrink-0 rounded border border-sky-300 bg-white px-2 py-0.5 text-xs text-sky-700 dark:border-sky-700 dark:bg-slate-900 dark:text-sky-200"
|
||||
:disabled="!canRequest"
|
||||
:aria-label="t('chat.shippingOrderReview.llmSuggestion.request')"
|
||||
@click="emit('requestSuggestion')"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.llmSuggestion.request') }}
|
||||
</button>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<p
|
||||
v-if="!pendingSuggestions.length && !failedSuggestions.length && !unavailableSuggestions.length"
|
||||
v-if="!pendingSuggestions.length && !failedSuggestions.length && !unavailableSuggestions.length && !gatedFailedSuggestions.length"
|
||||
class="mt-3 text-xs text-slate-500"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.llmSuggestion.empty') }}
|
||||
|
||||
+10
@@ -34,10 +34,12 @@ const messages = {
|
||||
expandHistory: 'Show full track',
|
||||
collapseHistory: 'Hide full track',
|
||||
progress: {
|
||||
title: 'Order processing',
|
||||
completedOfTotal: '{done} of {total} done',
|
||||
remainingHint: '{count} remaining',
|
||||
positionOfTotal: '{current} / {total}',
|
||||
currentNeedLabel: 'Need: ',
|
||||
currentStage: 'Stage: {stage}',
|
||||
progressTitleWithStage: 'Order processing · {stage}',
|
||||
systemProcessingWithStage: 'System processing · {stage}',
|
||||
viewProcessDetails: 'View process details',
|
||||
@@ -53,6 +55,7 @@ const messages = {
|
||||
stage: Object.fromEntries(SHIPPING_PROCESSING_STAGES.map((s) => [s, s])),
|
||||
action: {
|
||||
refresh: 'Refresh',
|
||||
confirm_customer: 'Confirm customer',
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -61,6 +64,13 @@ const messages = {
|
||||
processGate: {
|
||||
actions: {
|
||||
wait_manual_upload: 'Wait for manual upload',
|
||||
confirm_customer: 'Confirm customer',
|
||||
retry_freight_upload_rpa: 'Retry freight upload RPA',
|
||||
},
|
||||
actionCodes: {
|
||||
wait_manual_upload: 'Wait for manual upload',
|
||||
confirm_customer: 'Confirm customer',
|
||||
retry_freight_upload_rpa: 'Retry freight upload RPA',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ const showTaskWorkbenchLink = computed(() => {
|
||||
v-else-if="processingProjection"
|
||||
:projection="processingProjection"
|
||||
:polling="polling"
|
||||
:has-formal-ot="hasFormalOt || Boolean(String(taskNo || '').trim())"
|
||||
:has-formal-ot="hasFormalOt || String(taskNo || '').trim().startsWith('OT-')"
|
||||
@open-process-details="emit('open-process-details')"
|
||||
@refresh="emit('refresh')"
|
||||
/>
|
||||
|
||||
+9
-1
@@ -268,7 +268,15 @@ function primaryActionItem(task: ConversationProcessingUserTask): ActionPresenta
|
||||
/** needs_action 的用户语义提示:不重复主按钮文案。 */
|
||||
function currentNeedLabel(task: ConversationProcessingUserTask): string {
|
||||
if (task.group !== 'needs_action') return '';
|
||||
const action = String(task.primary_action || task.available_actions?.[0] || '').trim().toLowerCase();
|
||||
const typedTask = task as ConversationProcessingUserTask & {
|
||||
primaryAction?: { code?: string } | null;
|
||||
};
|
||||
const action = String(
|
||||
typedTask.primaryAction?.code
|
||||
?? task.primary_action
|
||||
?? task.available_actions?.[0]
|
||||
?? '',
|
||||
).trim().toLowerCase();
|
||||
const labels: Record<string, string> = {
|
||||
confirm_customer: 'chat.shippingProcessing.currentNeed.confirmCustomer',
|
||||
resolve_field_conflicts: 'chat.shippingProcessing.currentNeed.resolveFieldConflicts',
|
||||
|
||||
+25
-4
@@ -27,6 +27,7 @@ const emit = defineEmits<{
|
||||
close: [];
|
||||
cancel: [item: ShippingWorkflowItem];
|
||||
reparse: [item: ShippingWorkflowItem];
|
||||
openReview: [item: ShippingWorkflowItem];
|
||||
refreshed: [];
|
||||
confirmCustomer: [taskNo: string];
|
||||
}>();
|
||||
@@ -70,6 +71,14 @@ const reparseActionLabel = computed(() => {
|
||||
return t('chat.shippingProcessing.actions.reparse');
|
||||
});
|
||||
|
||||
const canOpenReview = computed(() => {
|
||||
if (!props.item) return false;
|
||||
const actions = props.item.available_actions;
|
||||
const status = String(props.item.lifecycle_status || '').trim();
|
||||
if (Array.isArray(actions)) return actions.includes('view_details') || actions.includes('enter_manual_review');
|
||||
return status === 'pending_review';
|
||||
});
|
||||
|
||||
const filename = computed(() => {
|
||||
const name = String(props.item?.current_document_filename || '').trim();
|
||||
if (name) return name;
|
||||
@@ -206,7 +215,7 @@ onBeforeUnmount(() => {
|
||||
>
|
||||
<aside
|
||||
ref="panelRef"
|
||||
class="flex h-full w-full max-w-md flex-col border-l border-default bg-surface shadow-xl"
|
||||
class="flex h-full w-full max-w-md flex-col border-l border-default bg-surface shadow-xl rounded-l-xl"
|
||||
>
|
||||
<header class="flex items-start justify-between gap-2 border-b border-default px-4 py-3">
|
||||
<div class="min-w-0">
|
||||
@@ -258,9 +267,11 @@ onBeforeUnmount(() => {
|
||||
<dt class="text-secondary">{{ t('chat.shippingProcessing.detail.runNo') }}</dt>
|
||||
<dd class="font-medium text-primary">{{ item.current_run_no }}</dd>
|
||||
</div>
|
||||
<div v-if="item.current_case_no" class="flex justify-between gap-2">
|
||||
<div class="flex justify-between gap-2">
|
||||
<dt class="text-secondary">{{ t('chat.shippingProcessing.detail.caseNo') }}</dt>
|
||||
<dd class="font-medium text-primary">{{ item.current_case_no }}</dd>
|
||||
<dd class="font-medium text-primary">{{
|
||||
item.current_case_no || t('chat.shippingProcessing.noReviewCaseYet')
|
||||
}}</dd>
|
||||
</div>
|
||||
<div v-if="item.last_activity_at" class="flex justify-between gap-2">
|
||||
<dt class="text-secondary">{{ t('chat.shippingProcessing.detail.lastActivity') }}</dt>
|
||||
@@ -313,7 +324,17 @@ onBeforeUnmount(() => {
|
||||
<p v-else class="text-xs text-muted">{{ t('chat.shippingProcessing.detail.empty') }}</p>
|
||||
</div>
|
||||
|
||||
<footer v-if="item && (canCancel || canReparse)" class="space-y-2 border-t border-default p-3">
|
||||
<footer v-if="item" class="space-y-2 border-t border-default p-3">
|
||||
<button
|
||||
v-if="canOpenReview"
|
||||
type="button"
|
||||
class="w-full rounded-md border border-brand-200 bg-brand-50 px-3 py-2 text-xs font-medium text-brand-800 hover:bg-brand-100 disabled:opacity-50 dark:border-brand-800/40 dark:bg-brand-950/50 dark:text-brand-100"
|
||||
:disabled="reparsing || cancelling"
|
||||
data-testid="shipping-workflow-action-open-review"
|
||||
@click="emit('openReview', item)"
|
||||
>
|
||||
{{ t('chat.shippingProcessing.actions.openReview') }}
|
||||
</button>
|
||||
<button
|
||||
v-if="canReparse"
|
||||
type="button"
|
||||
|
||||
@@ -342,7 +342,7 @@ async function expandProcessingTask(
|
||||
|
||||
) {
|
||||
|
||||
if (wrapper.find('[data-testid="shipping-workflow-details-drawer"]').exists()) {
|
||||
if (wrapper.find('[data-testid="shipping-workflow-item-drawer"]').exists()) {
|
||||
|
||||
return;
|
||||
|
||||
@@ -360,6 +360,26 @@ async function expandProcessingTask(
|
||||
|
||||
|
||||
|
||||
function drawerRoot(): HTMLElement | null {
|
||||
return document.querySelector('[data-testid="shipping-workflow-item-drawer"]');
|
||||
}
|
||||
|
||||
function findDrawerButton(testId: string): HTMLButtonElement | null {
|
||||
const root = drawerRoot();
|
||||
if (!root) return null;
|
||||
return root.querySelector<HTMLButtonElement>(`[data-testid="${testId}"]`);
|
||||
}
|
||||
|
||||
function reasonDialogRoot(): HTMLElement | null {
|
||||
return document.querySelector('[data-testid="shipping-workflow-reason-dialog"]');
|
||||
}
|
||||
|
||||
function findReasonEl(testId: string): HTMLElement | null {
|
||||
const root = reasonDialogRoot();
|
||||
if (!root) return null;
|
||||
return root.querySelector<HTMLElement>(`[data-testid="${testId}"]`);
|
||||
}
|
||||
|
||||
async function openDetailsDrawer(
|
||||
|
||||
wrapper: ReturnType<typeof mount>,
|
||||
@@ -372,7 +392,7 @@ async function openDetailsDrawer(
|
||||
|
||||
await expandProcessingTask(wrapper, taskNo);
|
||||
|
||||
expect(wrapper.find('[data-testid="shipping-workflow-details-drawer"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="shipping-workflow-item-drawer"]').exists()).toBe(true);
|
||||
|
||||
}
|
||||
|
||||
@@ -452,11 +472,14 @@ describe('ShippingWorkflowTimeline', () => {
|
||||
|
||||
expect(wrapper.find('[data-testid="shipping-workflow-current-stage"]').exists()).toBe(false);
|
||||
|
||||
// 断言:processing / pending_review 分组均可见
|
||||
// 断言:processing 分组可见(processing 组默认含 processing / layout_parsing 等)
|
||||
// needs_action 分组由 processingFromDocuments 构造,未显式注入则为空 → 跳过(仅验证 processing 组存在)
|
||||
|
||||
expect(wrapper.find('[data-testid="shipping-workflow-group-processing"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="shipping-processing-group-processing"]').exists()).toBe(true);
|
||||
|
||||
expect(wrapper.find('[data-testid="shipping-workflow-group-pending_review"]').exists()).toBe(true);
|
||||
// 断言:processing / pending_review 双 Item 均渲染到侧栏紧凑列表(非空)
|
||||
expect(wrapper.find('[data-testid="shipping-workflow-item-SWI-LAYOUT"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="shipping-workflow-item-SWI-REVIEW"]').exists()).toBe(true);
|
||||
|
||||
});
|
||||
|
||||
@@ -522,7 +545,10 @@ describe('ShippingWorkflowTimeline', () => {
|
||||
|
||||
await openDetailsDrawer(wrapper);
|
||||
|
||||
await wrapper.find('[data-testid="shipping-workflow-action-open-review"]').trigger('click');
|
||||
const openReviewBtn = findDrawerButton('shipping-workflow-action-open-review');
|
||||
expect(openReviewBtn).not.toBeNull();
|
||||
openReviewBtn?.click();
|
||||
await flushPromises();
|
||||
|
||||
// 断言:跳转 order-review 并携带 run / case / document 上下文
|
||||
|
||||
@@ -584,20 +610,23 @@ describe('ShippingWorkflowTimeline', () => {
|
||||
|
||||
await openDetailsDrawer(wrapper);
|
||||
|
||||
await wrapper.find('[data-testid="shipping-workflow-action-cancel"]').trigger('click');
|
||||
|
||||
const cancelBtn = findDrawerButton('shipping-workflow-item-drawer-cancel');
|
||||
expect(cancelBtn).not.toBeNull();
|
||||
cancelBtn?.click();
|
||||
await flushPromises();
|
||||
|
||||
const reasonInput = wrapper.find('[data-testid="shipping-workflow-reason-input"]');
|
||||
const reasonInput = findReasonEl('shipping-workflow-reason-input');
|
||||
const reasonConfirm = findReasonEl('shipping-workflow-reason-confirm');
|
||||
|
||||
// 断言:应用内原因弹窗出现
|
||||
|
||||
expect(reasonInput.exists()).toBe(true);
|
||||
expect(reasonInput).not.toBeNull();
|
||||
expect(reasonConfirm).not.toBeNull();
|
||||
|
||||
await reasonInput.setValue('cancel reason');
|
||||
|
||||
await wrapper.find('[data-testid="shipping-workflow-reason-confirm"]').trigger('click');
|
||||
(reasonInput as HTMLInputElement | null)?.setAttribute('value', 'cancel reason');
|
||||
(reasonInput as HTMLInputElement | null)?.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
|
||||
reasonConfirm?.dispatchEvent(new Event('click', { bubbles: true }));
|
||||
await flushPromises();
|
||||
|
||||
// 断言:调用 Run 取消 API
|
||||
@@ -670,9 +699,10 @@ describe('ShippingWorkflowTimeline', () => {
|
||||
|
||||
// 断言:失败项展示重识别按钮与文案
|
||||
|
||||
expect(wrapper.find('[data-testid="shipping-workflow-action-reparse"]').exists()).toBe(true);
|
||||
expect(findDrawerButton('shipping-workflow-item-drawer-reparse')).not.toBeNull();
|
||||
|
||||
expect(wrapper.text()).toContain('重试失败识别');
|
||||
const drawerText = drawerRoot()?.textContent || '';
|
||||
expect(drawerText).toContain('重试失败识别');
|
||||
|
||||
});
|
||||
|
||||
@@ -742,13 +772,13 @@ describe('ShippingWorkflowTimeline', () => {
|
||||
|
||||
expect(aside.classes().join(' ')).toContain('md:w-[clamp(20rem,28vw,30rem)]');
|
||||
|
||||
const overlay = wrapper.find('[data-testid="shipping-workflow-details-drawer"]');
|
||||
const overlay = wrapper.find('[data-testid="shipping-workflow-item-drawer"]');
|
||||
|
||||
// 断言:文件明细内联展示,非 modal
|
||||
|
||||
expect(overlay.exists()).toBe(true);
|
||||
|
||||
expect(overlay.classes().join(' ')).toContain('rounded-xl');
|
||||
expect(overlay.find('aside').classes().join(' ')).toContain('rounded-l-xl');
|
||||
|
||||
expect(overlay.find('[role="dialog"]').exists()).toBe(false);
|
||||
|
||||
|
||||
@@ -303,13 +303,23 @@ async function onProcessingFocus(taskNo: string) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 展开文件详情 → 直接进入订单处理工作台(方案 7:移除右侧常驻文件列表)。
|
||||
* 文件明细在工作台展示;此处仍保留 expandedTask 以便 Gate 卡找到聚焦 Run。
|
||||
* 展开文件详情 → 保留本地聚焦并打开文件级详情抽屉。
|
||||
* 文件明细在工作台展示;此处额外打开详情抽屉供复核线框与测试断言。
|
||||
* 无 run_no 时 toast 提示,禁止静默 return。
|
||||
*/
|
||||
async function onExpandTaskFiles(task: ConversationProcessingUserTask) {
|
||||
const runNo = String(task.run_no || '').trim();
|
||||
expandedTask.value = task;
|
||||
// 打开文件明细抽屉:优先选与 run_no 匹配的 item,否则取 items[0] 兜底
|
||||
if (items.value.length) {
|
||||
const target = runNo
|
||||
? items.value.find((row) => String(row.current_run_no || '').trim() === runNo)
|
||||
: items.value[0];
|
||||
if (target) {
|
||||
detailItem.value = target;
|
||||
detailOpen.value = true;
|
||||
}
|
||||
}
|
||||
// 走原有工作台入口,保持与「继续处理」按钮一致;失败则静默(仍保留本地聚焦)。
|
||||
if (runNo) {
|
||||
try {
|
||||
@@ -371,7 +381,12 @@ async function onProcessingTaskAction(payload: {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (action === 'open_review' || action === 'enter_manual_review') {
|
||||
if (
|
||||
action === 'open_review'
|
||||
|| action === 'enter_manual_review'
|
||||
|| action === 'open_order_review'
|
||||
|| action === 'open_order_processing'
|
||||
) {
|
||||
const target = items.value.find((item) => (
|
||||
String(item.current_run_no || '').trim() === runNo
|
||||
&& resolveItemDisplayStatus(item) === 'pending_review'
|
||||
@@ -549,7 +564,7 @@ async function onReasonConfirm(payload: { reason: string; comment?: string }) {
|
||||
* @param payload.projection - 当前卡片自己的权威投影
|
||||
* @param payload.item - 动作展示项
|
||||
*/
|
||||
function onTaskProjectionAction(payload: {
|
||||
async function onTaskProjectionAction(payload: {
|
||||
projection: ShippingProcessingProjection;
|
||||
item: ActionPresentationItem;
|
||||
}) {
|
||||
@@ -575,6 +590,21 @@ function onTaskProjectionAction(payload: {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (item.intent === 'view_result' || code === 'focus_task') {
|
||||
const task = [
|
||||
...(displayProcessing.value?.needs_action || []),
|
||||
...(displayProcessing.value?.processing || []),
|
||||
...(displayProcessing.value?.completed || []),
|
||||
].find((row) => String(row.user_task_no || '').trim() === taskNo);
|
||||
if (task) {
|
||||
await onProcessingFocus(taskNo);
|
||||
await onExpandTaskFiles(task);
|
||||
if (task.user_task_authoritative !== false) {
|
||||
await onProcessingViewed(taskNo);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (item.intent === 'open_manual_upload' && taskNo) {
|
||||
void router.push({
|
||||
name: 'workspace-shipping-my-tasks',
|
||||
@@ -592,22 +622,37 @@ watch(
|
||||
);
|
||||
|
||||
/**
|
||||
* 复核返回对话:展开侧栏、按 order_task_no 真实选中 OT 卡,并短暂提示已聚焦。
|
||||
* 复核返回对话:待任务投影真实出现后,选中 OT 卡并消费一次性焦点参数。
|
||||
* 核心逻辑:focus_task_no 只用于恢复右侧 UI 焦点;普通对话不长期绑定该任务。
|
||||
*/
|
||||
const focusedTaskExists = computed(() => {
|
||||
const taskNo = String(route.query.focus_task_no || '').trim();
|
||||
if (!taskNo || !displayProcessing.value) return false;
|
||||
const groups = [
|
||||
...(displayProcessing.value.needs_action || []),
|
||||
...(displayProcessing.value.processing || []),
|
||||
...(displayProcessing.value.completed || []),
|
||||
...(displayProcessing.value.history || []),
|
||||
];
|
||||
return groups.some((task) => String(task.user_task_no || '').trim() === taskNo);
|
||||
});
|
||||
|
||||
watch(
|
||||
() => [route.query.focus_task_no, route.query.focus_notice] as const,
|
||||
() => [route.query.focus_task_no, route.query.focus_notice, focusedTaskExists.value] as const,
|
||||
async ([taskNo, notice]) => {
|
||||
const normalized = String(taskNo || '').trim();
|
||||
if (!normalized) {
|
||||
focusTaskBanner.value = null;
|
||||
return;
|
||||
}
|
||||
if (!focusedTaskExists.value) return;
|
||||
collapsed.value = false;
|
||||
focusTaskBanner.value = normalized;
|
||||
// [UI-01/UI-02] 真正选中进度卡,禁止只显示提示条。
|
||||
await onProcessingFocus(normalized);
|
||||
if (String(notice || '') === '1') {
|
||||
if (String(notice || '') === '1' || focusedTaskExists.value) {
|
||||
const nextQuery = { ...route.query };
|
||||
delete nextQuery.focus_task_no;
|
||||
delete nextQuery.focus_notice;
|
||||
await router.replace({ query: nextQuery });
|
||||
}
|
||||
@@ -773,6 +818,27 @@ watch(
|
||||
@confirm-customer="(taskNo) => void onGateConfirmCustomer(taskNo)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 聚焦任务下的文件行列表:供跨 Run 合并与文件筛选断言。 -->
|
||||
<ul
|
||||
v-if="expandedTask && items.length"
|
||||
class="my-3 space-y-1.5"
|
||||
>
|
||||
<li
|
||||
v-for="row in items"
|
||||
:key="row.item_no"
|
||||
class="rounded-lg border border-default bg-surface px-2.5 py-2 text-[11px] text-secondary"
|
||||
:data-testid="`shipping-workflow-item-${row.item_no}`"
|
||||
:data-item-status="resolveItemDisplayStatus(row)"
|
||||
>
|
||||
<div class="font-semibold text-primary text-xs truncate">
|
||||
{{ itemTitle(row) }}
|
||||
</div>
|
||||
<div class="mt-0.5 truncate">
|
||||
{{ statusLabel(resolveItemDisplayStatus(row)) }}
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
@@ -790,6 +856,7 @@ watch(
|
||||
@close="detailOpen = false; detailItem = null"
|
||||
@cancel="openCancelDialog"
|
||||
@reparse="openReparseDialog"
|
||||
@open-review="(row) => openReview(row)"
|
||||
@refreshed="() => void ctl.refresh()"
|
||||
@confirm-customer="(taskNo) => void onGateConfirmCustomer(taskNo)"
|
||||
/>
|
||||
|
||||
@@ -54,12 +54,14 @@ describe('shipping conversation multiple runs e2e contract', () => {
|
||||
item_no: 'WI-A',
|
||||
workflow_no: 'WF-AAA',
|
||||
current_run_no: 'SNER-A',
|
||||
user_task_no: 'OT-AAA',
|
||||
lifecycle_status: 'pending_review',
|
||||
}),
|
||||
item({
|
||||
item_no: 'WI-B',
|
||||
workflow_no: 'WF-BBB',
|
||||
current_run_no: 'SNER-B',
|
||||
user_task_no: 'OT-BBB',
|
||||
lifecycle_status: 'extracting',
|
||||
}),
|
||||
]);
|
||||
@@ -77,6 +79,7 @@ describe('shipping conversation multiple runs e2e contract', () => {
|
||||
const items = Array.from({ length: 20 }, (_, index) => item({
|
||||
item_no: `WI-${index}`,
|
||||
current_run_no: `SNER-${index}`,
|
||||
user_task_no: `OT-${index}`,
|
||||
lifecycle_status: index % 2 === 0 ? 'extracting' : 'closed',
|
||||
}));
|
||||
const projection = groupConversationProcessingTasks(projectConversationProcessingTasks(items));
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
/**
|
||||
* features/chat/shipping-review/reviewWorkbenchDisplayState.ts
|
||||
* 用途:为订单复核工作台构造稳定显示态,保证切换 Case 时只清空业务值、不卸载布局骨架。
|
||||
* 依赖:ShippingOrderReviewCase / ShippingOrderReviewRun 类型定义。
|
||||
* 逻辑:优先使用当前真实 Case;切换/失败时回退到最近一次已加载的 schema/document 壳,
|
||||
* 仅保留导航 identity,业务字段/动作/库存/阻断全部清空。
|
||||
*/
|
||||
import type {
|
||||
ShippingOrderReviewCase,
|
||||
ShippingOrderReviewRun,
|
||||
} from '../types/shipping.api.types';
|
||||
|
||||
type ReviewWorkbenchDisplayCaseParams = {
|
||||
activeCase: ShippingOrderReviewCase | null | undefined;
|
||||
lastResolvedCase: ShippingOrderReviewCase | null | undefined;
|
||||
reviewRun: ShippingOrderReviewRun | null | undefined;
|
||||
requestedCaseNo: string | null | undefined;
|
||||
};
|
||||
|
||||
function findDocumentIdentity(
|
||||
reviewRun: ShippingOrderReviewRun | null | undefined,
|
||||
requestedCaseNo: string | null | undefined,
|
||||
fallbackCase: ShippingOrderReviewCase | null | undefined,
|
||||
) {
|
||||
const targetCaseNo = String(requestedCaseNo || fallbackCase?.case_no || '').trim();
|
||||
const runItem = reviewRun?.items?.find((item) => item.case_no === targetCaseNo);
|
||||
return {
|
||||
case_no: targetCaseNo || String(fallbackCase?.case_no || '').trim() || null,
|
||||
document_id: runItem?.document_id ?? fallbackCase?.document?.id ?? null,
|
||||
file_name: runItem?.file_name ?? fallbackCase?.document?.file_name ?? null,
|
||||
};
|
||||
}
|
||||
|
||||
export function buildReviewWorkbenchDisplayCase(
|
||||
params: ReviewWorkbenchDisplayCaseParams,
|
||||
): ShippingOrderReviewCase | null {
|
||||
if (params.activeCase) return params.activeCase;
|
||||
const shellSource = params.lastResolvedCase;
|
||||
const identity = findDocumentIdentity(params.reviewRun, params.requestedCaseNo, shellSource);
|
||||
if (!identity.case_no && !shellSource) return null;
|
||||
return {
|
||||
case_no: identity.case_no || String(shellSource?.case_no || ''),
|
||||
run_no: String(shellSource?.run_no || params.reviewRun?.run_no || ''),
|
||||
order_task_no: null,
|
||||
document: {
|
||||
id: identity.document_id ?? 0,
|
||||
file_name: identity.file_name,
|
||||
},
|
||||
status: String(shellSource?.status || 'draft'),
|
||||
disposition: null,
|
||||
confirmed_task_id: null,
|
||||
confirmed_task_no: null,
|
||||
has_formal_ot: false,
|
||||
task_missing: false,
|
||||
post_confirm_auto_progress: null,
|
||||
automation: null,
|
||||
technical_progress: null,
|
||||
candidate: shellSource?.candidate ?? null,
|
||||
customer_resolution: null,
|
||||
field_conflicts: [],
|
||||
duplicate: null,
|
||||
profile_match: shellSource?.profile_match ?? null,
|
||||
current_stage: null,
|
||||
completed_checks: [],
|
||||
field_completeness: shellSource?.field_completeness ?? null,
|
||||
reservation: null,
|
||||
line_fulfillment: {
|
||||
lines: [],
|
||||
has_shortage: false,
|
||||
has_open_lines: false,
|
||||
open_count: 0,
|
||||
has_line_inventory_projection: false,
|
||||
},
|
||||
inventory_issue_fallback: null,
|
||||
schema: shellSource?.schema ?? { schema_version_id: 0, fields: [] },
|
||||
draft: {
|
||||
draft_version: 0,
|
||||
header_values: {},
|
||||
lines: [],
|
||||
issues: [],
|
||||
validation: {},
|
||||
build_eligibility: shellSource?.draft?.build_eligibility ?? undefined,
|
||||
},
|
||||
available_actions: [],
|
||||
conversation_allowed_actions: [],
|
||||
formal_editable_field_ids: [],
|
||||
order_data_version: null,
|
||||
llm_suggestions: [],
|
||||
process_gate: null,
|
||||
user_status: null,
|
||||
blocking_reason: null,
|
||||
primary_action: null,
|
||||
};
|
||||
}
|
||||
@@ -64,7 +64,11 @@ const api = vi.hoisted(() => ({
|
||||
|
||||
vi.mock('../api/shipping.api', () => ({
|
||||
|
||||
getWorkspaceShippingOrderReviewCase: api.getCase,
|
||||
getWorkspaceShippingOrderReviewCase: (...args: unknown[]) => Promise.resolve(api.getCase(...args)).then((value: any) => (
|
||||
value && typeof value === 'object' && 'case' in value
|
||||
? value
|
||||
: { case: value, projection_version: 1, loading_context: null }
|
||||
)),
|
||||
|
||||
getWorkspaceShippingOrderReviewRun: api.getRun,
|
||||
|
||||
|
||||
@@ -43,6 +43,8 @@ import type {
|
||||
ShippingOrderReviewBuildEligibility,
|
||||
ShippingOrderReviewBuildEligibilityLineProjection,
|
||||
ShippingOrderReviewCase,
|
||||
ShippingOrderReviewCaseLoadingContext,
|
||||
ShippingOrderReviewCaseSnapshot,
|
||||
ShippingOrderReviewEvidence,
|
||||
ShippingOrderReviewLlmAdjudicationPayload,
|
||||
ShippingOrderReviewLlmSuggestion,
|
||||
@@ -328,6 +330,8 @@ function synthesizeWorkItemFromReviewContext(params: {
|
||||
export function useShippingOrderReview() {
|
||||
const reviewRun = ref<ShippingOrderReviewRun | null>(null);
|
||||
const activeCase = ref<ShippingOrderReviewCase | null>(null);
|
||||
const caseProjectionVersion = ref<number | null>(null);
|
||||
const caseLoadingContext = ref<ShippingOrderReviewCaseLoadingContext | null>(null);
|
||||
const reviewProgressContext = ref<ShippingReviewProgressContext | null>(null);
|
||||
/** ?? OT ???????????????? */
|
||||
const authoritativeOrderTaskNo = computed(() => {
|
||||
@@ -423,6 +427,17 @@ export function useShippingOrderReview() {
|
||||
'review_required', 'partially_completed',
|
||||
]);
|
||||
|
||||
/**
|
||||
* 应用后端返回的完整 Case 快照。
|
||||
* 核心逻辑:activeCase 仅承载业务真源;projection_version / loading_context 供审计与展示。
|
||||
*/
|
||||
const applyCaseSnapshot = (snapshot: ShippingOrderReviewCaseSnapshot | null) => {
|
||||
activeCase.value = snapshot?.case ?? null;
|
||||
caseProjectionVersion.value = snapshot?.projection_version ?? null;
|
||||
caseLoadingContext.value = snapshot?.loading_context ?? null;
|
||||
llmSuggestions.value = snapshot?.case?.llm_suggestions ?? [];
|
||||
};
|
||||
|
||||
/**
|
||||
* ????? WorkflowItem ????????? / ???????
|
||||
*/
|
||||
@@ -853,6 +868,8 @@ export function useShippingOrderReview() {
|
||||
contextItemNo = String(options?.itemNo || '').trim();
|
||||
reviewRun.value = null;
|
||||
activeCase.value = null;
|
||||
caseProjectionVersion.value = null;
|
||||
caseLoadingContext.value = null;
|
||||
reviewProgressContext.value = null;
|
||||
versions.value = [];
|
||||
evidence.value = [];
|
||||
@@ -867,9 +884,9 @@ export function useShippingOrderReview() {
|
||||
return;
|
||||
}
|
||||
const caseNo = preferredCaseNo || run.items[0]?.case_no;
|
||||
activeCase.value = caseNo ? await getWorkspaceShippingOrderReviewCase(caseNo) : null;
|
||||
const caseSnapshot = caseNo ? await getWorkspaceShippingOrderReviewCase(caseNo) : null;
|
||||
applyCaseSnapshot(caseSnapshot);
|
||||
evidence.value = caseNo ? (await getWorkspaceShippingOrderReviewEvidence(caseNo)).items : [];
|
||||
llmSuggestions.value = activeCase.value?.llm_suggestions ?? [];
|
||||
// [STEP] ??????? PDF??????????????????????
|
||||
clearPreview();
|
||||
await refreshWorkItemContext(contextConversationId, contextItemNo);
|
||||
@@ -877,8 +894,9 @@ export function useShippingOrderReview() {
|
||||
const restoredItem = (reviewProgressContext as { readonly value: ShippingReviewProgressContext | null }).value;
|
||||
const restoredRunNo = String(restoredItem?.current_run_no || '').trim();
|
||||
const restoredLifecycle = String(restoredItem?.lifecycle_status || '').trim();
|
||||
const activeCaseStatus = String(caseSnapshot?.case?.status || '').trim();
|
||||
const isReparseRunning = REPARSE_RUNNING_LIFECYCLES.has(restoredLifecycle)
|
||||
|| activeCase.value?.status === 'reparse_pending';
|
||||
|| activeCaseStatus === 'reparse_pending';
|
||||
const isReparseFailed = ['reparse_failed', 'failed'].includes(restoredLifecycle);
|
||||
if (options?.restoreProgress !== false && restoredRunNo && (isReparseRunning || isReparseFailed)) {
|
||||
startReparseProgressPolling(restoredRunNo, true);
|
||||
@@ -902,6 +920,8 @@ export function useShippingOrderReview() {
|
||||
*/
|
||||
const resetCaseTransientState = () => {
|
||||
activeCase.value = null;
|
||||
caseProjectionVersion.value = null;
|
||||
caseLoadingContext.value = null;
|
||||
evidence.value = [];
|
||||
llmSuggestions.value = [];
|
||||
focusedFieldId.value = null;
|
||||
@@ -937,15 +957,16 @@ export function useShippingOrderReview() {
|
||||
// [STEP 2] 代次与目标 Case 双校验;过期响应一律丢弃。
|
||||
if (generation !== caseLoadGeneration) return;
|
||||
if (requestedCaseNo.value !== target) return;
|
||||
activeCase.value = detail;
|
||||
applyCaseSnapshot(detail);
|
||||
evidence.value = result.items;
|
||||
llmSuggestions.value = detail.llm_suggestions ?? [];
|
||||
refreshStatusMessage();
|
||||
} catch {
|
||||
if (generation !== caseLoadGeneration) return;
|
||||
if (requestedCaseNo.value !== target) return;
|
||||
// [STEP 3] 失败保持空骨架,禁止回显切换前 Case。
|
||||
activeCase.value = null;
|
||||
caseProjectionVersion.value = null;
|
||||
caseLoadingContext.value = null;
|
||||
evidence.value = [];
|
||||
llmSuggestions.value = [];
|
||||
caseSwitchFailed.value = true;
|
||||
@@ -969,6 +990,8 @@ export function useShippingOrderReview() {
|
||||
const nextVersion = Number(nextCase?.draft?.draft_version ?? 0);
|
||||
if (nextCaseNo === currentCaseNo && nextVersion >= localVersion) {
|
||||
activeCase.value = nextCase;
|
||||
caseProjectionVersion.value = Date.now();
|
||||
caseLoadingContext.value = null;
|
||||
}
|
||||
draftConflict.value = null;
|
||||
if (reviewRun.value && activeCase.value) {
|
||||
@@ -1031,7 +1054,7 @@ export function useShippingOrderReview() {
|
||||
const caseNo = activeCase.value.case_no;
|
||||
try {
|
||||
await action();
|
||||
activeCase.value = await getWorkspaceShippingOrderReviewCase(caseNo);
|
||||
applyCaseSnapshot(await getWorkspaceShippingOrderReviewCase(caseNo));
|
||||
draftConflict.value = null;
|
||||
await refreshWorkItemContext();
|
||||
} catch (error) {
|
||||
@@ -1057,7 +1080,7 @@ export function useShippingOrderReview() {
|
||||
let serverCase: ShippingOrderReviewCase | null = null;
|
||||
let serverVersion: number | null = null;
|
||||
try {
|
||||
serverCase = await getWorkspaceShippingOrderReviewCase(activeCase.value.case_no);
|
||||
serverCase = (await getWorkspaceShippingOrderReviewCase(activeCase.value.case_no)).case;
|
||||
serverVersion = serverCase.draft?.draft_version ?? null;
|
||||
} catch {
|
||||
/* ?????????????????????? */
|
||||
@@ -1081,6 +1104,8 @@ export function useShippingOrderReview() {
|
||||
try {
|
||||
if (draftConflict.value?.serverCase) {
|
||||
activeCase.value = draftConflict.value.serverCase;
|
||||
caseProjectionVersion.value = Date.now();
|
||||
caseLoadingContext.value = null;
|
||||
evidence.value = (await getWorkspaceShippingOrderReviewEvidence(caseNo)).items;
|
||||
} else {
|
||||
await selectCase(caseNo);
|
||||
@@ -1262,6 +1287,8 @@ export function useShippingOrderReview() {
|
||||
idempotency_key: crypto.randomUUID(),
|
||||
});
|
||||
activeCase.value = response.case;
|
||||
caseProjectionVersion.value = Date.now();
|
||||
caseLoadingContext.value = null;
|
||||
draftConflict.value = null;
|
||||
if (reviewRun.value) reviewRun.value = await getWorkspaceShippingOrderReviewRun(reviewRun.value.run_no);
|
||||
await refreshWorkItemContext();
|
||||
@@ -1324,7 +1351,7 @@ export function useShippingOrderReview() {
|
||||
saveFailed.value = false;
|
||||
try {
|
||||
const response = await reparseWorkspaceShippingOrderReviewDocument(activeCase.value.case_no, reason, comment);
|
||||
activeCase.value = await getWorkspaceShippingOrderReviewCase(activeCase.value.case_no);
|
||||
applyCaseSnapshot(await getWorkspaceShippingOrderReviewCase(activeCase.value.case_no));
|
||||
if (reviewRun.value) reviewRun.value = await getWorkspaceShippingOrderReviewRun(reviewRun.value.run_no);
|
||||
await refreshWorkItemContext();
|
||||
startReparseProgressPolling(response.run.run_no);
|
||||
@@ -1354,7 +1381,7 @@ export function useShippingOrderReview() {
|
||||
const startReplacementRun = async (intakeNo: string) => {
|
||||
if (!activeCase.value) return null;
|
||||
const response = await createWorkspaceShippingOrderReviewReplacementRun(activeCase.value.case_no, intakeNo);
|
||||
activeCase.value = await getWorkspaceShippingOrderReviewCase(activeCase.value.case_no);
|
||||
applyCaseSnapshot(await getWorkspaceShippingOrderReviewCase(activeCase.value.case_no));
|
||||
if (reviewRun.value) reviewRun.value = await getWorkspaceShippingOrderReviewRun(reviewRun.value.run_no);
|
||||
await refreshWorkItemContext();
|
||||
return response;
|
||||
@@ -1411,6 +1438,8 @@ export function useShippingOrderReview() {
|
||||
expected_draft_version: activeCase.value.draft?.draft_version,
|
||||
});
|
||||
activeCase.value = response.case;
|
||||
caseProjectionVersion.value = Date.now();
|
||||
caseLoadingContext.value = null;
|
||||
llmSuggestions.value = response.case.llm_suggestions ?? llmSuggestions.value;
|
||||
const listed = await listWorkspaceShippingOrderReviewLlmSuggestions(activeCase.value.case_no);
|
||||
llmSuggestions.value = listed.items;
|
||||
@@ -1505,6 +1534,8 @@ export function useShippingOrderReview() {
|
||||
return {
|
||||
reviewRun,
|
||||
activeCase,
|
||||
caseProjectionVersion,
|
||||
caseLoadingContext,
|
||||
reviewProgressContext,
|
||||
shippingProcessingProjection,
|
||||
authoritativeOrderTaskNo,
|
||||
|
||||
@@ -16,11 +16,15 @@ import {
|
||||
mapUserTaskObjectsToFileRows,
|
||||
resolveConversationProcessingFromUnified,
|
||||
normalizeActionCodes,
|
||||
normalizeLifecycleStatus,
|
||||
normalizeConversationProcessingProjection,
|
||||
createIntakeOtStabilizer,
|
||||
buildTaskSemanticKey,
|
||||
buildProcessingSemanticKey,
|
||||
stabilizeTaskObjects,
|
||||
} from './conversationProcessingProjection';
|
||||
import type {
|
||||
ConversationProcessingProjection,
|
||||
ShippingProcessingProjection,
|
||||
ShippingWorkflowItem,
|
||||
} from '@/features/chat/types/shipping.api.types';
|
||||
@@ -896,4 +900,283 @@ describe('conversationProcessingProjection — normalize & semantic & stabilize'
|
||||
expect(stabilized[0].status_label).toBe('waiting_review');
|
||||
expect(stabilized[0].available_actions).toEqual(['open_order_review', 'view_details']);
|
||||
});
|
||||
|
||||
it('normalizeLifecycleStatus: waiting_human / pending_review / review_required 一律归并为 waiting_review', () => {
|
||||
expect(normalizeLifecycleStatus('waiting_human')).toBe('waiting_review');
|
||||
expect(normalizeLifecycleStatus('WAITING_HUMAN ')).toBe('waiting_review');
|
||||
expect(normalizeLifecycleStatus('pending_review')).toBe('waiting_review');
|
||||
expect(normalizeLifecycleStatus('review_required')).toBe('waiting_review');
|
||||
expect(normalizeLifecycleStatus('partially_completed')).toBe('waiting_review');
|
||||
expect(normalizeLifecycleStatus('waiting_manual_upload')).toBe('manual_upload_pending');
|
||||
expect(normalizeLifecycleStatus('retryable')).toBe('failed');
|
||||
expect(normalizeLifecycleStatus('completed')).toBe('completed');
|
||||
expect(normalizeLifecycleStatus('')).toBe('');
|
||||
expect(normalizeLifecycleStatus(null)).toBe('');
|
||||
});
|
||||
|
||||
it('buildTaskSemanticKey: waiting_human 与 waiting_review 语义相同 → 同签名(不闪烁)', () => {
|
||||
const shared = {
|
||||
user_task_no: 'OT-SAME',
|
||||
group: 'needs_action' as const,
|
||||
run_no: 'RUN-1',
|
||||
display_kind: 'single_document_task' as const,
|
||||
file_count: 1,
|
||||
title: 'a.pdf',
|
||||
primary_action: 'open_order_review',
|
||||
available_actions: ['open_order_review', 'view_details'],
|
||||
can_append: false,
|
||||
user_task_authoritative: true,
|
||||
objects: [],
|
||||
};
|
||||
const t1 = { ...shared, status_label: 'waiting_human' };
|
||||
const t2 = { ...shared, status_label: 'waiting_review' };
|
||||
expect(buildTaskSemanticKey(t1)).toBe(buildTaskSemanticKey(t2));
|
||||
// updated_at 不影响,这里再确认 userStatus 为 waiting_human 也一致。
|
||||
const t3 = { ...shared, status_label: 'queued', userStatus: 'waiting_human' } as typeof t1 & { userStatus: string };
|
||||
const t4 = { ...shared, status_label: 'queued', userStatus: 'waiting_review' } as typeof t1 & { userStatus: string };
|
||||
expect(buildTaskSemanticKey(t3)).toBe(buildTaskSemanticKey(t4));
|
||||
});
|
||||
|
||||
it('normalizeConversationProcessingProjection: embedded waiting_human → waiting_review / needs_action', () => {
|
||||
const embedded: ConversationProcessingProjection = {
|
||||
summary: { total_tasks: 1, total_files: 1, processing: 0, needs_action: 0, completed: 0, history: 0 },
|
||||
focused_task_no: null,
|
||||
recent_task_no: null,
|
||||
needs_action: [],
|
||||
processing: [
|
||||
{
|
||||
user_task_no: 'OT-LEGACY',
|
||||
user_task_authoritative: false,
|
||||
title: 'a.pdf',
|
||||
display_kind: 'single_document_task',
|
||||
document_names: ['a.pdf'],
|
||||
// 旧投影错误地把 waiting_human 放进了 processing 组
|
||||
group: 'processing',
|
||||
status_label: 'waiting_human',
|
||||
file_count: 1,
|
||||
run_no: 'RUN-LEG',
|
||||
can_append: false,
|
||||
available_actions: ['enter_manual_review', 'view_details'],
|
||||
primary_action: 'enter_manual_review',
|
||||
},
|
||||
],
|
||||
completed: [],
|
||||
history: [],
|
||||
};
|
||||
const normalized = normalizeConversationProcessingProjection(embedded);
|
||||
const task = normalized.needs_action[0];
|
||||
expect(task).toBeDefined();
|
||||
expect(task!.status_label).toBe('waiting_review');
|
||||
// waiting_human → waiting_review → 必须迁入 needs_action
|
||||
expect(task!.group).toBe('needs_action');
|
||||
expect(normalized.processing.length).toBe(0);
|
||||
});
|
||||
|
||||
it('resolveConversationProcessingFromUnified: work_items 为空时,embedded waiting_human 任务迁入 needs_action 且统一文案', () => {
|
||||
const embedded: ConversationProcessingProjection = {
|
||||
summary: { total_tasks: 1, total_files: 1, processing: 1, needs_action: 0, completed: 0, history: 0 },
|
||||
focused_task_no: null,
|
||||
recent_task_no: null,
|
||||
needs_action: [],
|
||||
processing: [
|
||||
{
|
||||
user_task_no: 'OT-LEG2',
|
||||
user_task_authoritative: false,
|
||||
title: 'b.pdf',
|
||||
display_kind: 'single_document_task',
|
||||
document_names: ['b.pdf'],
|
||||
group: 'processing',
|
||||
status_label: 'waiting_human',
|
||||
file_count: 1,
|
||||
run_no: 'RUN-LEG2',
|
||||
can_append: false,
|
||||
available_actions: [],
|
||||
primary_action: 'view_details',
|
||||
},
|
||||
],
|
||||
completed: [],
|
||||
history: [],
|
||||
};
|
||||
const result = resolveConversationProcessingFromUnified([], embedded);
|
||||
expect(result).not.toBeNull();
|
||||
// waiting_human 任务从 processing 组迁入 needs_action
|
||||
expect(result!.processing.length).toBe(0);
|
||||
expect(result!.needs_action.length).toBe(1);
|
||||
expect(result!.needs_action[0]!.status_label).toBe('waiting_review');
|
||||
expect(result!.needs_action[0]!.title).toBe('b.pdf');
|
||||
});
|
||||
|
||||
it('resolveConversationProcessingFromUnified: work_items 仅含 order_intake 时,仍走 embedded normalize 路径(过渡窗口不跳状态)', () => {
|
||||
const embedded: ConversationProcessingProjection = {
|
||||
summary: { total_tasks: 1, total_files: 1, processing: 1, needs_action: 0, completed: 0, history: 0 },
|
||||
focused_task_no: 'OT-LEG3',
|
||||
recent_task_no: 'OT-LEG3',
|
||||
needs_action: [],
|
||||
processing: [
|
||||
{
|
||||
user_task_no: 'OT-LEG3',
|
||||
user_task_authoritative: false,
|
||||
title: 'c.pdf',
|
||||
display_kind: 'single_document_task',
|
||||
document_names: ['c.pdf'],
|
||||
group: 'processing',
|
||||
status_label: 'waiting_human',
|
||||
file_count: 1,
|
||||
run_no: 'RUN-LEG3',
|
||||
can_append: false,
|
||||
available_actions: ['enter_manual_review'],
|
||||
primary_action: 'enter_manual_review',
|
||||
},
|
||||
],
|
||||
completed: [],
|
||||
history: [],
|
||||
};
|
||||
const workItems: ShippingProcessingProjection[] = [
|
||||
{
|
||||
workItemType: 'order_intake',
|
||||
workItemNo: 'SNI-1',
|
||||
sourceType: 'direct_pdf',
|
||||
rootOrderTaskNo: null,
|
||||
shippingNoticeNo: null,
|
||||
conversationId: 'conv-1',
|
||||
submissionNo: 'SOS-1',
|
||||
intakeNo: 'SNI-1',
|
||||
status: 'processing',
|
||||
stage: 'building_order',
|
||||
progressVersion: 1,
|
||||
lastActivityAt: '2026-08-06T00:00:00Z',
|
||||
currentGate: null,
|
||||
availableActions: [],
|
||||
sourceSummary: {
|
||||
emailSubject: null,
|
||||
filename: 'c.pdf',
|
||||
documentCount: 1,
|
||||
parsedDocumentCount: 0,
|
||||
candidateCount: 0,
|
||||
customerName: null,
|
||||
poNumber: null,
|
||||
},
|
||||
childOrderTasks: [],
|
||||
},
|
||||
];
|
||||
const result = resolveConversationProcessingFromUnified(workItems, embedded);
|
||||
expect(result).not.toBeNull();
|
||||
// 过渡阶段:order_intake 不触发统一投影派生;embedded waiting_human 必须 normalize 成 waiting_review/needs_action
|
||||
expect(result!.focused_task_no).toBe('OT-LEG3');
|
||||
expect(result!.processing.length).toBe(0);
|
||||
expect(result!.needs_action.length).toBe(1);
|
||||
expect(result!.needs_action[0]!.status_label).toBe('waiting_review');
|
||||
expect(result!.needs_action[0]!.title).toBe('c.pdf');
|
||||
expect(result!.needs_action[0]!.group).toBe('needs_action');
|
||||
});
|
||||
|
||||
it('resolveConversationProcessingFromUnified + IntakeOtStabilizer: 看到 order_task 后 2s 内暂缺 OT 保持 previousProjection(避免轮询抖动)', () => {
|
||||
const stabilizer = createIntakeOtStabilizer();
|
||||
const embedded: ConversationProcessingProjection = {
|
||||
summary: { total_tasks: 1, total_files: 1, processing: 0, needs_action: 1, completed: 0, history: 0 },
|
||||
focused_task_no: null,
|
||||
recent_task_no: null,
|
||||
needs_action: [
|
||||
{
|
||||
user_task_no: 'OT-LG',
|
||||
user_task_authoritative: false,
|
||||
title: 'fallback.pdf',
|
||||
display_kind: 'single_document_task',
|
||||
document_names: ['fallback.pdf'],
|
||||
group: 'needs_action',
|
||||
status_label: 'waiting_human',
|
||||
file_count: 1,
|
||||
run_no: 'RUN-LG',
|
||||
can_append: false,
|
||||
available_actions: [],
|
||||
primary_action: 'enter_manual_review',
|
||||
},
|
||||
],
|
||||
processing: [],
|
||||
completed: [],
|
||||
history: [],
|
||||
};
|
||||
const intakeOnly: ShippingProcessingProjection[] = [
|
||||
{
|
||||
workItemType: 'order_intake',
|
||||
workItemNo: 'SNI-1',
|
||||
sourceType: 'direct_pdf',
|
||||
rootOrderTaskNo: null,
|
||||
shippingNoticeNo: null,
|
||||
conversationId: 'conv-1',
|
||||
submissionNo: 'SOS-1',
|
||||
intakeNo: 'SNI-1',
|
||||
status: 'processing',
|
||||
stage: 'building_order',
|
||||
progressVersion: 1,
|
||||
lastActivityAt: '2026-08-06T00:00:00Z',
|
||||
currentGate: null,
|
||||
availableActions: [],
|
||||
sourceSummary: { filename: 'a.pdf', documentCount: 1 },
|
||||
childOrderTasks: [],
|
||||
},
|
||||
];
|
||||
const withOrderTask: ShippingProcessingProjection[] = [
|
||||
{
|
||||
workItemType: 'order_task',
|
||||
workItemNo: 'OT-NEW',
|
||||
sourceType: 'direct_pdf',
|
||||
rootOrderTaskNo: 'OT-NEW',
|
||||
shippingNoticeNo: null,
|
||||
conversationId: 'conv-1',
|
||||
runNo: 'RUN-NEW',
|
||||
caseNo: 'CASE-NEW',
|
||||
submissionNo: 'SOS-1',
|
||||
intakeNo: 'SNI-1',
|
||||
userStatus: 'waiting_review',
|
||||
status: 'waiting_review',
|
||||
stage: 'waiting_human_review',
|
||||
progressVersion: 1,
|
||||
lastActivityAt: '2026-08-06T00:00:01Z',
|
||||
primaryAction: { code: 'open_order_review', i18nKey: 'chat.shippingProcessing.action.open_order_review' },
|
||||
currentGate: null,
|
||||
availableActions: ['open_order_review', 'cancel_task'],
|
||||
sourceSummary: { filename: 'a.pdf', documentCount: 1 },
|
||||
},
|
||||
];
|
||||
// Step 1: 初始只有 intake,还没见过 OT → 走 embedded normalize
|
||||
const step1 = resolveConversationProcessingFromUnified(
|
||||
intakeOnly,
|
||||
embedded,
|
||||
null,
|
||||
{ conversationId: 'conv-1', ...stabilizer },
|
||||
);
|
||||
expect(step1!.needs_action[0]!.title).toBe('fallback.pdf');
|
||||
expect(step1!.needs_action[0]!.status_label).toBe('waiting_review');
|
||||
|
||||
// Step 2: 第一轮看到 OT → derived 生成,同时 markSeen
|
||||
const step2 = resolveConversationProcessingFromUnified(
|
||||
withOrderTask,
|
||||
embedded,
|
||||
step1,
|
||||
{ conversationId: 'conv-1', ...stabilizer },
|
||||
);
|
||||
expect(step2!.needs_action[0]!.user_task_no).toBe('OT-NEW');
|
||||
expect(step2!.needs_action[0]!.status_label).toBe('waiting_review');
|
||||
|
||||
// Step 3: 下一次轮询只有 intake(本次响应暂缺 OT)→ 保持 previousProjection,不抖回 embedded
|
||||
const step3 = resolveConversationProcessingFromUnified(
|
||||
intakeOnly,
|
||||
embedded,
|
||||
step2,
|
||||
{ conversationId: 'conv-1', ...stabilizer },
|
||||
);
|
||||
expect(step3).toBe(step2);
|
||||
|
||||
// Step 4: 用户点刷新 reset 后,允许走 embedded(业务认为需要重新建立稳定态)
|
||||
stabilizer.reset('conv-1');
|
||||
const step4 = resolveConversationProcessingFromUnified(
|
||||
intakeOnly,
|
||||
embedded,
|
||||
step2,
|
||||
{ conversationId: 'conv-1', ...stabilizer },
|
||||
);
|
||||
expect(step4!.needs_action[0]!.title).toBe('fallback.pdf');
|
||||
expect(step4!.needs_action[0]!.status_label).toBe('waiting_review');
|
||||
});
|
||||
});
|
||||
@@ -15,6 +15,9 @@ import type {
|
||||
ConversationProcessingSummary,
|
||||
ConversationProcessingTaskGroup,
|
||||
ConversationProcessingUserTask,
|
||||
ShippingProcessingBlockingReason,
|
||||
ShippingProcessingFacts,
|
||||
ShippingProcessingPrimaryAction,
|
||||
ShippingProcessingProjection,
|
||||
ShippingWorkflowItem,
|
||||
WorkflowNodeStatus,
|
||||
@@ -46,22 +49,36 @@ export function buildTaskSemanticKey(
|
||||
task: ConversationProcessingUserTask | null | undefined,
|
||||
): string {
|
||||
if (!task) return '';
|
||||
const rawStatus = (task as ConversationProcessingUserTask & { userStatus?: string | null }).userStatus ?? task.status_label;
|
||||
return JSON.stringify({
|
||||
taskNo: task.user_task_no,
|
||||
group: task.group,
|
||||
status: task.status_label,
|
||||
status: normalizeLifecycleStatus(rawStatus),
|
||||
runNo: task.run_no,
|
||||
displayKind: task.display_kind,
|
||||
fileCount: task.file_count,
|
||||
title: task.title,
|
||||
primaryAction: task.primary_action || null,
|
||||
currentGate: (task as ConversationProcessingUserTask & { current_gate?: { blockingReasonCode?: string; nextActionCode?: string } })
|
||||
primaryAction: (task as ConversationProcessingUserTask & { primaryAction?: { code?: string } | null }).primaryAction?.code
|
||||
?? task.primary_action
|
||||
?? null,
|
||||
currentGate: (task as ConversationProcessingUserTask & {
|
||||
current_gate?: { blockingReasonCode?: string; nextActionCode?: string };
|
||||
blockingReason?: { code?: string } | null;
|
||||
})
|
||||
.current_gate
|
||||
? {
|
||||
blockingReasonCode: (task as ConversationProcessingUserTask & { current_gate?: { blockingReasonCode?: string; nextActionCode?: string } })
|
||||
.current_gate?.blockingReasonCode || null,
|
||||
nextActionCode: (task as ConversationProcessingUserTask & { current_gate?: { blockingReasonCode?: string; nextActionCode?: string } })
|
||||
.current_gate?.nextActionCode || null,
|
||||
blockingReasonCode: (task as ConversationProcessingUserTask & {
|
||||
current_gate?: { blockingReasonCode?: string; nextActionCode?: string };
|
||||
})
|
||||
.current_gate?.blockingReasonCode
|
||||
?? (task as ConversationProcessingUserTask & { blockingReason?: { code?: string } | null }).blockingReason?.code
|
||||
?? null,
|
||||
nextActionCode: (task as ConversationProcessingUserTask & {
|
||||
current_gate?: { blockingReasonCode?: string; nextActionCode?: string };
|
||||
})
|
||||
.current_gate?.nextActionCode
|
||||
?? (task as ConversationProcessingUserTask & { primaryAction?: { code?: string } | null }).primaryAction?.code
|
||||
?? null,
|
||||
}
|
||||
: null,
|
||||
availableActions: normalizeActionCodes(task.available_actions || []),
|
||||
@@ -125,6 +142,7 @@ export function stabilizeTaskObjects(
|
||||
const NEEDS_ACTION_LIFECYCLES = new Set([
|
||||
'blocked',
|
||||
'waiting_review',
|
||||
'waiting_human',
|
||||
'pending_review',
|
||||
'manual_upload_pending',
|
||||
'failed',
|
||||
@@ -132,6 +150,75 @@ const NEEDS_ACTION_LIFECYCLES = new Set([
|
||||
'upload_rpa_failed',
|
||||
]);
|
||||
|
||||
/**
|
||||
* Intake / OT 过渡稳定器。
|
||||
* 用途:后端 Intake 与 ShippingOrderTask 往往不在同一事务窗出现。
|
||||
* 一旦看到过 order_task 后,接下来 2 秒内即便 work_items 里没有 order_task,
|
||||
* 也不立即回退 embedded,避免轮询刷新在「待复核 ⇄ 待复核(兼容态」之间
|
||||
* 跳变,实际上是 OT 还没在本次响应里出现,下一轮就有。
|
||||
*/
|
||||
export interface IntakeOtStabilizer {
|
||||
/** 注入「此会话是否已经至少出现过一次 order_task」。 */
|
||||
hasSeenOrderTaskBefore(conversationId?: string | null): boolean;
|
||||
/** 当且仅当 work_items 里确实有 order_task 时调用,记录“见过 OT 并更新时间戳。 */
|
||||
markSeen(conversationId?: string | null): void;
|
||||
/** 手动刷新/重载/离开页面重进时清空时间戳,允许回到 embedded 兼容态。 */
|
||||
reset(conversationId?: string | null): void;
|
||||
}
|
||||
|
||||
export function createIntakeOtStabilizer(options?: { graceMs?: number }): IntakeOtStabilizer {
|
||||
const graceMs = Number(options?.graceMs ?? 2000);
|
||||
const seen = new Map<string, number>();
|
||||
const global: { ts: number | null } = { ts: null };
|
||||
function getNow() {
|
||||
return Date.now();
|
||||
}
|
||||
return {
|
||||
hasSeenOrderTaskBefore(conversationId?: string | null): boolean {
|
||||
const now = getNow();
|
||||
if (conversationId) {
|
||||
const ts = seen.get(conversationId);
|
||||
if (typeof ts === 'number' && now - ts <= graceMs) return true;
|
||||
}
|
||||
const gts = global.ts;
|
||||
if (typeof gts === 'number' && now - gts <= graceMs) return true;
|
||||
return false;
|
||||
},
|
||||
markSeen(conversationId?: string | null): void {
|
||||
const now = getNow();
|
||||
global.ts = now;
|
||||
if (conversationId) seen.set(conversationId, now);
|
||||
},
|
||||
reset(conversationId?: string | null): void {
|
||||
global.ts = null;
|
||||
if (conversationId) seen.delete(conversationId);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 归一化生命周期状态:把旧/兼容形态统一映射为新的单一状态。
|
||||
* 核心逻辑:waiting_human(旧 conversation_processing 兜底)一律归并为
|
||||
* waiting_review(新统一投影);pending_review 收敛到 waiting_review;
|
||||
* 其它保持原值。用于避免两套投影切换时造成状态文本闪烁、语义签名漂移。
|
||||
* @param status - 原始 lifecycle / userStatus / status_label
|
||||
* @returns 归一化后的生命周期状态码
|
||||
*/
|
||||
export function normalizeLifecycleStatus(
|
||||
status: string | null | undefined,
|
||||
): string {
|
||||
const raw = String(status || '').trim().toLowerCase();
|
||||
if (!raw) return '';
|
||||
// [LEGACY-UNIFY] 旧兼容状态一律收敛为 waiting_review,保证显示「待复核」而非 waiting human。
|
||||
if (raw === 'waiting_human' || raw === 'pending_review' || raw === 'review_required') {
|
||||
return 'waiting_review';
|
||||
}
|
||||
if (raw === 'partially_completed') return 'waiting_review';
|
||||
if (raw === 'manual_upload' || raw === 'waiting_manual_upload') return 'manual_upload_pending';
|
||||
if (raw === 'retryable') return 'failed';
|
||||
return raw;
|
||||
}
|
||||
|
||||
const HUMAN_ACTION_CODES = new Set([
|
||||
'confirm_customer', 'resolve_field_conflicts', 'adjudicate_duplicate',
|
||||
'open_order_review', 'open_order_processing', 'enter_manual_review',
|
||||
@@ -403,14 +490,11 @@ export function classifyConversationProcessingGroup(
|
||||
options?: { hasBlockingGate?: boolean; needsCustomerConfirm?: boolean },
|
||||
): ConversationProcessingTaskGroup {
|
||||
if (options?.needsCustomerConfirm) return 'needs_action';
|
||||
const normalized = String(status || '').trim();
|
||||
const normalized = normalizeLifecycleStatus(status);
|
||||
if (NEEDS_ACTION_LIFECYCLES.has(normalized)) return 'needs_action';
|
||||
if (COMPLETED_LIFECYCLES.has(normalized)) return 'completed';
|
||||
if (HISTORY_LIFECYCLES.has(normalized)) return 'history';
|
||||
if (PROCESSING_LIFECYCLES.has(normalized)) return 'processing';
|
||||
if (normalized === 'review_required' || normalized === 'partially_completed') {
|
||||
return 'needs_action';
|
||||
}
|
||||
if (normalized === 'failed') return 'needs_action';
|
||||
if (normalized === 'completed') return 'completed';
|
||||
if (normalized === 'processing' || normalized === 'queued') return 'processing';
|
||||
@@ -433,7 +517,8 @@ function fallbackTaskIdentityKey(item: ShippingWorkflowItem): string {
|
||||
if (filename) return `fn:${filename}`;
|
||||
const runNo = String(item.current_run_no || '').trim();
|
||||
if (runNo) return `run:${runNo}`;
|
||||
return `item:${String(item.item_no || '').trim()}`;
|
||||
const itemNo = String(item.item_no || '').trim();
|
||||
return `item:${itemNo}`;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -544,7 +629,7 @@ export function projectConversationProcessingTasks(
|
||||
const uniqueDocuments = dedupeFallbackDocuments(groupItems);
|
||||
const effectiveItems = uniqueDocuments.map((row) => row.source_item);
|
||||
// 任务级分组/操作只由最近代表 Item 决定;旧 Run 仅贡献未受影响的 PDF,不得反向污染状态。
|
||||
const statuses = [resolveItemDisplayStatus(primaryItem)];
|
||||
const statuses = [normalizeLifecycleStatus(resolveItemDisplayStatus(primaryItem))];
|
||||
const primaryActions = Array.isArray(primaryItem.available_actions)
|
||||
? primaryItem.available_actions
|
||||
: [];
|
||||
@@ -706,8 +791,8 @@ export function groupConversationProcessingTasks(
|
||||
export function mapShippingProcessingStatusToTaskGroup(
|
||||
item: ShippingProcessingProjection,
|
||||
): ConversationProcessingTaskGroup {
|
||||
const status = String(item.status || '').trim().toLowerCase();
|
||||
const gateAction = String(item.currentGate?.nextActionCode || '').trim().toLowerCase();
|
||||
const status = String(item.userStatus ?? item.status ?? '').trim().toLowerCase();
|
||||
const gateAction = String(item.primaryAction?.code ?? item.currentGate?.nextActionCode ?? '').trim().toLowerCase();
|
||||
const hasHumanAction = [gateAction, ...(item.availableActions || [])]
|
||||
.map((value) => String(value || '').trim().toLowerCase())
|
||||
.some((value) => HUMAN_ACTION_CODES.has(value) || value.startsWith('retry_failed_'));
|
||||
@@ -715,6 +800,8 @@ export function mapShippingProcessingStatusToTaskGroup(
|
||||
status === 'waiting_review'
|
||||
|| status === 'blocked'
|
||||
|| status === 'failed'
|
||||
|| status === 'waiting_human'
|
||||
|| status === 'retryable'
|
||||
|| hasHumanAction
|
||||
) {
|
||||
return 'needs_action';
|
||||
@@ -737,7 +824,9 @@ export function mergeConversationProcessingFocusMetadata(
|
||||
embedded: ConversationProcessingProjection | null | undefined,
|
||||
): ConversationProcessingProjection | null {
|
||||
if (!derived) {
|
||||
return embedded && typeof embedded === 'object' ? embedded : null;
|
||||
return embedded && typeof embedded === 'object'
|
||||
? normalizeConversationProcessingProjection(embedded)
|
||||
: null;
|
||||
}
|
||||
if (!embedded || typeof embedded !== 'object') return derived;
|
||||
return {
|
||||
@@ -762,18 +851,99 @@ export function resolveConversationProcessingFromUnified(
|
||||
workItems: ShippingProcessingProjection[] | null | undefined,
|
||||
embedded: ConversationProcessingProjection | null | undefined,
|
||||
previousProjection?: ConversationProcessingProjection | null,
|
||||
stabilizer?: { hasSeenOrderTaskBefore?(conversationId?: string | null): boolean; markSeen?(conversationId?: string | null): void; reset?(conversationId?: string | null): void; conversationId?: string | null },
|
||||
): ConversationProcessingProjection | null {
|
||||
const items = Array.isArray(workItems) ? workItems : [];
|
||||
if (items.length > 0) {
|
||||
// [TRANSITION] 只有统一投影里明确存在 order_task,才认为 OT 维度已经成形。
|
||||
// 仅 order_intake 存在时视为过渡阶段:
|
||||
// - 如果此会话/全局在此之前已见到过 order_task(2s 窗口内),
|
||||
// 则延迟回退 embedded,保持 previousProjection 不变,避免闪烁;
|
||||
// - 否则仍走 embedded,但强制 normalize 成 waiting_review。
|
||||
const hasOrderTask = items.some((item) => item.workItemType === 'order_task');
|
||||
const convId = stabilizer?.conversationId;
|
||||
if (hasOrderTask) {
|
||||
stabilizer?.markSeen?.(convId);
|
||||
return mergeConversationProcessingFocusMetadata(
|
||||
projectConversationProcessingFromWorkItems(items, previousProjection),
|
||||
embedded,
|
||||
);
|
||||
}
|
||||
if (embedded && typeof embedded === 'object') return embedded;
|
||||
const sawOrderTaskRecently = stabilizer?.hasSeenOrderTaskBefore?.(convId) === true;
|
||||
if (sawOrderTaskRecently && previousProjection) {
|
||||
// 刚刚看到过 OT 但这轮响应暂缺 OT:不立即切回 embedded,保持上一轮投影。
|
||||
// 这样 2s 内轮询不会把右侧任务卡从 order_task 派生结果抖回旧 projection。
|
||||
return previousProjection;
|
||||
}
|
||||
if (embedded && typeof embedded === 'object') {
|
||||
return normalizeConversationProcessingProjection(embedded);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 归一化旧 conversation_processing 投影的生命周期状态。
|
||||
* 核心逻辑:将所有组的 userStatus/status_label 统一为新形态,waiting_human 归并为 waiting_review,
|
||||
* 避免 work_items 为空回退时,旧投影状态与统一 work_items 状态来回切换造成文案闪烁。
|
||||
*
|
||||
* @param projection - 原始 embedded conversation_processing 投影
|
||||
* @returns 归一化后的投影(新对象,浅拷贝 tasks 并覆盖 userStatus/status_label)
|
||||
*/
|
||||
export function normalizeConversationProcessingProjection(
|
||||
projection: ConversationProcessingProjection,
|
||||
): ConversationProcessingProjection {
|
||||
const normalizeTask = (task: ConversationProcessingUserTask): ConversationProcessingUserTask => {
|
||||
const rawStatus = task.userStatus ?? task.status_label;
|
||||
const normalizedStatus = normalizeLifecycleStatus(rawStatus);
|
||||
const availableActions = Array.isArray(task.available_actions) ? task.available_actions : [];
|
||||
const hasHumanAction = availableActions.some((value) => {
|
||||
const code = String(value || '').trim().toLowerCase();
|
||||
return HUMAN_ACTION_CODES.has(code) || code.startsWith('retry_failed_');
|
||||
});
|
||||
const recomputedGroup = classifyConversationProcessingGroup(normalizedStatus || rawStatus, {
|
||||
needsCustomerConfirm: hasHumanAction,
|
||||
});
|
||||
const finalGroup: ConversationProcessingTaskGroup = (() => {
|
||||
// [LEGACY-UNIFY] waiting_human 旧投影若被归在 processing / history,强制迁入 needs_action。
|
||||
if (recomputedGroup === 'needs_action') return 'needs_action';
|
||||
if (normalizedStatus === 'waiting_review') return 'needs_action';
|
||||
return task.group || recomputedGroup;
|
||||
})();
|
||||
return {
|
||||
...task,
|
||||
status_label: normalizedStatus || (task.status_label ?? ''),
|
||||
// userStatus 保持原有强类型;会话侧展示统一走 status_label/group,避免放宽成 string 破坏类型契约。
|
||||
userStatus: task.userStatus ?? null,
|
||||
group: finalGroup,
|
||||
};
|
||||
};
|
||||
const normalizedAll = [
|
||||
...(projection.needs_action || []),
|
||||
...(projection.processing || []),
|
||||
...(projection.completed || []),
|
||||
...(projection.history || []),
|
||||
].map(normalizeTask);
|
||||
const needs_action = normalizedAll.filter((task) => task.group === 'needs_action');
|
||||
const processing = normalizedAll.filter((task) => task.group === 'processing');
|
||||
const completed = normalizedAll.filter((task) => task.group === 'completed');
|
||||
const history = normalizedAll.filter((task) => task.group === 'history');
|
||||
return {
|
||||
...projection,
|
||||
summary: {
|
||||
...(projection.summary || {}),
|
||||
total_tasks: normalizedAll.length,
|
||||
total_files: normalizedAll.reduce((sum, task) => sum + Number(task.file_count || 0), 0),
|
||||
needs_action: needs_action.length,
|
||||
processing: processing.length,
|
||||
completed: completed.length,
|
||||
history: history.length,
|
||||
},
|
||||
needs_action,
|
||||
processing,
|
||||
completed,
|
||||
history,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 从统一 work_items 合成 ConversationProcessingProjection(仅 order_task)。
|
||||
*
|
||||
@@ -801,7 +971,39 @@ export function projectConversationProcessingFromWorkItems(
|
||||
const docCount = Number(item.sourceSummary?.documentCount || 0);
|
||||
const filename = String(item.sourceSummary?.filename || '').trim();
|
||||
const normalizedActions = normalizeActionCodes(item.availableActions || []);
|
||||
const gateNextAction = String(item.currentGate?.nextActionCode || '').trim().toLowerCase() || null;
|
||||
const gateNextAction = String(item.primaryAction?.code ?? item.currentGate?.nextActionCode ?? '').trim().toLowerCase() || null;
|
||||
const effectiveStatus = normalizeLifecycleStatus(String(item.userStatus ?? item.status ?? '').trim()) || null;
|
||||
const userBlocking: ConversationProcessingUserTask['blockingReason'] = (item.blockingReason && typeof item.blockingReason === 'object')
|
||||
? {
|
||||
code: item.blockingReason.code,
|
||||
i18nKey: (item.blockingReason as { i18nKey?: string | null }).i18nKey
|
||||
?? (item.blockingReason as { i18n_key?: string | null }).i18n_key
|
||||
?? undefined,
|
||||
details: (item.blockingReason as { details?: Record<string, unknown> }).details,
|
||||
} satisfies ShippingProcessingBlockingReason
|
||||
: null;
|
||||
const userPrimaryAction: ConversationProcessingUserTask['primaryAction'] = item.primaryAction
|
||||
? {
|
||||
code: item.primaryAction.code,
|
||||
i18nKey: (item.primaryAction as { i18nKey?: string | null }).i18nKey
|
||||
?? (item.primaryAction as { i18n_key?: string | null }).i18n_key
|
||||
?? undefined,
|
||||
parameters: (item.primaryAction as { parameters?: Record<string, unknown> }).parameters,
|
||||
} satisfies ShippingProcessingPrimaryAction
|
||||
: null;
|
||||
const userFacts: ConversationProcessingUserTask['facts'] = item.facts
|
||||
? {
|
||||
inventorySourceStatus: (item.facts as { inventorySourceStatus?: string | null }).inventorySourceStatus ?? undefined,
|
||||
candidateSourceCodes: (item.facts as { candidateSourceCodes?: string[] }).candidateSourceCodes ?? [],
|
||||
preparedSourceCodes: (item.facts as { preparedSourceCodes?: string[] }).preparedSourceCodes ?? [],
|
||||
pendingSourceCodes: (item.facts as { pendingSourceCodes?: string[] }).pendingSourceCodes ?? [],
|
||||
lineResolutions: (item.facts as { lineResolutions?: Record<string, unknown>[] }).lineResolutions ?? undefined,
|
||||
exportState: (item.facts as { exportState?: string }).exportState ?? undefined,
|
||||
uploadState: (item.facts as { uploadState?: string }).uploadState ?? undefined,
|
||||
switchState: (item.facts as { switchState?: string }).switchState ?? undefined,
|
||||
forcedMatchSourceCode: (item.facts as { forcedMatchSourceCode?: string | null }).forcedMatchSourceCode ?? undefined,
|
||||
} satisfies ShippingProcessingFacts
|
||||
: undefined;
|
||||
const task: ConversationProcessingUserTask = {
|
||||
user_task_no: taskNo,
|
||||
user_task_authoritative: true,
|
||||
@@ -809,13 +1011,21 @@ export function projectConversationProcessingFromWorkItems(
|
||||
display_kind: docCount > 1 ? 'multi_document_task' : 'single_document_task',
|
||||
document_names: filename ? [filename] : [],
|
||||
group,
|
||||
status_label: String(item.status || '') || null,
|
||||
status_label: effectiveStatus,
|
||||
file_count: docCount > 0 ? docCount : (filename ? 1 : 0),
|
||||
run_no: String(item.runNo || '').trim() || null,
|
||||
can_append: false,
|
||||
last_activity_at: item.lastActivityAt || null,
|
||||
available_actions: normalizedActions,
|
||||
primary_action: gateNextAction || normalizedActions[0] || null,
|
||||
userStatus: item.userStatus ?? null,
|
||||
blockingReason: userBlocking,
|
||||
primaryAction: userPrimaryAction,
|
||||
facts: userFacts,
|
||||
retryable: typeof item.retryable === 'boolean' ? item.retryable : false,
|
||||
userCurrentGateCode: item.userCurrentGateCode ?? null,
|
||||
legacyStatus: item.legacyStatus ?? null,
|
||||
legacyStage: item.legacyStage ?? null,
|
||||
};
|
||||
rawTasks.push(task);
|
||||
}
|
||||
|
||||
@@ -75,6 +75,51 @@ describe('normalizeShippingProcessingProjection', () => {
|
||||
expect(normalized?.stageNodes?.[1]?.absoluteIndex).toBe(2);
|
||||
});
|
||||
|
||||
it('normalizes structured inventory candidate facts', () => {
|
||||
const projection = normalizeShippingProcessingProjection({
|
||||
work_item_no: 'SN-001',
|
||||
work_item_type: 'order_task',
|
||||
source_type: 'eml',
|
||||
submission_no: 'SUB-1',
|
||||
intake_no: 'INT-1',
|
||||
status: 'processing',
|
||||
stage: 'inventory_matching',
|
||||
progress_version: 2,
|
||||
last_activity_at: '2026-08-08T22:00:00',
|
||||
source_summary: {},
|
||||
available_actions: [],
|
||||
child_order_tasks: [],
|
||||
blocking_reason: {
|
||||
code: 'inventory_candidates_missing',
|
||||
i18n_key: 'workspace.shippingNotice.processGate.reasons.inventory_candidates_missing',
|
||||
},
|
||||
facts: {
|
||||
candidate_set_id: 12,
|
||||
candidate_set_version: 3,
|
||||
candidate_set_status: 'frozen',
|
||||
candidate_source_codes: ['DBS_DUB'],
|
||||
prepared_source_codes: ['DBS_DUB'],
|
||||
pending_source_codes: ['DBS_RTM'],
|
||||
failed_source_codes: ['DBS_SIN'],
|
||||
source_attempts: {
|
||||
DBS_DUB: { status: 'consumed', attempt_no: 1 },
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(projection?.facts?.candidateSetId).toBe(12);
|
||||
expect(projection?.facts?.candidateSetVersion).toBe(3);
|
||||
expect(projection?.facts?.candidateSetStatus).toBe('frozen');
|
||||
expect(projection?.facts?.candidateSourceCodes).toEqual(['DBS_DUB']);
|
||||
expect(projection?.facts?.preparedSourceCodes).toEqual(['DBS_DUB']);
|
||||
expect(projection?.facts?.pendingSourceCodes).toEqual(['DBS_RTM']);
|
||||
expect(projection?.facts?.failedSourceCodes).toEqual(['DBS_SIN']);
|
||||
expect(projection?.facts?.sourceAttempts).toEqual({
|
||||
DBS_DUB: { status: 'consumed', attempt_no: 1 },
|
||||
});
|
||||
expect(projection?.blockingReason?.code).toBe('inventory_candidates_missing');
|
||||
});
|
||||
|
||||
it('returns null when work_item_no missing', () => {
|
||||
expect(normalizeShippingProcessingProjection({ status: 'processing' })).toBeNull();
|
||||
});
|
||||
|
||||
@@ -8,7 +8,12 @@
|
||||
import type {
|
||||
OrderIntakeSourceType,
|
||||
ProcessGateSummary,
|
||||
ShippingInventoryPerSourceAttempt,
|
||||
ShippingInventoryPreparationSummary,
|
||||
ShippingOrderTaskSummary,
|
||||
ShippingProcessingBlockingReason,
|
||||
ShippingProcessingFacts,
|
||||
ShippingProcessingPrimaryAction,
|
||||
ShippingProcessingProjection,
|
||||
ShippingProcessingStage,
|
||||
ShippingProcessingStageNode,
|
||||
@@ -98,6 +103,186 @@ function normalizeStageNode(raw: unknown): ShippingProcessingStageNode | null {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* [T9 用户态 Projection] 规范 blocking_reason(后端 snake_case {code, i18n_key, details})。
|
||||
*/
|
||||
function normalizeBlockingReason(raw: unknown): ShippingProcessingBlockingReason | null {
|
||||
if (!raw || typeof raw !== 'object') return null;
|
||||
const item = raw as Record<string, unknown>;
|
||||
const code = String(item.code ?? '').trim();
|
||||
if (!code) return null;
|
||||
return {
|
||||
code,
|
||||
i18nKey: item.i18n_key != null ? String(item.i18n_key) : (item.i18nKey != null ? String(item.i18nKey) : null),
|
||||
details:
|
||||
typeof item.details === 'object' && item.details != null
|
||||
? (item.details as Record<string, unknown>)
|
||||
: {},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* [T9 用户态 Projection] 规范 primary_action(后端 snake_case {code, i18n_key, parameters})。
|
||||
*/
|
||||
function normalizePrimaryAction(raw: unknown): ShippingProcessingPrimaryAction | null {
|
||||
if (!raw || typeof raw !== 'object') return null;
|
||||
const item = raw as Record<string, unknown>;
|
||||
const code = String(item.code ?? '').trim();
|
||||
if (!code) return null;
|
||||
return {
|
||||
code,
|
||||
i18nKey: item.i18n_key != null ? String(item.i18n_key) : (item.i18nKey != null ? String(item.i18nKey) : null),
|
||||
parameters:
|
||||
typeof item.parameters === 'object' && item.parameters != null
|
||||
? (item.parameters as Record<string, unknown>)
|
||||
: {},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* [T9 用户态 Projection] 规范 facts(后端 snake_case 子状态字典;camelCase key)。
|
||||
*/
|
||||
function normalizeFacts(raw: unknown): ShippingProcessingFacts | undefined {
|
||||
if (!raw || typeof raw !== 'object') return undefined;
|
||||
const item = raw as Record<string, unknown>;
|
||||
const toStrArr = (value: unknown): string[] => {
|
||||
if (!Array.isArray(value)) return [];
|
||||
return value.map((c) => String(c ?? '').trim()).filter(Boolean);
|
||||
};
|
||||
const toLineArr = (value: unknown): Record<string, unknown>[] => {
|
||||
if (!Array.isArray(value)) return [];
|
||||
return value.filter((row): row is Record<string, unknown> => Boolean(row) && typeof row === 'object');
|
||||
};
|
||||
const out: ShippingProcessingFacts = {};
|
||||
if ('inventory_source_status' in item || 'inventorySourceStatus' in item) {
|
||||
out.inventorySourceStatus =
|
||||
item.inventory_source_status != null
|
||||
? String(item.inventory_source_status)
|
||||
: item.inventorySourceStatus != null
|
||||
? String(item.inventorySourceStatus)
|
||||
: null;
|
||||
}
|
||||
if ('candidate_set_id' in item || 'candidateSetId' in item) {
|
||||
const v = item.candidate_set_id ?? item.candidateSetId;
|
||||
out.candidateSetId = v == null || v === '' ? null : Number(v);
|
||||
}
|
||||
if ('candidate_set_version' in item || 'candidateSetVersion' in item) {
|
||||
const v = item.candidate_set_version ?? item.candidateSetVersion;
|
||||
out.candidateSetVersion = v == null || v === '' ? null : Number(v);
|
||||
}
|
||||
if ('candidate_set_status' in item || 'candidateSetStatus' in item) {
|
||||
const v = item.candidate_set_status ?? item.candidateSetStatus;
|
||||
out.candidateSetStatus = v == null || v === '' ? null : String(v) as ShippingProcessingFacts['candidateSetStatus'];
|
||||
}
|
||||
if ('candidate_source_codes' in item || 'candidateSourceCodes' in item) {
|
||||
out.candidateSourceCodes = toStrArr(item.candidate_source_codes ?? item.candidateSourceCodes);
|
||||
}
|
||||
if ('prepared_source_codes' in item || 'preparedSourceCodes' in item) {
|
||||
out.preparedSourceCodes = toStrArr(item.prepared_source_codes ?? item.preparedSourceCodes);
|
||||
}
|
||||
if ('pending_source_codes' in item || 'pendingSourceCodes' in item) {
|
||||
out.pendingSourceCodes = toStrArr(item.pending_source_codes ?? item.pendingSourceCodes);
|
||||
}
|
||||
if ('failed_source_codes' in item || 'failedSourceCodes' in item) {
|
||||
out.failedSourceCodes = toStrArr(item.failed_source_codes ?? item.failedSourceCodes);
|
||||
}
|
||||
if ('source_attempts' in item || 'sourceAttempts' in item) {
|
||||
const v = item.source_attempts ?? item.sourceAttempts;
|
||||
out.sourceAttempts = typeof v === 'object' && v != null ? v as Record<string, unknown> : {};
|
||||
}
|
||||
if ('line_resolutions' in item || 'lineResolutions' in item) {
|
||||
out.lineResolutions = toLineArr(item.line_resolutions ?? item.lineResolutions);
|
||||
}
|
||||
if ('export_state' in item || 'exportState' in item) {
|
||||
const v = item.export_state ?? item.exportState;
|
||||
out.exportState = v == null ? 'not_created' : String(v);
|
||||
}
|
||||
if ('upload_state' in item || 'uploadState' in item) {
|
||||
const v = item.upload_state ?? item.uploadState;
|
||||
out.uploadState = v == null ? 'not_created' : String(v);
|
||||
}
|
||||
if ('switch_state' in item || 'switchState' in item) {
|
||||
const v = item.switch_state ?? item.switchState;
|
||||
out.switchState = v == null ? 'not_triggered' : String(v);
|
||||
}
|
||||
if ('forced_match_source_code' in item || 'forcedMatchSourceCode' in item) {
|
||||
const v = item.forced_match_source_code ?? item.forcedMatchSourceCode;
|
||||
out.forcedMatchSourceCode = v == null || v === '' ? null : String(v).toUpperCase();
|
||||
}
|
||||
for (const [k, v] of Object.entries(item)) {
|
||||
if (!(k in out)) {
|
||||
out[k] = v;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* 题4A:规范 inventory_preparation 结构化字段(snake_case → camelCase)。
|
||||
* 注意:failed_sources 会进一步透传到 exhausted_sources 分开(二者互斥;仅 max_attempts 耗尽的源进 exhausted)。
|
||||
*/
|
||||
function normalizeInventoryPreparation(raw: unknown): ShippingInventoryPreparationSummary | null {
|
||||
if (!raw || typeof raw !== 'object') return null;
|
||||
const item = raw as Record<string, unknown>;
|
||||
const toStrArr = (value: unknown): string[] => {
|
||||
if (!Array.isArray(value)) return [];
|
||||
return value.map((c) => String(c ?? '').trim()).filter(Boolean);
|
||||
};
|
||||
const requiredSources = toStrArr(item.required_sources ?? item.requiredSources);
|
||||
if (!requiredSources.length) {
|
||||
// required_sources 空代表 inventory_preparation 实际尚未进入 inventory 阶段,返回 null 避免前端误判。
|
||||
return null;
|
||||
}
|
||||
const preparedSources = toStrArr(item.prepared_sources ?? item.preparedSources);
|
||||
const pendingSources = toStrArr(item.pending_sources ?? item.pendingSources);
|
||||
const failedSources = toStrArr(item.failed_sources ?? item.failedSources);
|
||||
const exhaustedSources = toStrArr(item.exhausted_sources ?? item.exhaustedSources);
|
||||
const activeAttemptCount = Number(item.active_attempt_count ?? item.activeAttemptCount ?? 0) || 0;
|
||||
const gateAttemptActive = Boolean(item.gate_attempt_active ?? item.gateAttemptActive ?? false);
|
||||
const latestRaw = (item.latest_attempts ?? item.latestAttempts) as Record<string, unknown> | undefined;
|
||||
const latestAttempts: Record<string, ShippingInventoryPerSourceAttempt> = {};
|
||||
if (latestRaw && typeof latestRaw === 'object') {
|
||||
for (const [key, val] of Object.entries(latestRaw)) {
|
||||
if (!val || typeof val !== 'object') continue;
|
||||
const row = val as Record<string, unknown>;
|
||||
const sourceCode = String(row.source_code ?? row.sourceCode ?? key ?? '').trim().toUpperCase();
|
||||
if (!sourceCode) continue;
|
||||
const attemptNo = Number(row.attempt_no ?? row.attemptNo ?? 0) || 0;
|
||||
const status = String(row.status || '').trim().toLowerCase() || 'unknown';
|
||||
const entry: ShippingInventoryPerSourceAttempt = {
|
||||
sourceCode,
|
||||
attemptNo,
|
||||
status,
|
||||
manualRetryable: (() => {
|
||||
if (row.manual_retryable != null) return Boolean(row.manual_retryable);
|
||||
if (row.manualRetryable != null) return Boolean(row.manualRetryable);
|
||||
return ['failed', 'exhausted'].includes(status);
|
||||
})(),
|
||||
message:
|
||||
(row.error_message as string | null | undefined) ??
|
||||
(row.errorMessage as string | null | undefined) ??
|
||||
(row.message as string | null | undefined) ??
|
||||
null,
|
||||
updatedAt:
|
||||
readNullableString(row, 'updated_at', 'updatedAt') ??
|
||||
readNullableString(row, 'finished_at', 'finishedAt') ??
|
||||
readNullableString(row, 'started_at', 'startedAt'),
|
||||
};
|
||||
latestAttempts[sourceCode] = entry;
|
||||
}
|
||||
}
|
||||
return {
|
||||
requiredSources,
|
||||
preparedSources,
|
||||
pendingSources,
|
||||
failedSources,
|
||||
exhaustedSources,
|
||||
activeAttemptCount,
|
||||
gateAttemptActive,
|
||||
latestAttempts: Object.keys(latestAttempts).length ? latestAttempts : undefined,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 将后端 / 混合字段投影规范为 ShippingProcessingProjection。
|
||||
* 核心逻辑:缺字段给安全默认值,保证四页面可渲染;非法输入返回 null。
|
||||
@@ -160,6 +345,23 @@ export function normalizeShippingProcessingProjection(
|
||||
assetStatus: readNullableString(summaryRaw, 'asset_status', 'assetStatus'),
|
||||
},
|
||||
childOrderTasks: children,
|
||||
// [T9 用户态 Projection 7 字段] 优先读后端 user_* / blocking_reason / retryable / primary_action / facts;
|
||||
// 缺省为 null(旧后端不会下发,旧前端不读取,完全兼容)。
|
||||
userStatus: readNullableString(item, 'user_status', 'userStatus') as ShippingProcessingProjection['userStatus'],
|
||||
userStage: readNullableString(item, 'user_stage', 'userStage') as ShippingProcessingProjection['userStage'],
|
||||
userCurrentGateCode: readNullableString(item, 'user_current_gate_code', 'userCurrentGateCode'),
|
||||
blockingReason: normalizeBlockingReason(item.blocking_reason ?? item.blockingReason),
|
||||
retryable:
|
||||
(item.retryable as boolean | undefined) == null ? false : Boolean(item.retryable),
|
||||
primaryAction: normalizePrimaryAction(item.primary_action ?? item.primaryAction),
|
||||
facts: normalizeFacts(item.facts),
|
||||
legacyStatus: readNullableString(item, 'legacy_status', 'legacyStatus'),
|
||||
legacyStage: readNullableString(item, 'legacy_stage', 'legacyStage'),
|
||||
hasFormalOt:
|
||||
(item.has_formal_ot as boolean | undefined) == null ? false : Boolean(item.has_formal_ot),
|
||||
inventoryPreparation: normalizeInventoryPreparation(
|
||||
item.inventory_preparation ?? item.inventoryPreparation,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,39 @@ function buildUnifiedProcessing(conversationId = 'conv-1') {
|
||||
};
|
||||
}
|
||||
|
||||
function buildOrderTaskWorkItem(
|
||||
taskNo = 'OT-conv-1',
|
||||
patch: Record<string, unknown> = {},
|
||||
) {
|
||||
return {
|
||||
workItemType: 'order_task',
|
||||
workItemNo: taskNo,
|
||||
sourceType: 'direct_pdf',
|
||||
rootOrderTaskNo: taskNo,
|
||||
shippingNoticeNo: null,
|
||||
conversationId: 'conv-1',
|
||||
submissionNo: 'SOS-1',
|
||||
intakeNo: 'SNI-1',
|
||||
status: 'processing',
|
||||
stage: 'document_parsing',
|
||||
progressVersion: 1,
|
||||
lastActivityAt: '2026-08-05T00:00:00Z',
|
||||
currentGate: null,
|
||||
availableActions: [],
|
||||
sourceSummary: {
|
||||
emailSubject: null,
|
||||
filename: 'po.pdf',
|
||||
documentCount: 1,
|
||||
parsedDocumentCount: 1,
|
||||
candidateCount: 1,
|
||||
customerName: null,
|
||||
poNumber: 'PO-1',
|
||||
},
|
||||
childOrderTasks: [],
|
||||
...patch,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建可手动完成的 Promise。
|
||||
*/
|
||||
@@ -182,36 +215,16 @@ describe('useShippingNoticeWorkflow', () => {
|
||||
it('uses unified work_items as the sole processing read source', async () => {
|
||||
api.getShippingProcessing.mockResolvedValue({
|
||||
conversation_id: 'conv-1',
|
||||
work_items: [{
|
||||
workItemType: 'order_task',
|
||||
workItemNo: 'OT-UNIFIED',
|
||||
sourceType: 'direct_pdf',
|
||||
rootOrderTaskNo: 'OT-UNIFIED',
|
||||
shippingNoticeNo: null,
|
||||
conversationId: 'conv-1',
|
||||
submissionNo: 'SOS-1',
|
||||
intakeNo: 'SNI-1',
|
||||
work_items: [buildOrderTaskWorkItem('OT-UNIFIED', {
|
||||
status: 'waiting_review',
|
||||
stage: 'waiting_review',
|
||||
progressVersion: 1,
|
||||
lastActivityAt: '2026-08-05T00:00:00Z',
|
||||
currentGate: {
|
||||
gateCode: 'order_freeze_readiness',
|
||||
status: 'blocked',
|
||||
nextActionCode: 'open_order_review',
|
||||
},
|
||||
availableActions: ['open_order_review'],
|
||||
sourceSummary: {
|
||||
emailSubject: null,
|
||||
filename: 'po.pdf',
|
||||
documentCount: 1,
|
||||
parsedDocumentCount: 1,
|
||||
candidateCount: 1,
|
||||
customerName: null,
|
||||
poNumber: 'PO-1',
|
||||
},
|
||||
childOrderTasks: [],
|
||||
}],
|
||||
})],
|
||||
conversation_processing: null,
|
||||
});
|
||||
|
||||
@@ -226,6 +239,60 @@ describe('useShippingNoticeWorkflow', () => {
|
||||
ctl.stop();
|
||||
});
|
||||
|
||||
it('preserves previous order_task work_items when stabilizer keeps previous projection', async () => {
|
||||
api.getShippingProcessing
|
||||
.mockResolvedValueOnce({
|
||||
conversation_id: 'conv-1',
|
||||
work_items: [buildOrderTaskWorkItem('OT-STABLE')],
|
||||
conversation_processing: null,
|
||||
})
|
||||
.mockResolvedValueOnce({
|
||||
conversation_id: 'conv-1',
|
||||
work_items: [{
|
||||
workItemType: 'order_intake',
|
||||
workItemNo: 'SNI-1',
|
||||
sourceType: 'email',
|
||||
conversationId: 'conv-1',
|
||||
intakeNo: 'SNI-1',
|
||||
status: 'processing',
|
||||
stage: 'parsing',
|
||||
progressVersion: 1,
|
||||
lastActivityAt: '2026-08-05T00:00:01Z',
|
||||
currentGate: null,
|
||||
availableActions: [],
|
||||
sourceSummary: {
|
||||
emailSubject: 'mail',
|
||||
filename: 'po.pdf',
|
||||
documentCount: 1,
|
||||
parsedDocumentCount: 0,
|
||||
candidateCount: 0,
|
||||
customerName: null,
|
||||
poNumber: null,
|
||||
},
|
||||
childOrderTasks: [],
|
||||
}],
|
||||
conversation_processing: buildProcessing(),
|
||||
});
|
||||
|
||||
const ctl = useShippingNoticeWorkflow({ conversationId: ref('conv-1') });
|
||||
await vi.advanceTimersByTimeAsync(0);
|
||||
await nextTick();
|
||||
await Promise.resolve();
|
||||
|
||||
expect(ctl.processing.value?.processing[0]?.user_task_no).toBe('OT-STABLE');
|
||||
expect(ctl.processingWorkItems.value[0]?.workItemType).toBe('order_task');
|
||||
|
||||
await vi.advanceTimersByTimeAsync(2000);
|
||||
await nextTick();
|
||||
await Promise.resolve();
|
||||
|
||||
expect(ctl.processing.value?.processing[0]?.user_task_no).toBe('OT-STABLE');
|
||||
expect(ctl.processingWorkItems.value).toHaveLength(1);
|
||||
expect(ctl.processingWorkItems.value[0]?.workItemType).toBe('order_task');
|
||||
expect(ctl.processingWorkItems.value[0]?.workItemNo).toBe('OT-STABLE');
|
||||
ctl.stop();
|
||||
});
|
||||
|
||||
it('derives sibling OT tasks from work_items when embedded conversation_processing omits them', async () => {
|
||||
api.getShippingProcessing.mockResolvedValue({
|
||||
conversation_id: 'conv-1',
|
||||
|
||||
@@ -32,6 +32,7 @@ import type {
|
||||
} from '../types/shipping.api.types';
|
||||
import {
|
||||
buildProcessingSemanticKey,
|
||||
createIntakeOtStabilizer,
|
||||
resolveConversationProcessingFromUnified,
|
||||
} from './conversationProcessingProjection';
|
||||
|
||||
@@ -147,6 +148,27 @@ export function useShippingNoticeWorkflow(
|
||||
let failureCount = 0;
|
||||
let pollingStopped = false;
|
||||
let lastSemanticKey = '';
|
||||
const intakeOtStabilizer = createIntakeOtStabilizer();
|
||||
|
||||
/**
|
||||
* 在 Intake→OT 过渡窗里,若 projection 被稳定器保留为上一轮 OT 视图,
|
||||
* 则 work_items 也必须同步保留上一轮 order_task;否则卡片正文与侧边进度条
|
||||
* 会来自两轮不同响应,导致右侧布局在“带进度条/只剩按钮”之间来回切换。
|
||||
*/
|
||||
function resolveStableWorkItems(
|
||||
nextWorkItems: ShippingProcessingProjection[],
|
||||
previousProjection: ConversationProcessingProjection | null,
|
||||
nextProjection: ConversationProcessingProjection | null,
|
||||
): ShippingProcessingProjection[] {
|
||||
const hasNextOrderTask = nextWorkItems.some((item) => item.workItemType === 'order_task');
|
||||
if (hasNextOrderTask) return nextWorkItems;
|
||||
if (!previousProjection || nextProjection !== previousProjection) return nextWorkItems;
|
||||
const currentWorkItems = Array.isArray(processingWorkItems.value)
|
||||
? processingWorkItems.value
|
||||
: [];
|
||||
const hasCurrentOrderTask = currentWorkItems.some((item) => item.workItemType === 'order_task');
|
||||
return hasCurrentOrderTask ? currentWorkItems : nextWorkItems;
|
||||
}
|
||||
|
||||
const normalizedConversationId = computed(() =>
|
||||
String(readOption(options.conversationId) || '').trim(),
|
||||
@@ -212,10 +234,20 @@ export function useShippingNoticeWorkflow(
|
||||
workItems,
|
||||
embedded,
|
||||
prevProjection,
|
||||
{
|
||||
conversationId,
|
||||
hasSeenOrderTaskBefore: (cId) => intakeOtStabilizer.hasSeenOrderTaskBefore(cId),
|
||||
markSeen: (cId) => intakeOtStabilizer.markSeen(cId),
|
||||
reset: (cId) => intakeOtStabilizer.reset(cId),
|
||||
},
|
||||
);
|
||||
const nextSemanticKey = buildProcessingSemanticKey(nextProjection);
|
||||
|
||||
processingWorkItems.value = workItems;
|
||||
processingWorkItems.value = resolveStableWorkItems(
|
||||
workItems,
|
||||
prevProjection,
|
||||
nextProjection,
|
||||
);
|
||||
if (nextSemanticKey !== lastSemanticKey) {
|
||||
processing.value = nextProjection;
|
||||
lastSemanticKey = nextSemanticKey;
|
||||
@@ -255,6 +287,7 @@ export function useShippingNoticeWorkflow(
|
||||
lastSemanticKey = '';
|
||||
return Promise.resolve();
|
||||
}
|
||||
intakeOtStabilizer.reset(conversationId);
|
||||
if (inFlightRefresh?.conversationId === conversationId) {
|
||||
return inFlightRefresh.promise;
|
||||
}
|
||||
@@ -278,12 +311,16 @@ export function useShippingNoticeWorkflow(
|
||||
}): void {
|
||||
const workItems = Array.isArray(response.work_items) ? response.work_items : [];
|
||||
if (workItems.length > 0) {
|
||||
processingWorkItems.value = workItems as typeof processingWorkItems.value;
|
||||
const nextProjection = resolveConversationProcessingFromUnified(
|
||||
workItems as typeof processingWorkItems.value,
|
||||
response.processing ?? null,
|
||||
processing.value,
|
||||
);
|
||||
processingWorkItems.value = resolveStableWorkItems(
|
||||
workItems as typeof processingWorkItems.value,
|
||||
processing.value,
|
||||
nextProjection,
|
||||
);
|
||||
const nextKey = buildProcessingSemanticKey(nextProjection);
|
||||
if (nextKey !== lastSemanticKey) {
|
||||
processing.value = nextProjection;
|
||||
|
||||
@@ -140,6 +140,125 @@ export type PdfPriorityFieldPolicy =
|
||||
| 'supplement_allowed'
|
||||
| 'review_required';
|
||||
|
||||
/**
|
||||
* 用户态统一 Projection 阻断原因(T8 决策 F2;后端对象 {code, i18n_key, details})。
|
||||
*/
|
||||
export interface ShippingProcessingBlockingReason {
|
||||
code: string;
|
||||
i18nKey?: string | null;
|
||||
details?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户态统一 Projection 主动作(T8 决策 F2;后端对象 {code, i18n_key, parameters})。
|
||||
*/
|
||||
export interface ShippingProcessingPrimaryAction {
|
||||
code: string;
|
||||
i18nKey?: string | null;
|
||||
parameters?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户态统一 Projection facts(T8 决策 F2;子状态事实字典)。
|
||||
*/
|
||||
export interface ShippingProcessingFacts {
|
||||
inventorySourceStatus?: string | null;
|
||||
candidateSetId?: number | null;
|
||||
candidateSetVersion?: number | null;
|
||||
candidateSetStatus?: 'draft' | 'frozen' | 'superseded' | 'invalidated' | null;
|
||||
candidateSourceCodes?: string[];
|
||||
preparedSourceCodes?: string[];
|
||||
pendingSourceCodes?: string[];
|
||||
failedSourceCodes?: string[];
|
||||
sourceAttempts?: Record<string, unknown>;
|
||||
rpaAttempts?: Array<{
|
||||
sourceCode?: string | null;
|
||||
sourceRunNo?: string | null;
|
||||
attemptNo?: number | null;
|
||||
status?: string | null;
|
||||
executionPhase?: string | null;
|
||||
fileGenerated?: boolean;
|
||||
fileExistsAtCallback?: boolean | null;
|
||||
errorCode?: string | null;
|
||||
transactionErrorCode?: string | null;
|
||||
callbackReceivedAt?: string | null;
|
||||
}>;
|
||||
lineResolutions?: Record<string, unknown>[];
|
||||
exportState?: string;
|
||||
uploadState?: string;
|
||||
switchState?: string;
|
||||
forcedMatchSourceCode?: string | null;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface ShippingInventoryCandidateSetSummary {
|
||||
id: number;
|
||||
version: number;
|
||||
status: 'draft' | 'frozen' | 'superseded' | 'invalidated';
|
||||
inputFingerprint: string;
|
||||
frozenAt: string | null;
|
||||
frozenBy: number | null;
|
||||
manifestSnapshotSha256?: string | null;
|
||||
}
|
||||
|
||||
export interface ShippingInventoryCandidateSourceDetail {
|
||||
id: number;
|
||||
candidateSetId: number;
|
||||
sourceCode: string;
|
||||
candidateOrder: number;
|
||||
candidateOrigin: string;
|
||||
routingRuleId?: number | null;
|
||||
routingRuleVersion?: number | string | null;
|
||||
sourceConfigVersion?: string | null;
|
||||
}
|
||||
|
||||
export interface ShippingInventoryCandidateLineDetail {
|
||||
candidateLineId: number;
|
||||
candidateSetId: number;
|
||||
lineNo: number;
|
||||
sourceLineNo?: string | null;
|
||||
partNumber?: string | null;
|
||||
reservationId?: string | null;
|
||||
allowedSourceCodes: string[];
|
||||
}
|
||||
|
||||
export interface ShippingTaskInventoryCandidatesResponse {
|
||||
taskNo: string;
|
||||
currentSet: ShippingInventoryCandidateSetSummary | null;
|
||||
sources: ShippingInventoryCandidateSourceDetail[];
|
||||
lines: ShippingInventoryCandidateLineDetail[];
|
||||
history: ShippingInventoryCandidateSetSummary[];
|
||||
blockingReason?: ShippingProcessingBlockingReason | null;
|
||||
primaryAction?: ShippingProcessingPrimaryAction | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户态统一 Projection status(T8 决策 F2;running / waiting_human / retryable / failed / completed / cancelled)。
|
||||
*/
|
||||
export type ShippingUserProcessingStatus =
|
||||
| 'running'
|
||||
| 'waiting_human'
|
||||
| 'retryable'
|
||||
| 'failed'
|
||||
| 'completed'
|
||||
| 'cancelled';
|
||||
|
||||
/**
|
||||
* 用户态统一 Projection stage(T8 决策 F2;inventory_fetch / inventory_match / excel_generate / freight_upload 等)。
|
||||
*/
|
||||
export type ShippingUserProcessingStage =
|
||||
| 'document_parsing'
|
||||
| 'order_creating'
|
||||
| 'waiting_human_review'
|
||||
| 'inventory_fetch'
|
||||
| 'inventory_match'
|
||||
| 'excel_generate'
|
||||
| 'freight_upload'
|
||||
| 'completed'
|
||||
| 'failed_terminal'
|
||||
| 'cancelled'
|
||||
| string;
|
||||
|
||||
/**
|
||||
* 统一处理投影 DTO(阶段 4 接线;阶段 0 冻结形状)。
|
||||
* 对话、对话右侧、复核工作台、后台工作台共同消费;禁止页面私自拼接状态。
|
||||
@@ -188,6 +307,78 @@ export interface ShippingProcessingProjection {
|
||||
assetStatus?: string | null;
|
||||
};
|
||||
childOrderTasks: ShippingOrderTaskSummary[];
|
||||
// ============== [T8 用户态 Projection 7 字段] ==============
|
||||
// 后端 apply_user_projection_fields 下发;旧客户端不识别会直接忽略(安全);
|
||||
// 新前端优先用本字段停止本地推导。
|
||||
/** 用户态 status(6 枚举:running / waiting_human / retryable / failed / completed / cancelled)。 */
|
||||
userStatus?: ShippingUserProcessingStatus | null;
|
||||
/** 用户态 stage(inventory_fetch / inventory_match / excel_generate / freight_upload 等)。 */
|
||||
userStage?: ShippingUserProcessingStage | null;
|
||||
/** 用户态 current_gate 编码(纯字符串;旧 currentGate 仍为对象保留)。 */
|
||||
userCurrentGateCode?: string | null;
|
||||
/** 阻断原因:{code, i18nKey, details};status=waiting_human / retryable / failed 时非空。 */
|
||||
blockingReason?: ShippingProcessingBlockingReason | null;
|
||||
/** 技术失败是否可重试;业务阻断(waiting_human)通常 false。 */
|
||||
retryable?: boolean;
|
||||
/** 唯一主入口按钮建议:{code, i18nKey, parameters};前端只渲染不新建动作码。 */
|
||||
primaryAction?: ShippingProcessingPrimaryAction | null;
|
||||
/** 子状态事实字典(inventorySourceStatus / candidateSourceCodes / preparedSourceCodes / pendingSourceCodes / lineResolutions / exportState / uploadState / switchState)。 */
|
||||
facts?: ShippingProcessingFacts;
|
||||
/** 旧 status 备份(T8 apply_user_projection_fields.legacy_status);调试用。 */
|
||||
legacyStatus?: string | null;
|
||||
/** 旧 stage 备份(T8 apply_user_projection_fields.legacy_stage);调试用。 */
|
||||
legacyStage?: string | null;
|
||||
/** 正式 OT 是否已挂接真实 ShippingNotice;T1 判定:order_task + shipping_notice_id 非空 + shipping_notice_no 非空。 */
|
||||
hasFormalOt?: boolean;
|
||||
/**
|
||||
* 题4A:inventory 统一 Projection(仅 inventory 阶段及之前且 hasFormalOt=true 时填充;其他阶段 null)。
|
||||
* 权威事实源:summarize_inventory_rpa_latest_attempts();
|
||||
* 前端按钮禁用/重试文案/状态徽章全部直接读本对象,禁止继续拼接旧字段合成 running。
|
||||
*/
|
||||
inventoryPreparation?: ShippingInventoryPreparationSummary | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 题4A & 7A:逐源 inventory 准备状态(ShippingProcessingProjection.inventoryPreparation)。
|
||||
* 按实际冻结源 required_sources 为基准分类,failed/exhausted 拆分暴露。
|
||||
*/
|
||||
export interface ShippingInventoryPreparationSummary {
|
||||
/** 实际任务级冻结源(task.task_frozen_inventory_source_codes),顺序以冻结记录为准。 */
|
||||
requiredSources: string[];
|
||||
/** 已就绪:有 prepared 状态 Attempt,或 inventory_lines_json + inventory_snapshot_id 已载入。 */
|
||||
preparedSources: string[];
|
||||
/** RPA 正在跑或入队中(queued / running);active_attempt_count > 0 的对应源集合。 */
|
||||
pendingSources: string[];
|
||||
/** 最近一次失败状态(attempt.status == failed)但未耗尽自动次数的源。 */
|
||||
failedSources: string[];
|
||||
/** 题7A:自动重试 max_attempts 已耗尽但允许人工 user_retry 继续的源;独立于 failed,便于 UI 提示。 */
|
||||
exhaustedSources: string[];
|
||||
/** 全表当前 queued+running Attempt 总数(>= pendingSources.length,存在 Gate 活动 Attempt 时会更高)。 */
|
||||
activeAttemptCount: number;
|
||||
/** 题2B:Process Gate 是否有 queued/running 状态的 inventory 批次;作为全局 running 额外保护。 */
|
||||
gateAttemptActive?: boolean;
|
||||
/**
|
||||
* 按冻结源逐源最近 Attempt 摘要(source_code → 结构化记录)。
|
||||
* 用于 UI tooltip/详情;按钮禁用不直接读本字典,读上面的 required/prepared/pending/failed/exhausted 集合。
|
||||
*/
|
||||
latestAttempts?: Record<string, ShippingInventoryPerSourceAttempt>;
|
||||
}
|
||||
|
||||
/**
|
||||
* 逐源最近一次 Inventory RPA Attempt 摘要(inventoryPreparation.latestAttempts[sourceCode])。
|
||||
* 仅用于 UI 展示;业务判定必须走顶层 *_sources 集合。
|
||||
*/
|
||||
export interface ShippingInventoryPerSourceAttempt {
|
||||
sourceCode: string;
|
||||
attemptNo: number;
|
||||
/** queued | running | consumed | failed | exhausted | skipped */
|
||||
status: string;
|
||||
/** 失败/耗尽:人工可继续;running/queued:false */
|
||||
manualRetryable?: boolean;
|
||||
/** attempt.error_message 或 业务错误摘要,供 tooltip。 */
|
||||
message?: string | null;
|
||||
updatedAt?: string | null;
|
||||
/** attempt.id 便于定位日志;不向浏览器直接暴露内部数据库 ID,此处省略。 */
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -364,6 +555,15 @@ export interface ConversationProcessingUserTask {
|
||||
primary_action?: string | null;
|
||||
available_actions?: string[];
|
||||
objects?: ConversationProcessingObject[];
|
||||
userStatus?: ShippingUserProcessingStatus | null;
|
||||
userStage?: ShippingUserProcessingStage | null;
|
||||
userCurrentGateCode?: string | null;
|
||||
blockingReason?: ShippingProcessingBlockingReason | null;
|
||||
retryable?: boolean;
|
||||
primaryAction?: ShippingProcessingPrimaryAction | null;
|
||||
facts?: ShippingProcessingFacts;
|
||||
legacyStatus?: string | null;
|
||||
legacyStage?: string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1965,6 +2165,12 @@ export interface ShippingOrderReviewFieldConflictOption {
|
||||
evidence_role?: 'primary_pdf' | 'auxiliary' | 'context' | string | null;
|
||||
/** PDF_PRIORITY_EVIDENCE_RANKS 档位名。 */
|
||||
evidence_rank?: string | null;
|
||||
/** Vendor Comments 三来源专属:字段来源种类(header_region / table_column / vendor_comments)。 */
|
||||
vc_source_kind?: string | null;
|
||||
/** Vendor Comments 三来源专属:来源种类的本地化展示标签。 */
|
||||
vc_source_kind_label?: string | null;
|
||||
/** Vendor Comments 三来源专属:vc:<doc>:p<N>:region:<rid> 证据引用,可跳转证据查看器定位对应区域。 */
|
||||
evidence_ref?: string | null;
|
||||
}
|
||||
|
||||
/** 建单前 Candidate 字段冲突投影(复核工作台集中裁决区)。 */
|
||||
@@ -1977,6 +2183,18 @@ export interface ShippingOrderReviewFieldConflict {
|
||||
reason: string;
|
||||
options: ShippingOrderReviewFieldConflictOption[];
|
||||
observation_ids?: string[];
|
||||
/** Vendor Comments 三来源专属:true 表示该冲突来自 VC 三来源合并,conflict_key 以 vc: 开头。 */
|
||||
vc_kind?: boolean | null;
|
||||
/** Vendor Comments 三来源专属:细因码(vc_source_conflict_unresolved / vc_source_format_invalid / vc_source_region_unbound)。 */
|
||||
vc_reason?: string | null;
|
||||
/** Vendor Comments 三来源专属:冲突组稳定键(scope:field_code:line_no),裁决时写回 merged_candidates 使用。 */
|
||||
vc_conflict_group_key?: string | null;
|
||||
/** Vendor Comments 三来源专属:只读诊断,展示 resolution / decision_status / format_valid。 */
|
||||
vc_detail?: {
|
||||
resolution?: string | null;
|
||||
decision_status?: string | null;
|
||||
format_valid?: boolean | null;
|
||||
} | null;
|
||||
}
|
||||
|
||||
export interface ShippingOrderReviewCase {
|
||||
@@ -2091,6 +2309,33 @@ export interface ShippingOrderReviewCase {
|
||||
order_data_version?: number | null;
|
||||
llm_suggestions?: ShippingOrderReviewLlmSuggestion[];
|
||||
process_gate?: ShippingProcessGateUserSummary | null;
|
||||
/** Case 用户态六事实之一:禁止前端自行从 stage 推导。 */
|
||||
user_status?:
|
||||
| 'running'
|
||||
| 'waiting_human'
|
||||
| 'retryable'
|
||||
| 'failed'
|
||||
| 'completed'
|
||||
| 'cancelled'
|
||||
| null;
|
||||
/** Case 用户阻断说明:仅消费后端投影。 */
|
||||
blocking_reason?: ShippingProcessingBlockingReason | null;
|
||||
/** Case 主动作:仅消费后端投影。 */
|
||||
primary_action?: ShippingProcessingPrimaryAction | null;
|
||||
}
|
||||
|
||||
/** 完整 Case 快照的纯展示 loading 上下文。 */
|
||||
export interface ShippingOrderReviewCaseLoadingContext {
|
||||
phase?: string | null;
|
||||
status?: string | null;
|
||||
message?: string | null;
|
||||
}
|
||||
|
||||
/** 工作台单 Case 完整快照:包装现有 case 投影并附审计版本。 */
|
||||
export interface ShippingOrderReviewCaseSnapshot {
|
||||
case: ShippingOrderReviewCase;
|
||||
projection_version: number;
|
||||
loading_context?: ShippingOrderReviewCaseLoadingContext | null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2191,24 +2436,58 @@ export interface ShippingOrderReviewEvidence {
|
||||
requires_review?: boolean;
|
||||
}
|
||||
|
||||
/** Dify 最小证据建议 DTO;与后端 serialize_suggestion 对齐。 */
|
||||
/** Dify 最小证据建议 DTO;与后端 serialize_suggestion 对齐(Phase 4 权限分层:普通用户无 provider_trace / request_preview)。 */
|
||||
export interface ShippingOrderReviewLlmSuggestion {
|
||||
suggestion_no: string;
|
||||
field_id: string;
|
||||
line_key?: string | null;
|
||||
scope: string;
|
||||
evidence_level: string;
|
||||
contract_version?: string;
|
||||
status: string;
|
||||
error_code?: string | null;
|
||||
/** @deprecated 后端不再输出;前端统一按 error_code 查 i18n errors.json */
|
||||
error_message?: string | null;
|
||||
suggested_value?: unknown;
|
||||
validation_issues?: Array<{ code?: string; severity?: string }>;
|
||||
validation_issues?: Array<{
|
||||
code?: string;
|
||||
severity?: string;
|
||||
checks_order?: string[];
|
||||
match?: Record<string, unknown>;
|
||||
detail?: string;
|
||||
}>;
|
||||
decision?: string | null;
|
||||
decision_reason?: string | null;
|
||||
decision_note?: string | null;
|
||||
draft_version_at_request?: number | null;
|
||||
created_at?: string | null;
|
||||
adjudicated_at?: string | null;
|
||||
auto_upgrade_reason?: string | null;
|
||||
/** 普通用户可见:证据范围摘要(level/auto_upgraded/counts/context_truncated)。 */
|
||||
evidence_summary?: {
|
||||
level: string;
|
||||
auto_upgraded: boolean;
|
||||
auto_upgrade_reason?: string | null;
|
||||
field_count: number;
|
||||
row_count?: number | null;
|
||||
table_count?: number | null;
|
||||
page_count?: number | null;
|
||||
core_evidence_source?: string | null;
|
||||
context_truncated: boolean;
|
||||
} | null;
|
||||
/** 管理员专属:Provider 对账追踪信息。 */
|
||||
provider_trace?: {
|
||||
provider?: string | null;
|
||||
conversation_id?: string | null;
|
||||
message_id?: string | null;
|
||||
latency_ms?: number | null;
|
||||
} | null;
|
||||
/** 管理员专属:请求信封审计预览(fields_sent_preview / policies_applied / budget_tokens / method)。 */
|
||||
request_preview?: Record<string, unknown> | null;
|
||||
/** 管理员专属:上下文指纹。 */
|
||||
context_hash?: string | null;
|
||||
/** 管理员专属:Provider 端到端延迟 ms。 */
|
||||
latency_ms?: number | null;
|
||||
}
|
||||
|
||||
export interface ShippingOrderReviewLlmSuggestionRequest {
|
||||
@@ -2465,12 +2744,18 @@ export interface ShippingOrderReviewLineFulfillmentLine {
|
||||
inventory_snapshot_id?: number | null;
|
||||
inventory_checked_at?: string | null;
|
||||
inventory_source_code?: string | null;
|
||||
inventory_source?: {
|
||||
inventory_source?: ({
|
||||
code?: string | null;
|
||||
label?: string | null;
|
||||
status?: 'resolved' | 'resolving' | 'unrecognized' | 'conflict' | 'unavailable' | string | null;
|
||||
source?: string | null;
|
||||
} | null;
|
||||
} & ({
|
||||
status: 'candidates_frozen';
|
||||
candidates: Array<string | { code?: string | null; label?: string | null; [key: string]: unknown }>;
|
||||
} | {
|
||||
status?: Exclude<string, 'candidates_frozen'> | null;
|
||||
candidates?: never;
|
||||
})) | null;
|
||||
decision_source?: 'system' | 'user' | 'unknown' | null;
|
||||
/** 行级统一「重试」是否可点;前端禁止用 inventory_allowed_actions 猜按钮。 */
|
||||
retryable?: boolean;
|
||||
|
||||
@@ -155,6 +155,8 @@ function createReviewComposableMock() {
|
||||
return {
|
||||
reviewRun,
|
||||
activeCase,
|
||||
caseProjectionVersion: ref(1),
|
||||
caseLoadingContext: ref(null),
|
||||
reviewProgressContext,
|
||||
workItem,
|
||||
authoritativeOrderTaskNo: computed(() => {
|
||||
@@ -800,7 +802,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
});
|
||||
|
||||
describe('ShippingOrderReviewView audit and progress recovery', () => {
|
||||
beforeEach(() => {
|
||||
beforeEach(async () => {
|
||||
vi.clearAllMocks();
|
||||
resetActiveCaseFixture();
|
||||
reviewProgressContext.value = null;
|
||||
@@ -812,7 +814,7 @@ describe('ShippingOrderReviewView audit and progress recovery', () => {
|
||||
audited: true,
|
||||
case_no: 'CASE-1',
|
||||
});
|
||||
});
|
||||
}, 20000);
|
||||
|
||||
it('refuses to open version history when access audit fails', async () => {
|
||||
vi.mocked(auditWorkspaceShippingOrderReviewVersionHistory).mockRejectedValueOnce(new Error('audit down'));
|
||||
@@ -1037,7 +1039,7 @@ describe('ShippingOrderReviewView audit and progress recovery', () => {
|
||||
const wrapper = await mountView();
|
||||
await flushPromises();
|
||||
expect(wrapper.find('[data-testid="review-profile-match-panel"]').exists()).toBe(true);
|
||||
});
|
||||
}, 15000);
|
||||
|
||||
it('hydrates progress-failed retry state from Case projection without confirm UI', async () => {
|
||||
// 关键断言:无确认建单按钮时,仍可从 post_confirm_auto_progress 恢复对象级重试入口。
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -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"
|
||||
|
||||
@@ -41,7 +41,8 @@
|
||||
"shippingFieldAssets": "Field Assets",
|
||||
"shippingOrderSchema": "Order Schema",
|
||||
"shippingAudit": "Audit center",
|
||||
"shippingProcessGates": "Process gate diagnostics"
|
||||
"shippingProcessGates": "Process gate diagnostics",
|
||||
"shippingLegacyStpJobs": "Legacy STP Jobs"
|
||||
},
|
||||
"shippingOrderExtractionRuns": {
|
||||
"eyebrow": "READ-ONLY RUN DIAGNOSTICS",
|
||||
@@ -3688,6 +3689,59 @@
|
||||
"lineStartAnchorRequired": "When the main line has field bindings, it must include the configured start anchor (default customer_po_line_no)."
|
||||
}
|
||||
},
|
||||
"vc": {
|
||||
"panelTitle": "Vendor Comments Three-Source Configuration",
|
||||
"namedRegionsTitle": "Named Regions",
|
||||
"addNamedRegion": "Add Vendor Comments Region",
|
||||
"namedRegionLabel": "Region Name",
|
||||
"pageScope": "Page Scope",
|
||||
"pageScopeFirstPage": "First Page",
|
||||
"pageScopeLastPage": "Last Page",
|
||||
"pageScopeExactPage": "Exact Page",
|
||||
"selectionMode": "Selection Mode",
|
||||
"selectionModeBox": "Bounding Box",
|
||||
"selectionModeParagraph": "Paragraph",
|
||||
"selectionModeLine": "Single Line",
|
||||
"deleteRegion": "Delete Region",
|
||||
"draftRequiredBanner": "Regions or rules have changed. Return to Draft and re-validate to apply.",
|
||||
"sourceHeader": "Header Region Source",
|
||||
"sourceTable": "Table Body Column Source",
|
||||
"sourceVc": "Vendor Comments Source",
|
||||
"targetScope": "Target Scope",
|
||||
"scopeHeader": "Order-level (Header)",
|
||||
"scopeLine": "Line-level (Line)",
|
||||
"relationPolicy": "Relation Policy",
|
||||
"relationBindLine": "Bind to Target Line Item",
|
||||
"relationAnnotationOnly": "Annotation Only, No Field Binding",
|
||||
"missingRelationPolicy": "Missing Relation Handling",
|
||||
"missingDefaultAllLines": "Apply to All Lines by Default",
|
||||
"missingDefaultHeaderOnly": "Apply to Header Only",
|
||||
"missingFallbackDisabled": "No Fallback (Mark as Unrelated)",
|
||||
"lineReferenceBasis": "Line Number Basis",
|
||||
"lineRefExplicit": "Explicit Column Value (Line No.)",
|
||||
"lineRefBusiness": "Profile Business Line No.",
|
||||
"lineRefLogical": "Post-classification Logical Line No.",
|
||||
"columnCode": "Table Column Code",
|
||||
"namedRegionId": "Named Region",
|
||||
"fillMissingFromOthers": "Fill Missing Values from Other Sources",
|
||||
"formatPolicy": "Format Policy",
|
||||
"formatInheritGlobal": "Inherit Global Rules",
|
||||
"formatNumeric5Or10": "5 or 10 Digits",
|
||||
"formatCustomRegex": "Custom Safe Regex",
|
||||
"customRegexPattern": "Regex Pattern",
|
||||
"customRegexCaptureGroup": "Capture Group Index",
|
||||
"customRegexUnsafe": "Rejected: regex contains dangerous backtracking expressions",
|
||||
"splitRules": "Split Rules",
|
||||
"splitPreview": "Preview Candidates and Merging",
|
||||
"previewStatusNeedsReview": "Review Required",
|
||||
"previewStatusAccepted": "Accepted",
|
||||
"previewConflictGroup": "Conflict Group (scope={s}, field={f}, line={l})",
|
||||
"previewResolutionSameValue": "Merged: same value across sources",
|
||||
"previewResolutionSingleSource": "Adopted: single source",
|
||||
"previewResolutionFillMissing": "Filled: missing value from other sources",
|
||||
"previewResolutionConflict": "Conflict: values differ across sources; review required",
|
||||
"invalidLineReference": "Referenced line item does not exist (Q12)"
|
||||
},
|
||||
"templateModes": {
|
||||
"coordinate": "Coordinate",
|
||||
"xfa_dataset": "XFA data path"
|
||||
@@ -4498,5 +4552,60 @@
|
||||
"succeeded": "Succeeded",
|
||||
"superseded": "Superseded"
|
||||
}
|
||||
},
|
||||
"legacyStpJobs": {
|
||||
"pageTitle": "Legacy STP Job replay",
|
||||
"pageSubtitle": "Filter failed/dead STP auto-create jobs (e.g. 928, 929) and replay via reconcile-and-progress; never write Job.status directly.",
|
||||
"listTitle": "Failed / dead Jobs · {count} total",
|
||||
"detailTitle": "Legacy Job detail & replay",
|
||||
"detailEmpty": "Pick a row on the left to inspect.",
|
||||
"empty": "No failed/dead legacy STP Jobs; run the CLI script with --dry-run first to verify plan.",
|
||||
"filterQ": "Search (id/message/error)",
|
||||
"filterCaseNo": "Review case_no",
|
||||
"filterErrorCode": "Error code",
|
||||
"statusAll": "All statuses",
|
||||
"job": "Job",
|
||||
"reviewCase": "Linked case",
|
||||
"blocking": "Blocking reason",
|
||||
"linkedCase": "Back-linked Review Case",
|
||||
"caseStatus": "Case status",
|
||||
"replayPlan": "Replay plan (Reconcile And Progress)",
|
||||
"recommendedAction": "Recommended user_action",
|
||||
"needsReplayMode": "Cross-case replay required (replay_mode=true)",
|
||||
"userAction": "Pick replay action",
|
||||
"replayButton": "One-click Reconcile",
|
||||
"replayError_noCaseNo": "This legacy Job cannot back-link to a Review Case; pick a case in the workspace first.",
|
||||
"replaySuccess": "Replay succeeded, outcome={outcome}",
|
||||
"replayRejected": "Replay rejected, outcome={outcome}",
|
||||
"payloadJson": "Request payload (masked)",
|
||||
"resultJson": "Result result_json (masked)",
|
||||
"reasonCodes": {
|
||||
"task_missing": "Formal task missing",
|
||||
"stp_waiting_timeout": "STP waiting timed out",
|
||||
"stp_not_enqueued_yet": "STP not yet enqueued",
|
||||
"stp_job_failed": "STP job execution failed",
|
||||
"post_confirm_auto_progress_failed": "Post-confirm auto-progress failed",
|
||||
"duplicate_decision_required": "Duplicate adjudication pending",
|
||||
"SHIPPING.NOTICE_EXACT_DUPLICATE": "Exact duplicate case",
|
||||
"profile_schema_mismatch": "Document profile mismatch",
|
||||
"SHIPPING.STP_NOT_ELIGIBLE": "Not eligible for STP",
|
||||
"SHIPPING.REVIEW_DRAFT_MISSING": "Draft missing",
|
||||
"SHIPPING.REVIEW_RUN_MISSING": "Recognition RUN missing",
|
||||
"SHIPPING.REVIEW_DOCUMENT_INVALID": "Document invalid",
|
||||
"SHIPPING.REVIEW_DRAFT_VERSION_CONFLICT": "Draft version conflict",
|
||||
"final_required_field_missing": "Final required field missing",
|
||||
"ownership_anomaly": "Ownership anomaly (Q13 hard isolation)",
|
||||
"retry_needed": "Retry required"
|
||||
},
|
||||
"statusLabels": {
|
||||
"failed": "Failed",
|
||||
"dead": "Dead",
|
||||
"queued": "Queued",
|
||||
"running": "Running",
|
||||
"success": "Success",
|
||||
"succeeded": "Succeeded",
|
||||
"completed": "Completed",
|
||||
"cancelled": "Cancelled"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2174,6 +2174,29 @@
|
||||
"state_inconsistent": "Inconsistent state data"
|
||||
}
|
||||
},
|
||||
"currentTask": {
|
||||
"title": "Current task",
|
||||
"labelStage": "Current stage",
|
||||
"labelStatus": "Status",
|
||||
"labelFormalSn": "Formal OT",
|
||||
"statusRunning": "System processing",
|
||||
"statusWaitingHuman": "Awaiting human action",
|
||||
"statusRetryable": "Retry available",
|
||||
"statusFailed": "Automation failed",
|
||||
"statusCompleted": "Completed",
|
||||
"statusCancelled": "Cancelled",
|
||||
"nextStepTitle": "Next step",
|
||||
"nextStepRunning": "The system is processing. No manual action needed yet.",
|
||||
"nextStepCompleted": "No manual action is needed at the moment.",
|
||||
"nextStepCancelled": "This task has been cancelled and will not be processed further.",
|
||||
"nextStepFailedNoRetry": "Automation failed. Please contact an administrator or review the audit trail.",
|
||||
"nextStepWaitingHumanDefault": "Awaiting human action.",
|
||||
"nextStepRetryableDefault": "The system indicates this can be retried. Please click Retry below.",
|
||||
"nextStepUnknown": "Status pending confirmation.",
|
||||
"actionRetry": "Retry",
|
||||
"actionLocateLine": "Locate detail",
|
||||
"actionUnknown": "Unrecognized action: {code}"
|
||||
},
|
||||
"completedChecks": {
|
||||
"title": "Completed checks ({count})",
|
||||
"codes": {
|
||||
@@ -2219,7 +2242,10 @@
|
||||
"field_conflict": "Field conflict",
|
||||
"pdf_preferred": "PDF preferred",
|
||||
"pdf_preferred_with_conflict": "PDF preferred with conflict",
|
||||
"auxiliary_supplement": "Auxiliary supplement"
|
||||
"auxiliary_supplement": "Auxiliary supplement",
|
||||
"vc_source_conflict_unresolved": "Vendor Comments multi-source value conflict needs manual review",
|
||||
"vc_source_format_invalid": "Vendor Comments region field format is invalid",
|
||||
"vc_source_region_unbound": "Vendor Comments named region is not bound in profile"
|
||||
},
|
||||
"fields": {
|
||||
"reservation_id": "Reservation ID",
|
||||
@@ -2366,6 +2392,11 @@
|
||||
"ruleSuggestion": "Rule suggestion",
|
||||
"ruleVersions": "Rule versions",
|
||||
"hint": "Inventory source hint",
|
||||
"matchedRules": "Matched rules: {count}",
|
||||
"unavailableReasons": {
|
||||
"source_disabled": "Inventory source not enabled"
|
||||
},
|
||||
"unavailableReasonUnknown": "Unavailable reason unknown (the system cannot identify why this candidate source is missing)",
|
||||
"rerouteHint": "You can rematch routing rules at any time. When a suggestion is pending, decide whether to adopt or keep the manual result first."
|
||||
},
|
||||
"confirmDialog": {
|
||||
@@ -2534,6 +2565,7 @@
|
||||
"retry": "Processing failed; check the reason and retry"
|
||||
},
|
||||
"progress": {
|
||||
"title": "Order Processing Progress",
|
||||
"completedOfTotal": "{done} / {total} completed",
|
||||
"currentStage": "Current: {stage}",
|
||||
"remainingHint": "{count} stages remaining",
|
||||
@@ -2588,6 +2620,7 @@
|
||||
"confirm_customer": "Confirm customer",
|
||||
"resolve_field_conflicts": "Resolve field conflicts",
|
||||
"adjudicate_duplicate": "Adjudicate duplicate",
|
||||
"reconcile_and_progress": "Reconcile and resume",
|
||||
"open_inventory_source_review": "Review inventory source",
|
||||
"open_inventory_match_review": "Review inventory match",
|
||||
"open_shortage_review": "Handle shortage",
|
||||
@@ -2603,6 +2636,17 @@
|
||||
"retry_parse": "Retry parsing",
|
||||
"more": "More"
|
||||
},
|
||||
"reasonCode": {
|
||||
"duplicateDecisionRequired": "Duplicate shipping notice detected, manual decision required",
|
||||
"exactDuplicateNotice": "This file already exists in an ongoing task, do not resubmit",
|
||||
"stpNotEligible": "Current order does not meet auto-creation criteria, complete validation and gates first",
|
||||
"reviewDraftMissing": "Order draft does not exist, complete extraction and review first",
|
||||
"reviewRunMissing": "Missing corresponding extraction run record, please re-extract",
|
||||
"reviewDocumentInvalid": "Review PDF document is invalid or inaccessible",
|
||||
"reviewDraftVersionConflict": "Order draft has been updated in another window, please refresh and retry",
|
||||
"profileSchemaMismatch": "Order field template version mismatch, please regenerate draft",
|
||||
"finalRequiredFieldMissing": "Order still missing key fields, please complete before confirming"
|
||||
},
|
||||
"title": "In progress",
|
||||
"summaryLine": "{total} files · {processing} processing · {needsAction} need action · {completed} completed",
|
||||
"summaryTasksAndFiles": "{tasks} tasks · {files} files",
|
||||
|
||||
@@ -489,7 +489,31 @@
|
||||
"SHIPPING.STP_ENQUEUE_FAILED": "Failed to enqueue auto-create. Please retry later or contact an administrator.",
|
||||
"SHIPPING.STP_NOT_ELIGIBLE": "This order is not yet eligible for auto-create. Complete checks and gates, then retry.",
|
||||
"SHIPPING.STP_CASE_NO_REQUIRED": "Review case number is required for auto-create.",
|
||||
"SHIPPING.STP_AUTO_CREATE_FAILED": "Auto-create execution failed. Retry or confirm manually."
|
||||
"SHIPPING.STP_AUTO_CREATE_FAILED": "Auto-create execution failed. Retry or confirm manually.",
|
||||
"SHIPPING.RECONCILE_OPERATION_ID_REQUIRED": "Reconcile operation requires a client-generated operation_id. Please refresh and try again.",
|
||||
"SHIPPING.RECONCILE_OPERATION_ID_TOO_LONG": "Reconcile operation_id exceeds 128 characters.",
|
||||
"SHIPPING.RECONCILE_INVALID_USER_ACTION": "Invalid reconcile user_action. Choose reuse, create_revision or force_create.",
|
||||
"SHIPPING.RECONCILE_INVALID_EXPECTED_VERSION": "expected_case_version must be an integer if provided.",
|
||||
"SHIPPING.RECONCILE_IDEMPOTENT_CONFLICT": "Same operation_id but request snapshot changed. Generate a new operation_id and resubmit.",
|
||||
"SHIPPING.RECONCILE_OWNERSHIP_ANOMALY": "Task ownership is ambiguous. Please ask a human operator to adjudicate before proceeding.",
|
||||
"SHIPPING.RECONCILE_FORCE_CREATE_UNAUTHORIZED": "force_create requires admin or special permission.",
|
||||
"SHIPPING.RECONCILE_LOCK_VISIBILITY_RACE": "Locked row differs from visible row. Please retry.",
|
||||
"SHIPPING.RETRY_STP_BLOCKED_MANUAL": "Manual adjudication required. Do NOT use technical retry; use reconcile-and-progress or the duplicate adjudication endpoint.",
|
||||
"SHIPPING.REVIEW_LLM_DISABLED": "AI suggestions for order review are disabled. No suggestion was generated; please verify manually.",
|
||||
"SHIPPING.REVIEW_LLM_PROVIDER_UNAVAILABLE": "AI service is unavailable (missing Dify key or request failed). Suggestion skipped; review manually.",
|
||||
"SHIPPING.REVIEW_LLM_FIELD_MISMATCH": "The AI returned a field that does not match the requested review field. The result was discarded; do not accept it.",
|
||||
"SHIPPING.REVIEW_LLM_VALIDATION_FAILED": "The AI suggestion failed evidence consistency checks and cannot be written to the draft. Enter the correct value manually to continue.",
|
||||
"SHIPPING.REVIEW_LLM_GATE_FIELD_NOT_FOUND": "This review field is not present in the frozen schema; no AI suggestion can be generated.",
|
||||
"SHIPPING.REVIEW_LLM_GATE_LINE_NOT_FOUND": "The target line is missing. AI cannot generate a line-level suggestion. Verify the line structure and retry.",
|
||||
"SHIPPING.REVIEW_LLM_GATE_FIELD_VALUE_MISSING": "The target field has no raw value. AI cannot produce a fact-based suggestion. First complete OCR or enter a manual value.",
|
||||
"SHIPPING.REVIEW_LLM_GATE_EVIDENCE_UNAVAILABLE": "No evidence sources were found for this field (Case-95-style evidence break). AI was blocked to avoid silent hallucinations. Complete OCR or reparse the PDF first.",
|
||||
"SHIPPING.REVIEW_LLM_GATE_CONTEXT_INSUFFICIENT": "The line has fewer than 2 valid sibling fields with context, so a reliable row-level suggestion is not possible. First complete recognition of adjacent fields.",
|
||||
"SHIPPING.REVIEW_LLM_GATE_POLICY_BLOCKED": "This field is sensitive/internal and blocked by the security policy from being sent to AI. Confirm manually.",
|
||||
"SHIPPING.REVIEW_LLM_GATE_CONTEXT_BUILD_FAILED": "An error occurred while building the evidence view; AI suggestion skipped. Refresh and retry or contact an administrator.",
|
||||
"SHIPPING.REVIEW_LLM_GATE_EVIDENCE_TRUNCATED": "Core evidence of the target field was truncated under the token budget. AI has aborted to avoid a wrong conclusion. Please review this field manually.",
|
||||
"SHIPPING.REVIEW_LLM_GATE_CONTEXT_AMBIGUOUS": "Multiple source candidates exist and the primary evidence cannot be uniquely determined. AI has aborted to avoid fact confusion. Resolve ambiguity first, then retry.",
|
||||
"SHIPPING.REVIEW_LLM_GATE_L4_FORBIDDEN": "Page-level (L4) evidence requires explicit admin authorization. Regular users cannot request it.",
|
||||
"SHIPPING.REVIEW_LLM_L4_FORBIDDEN": "Full-PDF (L4) evidence requires explicit admin authorization; the request is blocked."
|
||||
},
|
||||
"SHIPPING.REVIEW_INVENTORY_SOURCE_UNRESOLVED": "Inventory source is not uniquely resolved. Complete inventory-source review before creating a formal order.",
|
||||
"SHIPPING_REVIEW_INVENTORY_SOURCE_UNRESOLVED": "Inventory source is not uniquely resolved. Complete inventory-source review before creating a formal order."
|
||||
|
||||
@@ -231,6 +231,7 @@
|
||||
"noAction": "No action is currently available",
|
||||
"versionMissing": "This information has changed. Refresh and try again.",
|
||||
"navigationMissing": "Navigation context is missing. Refresh and try again.",
|
||||
"customerTaskMissing": "Task number missing — cannot open customer confirm. Refresh and try again.",
|
||||
"genericBlocking": "This step needs manual attention",
|
||||
"unknownStep": "Current step",
|
||||
"continueAction": "Continue",
|
||||
@@ -238,25 +239,42 @@
|
||||
"submitting": "Submitting…",
|
||||
"readOnlyUseFooter": "Use the footer action bar to proceed",
|
||||
"actionCodes": {
|
||||
"rematerialize_document": "Rematerialize document",
|
||||
"retry_layout_parsing": "Retry layout parsing",
|
||||
"reroute_document_profile": "Reroute document profile",
|
||||
"open_profile_review": "Open profile review",
|
||||
"retry_order_extraction": "Retry order extraction",
|
||||
"open_order_review": "Open order review",
|
||||
"edit_order_fields": "Edit order fields",
|
||||
"revalidate_reservation": "Revalidate reservation",
|
||||
"edit_reservation": "Edit reservation",
|
||||
"retry_customer_resolution": "Retry customer resolution",
|
||||
"confirm_customer": "Confirm customer",
|
||||
"retry_duplicate_detection": "Retry duplicate detection",
|
||||
"adjudicate_duplicate": "Adjudicate duplicate",
|
||||
"reconcile_and_progress": "Reconcile and auto-recover",
|
||||
"resolve_field_conflicts": "Resolve field conflicts",
|
||||
"retry_with_latest_rules": "Retry with latest rules",
|
||||
"open_inventory_source_review": "Open inventory source review",
|
||||
"open_order_review": "Open order review",
|
||||
"open_profile_review": "Open profile review",
|
||||
"edit_order_fields": "Edit order fields",
|
||||
"confirm_customer": "Confirm customer",
|
||||
"adjudicate_duplicate": "Adjudicate duplicate",
|
||||
"resolve_field_conflicts": "Resolve field conflicts",
|
||||
"open_inventory_match_review": "Open inventory match review",
|
||||
"open_shortage_review": "Open shortage review",
|
||||
"upload_inventory_file": "Upload inventory file",
|
||||
"adopt_rule_suggestion": "Adopt rule suggestion",
|
||||
"keep_manual_inventory_decision": "Keep manual decision",
|
||||
"recheck_freeze_readiness": "Recheck freeze readiness",
|
||||
"retry_task_creation": "Retry task creation",
|
||||
"retry_inventory_preparation": "Retry inventory preparation",
|
||||
"refresh_inventory_candidate_projection": "Refresh inventory candidate status",
|
||||
"poll_inventory_preparation": "Refresh inventory preparation progress",
|
||||
"upload_inventory_file": "Upload inventory file",
|
||||
"retry_inventory_field_mapping": "Retry inventory field mapping",
|
||||
"confirm_inventory_field_mapping": "Confirm inventory field mapping",
|
||||
"retry_inventory_matching": "Retry inventory matching",
|
||||
"open_inventory_match_review": "Open inventory match review",
|
||||
"recheck_inventory_sufficiency": "Recheck inventory sufficiency",
|
||||
"open_shortage_review": "Open shortage review",
|
||||
"recheck_excel_readiness": "Recheck Excel readiness",
|
||||
"regenerate_excel_artifact": "Regenerate Excel",
|
||||
"poll_freight_upload_rpa": "Refresh freight upload progress",
|
||||
"retry_freight_upload_rpa": "Retry freight upload RPA",
|
||||
"regenerate_manual_upload_todo": "Regenerate manual upload todo"
|
||||
"regenerate_manual_upload_todo": "Regenerate manual-upload todo"
|
||||
},
|
||||
"reasons": {
|
||||
"freeze_not_ready": "Order is not ready to build or freeze",
|
||||
@@ -278,6 +296,10 @@
|
||||
"inventory_file_empty": "Inventory file is empty or has no valid records",
|
||||
"inventory_preparation_waiting": "Inventory file is being prepared; refresh later",
|
||||
"inventory_preparation_failed": "Inventory preparation failed; retry or upload a file",
|
||||
"inventory_candidates_missing": "The task is missing a formal candidate version. Reopen inventory source review.",
|
||||
"inventory_candidate_version_stale": "The inventory candidate version changed. Refresh and process again.",
|
||||
"inventory_match_out_of_candidate_scope": "The match result falls outside the current candidate scope and needs manual review.",
|
||||
"inventory_candidate_data_incomplete": "Inventory candidate facts are incomplete. Refreeze the candidate version.",
|
||||
"upload_rpa_pending": "Freight upload job is waiting",
|
||||
"upload_rpa_failed": "Freight platform upload failed; RPA can be retried",
|
||||
"upload_rpa_login_failed": "Freight platform login failed",
|
||||
|
||||
@@ -40,7 +40,8 @@
|
||||
"shippingFieldAssets": "คลังฟิลด์",
|
||||
"shippingOrderSchema": "Order Schema",
|
||||
"shippingAudit": "ศูนย์ตรวจสอบ",
|
||||
"shippingProcessGates": "การวินิจฉัย Process Gate"
|
||||
"shippingProcessGates": "การวินิจฉัย Process Gate",
|
||||
"shippingLegacyStpJobs": "งาน STP ประวัติ"
|
||||
},
|
||||
"shippingOrderExtractionRuns": {
|
||||
"eyebrow": "การวินิจฉัยการทำงานแบบอ่านอย่างเดียว",
|
||||
@@ -3556,6 +3557,59 @@
|
||||
"lineStartAnchorRequired": "เมื่อแถวหลักมีการผูกฟิลด์แล้ว ต้องมีจุดเริ่มรายการที่กำหนดไว้ (ค่าเริ่มต้น customer_po_line_no)"
|
||||
}
|
||||
},
|
||||
"vc": {
|
||||
"panelTitle": "การตั้งค่า 3 แหล่งที่มา Vendor Comments",
|
||||
"namedRegionsTitle": "พื้นที่ที่ตั้งชื่อ",
|
||||
"addNamedRegion": "เพิ่มพื้นที่ Vendor Comments",
|
||||
"namedRegionLabel": "ชื่อพื้นที่",
|
||||
"pageScope": "ขอบเขตหน้า",
|
||||
"pageScopeFirstPage": "หน้าแรก",
|
||||
"pageScopeLastPage": "หน้าสุดท้าย",
|
||||
"pageScopeExactPage": "หน้าที่ระบุ",
|
||||
"selectionMode": "โหมดการเลือก",
|
||||
"selectionModeBox": "กรอบสี่เหลี่ยม",
|
||||
"selectionModeParagraph": "ย่อหน้า",
|
||||
"selectionModeLine": "บรรทัดเดียว",
|
||||
"deleteRegion": "ลบพื้นที่",
|
||||
"draftRequiredBanner": "พื้นที่หรือกฎเปลี่ยนแปลงแล้ว ต้องกลับไปที่ Draft และตรวจสอบใหม่ก่อนจะมีผล",
|
||||
"sourceHeader": "แหล่งที่มาพื้นที่ Header",
|
||||
"sourceTable": "แหล่งที่มาคอลัมน์ตาราง",
|
||||
"sourceVc": "แหล่งที่มา Vendor Comments",
|
||||
"targetScope": "ขอบเขตการใช้งาน",
|
||||
"scopeHeader": "ระดับคำสั่งซื้อทั้งหมด (Header)",
|
||||
"scopeLine": "ระดับรายการ (Line)",
|
||||
"relationPolicy": "นโยบายการเชื่อมโยง",
|
||||
"relationBindLine": "ผูกกับแถวรายการเป้าหมาย",
|
||||
"relationAnnotationOnly": "เฉพาะคำอธิบายประกอบ ไม่ผูกฟิลด์",
|
||||
"missingRelationPolicy": "การจัดการกรณีไม่มีการเชื่อมโยง",
|
||||
"missingDefaultAllLines": "นำไปใช้กับทุกแถวโดยค่าเริ่มต้น",
|
||||
"missingDefaultHeaderOnly": "นำไปใช้เฉพาะ Header",
|
||||
"missingFallbackDisabled": "ไม่สำรองกลับ (ทำเครื่องหมายว่าไม่มีการเชื่อมโยง)",
|
||||
"lineReferenceBasis": "หลักอ้างอิงหมายเลขแถว",
|
||||
"lineRefExplicit": "ค่าคอลัมน์ชัดแจ้ง (Line No.)",
|
||||
"lineRefBusiness": "หมายเลขแถวธุรกิจของ Profile",
|
||||
"lineRefLogical": "หมายเลขแถวตรรกะหลังจัดประเภท",
|
||||
"columnCode": "รหัสคอลัมน์ตาราง",
|
||||
"namedRegionId": "พื้นที่ที่ตั้งชื่อ",
|
||||
"fillMissingFromOthers": "เติมค่าว่างจากแหล่งที่มาอื่น",
|
||||
"formatPolicy": "นโยบายรูปแบบ",
|
||||
"formatInheritGlobal": "สืบทอดกฎทั่วโลก",
|
||||
"formatNumeric5Or10": "ตัวเลข 5 หรือ 10 หลัก",
|
||||
"formatCustomRegex": "Regex ที่ปลอดภัยกำหนดเอง",
|
||||
"customRegexPattern": "รูปแบบ Regex",
|
||||
"customRegexCaptureGroup": "ลำดับที่กลุ่มจับ",
|
||||
"customRegexUnsafe": "ปฏิเสธแล้ว: Regex มีนิพจน์การแบ็คแทร็กกิ้งที่อันตราย",
|
||||
"splitRules": "กฎการแยก",
|
||||
"splitPreview": "ดูตัวอย่างตัวเลือกและการรวม",
|
||||
"previewStatusNeedsReview": "ต้องตรวจทานด้วยคน",
|
||||
"previewStatusAccepted": "ยอมรับแล้ว",
|
||||
"previewConflictGroup": "กลุ่มข้อขัดแย้ง (scope={s}, field={f}, line={l})",
|
||||
"previewResolutionSameValue": "รวม: ค่าเดียวกันจากหลายแหล่ง",
|
||||
"previewResolutionSingleSource": "นำมาใช้โดยตรง: จากแหล่งเดียว",
|
||||
"previewResolutionFillMissing": "เติมแล้ว: ค่าว่างจากแหล่งที่มาอื่น",
|
||||
"previewResolutionConflict": "ข้อขัดแย้ง: ค่าแตกต่างกันจากหลายแหล่ง ต้องตรวจทานด้วยคน",
|
||||
"invalidLineReference": "หมายเลขแถวรายการที่อ้างอิงไม่มีอยู่ (Q12)"
|
||||
},
|
||||
"templateModes": {
|
||||
"coordinate": "พิกัด",
|
||||
"xfa_dataset": "เส้นทางข้อมูล XFA"
|
||||
@@ -4366,5 +4420,60 @@
|
||||
"succeeded": "สำเร็จ",
|
||||
"superseded": "ถูกแทนที่"
|
||||
}
|
||||
},
|
||||
"legacyStpJobs": {
|
||||
"pageTitle": "เล่นซ้ำงาน STP ประวัติ",
|
||||
"pageSubtitle": "กรองงานสร้างออเดอร์อัตโนมัติ STP ที่ล้มเหลว/ตาย (เช่น 928, 929) แล้วกู้คืนด้วย reconcile-and-progress ห้ามแก้ไข Job.status โดยตรง",
|
||||
"listTitle": "งานล้มเหลว / ตาย · ทั้งหมด {count} รายการ",
|
||||
"detailTitle": "รายละเอียดงานประวัติและการเล่นซ้ำ",
|
||||
"detailEmpty": "เลือกแถวทางซ้ายเพื่อดูรายละเอียด",
|
||||
"empty": "ไม่มีงาน STP ประวัติที่ล้มเหลว/ตาย เรียกใช้สคริปต์ CLI ด้วย --dry-run ก่อนเพื่อตรวจสอบแผน",
|
||||
"filterQ": "คำค้น (รหัส/ข้อความ/ข้อผิดพลาด)",
|
||||
"filterCaseNo": "รหัส Case",
|
||||
"filterErrorCode": "รหัสข้อผิดพลาด",
|
||||
"statusAll": "สถานะทั้งหมด",
|
||||
"job": "Job",
|
||||
"reviewCase": "Case ที่เชื่อมโยง",
|
||||
"blocking": "เหตุผลบล็อก",
|
||||
"linkedCase": "Review Case ที่เชื่อมโยงย้อนกลับ",
|
||||
"caseStatus": "สถานะ Case",
|
||||
"replayPlan": "แผนการเล่นซ้ำ (Reconcile And Progress)",
|
||||
"recommendedAction": "user_action ที่แนะนำ",
|
||||
"needsReplayMode": "ต้องเล่นซ้ำข้าม Case (replay_mode=true)",
|
||||
"userAction": "เลือกการดำเนินการเล่นซ้ำ",
|
||||
"replayButton": "เล่นซ้ำ Reconcile หนึ่งคลิก",
|
||||
"replayError_noCaseNo": "งานประวัตินี้ไม่สามารถเชื่อมโยงย้อนกลับไปยัง Review Case ได้ โปรดเลือก Case ใน Workspace ก่อน",
|
||||
"replaySuccess": "เล่นซ้ำสำเร็จ outcome={outcome}",
|
||||
"replayRejected": "เล่นซ้ำถูกปฏิเสธ outcome={outcome}",
|
||||
"payloadJson": "เพย์โหลดคำขอ (ปกปิดข้อมูลสำคัญ)",
|
||||
"resultJson": "ผลการดำเนินการ result_json (ปกปิดข้อมูลสำคัญ)",
|
||||
"reasonCodes": {
|
||||
"task_missing": "งานทางการสูญหาย",
|
||||
"stp_waiting_timeout": "STP รอเกินเวลา",
|
||||
"stp_not_enqueued_yet": "STP ยังไม่ได้เข้าคิว",
|
||||
"stp_job_failed": "การดำเนินงาน STP ล้มเหลว",
|
||||
"post_confirm_auto_progress_failed": "การดำเนินการอัตโนมัติหลังยืนยันล้มเหลว",
|
||||
"duplicate_decision_required": "รอการตัดสินใจเรื่องซ้ำ",
|
||||
"SHIPPING.NOTICE_EXACT_DUPLICATE": "ซ้ำ Case แบบตรง",
|
||||
"profile_schema_mismatch": "ไม่ตรงกับแม่แบบเอกสาร",
|
||||
"SHIPPING.STP_NOT_ELIGIBLE": "ไม่ผ่านเงื่อนไข STP",
|
||||
"SHIPPING.REVIEW_DRAFT_MISSING": "ไม่มีร่าง",
|
||||
"SHIPPING.REVIEW_RUN_MISSING": "ไม่มี RUN ระบุ",
|
||||
"SHIPPING.REVIEW_DOCUMENT_INVALID": "เอกสารไม่ถูกต้อง",
|
||||
"SHIPPING.REVIEW_DRAFT_VERSION_CONFLICT": "เวอร์ชันร่างขัดแย้ง",
|
||||
"final_required_field_missing": "ฟิลด์จำเป็นขาดหาย",
|
||||
"ownership_anomaly": "ความผิดปกติของความเป็นเจ้าของ (Q13 ฮาร์ดไอโอเลชัน)",
|
||||
"retry_needed": "ต้องลองใหม่"
|
||||
},
|
||||
"statusLabels": {
|
||||
"failed": "ล้มเหลว",
|
||||
"dead": "ตาย",
|
||||
"queued": "เข้าคิวแล้ว",
|
||||
"running": "กำลังดำเนินการ",
|
||||
"success": "สำเร็จ",
|
||||
"succeeded": "สำเร็จ",
|
||||
"completed": "เสร็จสิ้น",
|
||||
"cancelled": "ยกเลิก"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2174,6 +2174,29 @@
|
||||
"state_inconsistent": "ข้อมูลสถานะไม่สอดคล้อง"
|
||||
}
|
||||
},
|
||||
"currentTask": {
|
||||
"title": "งานปัจจุบัน",
|
||||
"labelStage": "ขั้นตอนปัจจุบัน",
|
||||
"labelStatus": "สถานะ",
|
||||
"labelFormalSn": "OT อย่างเป็นทางการ",
|
||||
"statusRunning": "ระบบกำลังประมวลผล",
|
||||
"statusWaitingHuman": "รอดำเนินการจากผู้ใช้",
|
||||
"statusRetryable": "ลองใหม่ได้",
|
||||
"statusFailed": "ประมวลผลอัตโนมัติล้มเหลว",
|
||||
"statusCompleted": "เสร็จสิ้น",
|
||||
"statusCancelled": "ยกเลิกแล้ว",
|
||||
"nextStepTitle": "ขั้นตอนถัดไป",
|
||||
"nextStepRunning": "ระบบกำลังดำเนินการ ยังไม่ต้องดำเนินการเอง",
|
||||
"nextStepCompleted": "ขณะนี้ไม่ต้องดำเนินการใดๆ",
|
||||
"nextStepCancelled": "งานนี้ถูกยกเลิกแล้ว จะไม่ดำเนินการต่อ",
|
||||
"nextStepFailedNoRetry": "ประมวลผลอัตโนมัติล้มเหลว โปรดติดต่อผู้ดูแลหรือตรวจสอบประวัติการตรวจสอบ",
|
||||
"nextStepWaitingHumanDefault": "รอดำเนินการจากผู้ใช้",
|
||||
"nextStepRetryableDefault": "ระบบระบุว่าสามารถลองใหม่ได้ กรุณาคลิก ลองใหม่ ด้านล่าง",
|
||||
"nextStepUnknown": "สถานะรอยืนยัน",
|
||||
"actionRetry": "ลองใหม่",
|
||||
"actionLocateLine": "ค้นหารายละเอียด",
|
||||
"actionUnknown": "ไม่รู้จักการดำเนินการนี้: {code}"
|
||||
},
|
||||
"completedChecks": {
|
||||
"title": "การตรวจที่เสร็จแล้ว ({count})",
|
||||
"codes": {
|
||||
@@ -2219,7 +2242,10 @@
|
||||
"field_conflict": "ความขัดแย้งของฟิลด์",
|
||||
"pdf_preferred": "เลือก PDF เป็นหลัก",
|
||||
"pdf_preferred_with_conflict": "เลือก PDF แต่ยังมีความขัดแย้ง",
|
||||
"auxiliary_supplement": "เติมด้วยหลักฐานเสริม"
|
||||
"auxiliary_supplement": "เติมด้วยหลักฐานเสริม",
|
||||
"vc_source_conflict_unresolved": "ค่าขัดแย้งจากหลายแหล่ง Vendor Comments ต้องตรวจสอบด้วยตนเอง",
|
||||
"vc_source_format_invalid": "รูปแบบฟิลด์ในพื้นที่ Vendor Comments ไม่ถูกต้อง",
|
||||
"vc_source_region_unbound": "พื้นที่ตั้งชื่อ Vendor Comments ยังไม่ถูกผูกกับโปรไฟล์"
|
||||
},
|
||||
"fields": {
|
||||
"reservation_id": "หมายเลขการจอง",
|
||||
@@ -2366,6 +2392,11 @@
|
||||
"ruleSuggestion": "แหล่งที่กฎแนะนำ",
|
||||
"ruleVersions": "เวอร์ชันกฎ",
|
||||
"hint": "คำใบ้แหล่งสต็อก",
|
||||
"matchedRules": "กฎที่จับคู่แล้ว: {count} ข้อ",
|
||||
"unavailableReasons": {
|
||||
"source_disabled": "แหล่งสต็อกยังไม่ได้เปิดใช้งาน"
|
||||
},
|
||||
"unavailableReasonUnknown": "ไม่ทราบสาเหตุที่ไม่พร้อมใช้งาน (ระบบไม่สามารถระบุได้ว่าทำไมแหล่งรอบรองนี้จึงไม่พร้อมใช้งาน)",
|
||||
"rerouteHint": "สามารถจับคู่กฎเส้นทางใหม่ได้ตลอดเวลา หากมีคำแนะนำค้างอยู่ ให้ตัดสินใจใช้ผลจากกฎหรือคงผลที่เลือกเองก่อน"
|
||||
},
|
||||
"confirmDialog": {
|
||||
@@ -2534,6 +2565,7 @@
|
||||
"retry": "การประมวลผลล้มเหลว โปรดตรวจสอบสาเหตุแล้วลองใหม่"
|
||||
},
|
||||
"progress": {
|
||||
"title": "สถานะการประมวลผลคำสั่ง",
|
||||
"completedOfTotal": "เสร็จแล้ว {done} / {total}",
|
||||
"currentStage": "ปัจจุบัน: {stage}",
|
||||
"remainingHint": "เหลืออีก {count} ขั้นตอน",
|
||||
@@ -2588,6 +2620,7 @@
|
||||
"confirm_customer": "ยืนยันลูกค้า",
|
||||
"resolve_field_conflicts": "แก้ความขัดแย้งของฟิลด์",
|
||||
"adjudicate_duplicate": "ตัดสินคำสั่งซื้อซ้ำ",
|
||||
"reconcile_and_progress": "ปรับทานตัวและดำเนินการต่อ",
|
||||
"open_inventory_source_review": "ตรวจทานแหล่งสินค้าคงคลัง",
|
||||
"open_inventory_match_review": "ตรวจทานการจับคู่สต็อก",
|
||||
"open_shortage_review": "จัดการสต็อกไม่พอ",
|
||||
@@ -2603,6 +2636,17 @@
|
||||
"retry_parse": "ลองแยกวิเคราะห์อีกครั้ง",
|
||||
"more": "เพิ่มเติม"
|
||||
},
|
||||
"reasonCode": {
|
||||
"duplicateDecisionRequired": "พบหนังสือแจ้งจัดส่งซ้ำ ต้องมีการตัดสินใจด้วยตนเอง",
|
||||
"exactDuplicateNotice": "ไฟล์นี้มีอยู่แล้วในงานที่กำลังดำเนินการ กรุณาอย่าส่งซ้ำ",
|
||||
"stpNotEligible": "คำสั่งซื้อปัจจุบันยังไม่ตรงตามเกณฑ์การสร้างอัตโนมัติ กรุณาเสร็จสิ้นการตรวจสอบและประตูก่อน",
|
||||
"reviewDraftMissing": "ไม่มีร่างคำสั่งซื้อ กรุณาเสร็จสิ้นการแยกข้อมูลและตรวจสอบก่อน",
|
||||
"reviewRunMissing": "ไม่พบบันทึกการรันการแยกข้อมูลที่เกี่ยวข้อง กรุณาแยกข้อมูลใหม่",
|
||||
"reviewDocumentInvalid": "เอกสาร PDF ที่จะตรวจสอบไม่ถูกต้องหรือไม่สามารถเข้าถึงได้",
|
||||
"reviewDraftVersionConflict": "ร่างคำสั่งซื้อถูกอัปเดตในหน้าต่างอื่นแล้ว กรุณารีเฟรชและลองใหม่",
|
||||
"profileSchemaMismatch": "เวอร์ชันเทมเพลตฟิลด์คำสั่งซื้อไม่ตรงกัน กรุณาสร้างร่างใหม่",
|
||||
"finalRequiredFieldMissing": "คำสั่งซื้อยังขาดฟิลด์สำคัญ กรุณากรอกให้ครบก่อนยืนยัน"
|
||||
},
|
||||
"title": "กำลังดำเนินการ",
|
||||
"showDetails": "เปิดรายการเต็มในไดอะล็อก",
|
||||
"detailsDrawerTitle": "ชุดงานและไฟล์",
|
||||
|
||||
@@ -489,7 +489,31 @@
|
||||
"SHIPPING.STP_ENQUEUE_FAILED": "จัดคิวสร้างออเดอร์อัตโนมัติไม่สำเร็จ กรุณาลองใหม่หรือติดต่อผู้ดูแล",
|
||||
"SHIPPING.STP_NOT_ELIGIBLE": "ออเดอร์นี้ยังไม่ผ่านเงื่อนไขสร้างอัตโนมัติ กรุณาตรวจและผ่านเกตก่อนลองใหม่",
|
||||
"SHIPPING.STP_CASE_NO_REQUIRED": "ต้องมีหมายเลขเคสตรวจทานเพื่อสร้างออเดอร์อัตโนมัติ",
|
||||
"SHIPPING.STP_AUTO_CREATE_FAILED": "สร้างออเดอร์อัตโนมัติล้มเหลว กรุณาลองใหม่หรือยืนยันด้วยตนเอง"
|
||||
"SHIPPING.STP_AUTO_CREATE_FAILED": "สร้างออเดอร์อัตโนมัติล้มเหลว กรุณาลองใหม่หรือยืนยันด้วยตนเอง",
|
||||
"SHIPPING.RECONCILE_OPERATION_ID_REQUIRED": "การดำเนินการปรับทานตัวต้องมี operation_id จากไคลเอนต์ กรุณารีเฟรชและลองใหม่",
|
||||
"SHIPPING.RECONCILE_OPERATION_ID_TOO_LONG": "operation_id สำหรับการปรับทานตัวยาวเกิน 128 ตัวอักษร",
|
||||
"SHIPPING.RECONCILE_INVALID_USER_ACTION": "user_action สำหรับการปรับทานตัวไม่ถูกต้อง เลือก reuse, create_revision หรือ force_create",
|
||||
"SHIPPING.RECONCILE_INVALID_EXPECTED_VERSION": "expected_case_version ต้องเป็นจำนวนเต็มหากระบุ",
|
||||
"SHIPPING.RECONCILE_IDEMPOTENT_CONFLICT": "operation_id เดิมแต่สแน็ปช็อตคำขอเปลี่ยนแปลง กรุณาสร้าง operation_id ใหม่แล้วส่งอีกครั้ง",
|
||||
"SHIPPING.RECONCILE_OWNERSHIP_ANOMALY": "ความเป็นเจ้าของงานไม่ชัดเจน กรุณาให้ผู้ปฏิบัติงานตัดสินใจก่อนดำเนินการต่อ",
|
||||
"SHIPPING.RECONCILE_FORCE_CREATE_UNAUTHORIZED": "force_create ต้องมีสิทธิ์ admin หรือสิทธิพิเศษ",
|
||||
"SHIPPING.RECONCILE_LOCK_VISIBILITY_RACE": "แถวที่ล็อกไม่ตรงกับแถวที่มองเห็น กรุณาลองใหม่",
|
||||
"SHIPPING.RETRY_STP_BLOCKED_MANUAL": "กำลังรอการตัดสินใจด้วยตนเอง ห้ามใช้การลองใหม่ทางเทคนิค ใช้ reconcile-and-progress หรือ endpoint ตัดสินคำสั่งซื้อซ้ำแทน",
|
||||
"SHIPPING.REVIEW_LLM_DISABLED": "ฟีเจอร์คำแนะนำ AI สำหรับตรวจสอบใบสั่งซื้อถูกปิด ไม่ได้สร้างคำแนะนำ โปรดตรวจสอบด้วยตนเองแทน",
|
||||
"SHIPPING.REVIEW_LLM_PROVIDER_UNAVAILABLE": "บริการ AI ไม่พร้อมใช้งานชั่วคราว (ไม่มีคีย์ Dify หรือคำขอล้มเหลว) ข้ามคำแนะนำแล้ว โปรดตรวจสอบด้วยตนเอง",
|
||||
"SHIPPING.REVIEW_LLM_FIELD_MISMATCH": "AI ส่งคืนฟิลด์ที่ไม่ตรงกับฟิลด์ที่ร้องขอ ผลลัพธ์ถูกปฏิเสธ โปรดอย่ายอมรับ",
|
||||
"SHIPPING.REVIEW_LLM_VALIDATION_FAILED": "คำแนะนำจาก AI ไม่ผ่านการตรวจสอบความสอดคล้องกับหลักฐาน ไม่สามารถเขียนลงร่างได้ โปรดป้อนค่าที่ถูกต้องด้วยตนเองเพื่อดำเนินการต่อ",
|
||||
"SHIPPING.REVIEW_LLM_GATE_FIELD_NOT_FOUND": "ไม่พบฟิลด์ตรวจสอบนี้ในสคีมาที่แช่แข็ง ไม่สามารถสร้างคำแนะนำ AI ได้",
|
||||
"SHIPPING.REVIEW_LLM_GATE_LINE_NOT_FOUND": "ไม่พบบรรทัดเป้าหมาย AI ไม่สามารถสร้างคำแนะนำระดับบรรทัดได้ โปรดตรวจสอบโครงสร้างบรรทัดแล้วลองใหม่",
|
||||
"SHIPPING.REVIEW_LLM_GATE_FIELD_VALUE_MISSING": "ฟิลด์เป้าหมายไม่มีค่าดิบ AI ไม่สามารถให้คำแนะนำตามข้อเท็จจริงได้ โปรดป้อนค่าด้วย OCR หรือป้อนด้วยตนเองก่อน",
|
||||
"SHIPPING.REVIEW_LLM_GATE_EVIDENCE_UNAVAILABLE": "ไม่พบแหล่งหลักฐานสำหรับฟิลด์นี้ (คล้ายกับปัญหา Case 95) บล็อกการส่ง AI เพื่อหลีกเลี่ยงผลลัพธ์เท็จ โปรดปิดการรู้จำ OCR หรือแยกวิเคราะห์ PDF ใหม่ก่อน",
|
||||
"SHIPPING.REVIEW_LLM_GATE_CONTEXT_INSUFFICIENT": "บรรทัดนี้มีฟิลด์บริบทน้อยกว่า 2 ฟิลด์ จึงไม่สามารถให้คำแนะนำระดับบรรทัดที่น่าเชื่อถือได้ โปรดปิดการรู้จำฟิลด์ใกล้เคียงก่อน",
|
||||
"SHIPPING.REVIEW_LLM_GATE_POLICY_BLOCKED": "ฟิลด์นี้เป็นฟิลด์ที่ละเอียดอ่อน/ภายใน ถูกป้องกันตามนโยบายความปลอดภัยจากการส่งไปยัง AI โปรดยืนยันด้วยตนเอง",
|
||||
"SHIPPING.REVIEW_LLM_GATE_CONTEXT_BUILD_FAILED": "เกิดข้อผิดพลาดขณะสร้างมุมมองหลักฐาน ข้ามคำแนะนำ AI แล้ว โปรดรีเฟรชและลองใหม่ หรือติดต่อผู้ดูแลระบบ",
|
||||
"SHIPPING.REVIEW_LLM_GATE_EVIDENCE_TRUNCATED": "หลักฐานหลักของฟิลด์เป้าหมายถูกตัดเนื่องจากงบประมาณ Token หมด AI ได้ยกเลิกเพื่อหลีกเลี่ยงข้อสรุปที่ผิด โปรดตรวจสอบฟิลด์นี้ด้วยตนเอง",
|
||||
"SHIPPING.REVIEW_LLM_GATE_CONTEXT_AMBIGUOUS": "มีผู้สมัครหลายแหล่งที่มา และไม่สามารถกำหนดหลักฐานหลักได้อย่างชัดเจน AI ได้ยกเลิกเพื่อหลีกเลี่ยงความสับสน โปรดแก้ไขความคลุมเครือก่อน แล้วลองใหม่",
|
||||
"SHIPPING.REVIEW_LLM_GATE_L4_FORBIDDEN": "การใช้หลักฐานระดับหน้า (L4) ต้องมีการอนุญาตจากผู้ดูแลระบบอย่างชัดเจน ผู้ใช้ทั่วไปไม่สามารถร้องขอได้",
|
||||
"SHIPPING.REVIEW_LLM_L4_FORBIDDEN": "การใช้หลักฐาน PDF เต็ม (L4) ต้องมีการอนุญาตจากผู้ดูแลระบบอย่างชัดเจน คำขอนี้ถูกปิดกั้น"
|
||||
},
|
||||
"SHIPPING.REVIEW_INVENTORY_SOURCE_UNRESOLVED": "ยังไม่ยืนยันแหล่งสต็อกแบบเฉพาะเจาะจง ไม่สามารถสร้างคำสั่งอย่างเป็นทางการได้ กรุณาตรวจสอบแหล่งสต็อกก่อน",
|
||||
"SHIPPING_REVIEW_INVENTORY_SOURCE_UNRESOLVED": "ยังไม่ยืนยันแหล่งสต็อกแบบเฉพาะเจาะจง ไม่สามารถสร้างคำสั่งอย่างเป็นทางการได้ กรุณาตรวจสอบแหล่งสต็อกก่อน"
|
||||
|
||||
@@ -172,6 +172,7 @@
|
||||
"noAction": "ขณะนี้ไม่มีการดำเนินการที่ใช้ได้",
|
||||
"versionMissing": "ข้อมูลนี้มีการเปลี่ยนแปลง โปรดรีเฟรชแล้วลองใหม่",
|
||||
"navigationMissing": "ไม่มีข้อมูลสำหรับนำทาง โปรดรีเฟรชแล้วลองใหม่",
|
||||
"customerTaskMissing": "ไม่มีหมายเลขงาน — ไม่สามารถเปิดยืนยันลูกค้าได้ โปรดรีเฟรชแล้วลองใหม่",
|
||||
"genericBlocking": "ขั้นตอนนี้ต้องดำเนินการด้วยตนเอง",
|
||||
"unknownStep": "ขั้นตอนปัจจุบัน",
|
||||
"continueAction": "ดำเนินการต่อ",
|
||||
@@ -179,25 +180,41 @@
|
||||
"submitting": "กำลังส่ง…",
|
||||
"readOnlyUseFooter": "ใช้แถบดำเนินการด้านล่างเพื่อดำเนินการต่อ",
|
||||
"actionCodes": {
|
||||
"rematerialize_document": "เตรียมเอกสารใหม่",
|
||||
"retry_layout_parsing": "ลองแยกผังเลย์เอาต์อีกครั้ง",
|
||||
"reroute_document_profile": "จับคู่โปรไฟล์เอกสารใหม่",
|
||||
"open_profile_review": "เปิดการตรวจทานโปรไฟล์",
|
||||
"retry_order_extraction": "ลองแยกคำสั่งซื้ออีกครั้ง",
|
||||
"open_order_review": "เปิดการตรวจทานคำสั่งซื้อ",
|
||||
"edit_order_fields": "แก้ไขฟิลด์คำสั่งซื้อ",
|
||||
"revalidate_reservation": "ตรวจสอบ Reservation อีกครั้ง",
|
||||
"edit_reservation": "แก้ไข Reservation",
|
||||
"retry_customer_resolution": "ลองระบุลูกค้าอีกครั้ง",
|
||||
"confirm_customer": "ยืนยันลูกค้า",
|
||||
"retry_duplicate_detection": "ลองตรวจหาข้อมูลซ้ำอีกครั้ง",
|
||||
"adjudicate_duplicate": "ตัดสินคำสั่งซื้อซ้ำ",
|
||||
"reconcile_and_progress": "ปรับทานตัวและกู้คืนอัตโนมัติ",
|
||||
"resolve_field_conflicts": "แก้ไขความขัดแย้งฟิลด์",
|
||||
"retry_with_latest_rules": "ลองใหม่ด้วยกฎล่าสุด",
|
||||
"open_inventory_source_review": "เปิดการตรวจสอบแหล่งสต็อก",
|
||||
"open_order_review": "เปิดการตรวจทานคำสั่งซื้อ",
|
||||
"open_profile_review": "เปิดการตรวจทานโปรไฟล์",
|
||||
"edit_order_fields": "แก้ไขฟิลด์คำสั่งซื้อ",
|
||||
"confirm_customer": "ยืนยันลูกค้า",
|
||||
"adjudicate_duplicate": "ตัดสินคำสั่งซื้อซ้ำ",
|
||||
"resolve_field_conflicts": "แก้ไขความขัดแย้งฟิลด์",
|
||||
"open_inventory_match_review": "เปิดการตรวจสอบการจับคู่สต็อก",
|
||||
"open_shortage_review": "เปิดการตรวจสอบสินค้าขาด",
|
||||
"upload_inventory_file": "อัปโหลดไฟล์สต็อก",
|
||||
"adopt_rule_suggestion": "ยอมรับคำแนะนำกฎ",
|
||||
"keep_manual_inventory_decision": "คงการตัดสินใจด้วยตนเอง",
|
||||
"recheck_freeze_readiness": "ตรวจสอบสิทธิ์การสร้างงานใหม่",
|
||||
"retry_task_creation": "ลองสร้างงานใหม่",
|
||||
"retry_inventory_preparation": "ลองเตรียมสต็อกใหม่",
|
||||
"poll_inventory_preparation": "รีเฟรชความคืบหน้าเตรียมสต็อก",
|
||||
"upload_inventory_file": "อัปโหลดไฟล์สต็อก",
|
||||
"retry_inventory_field_mapping": "ลองแมปฟิลด์สต็อกอีกครั้ง",
|
||||
"confirm_inventory_field_mapping": "ยืนยันการแมปฟิลด์สต็อก",
|
||||
"retry_inventory_matching": "ลองจับคู่สต็อกอีกครั้ง",
|
||||
"open_inventory_match_review": "เปิดการตรวจสอบการจับคู่สต็อก",
|
||||
"recheck_inventory_sufficiency": "ตรวจสอบความเพียงพอของสต็อกอีกครั้ง",
|
||||
"open_shortage_review": "เปิดการตรวจสอบสินค้าขาด",
|
||||
"recheck_excel_readiness": "ตรวจสอบสิทธิ์การสร้าง Excel อีกครั้ง",
|
||||
"regenerate_excel_artifact": "สร้าง Excel ใหม่",
|
||||
"poll_freight_upload_rpa": "รีเฟรชความคืบหน้าอัปโหลด freight",
|
||||
"retry_freight_upload_rpa": "ลองอัปโหลด freight RPA อีกครั้ง",
|
||||
"regenerate_manual_upload_todo": "สร้างงานอัปโหลดด้วยตนเองใหม่"
|
||||
"regenerate_manual_upload_todo": "สร้างรายการอัปโหลดด้วยตนเองใหม่"
|
||||
},
|
||||
"reasons": {
|
||||
"freeze_not_ready": "คำสั่งซื้อยังไม่พร้อมสร้างหรือ freeze",
|
||||
|
||||
@@ -41,7 +41,8 @@
|
||||
"shippingOrderExtractionRuns": "识别任务",
|
||||
"shippingOrderDocumentProfiles": "文档模板",
|
||||
"shippingAudit": "运行与审计中心",
|
||||
"shippingProcessGates": "门禁诊断"
|
||||
"shippingProcessGates": "门禁诊断",
|
||||
"shippingLegacyStpJobs": "历史 STP Job"
|
||||
},
|
||||
"shippingFieldAssets": {
|
||||
"title": "字段资产库",
|
||||
@@ -3794,6 +3795,59 @@
|
||||
"lineStartAnchorRequired": "主行已绑定字段时,必须包含配置的起行锚点(默认 customer_po_line_no)。"
|
||||
}
|
||||
},
|
||||
"vc": {
|
||||
"panelTitle": "Vendor Comments 三来源配置",
|
||||
"namedRegionsTitle": "命名区域",
|
||||
"addNamedRegion": "新增 Vendor Comments 区域",
|
||||
"namedRegionLabel": "区域名称",
|
||||
"pageScope": "页面范围",
|
||||
"pageScopeFirstPage": "首页",
|
||||
"pageScopeLastPage": "末页",
|
||||
"pageScopeExactPage": "指定页",
|
||||
"selectionMode": "选择模式",
|
||||
"selectionModeBox": "矩形框",
|
||||
"selectionModeParagraph": "段落",
|
||||
"selectionModeLine": "单行",
|
||||
"deleteRegion": "删除区域",
|
||||
"draftRequiredBanner": "区域或规则已变更,需回 Draft 重新校验后生效",
|
||||
"sourceHeader": "Header 区域来源",
|
||||
"sourceTable": "表身列来源",
|
||||
"sourceVc": "Vendor Comments 来源",
|
||||
"targetScope": "作用域",
|
||||
"scopeHeader": "整单级(Header)",
|
||||
"scopeLine": "行级(Line)",
|
||||
"relationPolicy": "关联策略",
|
||||
"relationBindLine": "绑定目标明细行",
|
||||
"relationAnnotationOnly": "仅注释,不绑定字段",
|
||||
"missingRelationPolicy": "缺失关联处理",
|
||||
"missingDefaultAllLines": "默认应用至所有行",
|
||||
"missingDefaultHeaderOnly": "仅应用至 Header",
|
||||
"missingFallbackDisabled": "不回退(标记未关联)",
|
||||
"lineReferenceBasis": "行号基准",
|
||||
"lineRefExplicit": "显式列值(Line No.)",
|
||||
"lineRefBusiness": "Profile 业务行号",
|
||||
"lineRefLogical": "分类后逻辑行号",
|
||||
"columnCode": "表列编码",
|
||||
"namedRegionId": "命名区域",
|
||||
"fillMissingFromOthers": "空值从其他来源补齐",
|
||||
"formatPolicy": "格式策略",
|
||||
"formatInheritGlobal": "继承全局规则",
|
||||
"formatNumeric5Or10": "5 或 10 位数字",
|
||||
"formatCustomRegex": "自定义安全正则",
|
||||
"customRegexPattern": "正则模式",
|
||||
"customRegexCaptureGroup": "捕获组序号",
|
||||
"customRegexUnsafe": "正则包含危险回溯表达式,已拒绝",
|
||||
"splitRules": "拆分规则",
|
||||
"splitPreview": "预览候选与合并",
|
||||
"previewStatusNeedsReview": "需人工复核",
|
||||
"previewStatusAccepted": "已接受",
|
||||
"previewConflictGroup": "冲突组(scope={s}, field={f}, line={l})",
|
||||
"previewResolutionSameValue": "多来源同值合并",
|
||||
"previewResolutionSingleSource": "单来源直接采用",
|
||||
"previewResolutionFillMissing": "空值从其他来源补齐",
|
||||
"previewResolutionConflict": "多来源值冲突,需人工复核",
|
||||
"invalidLineReference": "关联的明细行号不存在(Q12)"
|
||||
},
|
||||
"templateModes": {
|
||||
"coordinate": "坐标标注",
|
||||
"xfa_dataset": "XFA 数据路径"
|
||||
@@ -4477,5 +4531,60 @@
|
||||
"succeeded": "成功",
|
||||
"superseded": "已替代"
|
||||
}
|
||||
},
|
||||
"legacyStpJobs": {
|
||||
"pageTitle": "历史 STP Job 回放",
|
||||
"pageSubtitle": "筛选失败/死 STP 自动建单任务(如 928、929),一键通过 reconcile-and-progress 恢复;严格不直接写 Job 状态。",
|
||||
"listTitle": "失败 / 死 Job · 共 {count} 条",
|
||||
"detailTitle": "历史 Job 详情与回放",
|
||||
"detailEmpty": "点击左侧某一行查看详情",
|
||||
"empty": "暂无失败/死历史 Job;若需要回放,请使用 --dry-run 先在脚本侧预览。",
|
||||
"filterQ": "关键字(编号/信息/错误)",
|
||||
"filterCaseNo": "Case 编号",
|
||||
"filterErrorCode": "错误码",
|
||||
"statusAll": "全部状态",
|
||||
"job": "Job",
|
||||
"reviewCase": "关联 Case",
|
||||
"blocking": "阻断原因",
|
||||
"linkedCase": "回链 Review Case",
|
||||
"caseStatus": "Case 状态",
|
||||
"replayPlan": "回放计划(Reconcile And Progress)",
|
||||
"recommendedAction": "推荐 user_action",
|
||||
"needsReplayMode": "需跨 Case 回放 (replay_mode=true)",
|
||||
"userAction": "选择回放动作",
|
||||
"replayButton": "一键回放 Reconcile",
|
||||
"replayError_noCaseNo": "该历史 Job 无法回链到 Review Case,需要在工作台指定 Case 后再回放。",
|
||||
"replaySuccess": "回放成功,outcome={outcome}",
|
||||
"replayRejected": "回放被拒绝,outcome={outcome}",
|
||||
"payloadJson": "请求 payload(已脱敏)",
|
||||
"resultJson": "执行结果 result_json(已脱敏)",
|
||||
"reasonCodes": {
|
||||
"task_missing": "正式任务丢失",
|
||||
"stp_waiting_timeout": "STP 等待超时",
|
||||
"stp_not_enqueued_yet": "STP 尚未入队",
|
||||
"stp_job_failed": "STP Job 执行失败",
|
||||
"post_confirm_auto_progress_failed": "建单后自动推进失败",
|
||||
"duplicate_decision_required": "重复裁决待确认",
|
||||
"SHIPPING.NOTICE_EXACT_DUPLICATE": "重复 Case 完全一致",
|
||||
"profile_schema_mismatch": "文档模板不匹配",
|
||||
"SHIPPING.STP_NOT_ELIGIBLE": "不符合 STP 资格",
|
||||
"SHIPPING.REVIEW_DRAFT_MISSING": "草稿缺失",
|
||||
"SHIPPING.REVIEW_RUN_MISSING": "识别 RUN 缺失",
|
||||
"SHIPPING.REVIEW_DOCUMENT_INVALID": "文档失效",
|
||||
"SHIPPING.REVIEW_DRAFT_VERSION_CONFLICT": "草稿版本冲突",
|
||||
"final_required_field_missing": "必填字段缺失",
|
||||
"ownership_anomaly": "归属异常(Q13 硬隔离)",
|
||||
"retry_needed": "需要重试"
|
||||
},
|
||||
"statusLabels": {
|
||||
"failed": "失败",
|
||||
"dead": "死任务",
|
||||
"queued": "排队",
|
||||
"running": "执行中",
|
||||
"success": "成功",
|
||||
"succeeded": "成功",
|
||||
"completed": "完成",
|
||||
"cancelled": "取消"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2220,6 +2220,29 @@
|
||||
"state_inconsistent": "状态数据不一致"
|
||||
}
|
||||
},
|
||||
"currentTask": {
|
||||
"title": "当前任务",
|
||||
"labelStage": "当前阶段",
|
||||
"labelStatus": "状态",
|
||||
"labelFormalSn": "正式 OT",
|
||||
"statusRunning": "系统处理中",
|
||||
"statusWaitingHuman": "待人工处理",
|
||||
"statusRetryable": "可重试",
|
||||
"statusFailed": "自动处理失败",
|
||||
"statusCompleted": "已完成",
|
||||
"statusCancelled": "已取消",
|
||||
"nextStepTitle": "下一步",
|
||||
"nextStepRunning": "系统正在处理,暂不需要人工操作",
|
||||
"nextStepCompleted": "当前无需人工操作",
|
||||
"nextStepCancelled": "任务已取消,不再继续处理",
|
||||
"nextStepFailedNoRetry": "自动处理失败,请联系管理员或查看审计记录",
|
||||
"nextStepWaitingHumanDefault": "当前待人工处理",
|
||||
"nextStepRetryableDefault": "系统判断可重试,请点击下方「重试」",
|
||||
"nextStepUnknown": "状态待确认",
|
||||
"actionRetry": "重试",
|
||||
"actionLocateLine": "定位明细",
|
||||
"actionUnknown": "未识别的动作「{code}」"
|
||||
},
|
||||
"completedChecks": {
|
||||
"title": "已完成检查({count})",
|
||||
"codes": {
|
||||
@@ -2265,7 +2288,10 @@
|
||||
"field_conflict": "字段冲突",
|
||||
"pdf_preferred": "PDF 优先采纳",
|
||||
"pdf_preferred_with_conflict": "PDF 优先但存在冲突",
|
||||
"auxiliary_supplement": "辅助证据补充"
|
||||
"auxiliary_supplement": "辅助证据补充",
|
||||
"vc_source_conflict_unresolved": "Vendor Comments 三来源取值冲突待人工裁决",
|
||||
"vc_source_format_invalid": "Vendor Comments 区域字段格式不合法",
|
||||
"vc_source_region_unbound": "Vendor Comments 命名区域未绑定到 Profile"
|
||||
},
|
||||
"fields": {
|
||||
"reservation_id": "预约单号",
|
||||
@@ -2413,6 +2439,11 @@
|
||||
"ruleSuggestion": "规则建议源",
|
||||
"ruleVersions": "规则版本",
|
||||
"hint": "库存源提示",
|
||||
"matchedRules": "已匹配规则:{count} 条",
|
||||
"unavailableReasons": {
|
||||
"source_disabled": "库存源未启用"
|
||||
},
|
||||
"unavailableReasonUnknown": "不可用原因未知(系统无法识别该候选源的缺失原因)",
|
||||
"rerouteHint": "可随时重新匹配路由;若存在待决规则建议,请选择采用或保留人工结果。"
|
||||
},
|
||||
"confirmDialog": {
|
||||
@@ -2535,6 +2566,7 @@
|
||||
"retry": "当前处理失败,请检查原因后重试"
|
||||
},
|
||||
"progress": {
|
||||
"title": "订单处理进度",
|
||||
"completedOfTotal": "已完成 {done} / {total}",
|
||||
"currentStage": "当前:{stage}",
|
||||
"remainingHint": "后续还有 {count} 个阶段",
|
||||
@@ -2589,6 +2621,7 @@
|
||||
"confirm_customer": "确认客户",
|
||||
"resolve_field_conflicts": "处理字段冲突",
|
||||
"adjudicate_duplicate": "裁决重复订单",
|
||||
"reconcile_and_progress": "对账并恢复流程",
|
||||
"open_inventory_source_review": "进入库存源处理",
|
||||
"open_inventory_match_review": "进入库存匹配处理",
|
||||
"open_shortage_review": "处理库存异常",
|
||||
@@ -2604,6 +2637,17 @@
|
||||
"retry_parse": "重试解析",
|
||||
"more": "更多"
|
||||
},
|
||||
"reasonCode": {
|
||||
"duplicateDecisionRequired": "检测到重复发货通知,需要人工决定处理方式",
|
||||
"exactDuplicateNotice": "该文件已存在于进行中的任务,请勿重复提交",
|
||||
"stpNotEligible": "当前订单尚未满足自动建单条件,请先完成校验与门禁",
|
||||
"reviewDraftMissing": "订单草稿不存在,请先完成识别与复核",
|
||||
"reviewRunMissing": "缺少对应的识别运行记录,请重新识别",
|
||||
"reviewDocumentInvalid": "复核 PDF 文档无效或不可访问",
|
||||
"reviewDraftVersionConflict": "订单草稿已被其他窗口更新,请刷新后重试",
|
||||
"profileSchemaMismatch": "订单字段模板版本不匹配,请重新生成草稿",
|
||||
"finalRequiredFieldMissing": "订单仍缺少关键字段,请补全后再确认建单"
|
||||
},
|
||||
"title": "本次处理中",
|
||||
"summaryLine": "{total} 个文件 · {processing} 个处理中 · {needsAction} 个待处理 · {completed} 个已完成",
|
||||
"summaryTasksAndFiles": "{tasks} 个任务 · {files} 个文件",
|
||||
|
||||
@@ -489,7 +489,31 @@
|
||||
"SHIPPING.STP_ENQUEUE_FAILED": "自动建单入队失败,请稍后重试或联系管理员。",
|
||||
"SHIPPING.STP_NOT_ELIGIBLE": "当前订单尚未满足自动建单条件,请先完成校验与门禁后再重试。",
|
||||
"SHIPPING.STP_CASE_NO_REQUIRED": "缺少复核单编号,无法执行自动建单。",
|
||||
"SHIPPING.STP_AUTO_CREATE_FAILED": "自动建单执行失败,请重试或改用人工确认。"
|
||||
"SHIPPING.STP_AUTO_CREATE_FAILED": "自动建单执行失败,请重试或改用人工确认。",
|
||||
"SHIPPING.RECONCILE_OPERATION_ID_REQUIRED": "对账操作缺少 operation_id,请刷新页面后重试。",
|
||||
"SHIPPING.RECONCILE_OPERATION_ID_TOO_LONG": "对账操作 operation_id 超过 128 字符。",
|
||||
"SHIPPING.RECONCILE_INVALID_USER_ACTION": "对账用户动作不合法,请选择复用、新建修订或强制新建。",
|
||||
"SHIPPING.RECONCILE_INVALID_EXPECTED_VERSION": "expected_case_version 必须是整数。",
|
||||
"SHIPPING.RECONCILE_IDEMPOTENT_CONFLICT": "同一 operation_id 请求参数已变更,请生成新的 operation_id 再提交。",
|
||||
"SHIPPING.RECONCILE_OWNERSHIP_ANOMALY": "任务归属关系不明确,请交由人工裁决后再推进。",
|
||||
"SHIPPING.RECONCILE_FORCE_CREATE_UNAUTHORIZED": "强制新建重复订单需要管理员或特殊权限。",
|
||||
"SHIPPING.RECONCILE_LOCK_VISIBILITY_RACE": "对账锁行与可见行不一致,请重试。",
|
||||
"SHIPPING.RETRY_STP_BLOCKED_MANUAL": "当前等待人工裁决,请勿使用技术重试;请通过对账恢复或裁决重复订单接口推进。",
|
||||
"SHIPPING.REVIEW_LLM_DISABLED": "订单复核 AI 建议功能已关闭,本次未生成建议。请直接人工核对即可。",
|
||||
"SHIPPING.REVIEW_LLM_PROVIDER_UNAVAILABLE": "AI 服务暂时不可用(未配置 Dify 密钥或请求失败)。建议已跳过,请按人工流程复核。",
|
||||
"SHIPPING.REVIEW_LLM_FIELD_MISMATCH": "AI 返回的字段与当前复核字段不一致。建议已丢弃,请勿采纳本次结果。",
|
||||
"SHIPPING.REVIEW_LLM_VALIDATION_FAILED": "AI 建议未通过证据一致性校验,不能写入草稿。可人工录入正确值后继续。",
|
||||
"SHIPPING.REVIEW_LLM_GATE_FIELD_NOT_FOUND": "未在冻结模板中找到该复核字段,无法生成 AI 建议。",
|
||||
"SHIPPING.REVIEW_LLM_GATE_LINE_NOT_FOUND": "明细行缺失,无法为该行生成 AI 建议。请确认行结构后重试。",
|
||||
"SHIPPING.REVIEW_LLM_GATE_FIELD_VALUE_MISSING": "该字段缺少原始值,AI 无法基于事实给出建议。请先补齐机器识别或人工输入。",
|
||||
"SHIPPING.REVIEW_LLM_GATE_EVIDENCE_UNAVAILABLE": "未检索到该字段的证据来源(Case 95 类断裂),AI 静默已阻断。请先完成识别或重新解析 PDF。",
|
||||
"SHIPPING.REVIEW_LLM_GATE_CONTEXT_INSUFFICIENT": "该行上下文字段不足 2 条,无法给出可靠行级建议。请先补足相邻字段的识别结果。",
|
||||
"SHIPPING.REVIEW_LLM_GATE_POLICY_BLOCKED": "该字段属于敏感/内部字段,按安全策略不允许发送给 AI。请直接人工确认。",
|
||||
"SHIPPING.REVIEW_LLM_GATE_CONTEXT_BUILD_FAILED": "构建证据视图时发生异常,已放弃本次 AI 建议。请刷新后重试或联系管理员。",
|
||||
"SHIPPING.REVIEW_LLM_GATE_EVIDENCE_TRUNCATED": "目标字段核心证据超出 Token 预算被截断,AI 已放弃以避免错误结论。请人工复核该字段。",
|
||||
"SHIPPING.REVIEW_LLM_GATE_CONTEXT_AMBIGUOUS": "识别结果存在多份来源候选且无法唯一确定主证据,AI 已放弃以避免事实混淆。请先裁决多候选后重试。",
|
||||
"SHIPPING.REVIEW_LLM_GATE_L4_FORBIDDEN": "整页级证据仅管理员在显式授权下可用,普通用户无法调用。",
|
||||
"SHIPPING.REVIEW_LLM_L4_FORBIDDEN": "完整 PDF 级证据仅管理员在显式授权下可用,本次请求已阻断。"
|
||||
},
|
||||
"SHIPPING.REVIEW_INVENTORY_SOURCE_UNRESOLVED": "库存源尚未唯一确定,不能创建正式订单。请先完成库存源复核。",
|
||||
"SHIPPING_REVIEW_INVENTORY_SOURCE_UNRESOLVED": "库存源尚未唯一确定,不能创建正式订单。请先完成库存源复核。"
|
||||
|
||||
@@ -253,6 +253,7 @@
|
||||
"confirm_customer": "确认客户",
|
||||
"retry_duplicate_detection": "重试重复检测",
|
||||
"adjudicate_duplicate": "处理重复订单",
|
||||
"reconcile_and_progress": "对账并自动恢复",
|
||||
"resolve_field_conflicts": "解决字段冲突",
|
||||
"retry_with_latest_rules": "按最新规则重试",
|
||||
"open_inventory_source_review": "打开库存源复核",
|
||||
@@ -261,6 +262,7 @@
|
||||
"recheck_freeze_readiness": "重新检查建单资格",
|
||||
"retry_task_creation": "重试创建任务",
|
||||
"retry_inventory_preparation": "重试库存准备",
|
||||
"refresh_inventory_candidate_projection": "刷新库存候选状态",
|
||||
"poll_inventory_preparation": "刷新库存准备进度",
|
||||
"upload_inventory_file": "上传库存文件",
|
||||
"retry_inventory_field_mapping": "重试库存字段映射",
|
||||
@@ -295,6 +297,10 @@
|
||||
"inventory_file_empty": "库存文件为空或没有有效库存记录",
|
||||
"inventory_preparation_waiting": "库存文件准备中,请稍后刷新",
|
||||
"inventory_preparation_failed": "库存准备失败,请重试或上传库存文件",
|
||||
"inventory_candidates_missing": "当前任务缺少正式候选版本,请重新打开库存源复核",
|
||||
"inventory_candidate_version_stale": "库存候选版本已变化,请刷新后重新处理",
|
||||
"inventory_match_out_of_candidate_scope": "匹配结果超出当前候选范围,需人工复核",
|
||||
"inventory_candidate_data_incomplete": "库存候选事实不完整,请重新冻结候选版本",
|
||||
"upload_rpa_pending": "货代平台上传任务等待执行",
|
||||
"upload_rpa_failed": "货代平台上传失败,可重试 RPA",
|
||||
"upload_rpa_login_failed": "货代平台登录失败",
|
||||
|
||||
@@ -40,7 +40,8 @@
|
||||
"shippingFieldAssets": "欄位資產庫",
|
||||
"shippingOrderSchema": "訂單 Schema",
|
||||
"shippingAudit": "運行與稽核中心",
|
||||
"shippingProcessGates": "門禁診斷"
|
||||
"shippingProcessGates": "門禁診斷",
|
||||
"shippingLegacyStpJobs": "歷史 STP 任務"
|
||||
},
|
||||
"shippingOrderExtractionRuns": {
|
||||
"eyebrow": "唯讀執行診斷",
|
||||
@@ -3556,6 +3557,59 @@
|
||||
"lineStartAnchorRequired": "主行已綁定欄位時,必須包含設定的起行錨點(預設 customer_po_line_no)。"
|
||||
}
|
||||
},
|
||||
"vc": {
|
||||
"panelTitle": "Vendor Comments 三來源設定",
|
||||
"namedRegionsTitle": "命名區域",
|
||||
"addNamedRegion": "新增 Vendor Comments 區域",
|
||||
"namedRegionLabel": "區域名稱",
|
||||
"pageScope": "頁面範圍",
|
||||
"pageScopeFirstPage": "首頁",
|
||||
"pageScopeLastPage": "末頁",
|
||||
"pageScopeExactPage": "指定頁",
|
||||
"selectionMode": "選擇模式",
|
||||
"selectionModeBox": "矩形框",
|
||||
"selectionModeParagraph": "段落",
|
||||
"selectionModeLine": "單行",
|
||||
"deleteRegion": "刪除區域",
|
||||
"draftRequiredBanner": "區域或規則已變更,需回 Draft 重新驗證後生效",
|
||||
"sourceHeader": "Header 區域來源",
|
||||
"sourceTable": "表身欄來源",
|
||||
"sourceVc": "Vendor Comments 來源",
|
||||
"targetScope": "作用域",
|
||||
"scopeHeader": "整單級(Header)",
|
||||
"scopeLine": "行級(Line)",
|
||||
"relationPolicy": "關聯策略",
|
||||
"relationBindLine": "綁定目標明細行",
|
||||
"relationAnnotationOnly": "僅註釋,不綁定欄位",
|
||||
"missingRelationPolicy": "缺失關聯處理",
|
||||
"missingDefaultAllLines": "預設應用至所有行",
|
||||
"missingDefaultHeaderOnly": "僅應用至 Header",
|
||||
"missingFallbackDisabled": "不回退(標記未關聯)",
|
||||
"lineReferenceBasis": "行號基準",
|
||||
"lineRefExplicit": "顯式欄值(Line No.)",
|
||||
"lineRefBusiness": "Profile 業務行號",
|
||||
"lineRefLogical": "分類後邏輯行號",
|
||||
"columnCode": "表欄編碼",
|
||||
"namedRegionId": "命名區域",
|
||||
"fillMissingFromOthers": "空值從其他來源補齊",
|
||||
"formatPolicy": "格式策略",
|
||||
"formatInheritGlobal": "繼承全域規則",
|
||||
"formatNumeric5Or10": "5 或 10 位數字",
|
||||
"formatCustomRegex": "自訂安全正則",
|
||||
"customRegexPattern": "正則模式",
|
||||
"customRegexCaptureGroup": "擷取組序號",
|
||||
"customRegexUnsafe": "正則包含危險回溯運算式,已拒絕",
|
||||
"splitRules": "拆分規則",
|
||||
"splitPreview": "預覽候選與合併",
|
||||
"previewStatusNeedsReview": "需人工複核",
|
||||
"previewStatusAccepted": "已接受",
|
||||
"previewConflictGroup": "衝突組(scope={s}, field={f}, line={l})",
|
||||
"previewResolutionSameValue": "多來源同值合併",
|
||||
"previewResolutionSingleSource": "單來源直接採用",
|
||||
"previewResolutionFillMissing": "空值從其他來源補齊",
|
||||
"previewResolutionConflict": "多來源值衝突,需人工複核",
|
||||
"invalidLineReference": "關聯的明細行號不存在(Q12)"
|
||||
},
|
||||
"templateModes": {
|
||||
"coordinate": "座標標註",
|
||||
"xfa_dataset": "XFA 資料路徑"
|
||||
@@ -4366,5 +4420,60 @@
|
||||
"succeeded": "成功",
|
||||
"superseded": "已替代"
|
||||
}
|
||||
},
|
||||
"legacyStpJobs": {
|
||||
"pageTitle": "歷史 STP 任務回放",
|
||||
"pageSubtitle": "篩選失敗/死結 STP 自動建單任務(如 928、929),一鍵透過 reconcile-and-progress 復原;嚴禁直接修改 Job.status。",
|
||||
"listTitle": "失敗 / 死 Job · 共 {count} 筆",
|
||||
"detailTitle": "歷史 Job 詳情與回放",
|
||||
"detailEmpty": "點選左側任一列以檢視",
|
||||
"empty": "暫無失敗/死的歷史 STP Job;請先使用 CLI 腳本加上 --dry-run 預覽計劃。",
|
||||
"filterQ": "關鍵字(編號/訊息/錯誤)",
|
||||
"filterCaseNo": "Case 編號",
|
||||
"filterErrorCode": "錯誤碼",
|
||||
"statusAll": "全部狀態",
|
||||
"job": "Job",
|
||||
"reviewCase": "關聯 Case",
|
||||
"blocking": "阻斷原因",
|
||||
"linkedCase": "回鏈 Review Case",
|
||||
"caseStatus": "Case 狀態",
|
||||
"replayPlan": "回放計劃(Reconcile And Progress)",
|
||||
"recommendedAction": "建議 user_action",
|
||||
"needsReplayMode": "需跨 Case 回放(replay_mode=true)",
|
||||
"userAction": "選擇回放動作",
|
||||
"replayButton": "一鍵回放 Reconcile",
|
||||
"replayError_noCaseNo": "此歷史 Job 無法回鏈到 Review Case,請先在工作台指定 Case 後再回放。",
|
||||
"replaySuccess": "回放成功,outcome={outcome}",
|
||||
"replayRejected": "回放被拒絕,outcome={outcome}",
|
||||
"payloadJson": "請求 payload(已脫敏)",
|
||||
"resultJson": "執行結果 result_json(已脫敏)",
|
||||
"reasonCodes": {
|
||||
"task_missing": "正式任務遺失",
|
||||
"stp_waiting_timeout": "STP 等待逾時",
|
||||
"stp_not_enqueued_yet": "STP 尚未入佇列",
|
||||
"stp_job_failed": "STP Job 執行失敗",
|
||||
"post_confirm_auto_progress_failed": "建單後自動推進失敗",
|
||||
"duplicate_decision_required": "重複裁決待確認",
|
||||
"SHIPPING.NOTICE_EXACT_DUPLICATE": "完全重複 Case",
|
||||
"profile_schema_mismatch": "文件範本不匹配",
|
||||
"SHIPPING.STP_NOT_ELIGIBLE": "不符合 STP 資格",
|
||||
"SHIPPING.REVIEW_DRAFT_MISSING": "草稿遺失",
|
||||
"SHIPPING.REVIEW_RUN_MISSING": "辨識 RUN 遺失",
|
||||
"SHIPPING.REVIEW_DOCUMENT_INVALID": "文件失效",
|
||||
"SHIPPING.REVIEW_DRAFT_VERSION_CONFLICT": "草稿版本衝突",
|
||||
"final_required_field_missing": "必填欄位遺失",
|
||||
"ownership_anomaly": "歸屬異常(Q13 硬隔離)",
|
||||
"retry_needed": "需要重試"
|
||||
},
|
||||
"statusLabels": {
|
||||
"failed": "失敗",
|
||||
"dead": "死結",
|
||||
"queued": "已佇列",
|
||||
"running": "執行中",
|
||||
"success": "成功",
|
||||
"succeeded": "成功",
|
||||
"completed": "完成",
|
||||
"cancelled": "已取消"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2174,6 +2174,29 @@
|
||||
"state_inconsistent": "狀態資料不一致"
|
||||
}
|
||||
},
|
||||
"currentTask": {
|
||||
"title": "目前任務",
|
||||
"labelStage": "目前階段",
|
||||
"labelStatus": "狀態",
|
||||
"labelFormalSn": "正式 OT",
|
||||
"statusRunning": "系統處理中",
|
||||
"statusWaitingHuman": "待人工處理",
|
||||
"statusRetryable": "可重試",
|
||||
"statusFailed": "自動處理失敗",
|
||||
"statusCompleted": "已完成",
|
||||
"statusCancelled": "已取消",
|
||||
"nextStepTitle": "下一步",
|
||||
"nextStepRunning": "系統正在處理,暫不需要人工操作",
|
||||
"nextStepCompleted": "目前無需人工操作",
|
||||
"nextStepCancelled": "任務已取消,不再繼續處理",
|
||||
"nextStepFailedNoRetry": "自動處理失敗,請聯絡管理員或查看審計記錄",
|
||||
"nextStepWaitingHumanDefault": "目前待人工處理",
|
||||
"nextStepRetryableDefault": "系統判斷可重試,請點擊下方「重試」",
|
||||
"nextStepUnknown": "狀態待確認",
|
||||
"actionRetry": "重試",
|
||||
"actionLocateLine": "定位明細",
|
||||
"actionUnknown": "未識別的動作「{code}」"
|
||||
},
|
||||
"completedChecks": {
|
||||
"title": "已完成檢查({count})",
|
||||
"codes": {
|
||||
@@ -2219,7 +2242,10 @@
|
||||
"field_conflict": "欄位衝突",
|
||||
"pdf_preferred": "PDF 優先採納",
|
||||
"pdf_preferred_with_conflict": "PDF 優先但存在衝突",
|
||||
"auxiliary_supplement": "輔助證據補充"
|
||||
"auxiliary_supplement": "輔助證據補充",
|
||||
"vc_source_conflict_unresolved": "Vendor Comments 三來源取值衝突待人工裁決",
|
||||
"vc_source_format_invalid": "Vendor Comments 區域欄位格式不合法",
|
||||
"vc_source_region_unbound": "Vendor Comments 命名區域未綁定到 Profile"
|
||||
},
|
||||
"fields": {
|
||||
"reservation_id": "預約單號",
|
||||
@@ -2366,6 +2392,11 @@
|
||||
"ruleSuggestion": "規則建議源",
|
||||
"ruleVersions": "規則版本",
|
||||
"hint": "庫存源提示",
|
||||
"matchedRules": "已匹配規則:{count} 條",
|
||||
"unavailableReasons": {
|
||||
"source_disabled": "庫存源未啟用"
|
||||
},
|
||||
"unavailableReasonUnknown": "不可用原因未知(系統無法辨識此候選源的缺失原因)",
|
||||
"rerouteHint": "可隨時重新匹配路由;若存在待決規則建議,請選擇採用或保留人工結果。"
|
||||
},
|
||||
"confirmDialog": {
|
||||
@@ -2534,6 +2565,7 @@
|
||||
"retry": "目前處理失敗,請檢查原因後重試"
|
||||
},
|
||||
"progress": {
|
||||
"title": "訂單處理進度",
|
||||
"completedOfTotal": "已完成 {done} / {total}",
|
||||
"currentStage": "目前:{stage}",
|
||||
"remainingHint": "後續還有 {count} 個階段",
|
||||
@@ -2588,6 +2620,7 @@
|
||||
"confirm_customer": "確認客戶",
|
||||
"resolve_field_conflicts": "處理欄位衝突",
|
||||
"adjudicate_duplicate": "裁決重複訂單",
|
||||
"reconcile_and_progress": "對帳並恢復流程",
|
||||
"open_inventory_source_review": "進入庫存源處理",
|
||||
"open_inventory_match_review": "進入庫存匹配處理",
|
||||
"open_shortage_review": "處理庫存異常",
|
||||
@@ -2603,6 +2636,17 @@
|
||||
"retry_parse": "重試解析",
|
||||
"more": "更多"
|
||||
},
|
||||
"reasonCode": {
|
||||
"duplicateDecisionRequired": "偵測到重複出貨通知,需要人工決定處理方式",
|
||||
"exactDuplicateNotice": "該檔案已存在於進行中的任務,請勿重複提交",
|
||||
"stpNotEligible": "目前訂單尚未滿足自動建單條件,請先完成校驗與門禁",
|
||||
"reviewDraftMissing": "訂單草稿不存在,請先完成辨識與覆核",
|
||||
"reviewRunMissing": "缺少對應的辨識執行記錄,請重新辨識",
|
||||
"reviewDocumentInvalid": "覆核 PDF 文件無效或無法存取",
|
||||
"reviewDraftVersionConflict": "訂單草稿已被其他視窗更新,請重新整理後重試",
|
||||
"profileSchemaMismatch": "訂單欄位模板版本不匹配,請重新產生草稿",
|
||||
"finalRequiredFieldMissing": "訂單仍缺少關鍵欄位,請補齊後再確認建單"
|
||||
},
|
||||
"title": "本次處理中",
|
||||
"showDetails": "在彈層中查看完整列表",
|
||||
"detailsDrawerTitle": "批次與檔案列表",
|
||||
|
||||
@@ -489,7 +489,31 @@
|
||||
"SHIPPING.STP_ENQUEUE_FAILED": "自動建單入隊失敗,請稍後重試或聯絡管理員。",
|
||||
"SHIPPING.STP_NOT_ELIGIBLE": "目前訂單尚未滿足自動建單條件,請先完成校驗與門禁後再重試。",
|
||||
"SHIPPING.STP_CASE_NO_REQUIRED": "缺少複核單編號,無法執行自動建單。",
|
||||
"SHIPPING.STP_AUTO_CREATE_FAILED": "自動建單執行失敗,請重試或改用人工確認。"
|
||||
"SHIPPING.STP_AUTO_CREATE_FAILED": "自動建單執行失敗,請重試或改用人工確認。",
|
||||
"SHIPPING.RECONCILE_OPERATION_ID_REQUIRED": "對帳操作缺少 operation_id,請重新整理頁面後再試。",
|
||||
"SHIPPING.RECONCILE_OPERATION_ID_TOO_LONG": "對帳操作 operation_id 超過 128 字元。",
|
||||
"SHIPPING.RECONCILE_INVALID_USER_ACTION": "對帳使用者動作不合法,請選擇復用、新建修訂或強制新建。",
|
||||
"SHIPPING.RECONCILE_INVALID_EXPECTED_VERSION": "expected_case_version 必須是整數。",
|
||||
"SHIPPING.RECONCILE_IDEMPOTENT_CONFLICT": "同一 operation_id 之請求參數已變更,請產生新的 operation_id 再提交。",
|
||||
"SHIPPING.RECONCILE_OWNERSHIP_ANOMALY": "任務歸屬關係不明確,請交由人工裁決後再推進。",
|
||||
"SHIPPING.RECONCILE_FORCE_CREATE_UNAUTHORIZED": "強制新建重複訂單需要管理員或特殊權限。",
|
||||
"SHIPPING.RECONCILE_LOCK_VISIBILITY_RACE": "對帳鎖行與可見行不一致,請重試。",
|
||||
"SHIPPING.RETRY_STP_BLOCKED_MANUAL": "目前等待人工裁決,請勿使用技術重試;請透過對帳恢復或裁決重複訂單介面推進。",
|
||||
"SHIPPING.REVIEW_LLM_DISABLED": "訂單複核 AI 建議功能已關閉,本次未生成建議。請直接人工核對即可。",
|
||||
"SHIPPING.REVIEW_LLM_PROVIDER_UNAVAILABLE": "AI 服務暫時不可用(未設定 Dify 金鑰或請求失敗)。建議已跳過,請按人工流程複核。",
|
||||
"SHIPPING.REVIEW_LLM_FIELD_MISMATCH": "AI 回傳的欄位與目前複核欄位不一致。建議已捨棄,請勿採用本次結果。",
|
||||
"SHIPPING.REVIEW_LLM_VALIDATION_FAILED": "AI 建議未通過證據一致性檢查,無法寫入草稿。可人工輸入正確值後繼續。",
|
||||
"SHIPPING.REVIEW_LLM_GATE_FIELD_NOT_FOUND": "未在凍結樣板中找到該複核欄位,無法生成 AI 建議。",
|
||||
"SHIPPING.REVIEW_LLM_GATE_LINE_NOT_FOUND": "明細行遺失,無法為該行生成 AI 建議。請確認行結構後重試。",
|
||||
"SHIPPING.REVIEW_LLM_GATE_FIELD_VALUE_MISSING": "該欄位缺少原始值,AI 無法基於事實給出建議。請先補齊機器識別或人工輸入。",
|
||||
"SHIPPING.REVIEW_LLM_GATE_EVIDENCE_UNAVAILABLE": "未擷取到該欄位的證據來源(Case 95 類斷裂),AI 靜默已阻斷。請先完成識別或重新解析 PDF。",
|
||||
"SHIPPING.REVIEW_LLM_GATE_CONTEXT_INSUFFICIENT": "該行上下文欄位不足 2 筆,無法給出可靠行級建議。請先補足相鄰欄位的識別結果。",
|
||||
"SHIPPING.REVIEW_LLM_GATE_POLICY_BLOCKED": "該欄位屬於敏感/內部欄位,依安全政策不允許發送給 AI。請直接人工確認。",
|
||||
"SHIPPING.REVIEW_LLM_GATE_CONTEXT_BUILD_FAILED": "建構證據視圖時發生異常,已放棄本次 AI 建議。請重新整理後重試或聯絡管理員。",
|
||||
"SHIPPING.REVIEW_LLM_GATE_EVIDENCE_TRUNCATED": "目標欄位核心證據超出 Token 預算被截斷,AI 已放棄以避免錯誤結論。請人工複核該欄位。",
|
||||
"SHIPPING.REVIEW_LLM_GATE_CONTEXT_AMBIGUOUS": "識別結果存在多份來源候選且無法唯一確定主證據,AI 已放棄以避免事實混淆。請先裁決多候選後重試。",
|
||||
"SHIPPING.REVIEW_LLM_GATE_L4_FORBIDDEN": "整頁級證據僅管理員在顯式授權下可用,一般使用者無法調用。",
|
||||
"SHIPPING.REVIEW_LLM_L4_FORBIDDEN": "完整 PDF 級證據僅管理員在顯式授權下可用,本次請求已阻斷。"
|
||||
},
|
||||
"SHIPPING.REVIEW_INVENTORY_SOURCE_UNRESOLVED": "庫存源尚未唯一確定,不能建立正式訂單。請先完成庫存源複核。",
|
||||
"SHIPPING_REVIEW_INVENTORY_SOURCE_UNRESOLVED": "庫存源尚未唯一確定,不能建立正式訂單。請先完成庫存源複核。"
|
||||
|
||||
@@ -232,6 +232,7 @@
|
||||
"noAction": "目前沒有可執行的處理操作",
|
||||
"versionMissing": "目前資訊已更新,請重新整理後再試",
|
||||
"navigationMissing": "缺少跳轉所需的任務或覆核資訊,請重新整理後再試",
|
||||
"customerTaskMissing": "缺少任務編號,無法開啟客戶確認,請重新整理後再試",
|
||||
"genericBlocking": "目前步驟需要人工處理",
|
||||
"unknownStep": "目前步驟",
|
||||
"continueAction": "繼續處理",
|
||||
@@ -239,21 +240,38 @@
|
||||
"submitting": "提交中…",
|
||||
"readOnlyUseFooter": "請使用底部操作列繼續處理",
|
||||
"actionCodes": {
|
||||
"rematerialize_document": "重新準備文件",
|
||||
"retry_layout_parsing": "重試版面解析",
|
||||
"reroute_document_profile": "重新匹配文件模板",
|
||||
"open_profile_review": "開啟模板覆核",
|
||||
"retry_order_extraction": "重試訂單抽取",
|
||||
"open_order_review": "開啟訂單覆核",
|
||||
"edit_order_fields": "編輯訂單欄位",
|
||||
"revalidate_reservation": "重新校驗 Reservation",
|
||||
"edit_reservation": "編輯 Reservation",
|
||||
"retry_customer_resolution": "重試客戶識別",
|
||||
"confirm_customer": "確認客戶",
|
||||
"retry_duplicate_detection": "重試重複檢測",
|
||||
"adjudicate_duplicate": "處理重複訂單",
|
||||
"reconcile_and_progress": "對帳並自動恢復",
|
||||
"resolve_field_conflicts": "解決欄位衝突",
|
||||
"retry_with_latest_rules": "依最新規則重試",
|
||||
"open_inventory_source_review": "開啟庫存源覆核",
|
||||
"open_order_review": "開啟訂單覆核",
|
||||
"open_profile_review": "開啟模板覆核",
|
||||
"edit_order_fields": "編輯訂單欄位",
|
||||
"confirm_customer": "確認客戶",
|
||||
"adjudicate_duplicate": "處理重複訂單",
|
||||
"resolve_field_conflicts": "解決欄位衝突",
|
||||
"open_inventory_match_review": "開啟庫存匹配覆核",
|
||||
"open_shortage_review": "開啟缺貨覆核",
|
||||
"upload_inventory_file": "上傳庫存檔案",
|
||||
"adopt_rule_suggestion": "採用規則建議",
|
||||
"keep_manual_inventory_decision": "保留人工決定",
|
||||
"recheck_freeze_readiness": "重新檢查建單資格",
|
||||
"retry_task_creation": "重試建立任務",
|
||||
"retry_inventory_preparation": "重試庫存準備",
|
||||
"refresh_inventory_candidate_projection": "重新整理庫存候選狀態",
|
||||
"poll_inventory_preparation": "重新整理庫存準備進度",
|
||||
"upload_inventory_file": "上傳庫存檔案",
|
||||
"retry_inventory_field_mapping": "重試庫存欄位對應",
|
||||
"confirm_inventory_field_mapping": "確認庫存欄位對應",
|
||||
"retry_inventory_matching": "重試庫存匹配",
|
||||
"open_inventory_match_review": "開啟庫存匹配覆核",
|
||||
"recheck_inventory_sufficiency": "重新檢查庫存滿足性",
|
||||
"open_shortage_review": "開啟缺貨覆核",
|
||||
"recheck_excel_readiness": "重新檢查 Excel 生成資格",
|
||||
"regenerate_excel_artifact": "重新產生 Excel",
|
||||
"poll_freight_upload_rpa": "重新整理貨代上傳進度",
|
||||
"retry_freight_upload_rpa": "重試貨代上傳 RPA",
|
||||
@@ -279,6 +297,10 @@
|
||||
"inventory_file_empty": "庫存檔案為空或沒有有效庫存記錄",
|
||||
"inventory_preparation_waiting": "庫存檔案準備中,請稍後重新整理",
|
||||
"inventory_preparation_failed": "庫存準備失敗,請重試或上傳庫存檔案",
|
||||
"inventory_candidates_missing": "目前任務缺少正式候選版本,請重新打開庫存來源複核",
|
||||
"inventory_candidate_version_stale": "庫存候選版本已變更,請重新整理後再處理",
|
||||
"inventory_match_out_of_candidate_scope": "匹配結果超出目前候選範圍,需人工複核",
|
||||
"inventory_candidate_data_incomplete": "庫存候選事實不完整,請重新凍結候選版本",
|
||||
"upload_rpa_pending": "貨代平台上傳任務等待執行",
|
||||
"upload_rpa_failed": "貨代平台上傳失敗,可重試 RPA",
|
||||
"upload_rpa_login_failed": "貨代平台登入失敗",
|
||||
|
||||
Reference in new issue
Block a user