feat(shipping-notice): 落地 XFA 统一视觉拆分确认门禁与处理投影收敛
闭合拆分预览令牌单次消费、样本 checksum 绑定与确认审计;正式提取改为 bindings-only。 同步统一标注工作台交互,并补齐进度投影/任务中心与迁移文档。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
d2b3d74def
commit
84a881b554
195 files changed
+20269
-3463
No files matched your search
@@ -91,6 +91,14 @@ export type ShippingAuditFilters = {
|
||||
owner_user_id?: string;
|
||||
/** 稳定业务原因码;与后端 audit_query_service.reason_code 对齐 */
|
||||
reason_code?: string;
|
||||
/** 订单模板 Profile ID;匹配 aggregate_id */
|
||||
profile_id?: string;
|
||||
/** 统一 binding_id;匹配 metadata/context_refs */
|
||||
binding_id?: string;
|
||||
/** Draft Revision 序号 */
|
||||
revision_no?: string;
|
||||
/** 拆分 segment_id */
|
||||
segment_id?: string;
|
||||
result?: string;
|
||||
created_from?: string;
|
||||
created_to?: string;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* features/admin/api/shipping-order-document-profile.api.ts
|
||||
* 用途:订单文档 Profile 管理、MinerU 样本选择和发布 API。
|
||||
* 用途:订单文档 Profile 管理、MinerU 样本选择、XFA 统一建议/视觉绑定与发布 API。
|
||||
* 依赖:shared/api/client、auth headers、Profile DTO。
|
||||
* 逻辑:页面只使用结构化接口;结构指纹和 HTML 始终由后端持有。
|
||||
* 逻辑:页面只使用结构化接口;结构指纹和 HTML 始终由后端持有;XFA suggest/preview 零写 Draft。
|
||||
*/
|
||||
|
||||
import { requestJson } from '@/shared/api/client';
|
||||
@@ -36,6 +36,14 @@ import type {
|
||||
const auth = () => ({ headers: getAuthHeaders() });
|
||||
const jsonAuth = () => ({ headers: { 'Content-Type': 'application/json', ...getAuthHeaders() } });
|
||||
|
||||
/** 为盲测独立样本重新创建版面解析版本;仅触发布局处理,不修改模板或盲测真值。 */
|
||||
export const reparseOrderProfileSampleLayout = (documentId: number) => requestJson<{
|
||||
id: number; status: string; document_id: number; payload_checksum?: string | null;
|
||||
}>(
|
||||
`/api/admin/shipping-notice/documents/${documentId}/layout-reparse`,
|
||||
{ method: 'POST', ...jsonAuth() },
|
||||
);
|
||||
|
||||
/** 列出全部 Profile 版本。 */
|
||||
export const listOrderDocumentProfiles = () =>
|
||||
requestJson<ShippingOrderDocumentProfile[]>('/api/admin/shipping-notice/order-document-profiles', auth());
|
||||
@@ -70,6 +78,8 @@ export const saveOrderDocumentProfileDraft = (profileId: number, payload: {
|
||||
profile_code: string; display_name: string; schema_version_id: number;
|
||||
definition: ShippingOrderDocumentProfile['definition']; change_note?: string;
|
||||
expected_lock_version: number; browser_session_id: string; lease_token: string; operation_id: string;
|
||||
/** path_id → 服务端签发的拆分预览确认令牌;confirmed 规则必须携带 */
|
||||
split_rule_confirmation_tokens?: Record<string, string>;
|
||||
}) => requestJson<ShippingOrderDocumentProfile>(
|
||||
`/api/admin/shipping-notice/order-document-profiles/${profileId}`,
|
||||
{ method: 'PUT', body: JSON.stringify(payload), ...jsonAuth() },
|
||||
@@ -270,14 +280,18 @@ export const getOrderProfileSampleXfaCollections = (documentId: number) =>
|
||||
auth(),
|
||||
);
|
||||
|
||||
/** 按 path_id 读取分级样本值;reveal=true 要求敏感读权限并产生完整访问审计。 */
|
||||
export const previewOrderProfileSampleXfaValue = (documentId: number, pathId: string, reveal = false) =>
|
||||
/** 按 path_id 读取样本值;reveal=true 时需敏感读权限并留痕。 */
|
||||
export const previewOrderProfileSampleXfaValue = (
|
||||
documentId: number,
|
||||
pathId: string,
|
||||
options?: { reveal?: boolean },
|
||||
) =>
|
||||
requestJson<import('../types/shipping-order-document-profile.types').XfaValuePreviewResponse>(
|
||||
`/api/admin/shipping-notice/order-document-profile-samples/${documentId}/xfa/value-preview`,
|
||||
{ method: 'POST', body: JSON.stringify({ path_id: pathId, reveal }), ...jsonAuth() },
|
||||
{ method: 'POST', body: JSON.stringify({ path_id: pathId, reveal: Boolean(options?.reveal) }), ...jsonAuth() },
|
||||
);
|
||||
|
||||
/** 预览拆分规则执行结果;reveal=true 需 audit_sensitive_read,返回完整值并写访问审计。 */
|
||||
/** 预览拆分规则并签发确认令牌;默认脱敏,reveal 需敏感读权限。 */
|
||||
export const previewOrderProfileSampleXfaSplitRules = (
|
||||
documentId: number,
|
||||
payload: { path_id: string; rule_set: Record<string, unknown>; profile_id?: number; reveal?: boolean },
|
||||
@@ -295,6 +309,147 @@ export const validateOrderProfileXfaSplitRules = (
|
||||
{ method: 'POST', body: JSON.stringify(payload), ...jsonAuth() },
|
||||
);
|
||||
|
||||
/** 生成 MATNR 类拆分规则建议;不写 Draft。 */
|
||||
export const suggestOrderProfileXfaSplitRules = (
|
||||
profileId: number,
|
||||
payload: { document_id: number; path_id?: string | null },
|
||||
) => requestJson<import('../types/shipping-order-document-profile.types').XfaSplitRulesSuggestResponse>(
|
||||
`/api/admin/shipping-notice/order-document-profiles/${profileId}/xfa/split-rules/suggest`,
|
||||
{ method: 'POST', body: JSON.stringify(payload), ...jsonAuth() },
|
||||
);
|
||||
|
||||
/** 统一返回视觉 + 拆分规则建议;不写 Draft。 */
|
||||
export const suggestOrderProfileXfaUnifiedMapping = (
|
||||
profileId: number,
|
||||
payload: {
|
||||
document_id: number;
|
||||
page_no: number;
|
||||
normalized_bbox: import('../types/shipping-order-document-profile.types').XfaNormalizedBBox;
|
||||
path_id?: string | null;
|
||||
include_visual?: boolean;
|
||||
include_split?: boolean;
|
||||
},
|
||||
) => requestJson<import('../types/shipping-order-document-profile.types').XfaUnifiedMappingSuggestResponse>(
|
||||
`/api/admin/shipping-notice/order-document-profiles/${profileId}/xfa/unified-mapping/suggest`,
|
||||
{ method: 'POST', body: JSON.stringify(payload), ...jsonAuth() },
|
||||
);
|
||||
|
||||
/** 为页面区域生成 XFA 视觉绑定候选;歧义不自动确认。 */
|
||||
export const suggestOrderProfileXfaVisualBindings = (
|
||||
profileId: number,
|
||||
payload: {
|
||||
document_id: number;
|
||||
page_no: number;
|
||||
normalized_bbox: import('../types/shipping-order-document-profile.types').XfaNormalizedBBox;
|
||||
},
|
||||
) => requestJson<import('../types/shipping-order-document-profile.types').XfaVisualBindingsSuggestResponse>(
|
||||
`/api/admin/shipping-notice/order-document-profiles/${profileId}/xfa/visual-bindings/suggest`,
|
||||
{ method: 'POST', body: JSON.stringify(payload), ...jsonAuth() },
|
||||
);
|
||||
|
||||
/** 确认视觉绑定;须携带 Lease / operation_id。 */
|
||||
export const confirmOrderProfileXfaVisualBinding = (
|
||||
profileId: number,
|
||||
bindingId: string,
|
||||
payload: {
|
||||
visual_binding: import('../types/shipping-order-document-profile.types').XfaVisualBinding;
|
||||
path_id?: string | null;
|
||||
browser_session_id: string;
|
||||
lease_token: string;
|
||||
operation_id: string;
|
||||
},
|
||||
) => requestJson<import('../types/shipping-order-document-profile.types').XfaVisualBindingMutationResponse>(
|
||||
`/api/admin/shipping-notice/order-document-profiles/${profileId}/xfa/visual-bindings/${encodeURIComponent(bindingId)}/confirm`,
|
||||
{ method: 'POST', body: JSON.stringify(payload), ...jsonAuth() },
|
||||
);
|
||||
|
||||
/** 驳回视觉绑定建议;须携带 Lease / operation_id。 */
|
||||
export const rejectOrderProfileXfaVisualBinding = (
|
||||
profileId: number,
|
||||
bindingId: string,
|
||||
payload: {
|
||||
reason_code?: string | null;
|
||||
browser_session_id: string;
|
||||
lease_token: string;
|
||||
operation_id: string;
|
||||
},
|
||||
) => requestJson<import('../types/shipping-order-document-profile.types').XfaVisualBindingMutationResponse>(
|
||||
`/api/admin/shipping-notice/order-document-profiles/${profileId}/xfa/visual-bindings/${encodeURIComponent(bindingId)}/reject`,
|
||||
{ method: 'POST', body: JSON.stringify(payload), ...jsonAuth() },
|
||||
);
|
||||
|
||||
/** Dry Run 统一 binding 迁移:只产出报告,不改 definition。 */
|
||||
export const dryRunOrderProfileUnifiedMigration = (profileId: number) =>
|
||||
requestJson<{
|
||||
profile_id: number;
|
||||
dry_run: true;
|
||||
report: {
|
||||
path_preserve_rate: number;
|
||||
field_diff_count: number;
|
||||
pending_visual_count: number;
|
||||
binding_count: number;
|
||||
};
|
||||
binding_preview_count: number;
|
||||
}>(
|
||||
`/api/admin/shipping-notice/order-document-profiles/${profileId}/unified-migration/dry-run`,
|
||||
{ method: 'POST', body: JSON.stringify({}), ...jsonAuth() },
|
||||
);
|
||||
|
||||
/** Execute 统一 binding 迁移:写入 Draft Revision。 */
|
||||
export const executeOrderProfileUnifiedMigration = (
|
||||
profileId: number,
|
||||
payload?: { operation_id?: string },
|
||||
) => requestJson<{
|
||||
profile_id: number;
|
||||
draft_profile_id: number;
|
||||
revision_no: number;
|
||||
dry_run: false;
|
||||
report: {
|
||||
path_preserve_rate: number;
|
||||
field_diff_count: number;
|
||||
pending_visual_count: number;
|
||||
binding_count: number;
|
||||
};
|
||||
}>(
|
||||
`/api/admin/shipping-notice/order-document-profiles/${profileId}/unified-migration/execute`,
|
||||
{ method: 'POST', body: JSON.stringify(payload || {}), ...jsonAuth() },
|
||||
);
|
||||
|
||||
/** 读取最近一次统一迁移报告(来自审计)。 */
|
||||
export const getOrderProfileUnifiedMigrationReport = (profileId: number) =>
|
||||
requestJson<{
|
||||
profile_id: number;
|
||||
report: Record<string, unknown> | null;
|
||||
event_type: string | null;
|
||||
created_at: string | null;
|
||||
}>(
|
||||
`/api/admin/shipping-notice/order-document-profiles/${profileId}/unified-migration/report`,
|
||||
auth(),
|
||||
);
|
||||
|
||||
/** 扫描全部模板族统一 binding 迁移状态(内存预览,不写 definition)。 */
|
||||
export const scanOrderProfileUnifiedMigration = () =>
|
||||
requestJson<{
|
||||
totals: {
|
||||
total_families: number;
|
||||
needs_migration: number;
|
||||
pending_visual: number;
|
||||
ready: number;
|
||||
pending_visual_bindings: number;
|
||||
};
|
||||
items: Array<{
|
||||
profile_code: string;
|
||||
display_name: string;
|
||||
target_profile_id: number;
|
||||
unified_binding_status: 'needs_migration' | 'pending_visual' | 'ready';
|
||||
pending_visual_count: number;
|
||||
needs_migration: boolean;
|
||||
}>;
|
||||
}>(
|
||||
'/api/admin/shipping-notice/order-document-profiles/unified-migration/scan',
|
||||
auth(),
|
||||
);
|
||||
|
||||
/** 冻结建议决定;接受后的实际区域修改仍由当前草稿保存接口统一写入 Revision。 */
|
||||
export const decideOrderDocumentProfileSuggestion = (profileId: number, payload: {
|
||||
suggestion_id: string;
|
||||
|
||||
Reference in new issue
Block a user