feat(shipping-notice): 收敛复核状态隔离、STP 重试幂等与 XFA 合成预览标注
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
84a881b554
commit
74270adc22
149 files changed
+20111
-3871
No files matched your search
@@ -1,9 +1,10 @@
|
||||
/**
|
||||
* features/workspace/shipping-task-center/ShippingTaskCenterPage.vue
|
||||
* 用途:发货「任务中心」壳——Pending|Processing|Done + 识别 Run 续办表;仅列表入口。
|
||||
* 依赖:shipping-tasks.api(my-todos)、shipping.api 详情(直链摘要)、ShippingRunProgressTable、useShippingTodoBadge、
|
||||
* shippingProcessingLabels。
|
||||
* 逻辑:选中项展示入口卡 + 统一进度紧凑摘要(UI-03);唯一主按钮深链「订单处理工作台」或对话;
|
||||
* 用途:发货「任务中心」壳——Pending|Processing|Done + 识别 Run 续办表;列表入口 + STP 重试。
|
||||
* 依赖:shipping-tasks.api(my-todos)、shipping.api(详情/STP retry)、ShippingRunProgressTable、
|
||||
* useShippingTodoBadge、useMessage、shippingProcessingLabels。
|
||||
* 逻辑:选中项展示入口卡 + 统一进度紧凑摘要(UI-03);主按钮深链「订单处理工作台」;
|
||||
* review_case 在 failed/manual_fallback 时提供「重试自动推进」(与底栏同一 API/幂等键);
|
||||
* 不内嵌 ShippingTaskWorkbench;轮询依据 shipping_processing_status /
|
||||
* process_status / Intake parse_status。
|
||||
*/
|
||||
@@ -15,6 +16,7 @@ import { useI18n } from 'vue-i18n';
|
||||
import {
|
||||
getWorkspaceShippingTask,
|
||||
listShippingChatAgents,
|
||||
retryWorkspaceShippingOrderStpAutoCreate,
|
||||
SHIPPING_NOTICE_AGENT_CODE,
|
||||
type ShippingTaskDetail,
|
||||
type ShippingTaskSummary,
|
||||
@@ -25,6 +27,8 @@ import {
|
||||
type ShippingMyTodosCount,
|
||||
} from '@/features/workspace/api/shipping-tasks.api';
|
||||
import { useShippingTodoBadge } from '../composables/useShippingTodoBadge';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import {
|
||||
IN_PROGRESS_PROCESSING_STATUSES,
|
||||
TERMINAL_PROCESSING_STATUSES,
|
||||
@@ -42,6 +46,7 @@ import {
|
||||
import ShippingRunProgressTable from './ShippingRunProgressTable.vue';
|
||||
|
||||
const { t, te } = useI18n();
|
||||
const msg = useMessage();
|
||||
/** 进行中 Workflow/Task 前台轮询间隔。 */
|
||||
const FOREGROUND_POLL_MS = 2000;
|
||||
/** 页面隐藏时后台轮询间隔。 */
|
||||
@@ -354,7 +359,7 @@ async function refreshAll(_options?: { silent?: boolean }) {
|
||||
|
||||
/**
|
||||
* 打开订单处理工作台(Chat 主区 order-review;单 OT 全生命周期)。
|
||||
* 任务中心仅作列表入口,禁止在本页履约写操作。
|
||||
* 任务中心仅作列表入口,禁止在本页履约写操作(STP 重试除外)。
|
||||
*/
|
||||
function openOrderProcessing(item: ShippingTaskSummary | ShippingTaskDetail) {
|
||||
const runNo = String(item.review_run_no || '').trim();
|
||||
@@ -382,6 +387,41 @@ function canOpenOrderProcessing(item: ShippingTaskSummary | ShippingTaskDetail |
|
||||
return Boolean(runNo && agentId);
|
||||
}
|
||||
|
||||
const stpRetrying = ref(false);
|
||||
|
||||
/**
|
||||
* 任务中心是否展示「重试自动推进」(与工作台底栏同一 available_actions / 幂等键)。
|
||||
*/
|
||||
function canRetryStpAutoCreate(item: ShippingTaskSummary | ShippingTaskDetail | null): boolean {
|
||||
if (!item || item.can_handle === false) return false;
|
||||
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');
|
||||
}
|
||||
|
||||
/**
|
||||
* 显式重试 STP 自动建单入队;与 ReviewWorkbenchFooter 共用 POST retry API。
|
||||
*/
|
||||
async function retryStpAutoCreate(item: ShippingTaskSummary | ShippingTaskDetail) {
|
||||
const caseNo = String(item.review_case_no || '').trim();
|
||||
if (!caseNo || stpRetrying.value) return;
|
||||
stpRetrying.value = true;
|
||||
try {
|
||||
await retryWorkspaceShippingOrderStpAutoCreate(caseNo);
|
||||
msg.success(t('chat.shippingOrderReview.autoProgress.retryStpSuccess'));
|
||||
await loadTodos();
|
||||
} catch (error) {
|
||||
const message = error instanceof BusinessError
|
||||
? (error.message || t('chat.shippingOrderReview.autoProgress.retryStp'))
|
||||
: t('chat.shippingOrderReview.autoProgress.retryStp');
|
||||
msg.error(message);
|
||||
} finally {
|
||||
stpRetrying.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开对话「本次处理中」卡,聚焦未建 OT 的 Intake 材料。
|
||||
*/
|
||||
@@ -731,16 +771,29 @@ onBeforeUnmount(() => {
|
||||
{{ selectedItem.source_file_name }}
|
||||
<span v-if="selectedItem.review_run_no"> · {{ selectedItem.review_run_no }}</span>
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1.5 rounded-xl bg-brand-600 px-4 py-2 text-sm font-medium text-white hover:bg-brand-700 disabled:opacity-50"
|
||||
:disabled="!canOpenOrderProcessing(selectedItem)"
|
||||
data-testid="my-todos-open-order-processing"
|
||||
@click="openOrderProcessing(selectedItem)"
|
||||
>
|
||||
<ExternalLink class="h-3.5 w-3.5" />
|
||||
{{ $t('workspace.shippingNotice.myTodos.openReview') }}
|
||||
</button>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1.5 rounded-xl bg-brand-600 px-4 py-2 text-sm font-medium text-white hover:bg-brand-700 disabled:opacity-50"
|
||||
:disabled="!canOpenOrderProcessing(selectedItem)"
|
||||
data-testid="my-todos-open-order-processing"
|
||||
@click="openOrderProcessing(selectedItem)"
|
||||
>
|
||||
<ExternalLink class="h-3.5 w-3.5" />
|
||||
{{ $t('workspace.shippingNotice.myTodos.openReview') }}
|
||||
</button>
|
||||
<button
|
||||
v-if="canRetryStpAutoCreate(selectedItem)"
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1.5 rounded-xl border border-amber-400 bg-amber-50 px-4 py-2 text-sm font-medium text-amber-950 hover:bg-amber-100 disabled:opacity-50 dark:border-amber-700 dark:bg-amber-950/40 dark:text-amber-100"
|
||||
:disabled="stpRetrying"
|
||||
data-testid="my-todos-retry-stp-auto-create"
|
||||
@click="() => { if (selectedItem) void retryStpAutoCreate(selectedItem); }"
|
||||
>
|
||||
<RefreshCw class="h-3.5 w-3.5" />
|
||||
{{ $t('chat.shippingOrderReview.autoProgress.retryStp') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-else-if="isIntakeSelection && selectedItem"
|
||||
|
||||
Reference in new issue
Block a user