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
@@ -3,33 +3,41 @@
|
||||
* 用途:从统一投影解析四页面共用的 ActionPresentation(主/次/溢出)。
|
||||
* 依赖:ShippingProcessingProjection、SHIPPING_PROCESSING_ACTION_INTENTS、types。
|
||||
* 逻辑:优先级 Gate.nextActionCode → availableActions → 终态查看 → none;
|
||||
* 自动处理中(processing/automating)主按钮为空,避免误导性 CTA。
|
||||
* 自动处理中(processing/automating)主按钮为空;review 面隐藏 open_order_review。
|
||||
*/
|
||||
|
||||
import type {
|
||||
ShippingProcessingActionIntent,
|
||||
ShippingProcessingProjection,
|
||||
} from '@/features/chat/types/shipping.api.types';
|
||||
import type { ActionPresentation, ActionPresentationItem } from './types';
|
||||
import type { ActionPresentation, ActionPresentationItem, ActionPresentationSurface } from './types';
|
||||
|
||||
/** 可映射为统一意图的原始动作码(gate / available_actions)。 */
|
||||
const ACTION_CODE_TO_INTENT: Record<string, ShippingProcessingActionIntent> = {
|
||||
open_order_review: 'open_order_review',
|
||||
open_review: 'open_order_review',
|
||||
open_order_processing: 'open_order_review',
|
||||
edit_formal_task: 'edit_formal_task',
|
||||
open_inventory_source_review: 'open_inventory_source_review',
|
||||
confirm_inventory_source: 'open_inventory_source_review',
|
||||
retry_resolve_inventory_source: 'open_inventory_source_review',
|
||||
open_inventory_match_review: 'open_inventory_match_review',
|
||||
rematch: 'open_inventory_match_review',
|
||||
match_inventory: 'open_inventory_match_review',
|
||||
open_shortage_review: 'open_shortage_review',
|
||||
upload_inventory_file: 'upload_inventory_file',
|
||||
retry: 'retry',
|
||||
retry_parse: 'retry',
|
||||
retry_failed_documents: 'retry',
|
||||
refresh: 'refresh',
|
||||
regenerate_excel: 'regenerate_excel',
|
||||
generate_excel: 'regenerate_excel',
|
||||
download_excel: 'download_excel',
|
||||
open_manual_upload: 'open_manual_upload',
|
||||
wait_manual_upload: 'open_manual_upload',
|
||||
mark_manual_uploaded: 'open_manual_upload',
|
||||
regenerate_manual_upload_todo: 'open_manual_upload',
|
||||
open_fulfillment: 'view_result',
|
||||
view_result: 'view_result',
|
||||
view_details: 'view_result',
|
||||
view_record: 'view_record',
|
||||
@@ -49,11 +57,22 @@ export function mapActionCodeToIntent(code: string | null | undefined): Shipping
|
||||
/**
|
||||
* 构建单个动作项。
|
||||
*/
|
||||
function toItem(code: string, intent: ShippingProcessingActionIntent): ActionPresentationItem {
|
||||
function toItem(
|
||||
code: string,
|
||||
intent: ShippingProcessingActionIntent,
|
||||
surface?: ActionPresentationSurface,
|
||||
): ActionPresentationItem {
|
||||
let labelKey = `chat.shippingProcessing.action.${intent}`;
|
||||
if (
|
||||
intent === 'open_order_review'
|
||||
&& (surface === 'chat' || surface === 'right')
|
||||
) {
|
||||
labelKey = 'chat.shippingProcessing.action.open_order_processing';
|
||||
}
|
||||
return {
|
||||
intent,
|
||||
actionCode: code,
|
||||
labelKey: `chat.shippingProcessing.action.${intent}`,
|
||||
labelKey,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -64,14 +83,17 @@ function toItem(code: string, intent: ShippingProcessingActionIntent): ActionPre
|
||||
* 1. processing/automating/queued → 主按钮为空(自动推进中);
|
||||
* 2. currentGate.nextActionCode 优先;
|
||||
* 3. availableActions 依次填主/次/溢出;
|
||||
* 4. completed/failed/cancelled → view_result / view_record 兜底。
|
||||
* 4. completed/failed/cancelled → view_result / view_record 兜底;
|
||||
* 5. surface=review 时过滤 open_order_review(已在复核页)。
|
||||
*/
|
||||
export function resolveProcessingActionPresentation(
|
||||
projection: ShippingProcessingProjection | null | undefined,
|
||||
options?: { surface?: ActionPresentationSurface },
|
||||
): ActionPresentation {
|
||||
const empty: ActionPresentation = { primary: null, secondary: null, overflow: [] };
|
||||
if (!projection) return empty;
|
||||
|
||||
const surface = options?.surface;
|
||||
const status = String(projection.status || '').trim().toLowerCase();
|
||||
if (AUTOMATING_STATUSES.has(status) && !projection.currentGate?.nextActionCode) {
|
||||
return empty;
|
||||
@@ -87,8 +109,9 @@ export function resolveProcessingActionPresentation(
|
||||
if (seen.has(key)) return;
|
||||
const intent = mapActionCodeToIntent(code);
|
||||
if (!intent || intent === 'none') return;
|
||||
if (surface === 'review' && intent === 'open_order_review') return;
|
||||
seen.add(key);
|
||||
items.push(toItem(code, intent));
|
||||
items.push(toItem(code, intent, surface));
|
||||
};
|
||||
|
||||
pushCode(projection.currentGate?.nextActionCode);
|
||||
|
||||
Reference in new issue
Block a user