feat(in-transit-transfer): 异常恢复一键重建预检并支持按行批量处理

- 新增 resume_service:可恢复阻断行按(来源×收料日期)分组重建范围预检,收料文件不可用自动触发 RPA 重抓,单组失败不影响其余组
- precheck 新增 list_recent_prechecks 最近预检入口:未执行未过期可继续执行,解决预检卡关闭后无处恢复
- manual_close 支持按 item_ids 批量关闭并带审计,retry/backlog 配合按行口径调整
- 前端三区接线换新:首页待办/预检卡/待处理异常接恢复与批量动作,新增 transferDate 日期工具与 e2e 用例
- i18n chat/errors 四语言同步,technical.md 与 funclist 更新,落行归属解耦与 ERP 写路径两份实施计划
This commit is contained in:
hugo committed 2026-09-23 15:30:07 +08:00
1 parent 42b271f92b
commit 556d3fd3db
35 files changed
+2895 -121

No files matched your search

@@ -1,10 +1,11 @@
<!--
features/chat/components/messages/TransferHomePanel.vue
用途:在途仓自动调拨 Agent 的 Chat 首页入口区——home 视图展示标题、今日待办
入口与三张历史待办计数卡;点击入口独立触发 source-select / backlog 卡片。
入口、最近预检(一键恢复)与三张历史待办计数卡;点击入口独立触发
source-select / backlog / 预检恢复卡片。
依赖:TransferMessageView(复用自驱动卡片)、useChatTransfer、i18n chat.transfer.*。
逻辑:home 时只消费 backlogSummary 计数;非 home 时渲染 TransferMessageView。
卡片不注入消息流,因此无需后端 ChatLog 消息(决策:补首页入口 A 方案)。
逻辑:home 时消费 backlogSummary 计数与 recentPrechecks 列表;非 home 时渲染
TransferMessageView。卡片不注入消息流,因此无需后端 ChatLog 消息。
-->
<script setup lang="ts">
import { computed, onMounted, ref, watch } from 'vue';
@@ -20,18 +21,33 @@ const emit = defineEmits<{
'flow-active': [active: boolean];
}>();
type HomeView = 'home' | 'source-select' | 'backlog';
type HomeView = 'home' | 'source-select' | 'backlog' | 'precheck-restore';
/** 待处理池结果筛选(与 TransferBacklogSummaryCard 的筛选选项一致)。 */
type BacklogFilter = 'all' | 'recoverable' | 'closed' | 'unknown';
const transfer = useChatTransfer();
const view = ref<HomeView>('home');
/** 最近预检入口选中的预检号(precheck-restore 视图传给 TransferMessageView 按ID恢复)。 */
const restorePrecheckId = ref('');
/** 历史待办计数卡对应的初始筛选:点击哪张卡就落到哪个切片,不再一律全量列表。 */
const backlogFilter = ref<BacklogFilter>('all');
/** 打开待处理池并按计数卡切片(recoverable/closed/unknown)。 */
function openBacklog(filter: BacklogFilter) {
backlogFilter.value = filter;
view.value = 'backlog';
}
/** 进入非 home 时通知父级隐藏聊天输入框(决策:来源选择为业务页,无对话输入区)。 */
watch(view, (value) => emit('flow-active', value !== 'home'), { immediate: true });
/** home 视图仅需要待办汇总;进入时拉取计数。 */
/** home 视图需要待办汇总与最近预检;进入时拉取。 */
async function loadHomeSummary() {
if (view.value !== 'home') return;
await transfer.loadBacklog();
await Promise.all([
transfer.loadBacklog().catch(() => undefined),
transfer.loadRecentPrechecks().catch(() => undefined),
]);
}
onMounted(() => { void loadHomeSummary(); });
@@ -39,12 +55,19 @@ watch(view, () => { void loadHomeSummary(); });
const displayAgentName = computed(() => props.agentName || '在途仓自动调拨');
/** 非 home 视图把当前入口透传给自驱动的 TransferMessageView(决定 source-select 或 backlog)。 */
const childPayload = computed(() => (
view.value === 'source-select'
? { kind: 'source-select' }
: { kind: 'backlog' }
));
/** 确认窗口剩余分钟(前端按 expires_at 计算,用于最近预检行展示)。 */
function remainingMinutes(expiresAt?: string | null): number {
if (!expiresAt) return 0;
const ms = new Date(expiresAt).getTime() - Date.now();
return Math.max(0, Math.ceil(ms / 60000));
}
/** 非 home 视图把当前入口透传给自驱动的 TransferMessageView。 */
const childPayload = computed(() => {
if (view.value === 'source-select') return { kind: 'source-select' };
if (view.value === 'precheck-restore') return { kind: 'precheck', precheck_id: restorePrecheckId.value };
return { kind: 'backlog', filter: backlogFilter.value };
});
function goBack() {
view.value = 'home';
@@ -79,6 +102,35 @@ function goBack() {
</button>
</section>
<!-- 最近预检:关闭/离开视图后可一键恢复(后端只列未执行、未过期、仍拥有归属行) -->
<section v-if="transfer.recentPrechecks.value.length" aria-label="最近预检">
<p class="mb-2 text-sm font-bold text-secondary">{{ $t('chat.transfer.homeRecentTitle') }}</p>
<div class="flex flex-col gap-2">
<button
v-for="recent in transfer.recentPrechecks.value"
:key="recent.precheck_no"
type="button"
data-testid="transfer-home-recent-precheck"
class="flex w-full items-center gap-3 rounded-2xl border border-default bg-surface p-3 text-left transition-colors hover:border-brand-200 hover:bg-brand-50"
@click="restorePrecheckId = recent.precheck_no; view = 'precheck-restore'"
>
<span class="min-w-0 flex-1">
<b class="block text-sm font-bold text-primary">{{ recent.precheck_no }}</b>
<span class="mt-0.5 block text-xs text-secondary">
{{ recent.business_date }}
· {{ $t('chat.transfer.executableCount') }} {{ recent.counts.executable_count }}
· {{ $t('chat.transfer.blockedCount') }} {{ recent.counts.blocked_count }}
<template v-if="recent.status === 'prechecking'"> · {{ $t('chat.transfer.recentPrechecking') }}</template>
<template v-else-if="remainingMinutes(recent.expires_at) > 0">
· {{ $t('chat.transfer.recentRemaining', { min: remainingMinutes(recent.expires_at) }) }}
</template>
</span>
</span>
<span class="shrink-0 text-xl text-brand-600">›</span>
</button>
</div>
</section>
<!-- 历史待办 -->
<section aria-label="历史待办">
<p class="mb-2 text-sm font-bold text-secondary">{{ $t('chat.transfer.homeHistoryLabel') }}</p>
@@ -87,7 +139,7 @@ function goBack() {
type="button"
data-testid="transfer-home-recoverable"
class="rounded-2xl border border-brand-200 bg-brand-50 p-4 text-left transition-colors hover:bg-brand-100"
@click="view = 'backlog'"
@click="openBacklog('recoverable')"
>
<b class="block text-2xl leading-none text-brand-600">{{ transfer.backlogSummary.value?.recoverable ?? 0 }}</b>
<b class="mt-2 block text-sm font-bold text-primary">{{ $t('chat.transfer.homeRecoverable') }}</b>
@@ -97,7 +149,7 @@ function goBack() {
type="button"
data-testid="transfer-home-closed"
class="rounded-2xl border border-default bg-surface p-4 text-left transition-colors hover:border-brand-200 hover:bg-brand-50"
@click="view = 'backlog'"
@click="openBacklog('closed')"
>
<b class="block text-2xl leading-none text-secondary">{{ transfer.backlogSummary.value?.closed ?? 0 }}</b>
<b class="mt-2 block text-sm font-bold text-primary">{{ $t('chat.transfer.homeClosed') }}</b>
@@ -107,7 +159,7 @@ function goBack() {
type="button"
data-testid="transfer-home-unknown"
class="rounded-2xl border border-amber-200 bg-amber-50 p-4 text-left transition-colors hover:bg-amber-100"
@click="view = 'backlog'"
@click="openBacklog('unknown')"
>
<b class="block text-2xl leading-none text-amber-600">{{ transfer.backlogSummary.value?.unknown ?? 0 }}</b>
<b class="mt-2 block text-sm font-bold text-primary">{{ $t('chat.transfer.homeUnknown') }}</b>