feat(shipping-notice): 落地 XFA 拆分、版面签名、统一进度与处理域履约
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3a9fbac2fc
commit
d2b3d74def
571 files changed
+78064
-24681
No files matched your search
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* features/workspace/shipping-task-center/shippingTaskCenterPolling.ts
|
||||
* 用途:任务中心列表项是否仍需前台轮询(纯函数,供页面与单测共用)。
|
||||
* 依赖:ShippingTaskSummary、shippingProcessingFulfillment 状态集合。
|
||||
* 逻辑:ShippingTaskCenterPage 用本函数决定 poll;Intake created/queued/parsing 必须轮询,
|
||||
* parse_failed 停止;review_case 持续轮询;OT/Notice 走统一投影状态。
|
||||
*/
|
||||
|
||||
import type { ShippingTaskSummary } from '@/features/chat/api/shipping.api';
|
||||
import {
|
||||
IN_PROGRESS_PROCESSING_STATUSES,
|
||||
TERMINAL_PROCESSING_STATUSES,
|
||||
} from '@/features/chat/shipping/shippingProcessingFulfillment';
|
||||
|
||||
/** 仍视为进行中、需要自动刷新的任务 process_status(列表项无统一投影时的 notice 任务兜底)。 */
|
||||
export const IN_PROGRESS_PROCESS = new Set([
|
||||
'parsing',
|
||||
'parsed',
|
||||
'matching',
|
||||
'matched',
|
||||
'waiting_upload',
|
||||
'uploading',
|
||||
'upload_failed',
|
||||
'exporting',
|
||||
'needs_human',
|
||||
'pending_void',
|
||||
]);
|
||||
|
||||
/** Intake 仍在解析、必须轮询的状态。 */
|
||||
export const INTAKE_POLLING_PARSE_STATUSES = new Set([
|
||||
'created',
|
||||
'queued',
|
||||
'parsing',
|
||||
]);
|
||||
|
||||
/**
|
||||
* 判断列表项是否应触发轮询刷新。
|
||||
* 核心逻辑:review_case 持续轮询;order_intake 仅 created/queued/parsing;
|
||||
* 其余优先 shipping_processing_status,缺省回退 process_status;
|
||||
* 不复用 WorkflowItem lifecycle。
|
||||
* @param item - 我的待办列表项
|
||||
* @returns 是否需要继续轮询
|
||||
*/
|
||||
export function isShippingTodoListItemInProgress(item: ShippingTaskSummary): boolean {
|
||||
if (item.item_kind === 'review_case' || (item.review_run_no && !item.task_no)) {
|
||||
return true;
|
||||
}
|
||||
if (item.item_kind === 'order_intake') {
|
||||
const intakeStatus = String(
|
||||
item.intake_parse_status || item.process_status || '',
|
||||
).trim().toLowerCase();
|
||||
return INTAKE_POLLING_PARSE_STATUSES.has(intakeStatus);
|
||||
}
|
||||
const unified = String(item.shipping_processing_status || '').trim().toLowerCase();
|
||||
if (unified) {
|
||||
if (TERMINAL_PROCESSING_STATUSES.has(unified)) return false;
|
||||
return IN_PROGRESS_PROCESSING_STATUSES.has(unified);
|
||||
}
|
||||
const process = String(item.process_status || '').trim();
|
||||
return IN_PROGRESS_PROCESS.has(process);
|
||||
}
|
||||
Reference in new issue
Block a user