refactor(shipping-notice): 重构货代发货通知状态管理,移除废弃的process_status字段
统一货代发货通知的业务阶段为四个标准阶段:接收解析、订单复核、发货准备、上传完成 设置 ui_state 为前端唯一状态数据源,不再依赖 process_status 驱动业务流程 删除 shipping_notices 表的废弃 process_status 列及对应复合索引,新增数据库迁移脚本 替换全栈代码中所有对 process_status 的引用为生命周期、上传状态等领域字段 更新相关文档、测试用例与前端展示逻辑适配新的状态管理规则
This commit is contained in:
1 parent
6684e7181a
commit
5ef8329bd8
178 files changed
+5091
-1734
No files matched your search
@@ -5,8 +5,8 @@
|
||||
* useShippingTodoBadge、useMessage、shippingProcessingLabels。
|
||||
* 逻辑:选中项展示入口卡 + 统一进度紧凑摘要(UI-03);主按钮深链「订单处理工作台」;
|
||||
* review_case 在 failed/manual_fallback 时提供「重试自动推进」(与底栏同一 API/幂等键);
|
||||
* 不内嵌 ShippingTaskWorkbench;轮询依据 shipping_processing_status /
|
||||
* process_status / Intake parse_status。
|
||||
* 不内嵌 ShippingTaskWorkbench;业务阶段和主进度只依据 ui_state.stage/steps,
|
||||
* Intake parse_status 仅用于解析任务轮询。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
||||
@@ -33,14 +33,8 @@ import {
|
||||
IN_PROGRESS_PROCESSING_STATUSES,
|
||||
TERMINAL_PROCESSING_STATUSES,
|
||||
} from '@/features/chat/shipping/shippingProcessingFulfillment';
|
||||
import {
|
||||
resolveShippingProcessingStatusLabel,
|
||||
shippingProcessingStageKey,
|
||||
} from '@/features/chat/shipping/shippingProcessingLabels';
|
||||
import { stageAbsoluteIndex } from '@/features/shipping-progress/progressWindow';
|
||||
import { resolveGateReasonLabel } from '@/features/shipping-progress/gateReasonLabel';
|
||||
import {
|
||||
IN_PROGRESS_PROCESS,
|
||||
isShippingTodoListItemInProgress,
|
||||
} from './shippingTaskCenterPolling';
|
||||
import ShippingRunProgressTable from './ShippingRunProgressTable.vue';
|
||||
@@ -54,18 +48,18 @@ const BACKGROUND_POLL_MS = 8000;
|
||||
|
||||
/**
|
||||
* 判断详情是否仍处于进行中。
|
||||
* 核心逻辑:与列表同源——优先 shipping_processing_status;缺失时回退 process_status;
|
||||
* 不回退 WorkflowItem lifecycle(UI-03)。
|
||||
* 核心逻辑:优先统一 ui_state.stage;技术 processing status 仅用于轮询,不用于业务阶段展示。
|
||||
*/
|
||||
function isDetailInProgress(task: ShippingTaskDetail | null): boolean {
|
||||
if (!task) return false;
|
||||
const stage = String(task.ui_state?.stage?.code || '').trim();
|
||||
if (stage) return stage !== 'upload_complete';
|
||||
const unified = String(task.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(task.process_status || '').trim();
|
||||
return IN_PROGRESS_PROCESS.has(process);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -140,31 +134,20 @@ const entryItem = computed((): ShippingTaskSummary | ShippingTaskDetail | null =
|
||||
});
|
||||
|
||||
/**
|
||||
* 任务中心选中项的统一进度紧凑摘要(UI-03):阶段 · n/15 + 阻断文案。
|
||||
* 任务中心选中项的统一进度紧凑摘要:只展示后端阶段与阻断原因。
|
||||
* 15 节点只属于订单详情进度条,任务中心不得重复显示。
|
||||
*/
|
||||
const entryProgressSummary = computed(() => {
|
||||
const item = entryItem.value;
|
||||
if (!item) return null;
|
||||
const stage = String(
|
||||
('shipping_processing_stage' in item ? item.shipping_processing_stage : null)
|
||||
|| '',
|
||||
).trim();
|
||||
const status = String(item.shipping_processing_status || '').trim();
|
||||
if (!stage && !status) return null;
|
||||
const stageKey = shippingProcessingStageKey(stage || '');
|
||||
const stageLabel = stage && te(stageKey) ? t(stageKey) : (stage || resolveShippingProcessingStatusLabel(status, te, t));
|
||||
const index = stage ? stageAbsoluteIndex(stage) + 1 : 0;
|
||||
const gateCode = String(
|
||||
item.ui_state?.process_gate?.current_blocking_gate?.blocking_reason_code
|
||||
|| item.ui_state?.process_gate?.blocking_reason_code
|
||||
|| '',
|
||||
).trim();
|
||||
const blocker = resolveGateReasonLabel(gateCode, { t, te });
|
||||
const stageCode = String(item.ui_state?.stage?.code || '').trim();
|
||||
const stageLabel = String(item.ui_state?.stage?.label || '').trim();
|
||||
if (!stageCode && !stageLabel) return null;
|
||||
const reason = item.ui_state?.reason;
|
||||
const blocker = String(reason?.message || '').trim()
|
||||
|| resolveGateReasonLabel(String(reason?.code || '').trim(), { t, te });
|
||||
return {
|
||||
stageLabel,
|
||||
index,
|
||||
total: 15,
|
||||
statusLabel: resolveShippingProcessingStatusLabel(status, te, t),
|
||||
stageLabel: stageLabel || stageCode,
|
||||
blocker,
|
||||
poNumber: String(item.po_number || '').trim() || null,
|
||||
customerName: String(item.customer_name || '').trim() || null,
|
||||
@@ -198,7 +181,7 @@ function todoDisplayNo(item: ShippingTaskSummary): string {
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否应继续自动轮询:processing 桶、进行中直链详情,或 runs 面;列表项按统一投影 / process_status。
|
||||
* 是否应继续自动轮询:processing 桶、进行中直链详情,或 runs 面;列表项按统一投影。
|
||||
*/
|
||||
const shouldAutoRefresh = computed(() => {
|
||||
if (surface.value === 'runs') return true;
|
||||
@@ -397,8 +380,10 @@ function canRetryStpAutoCreate(item: ShippingTaskSummary | ShippingTaskDetail |
|
||||
const caseNo = String(item.review_case_no || '').trim();
|
||||
if (!caseNo) return false;
|
||||
const summaryActions = item.ui_state?.summary?.allowed_actions || [];
|
||||
const buttons = (item.ui_state?.action_buttons || []).map((action) => String(action));
|
||||
return summaryActions.includes('retry_stp_auto_create') || buttons.includes('retry_stp_auto_create');
|
||||
const actions = [item.ui_state?.actions?.primary, ...(item.ui_state?.actions?.secondary || [])]
|
||||
.filter(Boolean)
|
||||
.map((action) => String(action?.code || ''));
|
||||
return summaryActions.includes('retry_stp_auto_create') || actions.includes('retry_stp_auto_create');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -730,7 +715,7 @@ onBeforeUnmount(() => {
|
||||
</span>
|
||||
</div>
|
||||
<div class="mt-1 truncate text-sm text-secondary">
|
||||
{{ item.ui_state?.summary?.current_todo || item.ui_state?.summary?.title || item.process_status }}
|
||||
{{ item.ui_state?.todo?.title || item.ui_state?.summary?.current_todo || item.ui_state?.summary?.title || item.ui_state?.stage?.label || '—' }}
|
||||
</div>
|
||||
<div class="mt-1 truncate text-xs text-muted">
|
||||
{{ item.customer_name || item.source_file_name || item.review_run_no || '—' }}
|
||||
@@ -838,8 +823,6 @@ onBeforeUnmount(() => {
|
||||
>
|
||||
{{ $t('workspace.shippingNotice.myTodos.progressSummary', {
|
||||
stage: entryProgressSummary.stageLabel,
|
||||
current: entryProgressSummary.index || '—',
|
||||
total: entryProgressSummary.total,
|
||||
}) }}
|
||||
</p>
|
||||
<p
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* features/workspace/shipping-task-center/ShippingTaskWorkbench.vue
|
||||
* 用途:发货任务处理主区——当前待办栏、统一 15 阶进度、最后活动/终止原因、STP 事实、订单概览、时间线。
|
||||
* 用途:发货任务处理主区——当前待办栏、四阶段进度、最后活动/终止原因、STP 事实、订单概览、时间线。
|
||||
* 依赖:TaskTodoPanel、StpProgressFactsPanel、TaskProgressTimeline、ShippingTaskParsedResultCard、
|
||||
* useShippingProcessingWorkItem、WorkbenchProgressGrouped、listWorkspaceShippingTaskAuditTimeline。
|
||||
* useShippingProcessingWorkItem、ShippingWorkflowStepper、listWorkspaceShippingTaskAuditTimeline。
|
||||
* 逻辑:由 ShippingTaskCenterPage 选中任务后挂载;OT 身份取 detail.order_task_no(禁止 WorkflowItem);
|
||||
* 进度仅来自 ShippingProcessingProjection(showActions=false,动作归 TaskTodoPanel,UI-05);
|
||||
* 业务进度仅来自 detail.ui_state.steps(动作归 TaskTodoPanel,UI-05);
|
||||
* 时间线仅消费统一 ShippingAuditEvent。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
@@ -12,16 +12,12 @@ import { computed, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import ShippingMatchResultCard from '@/features/chat/components/messages/ShippingMatchResultCard.vue';
|
||||
import ShippingTaskParsedResultCard from '@/features/chat/components/ShippingTaskParsedResultCard.vue';
|
||||
import {
|
||||
resolveShippingProcessingStatusLabel,
|
||||
shippingProcessingStageKey,
|
||||
} from '@/features/chat/shipping/shippingProcessingLabels';
|
||||
import { resolveShippingWorkflowSteps } from '@/features/chat/shipping/shippingStepper';
|
||||
import ShippingWorkflowStepper from '@/features/chat/components/ShippingWorkflowStepper.vue';
|
||||
import { useShippingProcessingWorkItem } from '@/features/chat/shipping/useShippingProcessingWorkItem';
|
||||
import type { ShippingTaskAuditTimelineItem, ShippingTaskDetail } from '@/features/chat/types/shipping.api.types';
|
||||
import { listWorkspaceShippingTaskAuditTimeline } from '@/features/chat/api/shipping.api';
|
||||
import WorkbenchProgressGrouped from '@/features/shipping-progress/components/WorkbenchProgressGrouped.vue';
|
||||
import { resolveProcessingActionPresentation } from '@/features/shipping-progress/actionPresentation';
|
||||
import type { ActionPresentationItem } from '@/features/shipping-progress/types';
|
||||
import { formatLocalDateTime } from '@/shared/utils/dateTime';
|
||||
import TaskTodoPanel from './TaskTodoPanel.vue';
|
||||
import StpProgressFactsPanel from './StpProgressFactsPanel.vue';
|
||||
@@ -92,34 +88,18 @@ const lastActivityAt = computed(() =>
|
||||
);
|
||||
const terminateReason = computed(() => {
|
||||
const code = String(
|
||||
shippingProcessingProjection.value?.currentGate?.blockingReasonCode || '',
|
||||
shippingProcessingProjection.value?.uiState
|
||||
? shippingProcessingProjection.value.uiState.blocking_reason?.code
|
||||
: shippingProcessingProjection.value?.currentGate?.blockingReasonCode || '',
|
||||
).trim();
|
||||
if (!code) return null;
|
||||
const key = `workspace.shippingNotice.workflowReasons.${code}`;
|
||||
return te(key) ? t(key) : code;
|
||||
});
|
||||
|
||||
/** 统一投影是否可用。 */
|
||||
const hasFulfillmentProjection = computed(() => Boolean(shippingProcessingProjection.value));
|
||||
const workflowSteps = computed(() => resolveShippingWorkflowSteps(props.detail));
|
||||
|
||||
const unifiedProcessingLabel = computed(() => {
|
||||
const projection = shippingProcessingProjection.value;
|
||||
if (!projection) return '';
|
||||
const status = resolveShippingProcessingStatusLabel(projection.status, te, t);
|
||||
const stageKey = shippingProcessingStageKey(projection.stage);
|
||||
const stage = te(stageKey) ? t(stageKey) : projection.stage;
|
||||
return [status, stage].filter(Boolean).join(' · ');
|
||||
});
|
||||
|
||||
/** 将内部状态映射为业务文案,未知值不回显原始状态码。 */
|
||||
function workflowStatusLabel(value: unknown): string {
|
||||
const code = String(value || '').trim();
|
||||
if (!code) return t('workspace.shippingNotice.status.unknown');
|
||||
const key = `workspace.shippingNotice.workflowStatus.${code}`;
|
||||
return te(key) ? t(key) : t('workspace.shippingNotice.status.unknown');
|
||||
}
|
||||
|
||||
const taskStatusLabel = computed(() => workflowStatusLabel(props.detail.process_status));
|
||||
const taskStatusLabel = computed(() => props.detail.ui_state?.stage?.label || t('workspace.shippingNotice.status.unknown'));
|
||||
const taskMatchStatusLabel = computed(() => {
|
||||
const code = String(props.detail.match_status || '').trim();
|
||||
if (!code) return t('workspace.shippingNotice.matchStatus.unknown');
|
||||
@@ -127,24 +107,6 @@ const taskMatchStatusLabel = computed(() => {
|
||||
return te(key) ? t(key) : t('workspace.shippingNotice.matchStatus.unknown');
|
||||
});
|
||||
|
||||
/**
|
||||
* 任务台统一动作栏:刷新投影;其余 intent 由 TaskTodoPanel 承载。
|
||||
*/
|
||||
function onTaskUnifiedAction(item: ActionPresentationItem) {
|
||||
if (item.intent === 'refresh') {
|
||||
emit('refreshed');
|
||||
return;
|
||||
}
|
||||
if (item.intent === 'download_excel') {
|
||||
void downloadExcel();
|
||||
return;
|
||||
}
|
||||
if (item.intent === 'open_manual_upload') {
|
||||
// 已在任务台,无需跳转。
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉取任务统一审计时间线(ShippingAuditEvent 单源)。
|
||||
*/
|
||||
@@ -202,26 +164,10 @@ async function downloadExcel() {
|
||||
<div class="mb-3 text-xs font-semibold uppercase tracking-wide text-muted">
|
||||
{{ $t('workspace.shippingNotice.todo.workflow') }}
|
||||
</div>
|
||||
<p
|
||||
v-if="unifiedProcessingLabel"
|
||||
class="mb-2 text-xs text-secondary"
|
||||
data-testid="task-shipping-processing-summary"
|
||||
>
|
||||
{{ unifiedProcessingLabel }}
|
||||
</p>
|
||||
<p
|
||||
v-else-if="!hasFulfillmentProjection"
|
||||
class="mb-2 text-xs text-amber-700 dark:text-amber-300"
|
||||
data-testid="task-workbench-progress-unavailable"
|
||||
>
|
||||
<ShippingWorkflowStepper v-if="workflowSteps.length" :steps="workflowSteps" compact />
|
||||
<p v-else class="mb-2 text-xs text-amber-700 dark:text-amber-300" data-testid="task-workbench-progress-unavailable">
|
||||
{{ $t('workspace.shippingNotice.todo.progressUnavailable') }}
|
||||
</p>
|
||||
<WorkbenchProgressGrouped
|
||||
v-if="shippingProcessingProjection"
|
||||
:projection="shippingProcessingProjection"
|
||||
:show-actions="false"
|
||||
@action="onTaskUnifiedAction"
|
||||
/>
|
||||
<dl class="mt-3 grid gap-2 text-xs sm:grid-cols-2">
|
||||
<div>
|
||||
<dt class="text-muted">{{ $t('workspace.shippingNotice.todo.lastActivity') }}</dt>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
* features/workspace/shipping-task-center/TaskTodoPanel.vue
|
||||
* 用途:渲染统一 Gate 恢复卡片与 STP 履约待办说明(表单/弹窗入口)。
|
||||
* 依赖:ProcessGateRecoveryCard、shipping.api、shipping-tasks.api、ManualUploadEvidenceDialog。
|
||||
* 逻辑:gateCanHandle 控制 Gate 卡写按钮;actionsExecutable 控制 invokeActionByCode / 对话框写;
|
||||
* hidePrimaryActions=true 时不渲染 action_buttons(订单处理工作台写入口仅 Footer);
|
||||
* 逻辑:gateCanHandle 控制 Gate 卡写按钮;actionsExecutable 控制统一 action.code 写操作;
|
||||
* hidePrimaryActions=true 时隐藏本卡按钮(订单处理工作台写入口仅 Footer);
|
||||
* 系统 Worker / technical_auto_only 不计入人工阻断,避免「待处理事项」冒充系统等待。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
@@ -35,7 +35,6 @@ import ManualUploadEvidenceDialog from './ManualUploadEvidenceDialog.vue';
|
||||
import ProcessGateRecoveryCard from '@/features/shipping-process-gates/components/ProcessGateRecoveryCard.vue';
|
||||
import { postWorkspaceProcessGateAction } from '@/features/shipping-process-gates/api/process-gates.api';
|
||||
import type { ShippingProcessGateUserSummary } from '@/features/chat/types/shipping.api.types';
|
||||
import { gateSummaryIndicatesManualUpload } from '@/features/chat/shipping/shippingProcessingFulfillment';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
detail: ShippingTaskDetail;
|
||||
@@ -45,7 +44,7 @@ const props = withDefaults(defineProps<{
|
||||
gateCanHandle?: boolean;
|
||||
/** Footer/Resolver 委托的 invokeActionByCode 是否可执行写。 */
|
||||
actionsExecutable?: boolean;
|
||||
/** 为 true 时隐藏全部 action_buttons(订单处理工作台写入口仅 Footer)。 */
|
||||
/** 为 true 时隐藏本卡全部后端 actions(订单处理工作台写入口仅 Footer)。 */
|
||||
hidePrimaryActions?: boolean;
|
||||
/** 订单处理工作台将 Gate 卡提升到右侧展示时隐藏此处重复卡。 */
|
||||
hideGateCard?: boolean;
|
||||
@@ -92,16 +91,9 @@ const processGateSummary = computed((): ShippingProcessGateUserSummary | null =>
|
||||
|| (summary.value.process_gate as ShippingProcessGateUserSummary | null | undefined)
|
||||
|| null,
|
||||
);
|
||||
const actionButtons = computed(() => props.detail.ui_state?.action_buttons || []);
|
||||
const checkpointKind = computed(() => String(props.detail.ui_state?.checkpoint_kind || ''));
|
||||
/** 统一 Gate 投影中的主要恢复动作;用于去重旧 action_buttons。 */
|
||||
const processGateNextAction = computed(() =>
|
||||
String(
|
||||
processGateSummary.value?.next_action_code
|
||||
|| processGateSummary.value?.current_blocking_gate?.next_action_code
|
||||
|| '',
|
||||
).trim(),
|
||||
);
|
||||
const unifiedActions = computed(() => props.detail.ui_state?.actions || { primary: null, secondary: [] });
|
||||
const backendPrimaryAction = computed(() => unifiedActions.value.primary || null);
|
||||
const backendSecondaryActions = computed(() => unifiedActions.value.secondary || []);
|
||||
/** 有 Gate 阻断时优先展示统一投影文案。 */
|
||||
const displayTodoTitle = computed(() =>
|
||||
processGateSummary.value?.current_blocking_gate?.label
|
||||
@@ -115,31 +107,6 @@ const displayTodoMessage = computed(() =>
|
||||
|| t('workspace.shippingNotice.todo.noActionMessage'),
|
||||
);
|
||||
|
||||
/**
|
||||
* 是否展示「待人工上传登记」提示。
|
||||
* 核心逻辑:优先 process_gate / current_blocking_gate 的 next_action_code 与
|
||||
* available_actions;RPA 上传中不展示;禁止用 workflow_item.lifecycle 作主判据。
|
||||
*/
|
||||
const showWaitingManualUploadNote = computed(() => {
|
||||
const process = String(props.detail.process_status || '').trim();
|
||||
if (process === 'uploading') return false;
|
||||
const gateNextAction = String(
|
||||
processGateSummary.value?.current_blocking_gate?.next_action_code
|
||||
|| processGateSummary.value?.next_action_code
|
||||
|| processGateNextAction.value
|
||||
|| '',
|
||||
).trim();
|
||||
const allowedActions = [
|
||||
...(summary.value.allowed_actions || []),
|
||||
...(actionButtons.value.map((item) => item.id)),
|
||||
];
|
||||
return gateSummaryIndicatesManualUpload({
|
||||
nextActionCode: gateNextAction,
|
||||
checkpointKind: checkpointKind.value,
|
||||
availableActions: allowedActions,
|
||||
});
|
||||
});
|
||||
|
||||
/** 当前导出工件 id,供人工上传登记对话框绑定。 */
|
||||
const currentExportArtifactId = computed(() => {
|
||||
const artifacts = props.detail.export_artifacts;
|
||||
@@ -147,41 +114,6 @@ const currentExportArtifactId = computed(() => {
|
||||
const id = Number(artifacts[0]?.id);
|
||||
return Number.isFinite(id) ? id : null;
|
||||
});
|
||||
/** auto_continue 仅保留刷新;正常 STP 由后台自动推进。 */
|
||||
const AUTO_CONTINUE_ACTIONS = new Set(['refresh']);
|
||||
/** wait_manual_upload 仅允许下载/导出/人工上传确认。 */
|
||||
const WAIT_MANUAL_UPLOAD_ACTIONS = new Set(['download_excel', 'export', 'mark_manual_uploaded', 'refresh']);
|
||||
/** must_human 保留例外处理动作,禁止 Chat 侧履约写路径。 */
|
||||
const MUST_HUMAN_ACTIONS = new Set([
|
||||
'confirm',
|
||||
'reject',
|
||||
'reparse',
|
||||
'replace_notice_file',
|
||||
'rematch',
|
||||
'retry_rpa',
|
||||
'confirm_inventory_source',
|
||||
'retry_resolve_inventory_source',
|
||||
'confirm_customer',
|
||||
'freeze_order',
|
||||
'upload_inventory_file',
|
||||
'match_inventory',
|
||||
'refresh',
|
||||
]);
|
||||
/**
|
||||
* 按 STP checkpoint_kind 过滤工作台动作,避免 auto_continue 误点写操作。
|
||||
*/
|
||||
function isActionAllowedForCheckpoint(actionId: string, kind: string): boolean {
|
||||
if (!kind || kind === 'complete') return actionId === 'refresh';
|
||||
if (kind === 'auto_continue') return AUTO_CONTINUE_ACTIONS.has(actionId);
|
||||
if (kind === 'wait_manual_upload') return WAIT_MANUAL_UPLOAD_ACTIONS.has(actionId);
|
||||
if (kind === 'must_human') return MUST_HUMAN_ACTIONS.has(actionId);
|
||||
return true;
|
||||
}
|
||||
const allowedIds = computed(() => {
|
||||
const fromSummary = summary.value.allowed_actions;
|
||||
if (Array.isArray(fromSummary) && fromSummary.length) return new Set(fromSummary.map(String));
|
||||
return new Set(actionButtons.value.map((item) => item.id));
|
||||
});
|
||||
const hasBlockingGate = computed(() => {
|
||||
const gate = processGateSummary.value;
|
||||
if (!gate?.current_blocking_gate) return false;
|
||||
@@ -205,40 +137,7 @@ const isSystemAutoWait = computed(() => {
|
||||
return !hasBlockingGate.value;
|
||||
});
|
||||
|
||||
const UNIFIED_OWNED_ACTION_IDS = new Set([
|
||||
'retry',
|
||||
'refresh',
|
||||
'download_excel',
|
||||
'export',
|
||||
'open_manual_upload',
|
||||
'mark_manual_uploaded',
|
||||
'regenerate_excel',
|
||||
'view_result',
|
||||
'open_order_review',
|
||||
'open_order_processing',
|
||||
]);
|
||||
|
||||
const visibleActions = computed(() => {
|
||||
// [STEP] 订单处理工作台:写操作仅 Footer;不渲染 Notice action_buttons(D1)。
|
||||
if (props.hidePrimaryActions) return [];
|
||||
// [STEP] Gate 阻断或系统自动等待时均由统一 Gate 投影拥有动作;
|
||||
// 禁止历史 action_buttons(如 edit_formal_task)穿透到当前阶段。
|
||||
if (hasBlockingGate.value || isSystemAutoWait.value) return [];
|
||||
return actionButtons.value.filter((action) => {
|
||||
const id = String(action.id || '');
|
||||
if (id === 'regenerate_manual_upload_todo') return false;
|
||||
if (UNIFIED_OWNED_ACTION_IDS.has(id)) {
|
||||
return false;
|
||||
}
|
||||
if (!allowedIds.value.has(id) || !isActionAllowedForCheckpoint(id, checkpointKind.value)) {
|
||||
return false;
|
||||
}
|
||||
if (processGateNextAction.value && id === processGateNextAction.value) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
});
|
||||
// 统一 actions 已是唯一按钮来源;旧 action_buttons 不再参与渲染。
|
||||
/** Gate 卡写权限;订单处理工作台传入 false 保持只读。 */
|
||||
const resolvedGateCanHandle = computed(() => (
|
||||
props.gateCanHandle !== undefined ? Boolean(props.gateCanHandle) : Boolean(props.canHandle)
|
||||
@@ -508,6 +407,17 @@ async function runAction(action: ShippingChatAction) {
|
||||
}
|
||||
}
|
||||
|
||||
/** 将后端统一动作适配到现有专用弹窗/提交执行器;业务判断仍完全由后端提供。 */
|
||||
async function runUnifiedAction(action: NonNullable<typeof backendPrimaryAction.value>) {
|
||||
if (!action.enabled) return;
|
||||
await runAction({
|
||||
id: action.code,
|
||||
label: action.label || action.code,
|
||||
message: action.disabled_reason || '',
|
||||
variant: action.kind === 'terminate' ? 'danger' : action.kind === 'view' ? 'secondary' : 'primary',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 供订单处理工作台统一 ActionBar 委托履约动作(库存源/匹配/上传登记等)。
|
||||
*
|
||||
@@ -516,13 +426,11 @@ async function runAction(action: ShippingChatAction) {
|
||||
async function invokeActionByCode(actionId: string) {
|
||||
const id = String(actionId || '').trim();
|
||||
if (!id) return;
|
||||
const fromButtons = actionButtons.value.find((item) => String(item.id || '') === id);
|
||||
await runAction(fromButtons || {
|
||||
id,
|
||||
label: id,
|
||||
message: '',
|
||||
variant: 'primary',
|
||||
});
|
||||
const projected = [backendPrimaryAction.value, ...backendSecondaryActions.value]
|
||||
.find((item) => item && item.code === id);
|
||||
if (projected) {
|
||||
await runUnifiedAction(projected);
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
@@ -564,30 +472,33 @@ defineExpose({
|
||||
<div v-if="!resolvedActionsExecutable" class="mt-3 text-xs text-muted">
|
||||
{{ $t('workspace.shippingNotice.todo.adminViewOnly') }}
|
||||
</div>
|
||||
<div v-else-if="visibleActions.length" class="mt-3 flex flex-wrap gap-2">
|
||||
<div v-else-if="backendPrimaryAction || backendSecondaryActions.length" class="mt-3 flex flex-wrap gap-2">
|
||||
<button
|
||||
v-for="action in visibleActions"
|
||||
:key="action.id"
|
||||
v-if="backendPrimaryAction"
|
||||
:key="backendPrimaryAction.code"
|
||||
type="button"
|
||||
class="rounded-xl px-3 py-1.5 text-sm font-medium transition-colors disabled:opacity-50"
|
||||
:class="action.variant === 'danger'
|
||||
:class="backendPrimaryAction.kind === 'terminate'
|
||||
? 'bg-rose-600 text-white hover:bg-rose-700'
|
||||
: action.variant === 'secondary'
|
||||
: backendPrimaryAction.kind === 'view'
|
||||
? 'border border-default bg-surface text-secondary hover:bg-surface-soft'
|
||||
: 'bg-brand-600 text-white hover:bg-brand-700'"
|
||||
:disabled="busyId === action.id"
|
||||
@click="runAction(action)"
|
||||
:disabled="!backendPrimaryAction.enabled || busyId === backendPrimaryAction.code"
|
||||
@click="runUnifiedAction(backendPrimaryAction)"
|
||||
>
|
||||
{{ action.label }}
|
||||
{{ backendPrimaryAction.label || backendPrimaryAction.code }}
|
||||
</button>
|
||||
<button
|
||||
v-for="action in backendSecondaryActions"
|
||||
:key="action.code"
|
||||
type="button"
|
||||
class="rounded-xl border border-default bg-surface px-3 py-1.5 text-sm font-medium text-secondary transition-colors hover:bg-surface-soft disabled:opacity-50"
|
||||
:disabled="!action.enabled || busyId === action.code"
|
||||
@click="runUnifiedAction(action)"
|
||||
>
|
||||
{{ action.label || action.code }}
|
||||
</button>
|
||||
</div>
|
||||
<p
|
||||
v-if="showWaitingManualUploadNote"
|
||||
class="mt-3 rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-800"
|
||||
data-testid="manual-upload-end-note"
|
||||
>
|
||||
{{ $t('workspace.shippingNotice.todo.waitingManualUploadNote') }}
|
||||
</p>
|
||||
<ManualUploadEvidenceDialog
|
||||
v-model:open="manualUploadOpen"
|
||||
:task-no="detail.task_no"
|
||||
|
||||
@@ -14,7 +14,6 @@ function intakeItem(status: string): ShippingTaskSummary {
|
||||
todo_ref: 'SNI-1',
|
||||
intake_no: 'SNI-1',
|
||||
intake_parse_status: status,
|
||||
process_status: status,
|
||||
todo_category: 'intake_parse',
|
||||
} as ShippingTaskSummary;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
TERMINAL_PROCESSING_STATUSES,
|
||||
} from '@/features/chat/shipping/shippingProcessingFulfillment';
|
||||
|
||||
/** 仍视为进行中、需要自动刷新的任务 process_status(列表项无统一投影时的 notice 任务兜底)。 */
|
||||
/** 历史轮询状态集合;正常任务中心优先消费统一 ui_state。 */
|
||||
export const IN_PROGRESS_PROCESS = new Set([
|
||||
'parsing',
|
||||
'parsed',
|
||||
@@ -36,7 +36,7 @@ export const INTAKE_POLLING_PARSE_STATUSES = new Set([
|
||||
/**
|
||||
* 判断列表项是否应触发轮询刷新。
|
||||
* 核心逻辑:review_case 持续轮询;order_intake 仅 created/queued/parsing;
|
||||
* 其余优先 shipping_processing_status,缺省回退 process_status;
|
||||
* 其余优先 shipping_processing_status,再按统一 ui_state.stage;
|
||||
* 不复用 WorkflowItem lifecycle。
|
||||
* @param item - 我的待办列表项
|
||||
* @returns 是否需要继续轮询
|
||||
@@ -47,7 +47,7 @@ export function isShippingTodoListItemInProgress(item: ShippingTaskSummary): boo
|
||||
}
|
||||
if (item.item_kind === 'order_intake') {
|
||||
const intakeStatus = String(
|
||||
item.intake_parse_status || item.process_status || '',
|
||||
item.intake_parse_status || '',
|
||||
).trim().toLowerCase();
|
||||
return INTAKE_POLLING_PARSE_STATUSES.has(intakeStatus);
|
||||
}
|
||||
@@ -56,6 +56,6 @@ export function isShippingTodoListItemInProgress(item: ShippingTaskSummary): boo
|
||||
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);
|
||||
const stage = String(item.ui_state?.stage?.code || '').trim();
|
||||
return Boolean(stage) && stage !== 'upload_complete';
|
||||
}
|
||||
Reference in new issue
Block a user