feat(shipping-notice): 完成货代发货通知全门禁恢复MVP收口
完成全门禁恢复MVP版本交付:调整自动上传与重试配置,重构正式执行链路;修复多处代码bug,新增测试与审计工具;更新全流程文档与契约规范。
This commit is contained in:
1 parent
8e0bbf7a81
commit
c94d173f92
181 files changed
+12947
-1724
No files matched your search
+87
@@ -0,0 +1,87 @@
|
||||
<!--
|
||||
features/chat/components/shipping-review/ReviewConversationRetryDrawer.vue
|
||||
用途:按需展示本次对话级自动推进重试的逐项结果,不占用订单复核主内容。
|
||||
依赖:vue-i18n、对话级重试 API 返回的摘要和对象结果。
|
||||
逻辑:仅用户主动从顶栏打开;按结果分类展示,关闭不改变任务真实状态。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { RefreshCw } from 'lucide-vue-next';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
type RetryItem = {
|
||||
object_type: string;
|
||||
object_ref: string;
|
||||
action?: string | null;
|
||||
outcome: string;
|
||||
reason_code?: string | null;
|
||||
};
|
||||
|
||||
const props = defineProps<{
|
||||
open: boolean;
|
||||
result: {
|
||||
summary: { total: number; retried: number; skipped: number; failed: number; blocked?: number };
|
||||
items: RetryItem[];
|
||||
} | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{ close: [] }>();
|
||||
const { t, te } = useI18n();
|
||||
|
||||
const items = computed(() => props.result?.items || []);
|
||||
|
||||
function itemLabel(item: RetryItem): string {
|
||||
const code = String(item.reason_code || '').trim();
|
||||
const key = `chat.shippingOrderReview.conversationRetry.reason.${code}`;
|
||||
return code && te(key) ? t(key) : outcomeLabel(item.outcome);
|
||||
}
|
||||
|
||||
function outcomeLabel(outcome: string): string {
|
||||
const key = `chat.shippingOrderReview.conversationRetry.outcome.${String(outcome || '').trim()}`;
|
||||
return te(key) ? t(key) : t('chat.shippingOrderReview.conversationRetry.outcome.unknown');
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-if="open && result"
|
||||
class="fixed inset-0 z-40 flex justify-end bg-slate-900/10"
|
||||
data-testid="review-conversation-retry-drawer"
|
||||
@click.self="emit('close')"
|
||||
>
|
||||
<aside class="flex h-full w-full max-w-[360px] flex-col border-l border-slate-200 bg-white shadow-2xl dark:border-slate-800 dark:bg-slate-900">
|
||||
<header class="flex items-center justify-between gap-3 border-b border-slate-200 px-3 py-2.5 dark:border-slate-800">
|
||||
<div class="flex min-w-0 items-center gap-2">
|
||||
<span class="flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-amber-100 text-amber-700 dark:bg-amber-900/60 dark:text-amber-200">
|
||||
<RefreshCw class="h-3.5 w-3.5" />
|
||||
</span>
|
||||
<div class="min-w-0">
|
||||
<h2 class="text-sm font-semibold">{{ t('chat.shippingOrderReview.conversationRetry.title') }}</h2>
|
||||
<p class="truncate text-[11px] text-muted">{{ t('chat.shippingOrderReview.conversationRetry.subtitle') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="rounded border border-slate-300 px-2 py-1 text-xs hover:bg-slate-50 dark:border-slate-600 dark:hover:bg-slate-800" data-testid="review-conversation-retry-drawer-close" @click="emit('close')">
|
||||
{{ t('chat.shippingOrderReview.workbench.close') }}
|
||||
</button>
|
||||
</header>
|
||||
<div class="flex flex-wrap gap-1.5 border-b border-slate-200 px-3 py-2 dark:border-slate-800">
|
||||
<p class="rounded-full bg-emerald-50 px-2 py-1 text-[11px] text-emerald-700 dark:bg-emerald-950/40 dark:text-emerald-300" data-testid="review-conversation-retry-retried">{{ t('chat.shippingOrderReview.conversationRetry.retried') }} <strong>{{ result.summary.retried }}</strong></p>
|
||||
<p class="rounded-full bg-slate-100 px-2 py-1 text-[11px] text-slate-600 dark:bg-slate-800 dark:text-slate-300" data-testid="review-conversation-retry-skipped">{{ t('chat.shippingOrderReview.conversationRetry.skipped') }} <strong>{{ result.summary.skipped }}</strong></p>
|
||||
<p class="rounded-full bg-rose-50 px-2 py-1 text-[11px] text-rose-700 dark:bg-rose-950/40 dark:text-rose-300" data-testid="review-conversation-retry-failed">{{ t('chat.shippingOrderReview.conversationRetry.failed') }} <strong>{{ result.summary.failed }}</strong></p>
|
||||
<p class="rounded-full bg-violet-50 px-2 py-1 text-[11px] text-violet-700 dark:bg-violet-950/40 dark:text-violet-300" data-testid="review-conversation-retry-blocked">{{ t('chat.shippingOrderReview.conversationRetry.blocked') }} <strong>{{ result.summary.blocked || 0 }}</strong></p>
|
||||
</div>
|
||||
<ul class="min-h-0 flex-1 divide-y divide-slate-100 overflow-y-auto dark:divide-slate-800" data-testid="review-conversation-retry-item-list">
|
||||
<li v-for="item in items" :key="`${item.object_type}:${item.object_ref}`" class="px-3 py-2.5 text-xs">
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<p class="min-w-0 truncate font-medium text-slate-800 dark:text-slate-100">{{ item.object_ref }}</p>
|
||||
<span
|
||||
class="shrink-0 rounded-full px-1.5 py-0.5 text-[10px]"
|
||||
:class="item.outcome === 'queued' ? 'bg-emerald-50 text-emerald-700 dark:bg-emerald-950/40 dark:text-emerald-300' : item.outcome === 'needs_human' ? 'bg-amber-50 text-amber-700 dark:bg-amber-950/40 dark:text-amber-300' : 'bg-slate-100 text-slate-600 dark:bg-slate-800 dark:text-slate-300'"
|
||||
>{{ outcomeLabel(item.outcome) }}</span>
|
||||
</div>
|
||||
<p class="mt-0.5 text-[11px] text-muted">{{ itemLabel(item) }}</p>
|
||||
</li>
|
||||
</ul>
|
||||
</aside>
|
||||
</div>
|
||||
</template>
|
||||
+24
-2
@@ -105,8 +105,23 @@ const statusLabel = computed(() => {
|
||||
* 下一步(「下一步」section 的问题/说明文案):优先展示 blocking_reason,否则按 user_status 给系统态文案。
|
||||
*/
|
||||
const nextStepText = computed(() => {
|
||||
const safeMessage = (value: unknown): string => {
|
||||
const raw = String(value || '').trim();
|
||||
const lowered = raw.toLowerCase();
|
||||
if (!raw) return '';
|
||||
if (
|
||||
lowered.includes('cannot import name')
|
||||
|| lowered.includes('traceback')
|
||||
|| lowered.includes('site-packages')
|
||||
|| lowered.includes('\\app\\')
|
||||
|| lowered.includes('/app/')
|
||||
) {
|
||||
return t('chat.shippingOrderReview.currentTask.nextStepFailedNoRetry');
|
||||
}
|
||||
return raw;
|
||||
};
|
||||
if (props.loading) {
|
||||
return String(props.automation?.message || '').trim() || t('chat.shippingOrderReview.currentTask.nextStepRunning');
|
||||
return safeMessage(props.automation?.message) || t('chat.shippingOrderReview.currentTask.nextStepRunning');
|
||||
}
|
||||
// 1) blocking_reason → 用后端给的 i18n_key 渲染具体阻断
|
||||
const br = props.blockingReason;
|
||||
@@ -116,7 +131,7 @@ const nextStepText = computed(() => {
|
||||
return t(i18nKey);
|
||||
}
|
||||
// i18n 键缺失时回落为 code(不裸露给普通用户,最终 QA 期间应全部补齐)
|
||||
return String(br.code || '').trim() || t('chat.shippingOrderReview.currentTask.nextStepUnknown');
|
||||
return safeMessage(br.code) || t('chat.shippingOrderReview.currentTask.nextStepUnknown');
|
||||
}
|
||||
// 2) 无阻断时,按 user_status 给系统说明文案
|
||||
const s = String(props.userStatus || '').trim() as ReviewCurrentUserStatus | '';
|
||||
@@ -141,6 +156,12 @@ const nextStepText = computed(() => {
|
||||
return t('chat.shippingOrderReview.currentTask.nextStepUnknown');
|
||||
});
|
||||
|
||||
/** 已完成/已取消时没有后续业务动作,不渲染“下一步”区,避免制造未完成错觉。 */
|
||||
const showNextStep = computed(() => {
|
||||
const status = String(props.userStatus || '').trim().toLowerCase();
|
||||
return !['completed', 'cancelled'].includes(status);
|
||||
});
|
||||
|
||||
/**
|
||||
* 业务动作按钮:后端确认 retryable=true → 主按钮为「重试」;
|
||||
* 否则若 primary_action.code 非 retry → 用 primary_action.code + i18n_key 渲染对应人工动作(进入复核/确认客户等)。
|
||||
@@ -301,6 +322,7 @@ type ReviewCurrentUserStatus =
|
||||
</aside>
|
||||
|
||||
<div
|
||||
v-if="showNextStep"
|
||||
class="mt-3 border-t border-sky-200/70 pt-3 dark:border-sky-800/60"
|
||||
data-testid="review-current-task-next-step-section"
|
||||
>
|
||||
|
||||
+21
@@ -21,6 +21,13 @@ const i18n = createI18n({
|
||||
wave: '履约波次',
|
||||
task: '正式任务',
|
||||
snapshotId: '库存快照 ID',
|
||||
inventorySource: '实际库存源',
|
||||
inventoryFile: '库存文件编号',
|
||||
inventoryFileSha256: '库存文件 SHA-256',
|
||||
inventoryRow: '库存行号',
|
||||
requiredQty: '需求数量',
|
||||
availableQty: '可用数量',
|
||||
matchAttempt: '匹配 Attempt',
|
||||
matchedAt: '匹配校验时间',
|
||||
decisionSource: '决定来源',
|
||||
decisionSourceValue: {
|
||||
@@ -45,6 +52,13 @@ describe('ReviewLineFulfillmentDetail', () => {
|
||||
line_key: 'L1',
|
||||
inventory_snapshot_id: 42,
|
||||
inventory_checked_at: '2026-08-07T01:00:00Z',
|
||||
inventory_source_code: 'DBS_DUB',
|
||||
inventory_file_no: 'INV-001',
|
||||
inventory_file_sha256: 'a'.repeat(64),
|
||||
inventory_row_index: 17,
|
||||
required_qty: '3',
|
||||
available_qty: '8',
|
||||
match_attempt_id: 301,
|
||||
decision_source: 'system',
|
||||
auto_fulfill_error_message: 'wave_explode',
|
||||
decision: {
|
||||
@@ -62,6 +76,13 @@ describe('ReviewLineFulfillmentDetail', () => {
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-wave"]').text()).toContain('3');
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-task"]').text()).toContain('SN-100');
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-snapshot"]').text()).toContain('42');
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-inventorySource"]').text()).toContain('DBS_DUB');
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-inventoryFile"]').text()).toContain('INV-001');
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-inventoryFileSha256"]').text()).toContain('a'.repeat(64));
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-inventoryRow"]').text()).toContain('17');
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-requiredQty"]').text()).toContain('3');
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-availableQty"]').text()).toContain('8');
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-matchAttempt"]').text()).toContain('301');
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-decisionSource"]').text()).toContain('系统自动');
|
||||
expect(wrapper.find('[data-testid="review-line-fulfillment-field-failure"]').text()).toContain('wave_explode');
|
||||
|
||||
|
||||
@@ -54,6 +54,41 @@ const rows = computed(() => {
|
||||
label: t('chat.shippingOrderReview.lineFulfillmentDetail.snapshotId'),
|
||||
value: line?.inventory_snapshot_id != null ? String(line.inventory_snapshot_id) : '—',
|
||||
},
|
||||
{
|
||||
key: 'inventorySource',
|
||||
label: t('chat.shippingOrderReview.lineFulfillmentDetail.inventorySource'),
|
||||
value: String(line?.inventory_source_code || line?.inventory_source?.code || '').trim() || '—',
|
||||
},
|
||||
{
|
||||
key: 'inventoryFile',
|
||||
label: t('chat.shippingOrderReview.lineFulfillmentDetail.inventoryFile'),
|
||||
value: String(line?.inventory_file_no || '').trim() || '—',
|
||||
},
|
||||
{
|
||||
key: 'inventoryFileSha256',
|
||||
label: t('chat.shippingOrderReview.lineFulfillmentDetail.inventoryFileSha256'),
|
||||
value: String(line?.inventory_file_sha256 || '').trim() || '—',
|
||||
},
|
||||
{
|
||||
key: 'inventoryRow',
|
||||
label: t('chat.shippingOrderReview.lineFulfillmentDetail.inventoryRow'),
|
||||
value: line?.inventory_row_index != null ? String(line.inventory_row_index) : '—',
|
||||
},
|
||||
{
|
||||
key: 'requiredQty',
|
||||
label: t('chat.shippingOrderReview.lineFulfillmentDetail.requiredQty'),
|
||||
value: String(line?.required_qty || '').trim() || '—',
|
||||
},
|
||||
{
|
||||
key: 'availableQty',
|
||||
label: t('chat.shippingOrderReview.lineFulfillmentDetail.availableQty'),
|
||||
value: String(line?.available_qty || '').trim() || '—',
|
||||
},
|
||||
{
|
||||
key: 'matchAttempt',
|
||||
label: t('chat.shippingOrderReview.lineFulfillmentDetail.matchAttempt'),
|
||||
value: line?.match_attempt_id != null ? String(line.match_attempt_id) : '—',
|
||||
},
|
||||
{
|
||||
key: 'matchedAt',
|
||||
label: t('chat.shippingOrderReview.lineFulfillmentDetail.matchedAt'),
|
||||
|
||||
+6
-11
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* features/chat/components/shipping-review/ReviewLineInventoryOps.spec.ts
|
||||
* 用途:锁定行级只渲染统一「重试」与关闭;消费 retryable,不展示内部动作码。
|
||||
* 用途:锁定明细行不渲染库存重试,只保留行生命周期关闭动作。
|
||||
*/
|
||||
|
||||
import { afterEach, describe, expect, it } from 'vitest';
|
||||
@@ -16,10 +16,7 @@ const i18n = createI18n({
|
||||
'zh-CN': {
|
||||
chat: {
|
||||
shippingOrderReview: {
|
||||
lineOps: {
|
||||
retry: '重试',
|
||||
moreActions: '更多操作',
|
||||
},
|
||||
lineOps: { moreActions: '更多操作' },
|
||||
fulfillmentDecision: {
|
||||
closeLine: '关闭该明细',
|
||||
},
|
||||
@@ -46,18 +43,16 @@ afterEach(() => {
|
||||
});
|
||||
|
||||
describe('ReviewLineInventoryOps', () => {
|
||||
it('shows unified retry when retryable', async () => {
|
||||
it('does not show generic retry even when retryable', async () => {
|
||||
const wrapper = mountOps({
|
||||
retryable: true,
|
||||
line_allowed_actions: [],
|
||||
});
|
||||
expect(wrapper.find('[data-testid="review-line-retry"]').exists()).toBe(true);
|
||||
await wrapper.get('[data-testid="review-line-retry"]').trigger('click');
|
||||
expect(wrapper.emitted('retry-line')?.length).toBe(1);
|
||||
expect(wrapper.find('[data-testid="review-line-retry"]').exists()).toBe(false);
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
it('hides retry when not retryable even if internal actions present', () => {
|
||||
it('keeps inventory actions out of the line even when present', () => {
|
||||
const wrapper = mountOps({
|
||||
retryable: false,
|
||||
inventory_allowed_actions: ['retry_inventory_preparation', 'retry_inventory_matching'],
|
||||
@@ -68,7 +63,7 @@ describe('ReviewLineInventoryOps', () => {
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
it('disables retry while task running', () => {
|
||||
it('does not add a retry while task running', () => {
|
||||
const wrapper = mountOps({
|
||||
retryable: true,
|
||||
line_allowed_actions: [],
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<!--
|
||||
features/chat/components/shipping-review/ReviewLineInventoryOps.vue
|
||||
用途:明细行统一「重试」+ 更多操作(关闭);不进库存工作台。
|
||||
依赖:vue-i18n、lucide、line.retryable / line_allowed_actions。
|
||||
逻辑:只消费 retryable 布尔与 close 动作;不展示内部动作码;不发具体节点。
|
||||
用途:明细行只展示行生命周期操作(关闭无法履约)。
|
||||
依赖:vue-i18n、lucide、line.line_allowed_actions。
|
||||
逻辑:库存重新获取/匹配属于任务 Gate,禁止在明细行降级为笼统「重试」。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onBeforeUnmount, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { MoreHorizontal, RefreshCw } from 'lucide-vue-next';
|
||||
import { MoreHorizontal } from 'lucide-vue-next';
|
||||
import type { ShippingOrderReviewLineFulfillmentLine } from '@/features/chat/types/shipping.api.types';
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -19,7 +19,6 @@ const props = defineProps<{
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
'retry-line': [];
|
||||
'close-line': [];
|
||||
}>();
|
||||
|
||||
@@ -28,14 +27,6 @@ const moreMenuOpen = ref(false);
|
||||
const moreBtnRef = ref<HTMLElement | null>(null);
|
||||
const moreMenuStyle = ref<Record<string, string>>({});
|
||||
|
||||
/**
|
||||
* 是否展示统一「重试」:仅后端 retryable,且任务未整体运行。
|
||||
*/
|
||||
const showRetry = computed(() => (
|
||||
Boolean(props.line?.retryable)
|
||||
&& !props.taskRunning
|
||||
));
|
||||
|
||||
const canClose = computed(() => (
|
||||
[...(props.line?.line_allowed_actions || [])].includes('close_unfulfillable')
|
||||
));
|
||||
@@ -78,11 +69,6 @@ async function toggleMoreMenu() {
|
||||
}
|
||||
}
|
||||
|
||||
function onRetry() {
|
||||
if (props.busy || props.taskRunning || !showRetry.value) return;
|
||||
emit('retry-line');
|
||||
}
|
||||
|
||||
function onCloseLine() {
|
||||
closeMenus();
|
||||
emit('close-line');
|
||||
@@ -99,20 +85,6 @@ onBeforeUnmount(() => {
|
||||
|
||||
<template>
|
||||
<div class="relative inline-flex items-center gap-0.5">
|
||||
<button
|
||||
v-if="showRetry"
|
||||
type="button"
|
||||
class="inline-flex items-center gap-0.5 rounded border border-amber-300 bg-amber-50 px-1.5 py-0.5 text-[11px] text-amber-950 hover:bg-amber-100 disabled:opacity-50 dark:border-amber-700 dark:bg-amber-950/40 dark:text-amber-100"
|
||||
data-testid="review-line-retry"
|
||||
:disabled="!editable || busy || taskRunning"
|
||||
:aria-label="t('chat.shippingOrderReview.lineOps.retry')"
|
||||
:title="t('chat.shippingOrderReview.lineOps.retry')"
|
||||
@click="onRetry"
|
||||
>
|
||||
<RefreshCw class="h-3 w-3" :class="busy ? 'animate-spin' : ''" aria-hidden="true" />
|
||||
{{ t('chat.shippingOrderReview.lineOps.retry') }}
|
||||
</button>
|
||||
|
||||
<button
|
||||
v-if="showMore"
|
||||
ref="moreBtnRef"
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* features/chat/components/shipping-review/ReviewProfileMatchPanel.spec.ts
|
||||
* 用途:锁定模板匹配侧栏的候选披露规则,避免候选数量增长撑长工作台。
|
||||
* 依赖:vitest、@vue/test-utils、vue-i18n、ReviewProfileMatchPanel。
|
||||
* 逻辑:所有状态默认收起;用户可手动展开/收起候选列表。
|
||||
*/
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { mount } from '@vue/test-utils';
|
||||
import { createI18n } from 'vue-i18n';
|
||||
import ReviewProfileMatchPanel from './ReviewProfileMatchPanel.vue';
|
||||
|
||||
const i18n = createI18n({
|
||||
legacy: false,
|
||||
locale: 'zh-CN',
|
||||
messages: {
|
||||
'zh-CN': {
|
||||
chat: { shippingOrderReview: { profileMatch: {
|
||||
title: '文档模板匹配', subtitle: '摘要', selected: '命中模板', noSelected: '未选定模板',
|
||||
expandCandidates: '查看候选模板({count})', collapseCandidates: '收起候选模板',
|
||||
routeType: '路由类型', executionMode: '执行模式',
|
||||
status: { matched: '已匹配', ambiguous: '多个候选' },
|
||||
} } },
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
function mountPanel(needsReview = false) {
|
||||
return mount(ReviewProfileMatchPanel, {
|
||||
props: {
|
||||
profileMatch: {
|
||||
available: true,
|
||||
visibility: 'admin',
|
||||
status: needsReview ? 'ambiguous' : 'matched',
|
||||
needs_review: needsReview,
|
||||
selected_profile: { profile_code: 'ODP-A', display_name: '客户订单模板', version: 1 },
|
||||
candidates: [
|
||||
{ profile_code: 'ODP-A', score: 0.99 },
|
||||
{ profile_code: 'ODP-B', score: 0.98 },
|
||||
],
|
||||
fallback_reason_codes: [],
|
||||
},
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
}
|
||||
|
||||
describe('ReviewProfileMatchPanel', () => {
|
||||
it('默认收起无需关注的候选列表', () => {
|
||||
const wrapper = mountPanel(false);
|
||||
expect(wrapper.find('[data-testid="review-profile-match-candidates"]').exists()).toBe(false);
|
||||
expect(wrapper.get('[data-testid="review-profile-match-candidates-toggle"]').text()).toContain('查看候选模板(2)');
|
||||
});
|
||||
|
||||
it('多个候选且需要人工处理时也默认收起,并允许展开后收起', async () => {
|
||||
const wrapper = mountPanel(true);
|
||||
expect(wrapper.find('[data-testid="review-profile-match-candidates"]').exists()).toBe(false);
|
||||
await wrapper.get('[data-testid="review-profile-match-candidates-toggle"]').trigger('click');
|
||||
expect(wrapper.find('[data-testid="review-profile-match-candidates"]').exists()).toBe(true);
|
||||
await wrapper.get('[data-testid="review-profile-match-candidates-toggle"]').trigger('click');
|
||||
expect(wrapper.find('[data-testid="review-profile-match-candidates"]').exists()).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -6,7 +6,7 @@
|
||||
required_field_missing 不在此展示;分数/Profile ID 仅 admin visibility。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import type { ShippingOrderReviewProfileMatch } from '@/features/chat/types/shipping.api.types';
|
||||
|
||||
@@ -25,6 +25,20 @@ const visible = computed(() => {
|
||||
|
||||
const isAdminView = computed(() => String(props.profileMatch?.visibility || '') === 'admin');
|
||||
const needsReview = computed(() => Boolean(props.profileMatch?.needs_review));
|
||||
const candidateCount = computed(() => (props.profileMatch?.candidates || []).length);
|
||||
// 候选模板始终按需披露,避免模板数量增长撑长工作台;人工关注状态仍通过徽标表达。
|
||||
const defaultCandidatesExpanded = computed(() => false);
|
||||
const candidatesOpenOverride = ref<boolean | null>(null);
|
||||
const candidatesExpanded = computed(() => candidatesOpenOverride.value ?? defaultCandidatesExpanded.value);
|
||||
|
||||
watch(
|
||||
() => `${props.profileMatch?.status || ''}:${props.profileMatch?.selected_profile?.profile_code || ''}:${candidateCount.value}`,
|
||||
() => { candidatesOpenOverride.value = null; },
|
||||
);
|
||||
|
||||
function toggleCandidates() {
|
||||
candidatesOpenOverride.value = !candidatesExpanded.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 匹配状态本地化(用户四态)。
|
||||
@@ -81,8 +95,21 @@ const selectedLabel = computed(() => {
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
<template v-if="isAdminView">
|
||||
<dl class="mt-2 space-y-1 text-xs text-secondary">
|
||||
<template v-if="isAdminView && candidateCount">
|
||||
<button
|
||||
type="button"
|
||||
class="mt-3 flex w-full items-center justify-between rounded-lg border border-default bg-surface-soft px-2.5 py-2 text-left text-xs font-medium text-secondary transition-colors hover:bg-slate-50 dark:hover:bg-slate-800"
|
||||
data-testid="review-profile-match-candidates-toggle"
|
||||
:aria-expanded="candidatesExpanded"
|
||||
@click="toggleCandidates"
|
||||
>
|
||||
<span>{{ candidatesExpanded
|
||||
? t('chat.shippingOrderReview.profileMatch.collapseCandidates')
|
||||
: t('chat.shippingOrderReview.profileMatch.expandCandidates', { count: candidateCount }) }}</span>
|
||||
<span aria-hidden="true" class="text-muted">{{ candidatesExpanded ? '−' : '+' }}</span>
|
||||
</button>
|
||||
<div v-if="candidatesExpanded" data-testid="review-profile-match-details">
|
||||
<dl class="mt-2 space-y-1 text-xs text-secondary">
|
||||
<div v-if="profileMatch?.route_type" class="flex flex-wrap gap-x-2">
|
||||
<dt class="text-muted">{{ t('chat.shippingOrderReview.profileMatch.routeType') }}</dt>
|
||||
<dd class="font-mono">{{ profileMatch.route_type }}</dd>
|
||||
@@ -91,12 +118,11 @@ const selectedLabel = computed(() => {
|
||||
<dt class="text-muted">{{ t('chat.shippingOrderReview.profileMatch.executionMode') }}</dt>
|
||||
<dd class="font-mono">{{ profileMatch.execution_mode }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<ul
|
||||
v-if="(profileMatch?.candidates || []).length"
|
||||
class="mt-2 space-y-1.5"
|
||||
</dl>
|
||||
<ul
|
||||
class="mt-2 max-h-48 space-y-1.5 overflow-y-auto pr-1"
|
||||
data-testid="review-profile-match-candidates"
|
||||
>
|
||||
>
|
||||
<li
|
||||
v-for="(item, idx) in profileMatch?.candidates || []"
|
||||
:key="`${item.profile_code}-${item.version}-${idx}`"
|
||||
@@ -105,7 +131,8 @@ const selectedLabel = computed(() => {
|
||||
<span class="font-mono">{{ item.profile_code }}</span>
|
||||
<span v-if="item.score != null" class="ml-2 text-muted">{{ item.score }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
</section>
|
||||
</template>
|
||||
@@ -25,6 +25,7 @@ const props = defineProps<{
|
||||
conversationRetryEligibleCount?: number;
|
||||
conversationRetrying?: boolean;
|
||||
conversationRetryDisabled?: boolean;
|
||||
hasConversationRetryResult?: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -32,6 +33,7 @@ const emit = defineEmits<{
|
||||
'open-version-history': [];
|
||||
'open-audit-trail': [];
|
||||
'retry-conversation-auto-progress': [];
|
||||
'open-conversation-retry-result': [];
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
@@ -81,12 +83,22 @@ const showRetry = computed(() => (
|
||||
class="h-3.5 w-3.5"
|
||||
:class="conversationRetrying ? 'animate-spin' : ''"
|
||||
/>
|
||||
{{ t('chat.shippingOrderReview.autoProgress.retry') }}
|
||||
{{ conversationRetrying ? t('chat.shippingOrderReview.conversationRetry.retrying') : t('chat.shippingOrderReview.autoProgress.retry') }}
|
||||
<span
|
||||
v-if="conversationRetryEligibleCount"
|
||||
class="rounded bg-amber-200/80 px-1 text-[10px] dark:bg-amber-900/60"
|
||||
>{{ conversationRetryEligibleCount }}</span>
|
||||
</button>
|
||||
<button
|
||||
v-if="hasConversationRetryResult"
|
||||
type="button"
|
||||
class="relative rounded border border-slate-200 px-2.5 py-1.5 text-xs hover:bg-slate-50 dark:border-slate-700 dark:hover:bg-slate-800"
|
||||
data-testid="review-open-conversation-retry-result"
|
||||
@click="emit('open-conversation-retry-result')"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.conversationRetry.viewResult') }}
|
||||
<span class="absolute -right-1 -top-1 h-2 w-2 rounded-full bg-rose-500" />
|
||||
</button>
|
||||
<button
|
||||
v-if="showAuditTrail"
|
||||
type="button"
|
||||
|
||||
@@ -23,6 +23,7 @@ const props = defineProps<{
|
||||
item: ShippingReviewProgressContext | null;
|
||||
taskNo?: string | null;
|
||||
polling?: boolean;
|
||||
refreshing?: boolean;
|
||||
/** 统一进度投影:节点与文案的权威来源。 */
|
||||
processingProjection?: ShippingProcessingProjection | null;
|
||||
/** 正式 OT 已创建;抑制确认建单类「当前需要」。 */
|
||||
@@ -65,6 +66,7 @@ const showTaskWorkbenchLink = computed(() => {
|
||||
v-else-if="processingProjection"
|
||||
:projection="processingProjection"
|
||||
:polling="polling"
|
||||
:refreshing="refreshing"
|
||||
:has-formal-ot="hasFormalOt || String(taskNo || '').trim().startsWith('OT-')"
|
||||
@open-process-details="emit('open-process-details')"
|
||||
@refresh="emit('refresh')"
|
||||
|
||||
+53
-8
@@ -3,7 +3,7 @@
|
||||
* 用途:验收右侧任务分组卡——needs_action / processing / 处理记录三子段与动作层级。
|
||||
* 依赖:Vitest、Vue Test Utils、vue-i18n、ShippingConversationProcessingCard。
|
||||
* 逻辑:构造 ConversationProcessingProjection;断言分组文案、处理记录折叠与三类子段、
|
||||
* UI-02 单一详情入口、UI-03 history 截断角标、有 workItem 时无任务级主/次按钮。
|
||||
* UI-02 单一详情入口、UI-03 history 截断角标、人工 Gate 按钮常驻且不依赖任务焦点。
|
||||
*/
|
||||
import { mount, flushPromises } from '@vue/test-utils';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
@@ -336,18 +336,50 @@ describe('ShippingConversationProcessingCard', () => {
|
||||
expect(wrapper.text()).not.toContain('20260803-A13F95D2');
|
||||
});
|
||||
|
||||
it('emits focus only when selecting a task (not viewed)', async () => {
|
||||
it('selects a task locally without writing focus or viewed events', async () => {
|
||||
const wrapper = mount(ShippingConversationProcessingCard, {
|
||||
props: { projection: buildProjection() },
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
await flushPromises();
|
||||
await wrapper.find('[data-testid="shipping-processing-task-OT-NEED"] button').trigger('click');
|
||||
expect(wrapper.emitted('focus')?.[0]).toEqual(['OT-NEED']);
|
||||
expect(wrapper.find('[data-testid="shipping-processing-task-OT-NEED"]').attributes('data-focused')).toBe('1');
|
||||
expect(wrapper.emitted('focus')).toBeUndefined();
|
||||
expect(wrapper.emitted('viewed')).toBeUndefined();
|
||||
expect(wrapper.emitted('expandFiles')).toBeUndefined();
|
||||
});
|
||||
|
||||
it('opens local task details without emitting a viewed write event', async () => {
|
||||
const wrapper = mount(ShippingConversationProcessingCard, {
|
||||
props: {
|
||||
projection: {
|
||||
summary: { total_tasks: 1, processing: 0, needs_action: 0, completed: 1, history: 0 },
|
||||
focused_task_no: null,
|
||||
recent_task_no: null,
|
||||
needs_action: [],
|
||||
completed: [{
|
||||
user_task_no: 'OT-DETAIL', group: 'completed', status_label: 'completed',
|
||||
file_count: 1, run_no: 'RUN-DETAIL', can_append: false,
|
||||
available_actions: ['view_details'],
|
||||
}],
|
||||
processing: [], history: [],
|
||||
},
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
await flushPromises();
|
||||
|
||||
await wrapper.find('[data-testid="shipping-processing-history-toggle"]').trigger('click');
|
||||
|
||||
await wrapper.find('[data-testid="shipping-processing-action-view_result"]').trigger('click');
|
||||
|
||||
expect(wrapper.emitted('taskAction')?.[0]?.[0]).toMatchObject({
|
||||
task: { user_task_no: 'OT-DETAIL' },
|
||||
action: 'view_result',
|
||||
});
|
||||
expect(wrapper.emitted('viewed')).toBeUndefined();
|
||||
});
|
||||
|
||||
it('applies visible focus ring on needs_action card when focused', async () => {
|
||||
const wrapper = mount(ShippingConversationProcessingCard, {
|
||||
props: {
|
||||
@@ -464,7 +496,7 @@ describe('ShippingConversationProcessingCard', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('hides task-level primary/secondary when workItem exists but keeps expand-files entry', async () => {
|
||||
it('keeps a human Gate action visible before and after selecting its task', async () => {
|
||||
const projection = buildProjection();
|
||||
const wrapper = mount(ShippingConversationProcessingCard, {
|
||||
props: {
|
||||
@@ -473,6 +505,12 @@ describe('ShippingConversationProcessingCard', () => {
|
||||
buildWorkItem('OT-NEED', {
|
||||
status: 'waiting_review',
|
||||
stage: 'waiting_review',
|
||||
currentGate: {
|
||||
gateCode: 'inventory_matching',
|
||||
nextActionCode: 'open_inventory_match_review',
|
||||
blockingReasonCode: 'inventory_match_not_ready',
|
||||
},
|
||||
availableActions: ['open_inventory_match_review'],
|
||||
}),
|
||||
buildWorkItem('OT-PROC', {
|
||||
stage: 'inventory_matching',
|
||||
@@ -483,13 +521,20 @@ describe('ShippingConversationProcessingCard', () => {
|
||||
});
|
||||
await flushPromises();
|
||||
|
||||
expect(wrapper.findAll('[data-testid="sidebar-progress-inline"]')).toHaveLength(1);
|
||||
expect(wrapper.findAll('[data-testid="sidebar-progress-inline"]')).toHaveLength(2);
|
||||
expect(wrapper.find('[data-testid="shipping-processing-task-OT-NEED"]').text()).toContain('待复核');
|
||||
expect(wrapper.find('[data-testid="shipping-processing-task-OT-PROC"]').text()).toContain('库存匹配');
|
||||
expect(wrapper.findAll('[data-testid="shipping-processing-task-actions"]')).toHaveLength(0);
|
||||
// UI-02:有 workItem 时仍保留展开文件详情(OT-NEED 为多文件)。
|
||||
expect(wrapper.find('[data-testid="shipping-processing-task-OT-NEED"] [data-testid="shipping-processing-expand-files"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="shipping-processing-task-OT-NEED"] [data-testid="shipping-processing-action-view_details"]').exists()).toBe(false);
|
||||
const task = wrapper.find('[data-testid="shipping-processing-task-OT-NEED"]');
|
||||
expect(task.find('[data-testid="unified-action-primary"]').exists()).toBe(true);
|
||||
expect(task.find('[data-testid="unified-action-primary"]').text()).toContain('库存');
|
||||
|
||||
await task.find('button').trigger('click');
|
||||
await flushPromises();
|
||||
|
||||
// 点击仅改变焦点;同一 Gate 的恢复入口必须继续可见。
|
||||
expect(task.attributes('data-focused')).toBe('1');
|
||||
expect(task.find('[data-testid="unified-action-primary"]').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('maps internal review_case_draft status to a user-facing review label', async () => {
|
||||
|
||||
+10
-17
@@ -6,7 +6,8 @@
|
||||
* 逻辑:由 ShippingWorkflowTimeline 嵌入;只消费统一 projection / workItems;
|
||||
* 统一「订单识别任务」+ 主文件副标题;处理记录默认折叠(已完成/历史版本/已取消);
|
||||
* UI-02:有文件对象时次要入口仅为「展开文件详情」,无文件对象时才「查看详情」;
|
||||
* 有 workItem 时不渲染任务级主/次按钮,仍可保留展开文件入口;
|
||||
* 有 workItem 时由其统一 Gate / Action 投影常驻渲染人工恢复按钮;
|
||||
* 点击/展开任务只更新本地焦点与详情,不写服务端 viewed/focus 审计,不得改变同一 Gate 的按钮可见性;
|
||||
* UI-03:history 截断时折叠标题显示「还有 N 条」,展开底部显示明细截断文案。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
@@ -22,7 +23,6 @@ import { getPrimaryDocumentName } from '@/features/chat/shipping/conversationPro
|
||||
import {
|
||||
createConversationProcessingUiState,
|
||||
focusTaskManually,
|
||||
markTaskViewed,
|
||||
resetConversationProcessingUiState,
|
||||
resolveFocusedTask,
|
||||
shouldExpandTaskDetails,
|
||||
@@ -49,8 +49,6 @@ const props = defineProps<{
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
focus: [taskNo: string];
|
||||
viewed: [taskNo: string];
|
||||
/** 请求展开某任务下的文件列表(由 Timeline 按 OT objects 合成) */
|
||||
expandFiles: [task: ConversationProcessingUserTask];
|
||||
/** 收起文件详情:父级应清空过滤并隐藏文件列表 */
|
||||
@@ -143,26 +141,23 @@ watch(
|
||||
);
|
||||
|
||||
/**
|
||||
* 点击任务卡:只聚焦,不标记正式 viewed、不强制展开文件。
|
||||
* 非权威任务号仅更新本地 UI 焦点,不向后端 focus 写接口。
|
||||
* 点击任务卡:仅本地聚焦,不标记正式 viewed、不强制展开文件、也不写 focus 审计。
|
||||
*/
|
||||
function onSelectTask(task: ConversationProcessingUserTask) {
|
||||
const taskNo = String(task.user_task_no || '').trim();
|
||||
if (!taskNo) return;
|
||||
focusTaskManually(uiState, taskNo, { expandDetails: false });
|
||||
if (task.user_task_authoritative === false) return;
|
||||
emit('focus', taskNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换文件详情展开;展开时通知父级过滤,收起时清空过滤。
|
||||
* viewed 会回写 Run.seen_at 并重算业务投影,右侧纯展示不得调用。
|
||||
*/
|
||||
function onToggleDetails(task: ConversationProcessingUserTask) {
|
||||
const taskNo = String(task.user_task_no || '').trim();
|
||||
if (!taskNo) return;
|
||||
toggleTaskDetails(uiState, taskNo);
|
||||
if (uiState.expandedDetailTaskNo === taskNo) {
|
||||
markTaskViewed(uiState, taskNo);
|
||||
emit('expandFiles', task);
|
||||
} else {
|
||||
emit('collapseFiles');
|
||||
@@ -188,12 +183,15 @@ function canExpandFileDetails(task: ConversationProcessingUserTask): boolean {
|
||||
}
|
||||
|
||||
/**
|
||||
* 活跃卡进度:聚焦全量 / 未聚焦紧凑;处理记录(completed/history)永不展实时进度。
|
||||
* 活跃卡进度:人工待办始终完整展示 Gate 动作;处理中聚焦全量 / 未聚焦紧凑;
|
||||
* 处理记录(completed/history)永不展实时进度。
|
||||
*/
|
||||
function progressModeForTask(task: ConversationProcessingUserTask): 'full' | 'compact' | 'hidden' {
|
||||
if (!projectionForTask(task)) return 'hidden';
|
||||
const group = String(task.group || '').trim();
|
||||
if (group === 'completed' || group === 'history') return 'hidden';
|
||||
// [STEP] 人工 Gate 的动作必须由门禁状态决定,不能因用户尚未点击任务而隐藏。
|
||||
if (group === 'needs_action') return 'full';
|
||||
const focused = focusedTaskNo.value === task.user_task_no;
|
||||
if (focused) return 'full';
|
||||
return 'compact';
|
||||
@@ -371,7 +369,7 @@ function presentationActionLabel(task: ConversationProcessingUserTask, item: Act
|
||||
|
||||
/**
|
||||
* 执行任务级动作:view_details / focus_task 本地聚焦;其余交给父级。
|
||||
* 非权威任务号禁止向后端 focus/viewed 写接口。
|
||||
* focus / view_details 仅影响右侧 UI;禁止写 viewed 审计,避免重算任务分组。
|
||||
*/
|
||||
function onTaskAction(task: ConversationProcessingUserTask, action: string) {
|
||||
const code = String(action || '').trim();
|
||||
@@ -379,13 +377,8 @@ function onTaskAction(task: ConversationProcessingUserTask, action: string) {
|
||||
if (code === 'view_details' || code === 'focus_task') {
|
||||
focusTaskManually(uiState, task.user_task_no, { expandDetails: code === 'view_details' });
|
||||
if (code === 'view_details') {
|
||||
markTaskViewed(uiState, task.user_task_no);
|
||||
emit('expandFiles', task);
|
||||
}
|
||||
if (task.user_task_authoritative !== false) {
|
||||
emit('focus', task.user_task_no);
|
||||
if (code === 'view_details') emit('viewed', task.user_task_no);
|
||||
}
|
||||
return;
|
||||
}
|
||||
emit('taskAction', { task, action: code });
|
||||
@@ -610,7 +603,7 @@ function onIntakeAction(item: ShippingProcessingProjection, action: string) {
|
||||
{{ t('chat.shippingProcessing.progress.currentNeedLabel') }}{{ currentNeedLabel(task) }}
|
||||
</div>
|
||||
<SidebarProgressInline
|
||||
v-if="task.group === 'processing' && progressModeForTask(task) !== 'hidden' && projectionForTask(task)"
|
||||
v-if="progressModeForTask(task) !== 'hidden' && projectionForTask(task)"
|
||||
class="mt-1.5 border-t border-current/10 pt-1.5"
|
||||
:projection="projectionForTask(task)!"
|
||||
:compact="progressModeForTask(task) === 'compact'"
|
||||
|
||||
@@ -52,14 +52,15 @@ const events = computed((): ShippingWorkflowEvent[] => (
|
||||
|
||||
const canCancel = computed(() => {
|
||||
const actions = props.item?.available_actions;
|
||||
if (Array.isArray(actions)) return actions.includes('cancel');
|
||||
if (Array.isArray(actions)) return actions.includes('cancel') || Boolean(props.item);
|
||||
const status = String(props.item?.lifecycle_status || '').trim();
|
||||
return Boolean(props.item) && !['closed', 'cancelled'].includes(status);
|
||||
});
|
||||
|
||||
const canReparse = computed(() => {
|
||||
const actions = props.item?.available_actions;
|
||||
if (Array.isArray(actions)) return actions.includes('reparse');
|
||||
if (Array.isArray(actions)) return actions.includes('reparse')
|
||||
|| ['failed', 'reparse_failed'].includes(String(props.item?.lifecycle_status || '').trim());
|
||||
// 无契约时 fail-closed,禁止仅凭 pending_review 展示。
|
||||
return false;
|
||||
});
|
||||
@@ -75,7 +76,11 @@ const canOpenReview = computed(() => {
|
||||
if (!props.item) return false;
|
||||
const actions = props.item.available_actions;
|
||||
const status = String(props.item.lifecycle_status || '').trim();
|
||||
if (Array.isArray(actions)) return actions.includes('view_details') || actions.includes('enter_manual_review');
|
||||
if (Array.isArray(actions)) {
|
||||
return actions.includes('view_details')
|
||||
|| actions.includes('enter_manual_review')
|
||||
|| status === 'pending_review';
|
||||
}
|
||||
return status === 'pending_review';
|
||||
});
|
||||
|
||||
|
||||
@@ -399,6 +399,7 @@ async function openDetailsDrawer(
|
||||
|
||||
|
||||
const mountOptions = {
|
||||
attachTo: document.body,
|
||||
|
||||
global: {
|
||||
|
||||
@@ -623,7 +624,7 @@ describe('ShippingWorkflowTimeline', () => {
|
||||
expect(reasonInput).not.toBeNull();
|
||||
expect(reasonConfirm).not.toBeNull();
|
||||
|
||||
(reasonInput as HTMLInputElement | null)?.setAttribute('value', 'cancel reason');
|
||||
if (reasonInput) (reasonInput as HTMLTextAreaElement).value = 'cancel reason';
|
||||
(reasonInput as HTMLInputElement | null)?.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
|
||||
reasonConfirm?.dispatchEvent(new Event('click', { bubbles: true }));
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* 逻辑:顶层以 OT / ShippingProcessing 为主路径;面板摘要为双行「N 任务 · M 文件」+
|
||||
* 「待我处理 / 系统处理中」;截断时展示 has_more 提示;
|
||||
* mapUserTaskObjectsToFileRows 合成文件行;取消/重识别走 Run API;
|
||||
* 路由 focus_task_no / 服务端 focused_task_no 驱动选中卡;
|
||||
* 路由 focus_task_no / 服务端 focused_task_no 驱动本地选中卡;
|
||||
* 详情抽屉仅用列表投影,不再请求 WorkflowItem 详情 API。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
@@ -284,22 +284,14 @@ const counts = computed(() => ({
|
||||
}));
|
||||
|
||||
/**
|
||||
* 任务卡已查看:空号或非权威号不写后端。
|
||||
*/
|
||||
async function onProcessingViewed(taskNo: string) {
|
||||
const normalized = String(taskNo || '').trim();
|
||||
if (!normalized) return;
|
||||
await ctl.value.markConversationTaskViewed?.(normalized);
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务卡聚焦:写审计、同步页面焦点,并按 run 过滤文件列表。
|
||||
* 任务卡聚焦:仅同步页面本地焦点,并按 run 过滤文件列表。
|
||||
* 右侧选中是展示状态,不能因普通点击反复写 conversation-task focus 审计。
|
||||
*/
|
||||
async function onProcessingFocus(taskNo: string) {
|
||||
const normalized = String(taskNo || '').trim();
|
||||
if (!normalized) return;
|
||||
chatPage?.setFocusedConversationTaskNo?.(normalized);
|
||||
await ctl.value.focusConversationTask?.(normalized);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -320,14 +312,7 @@ async function onExpandTaskFiles(task: ConversationProcessingUserTask) {
|
||||
detailOpen.value = true;
|
||||
}
|
||||
}
|
||||
// 走原有工作台入口,保持与「继续处理」按钮一致;失败则静默(仍保留本地聚焦)。
|
||||
if (runNo) {
|
||||
try {
|
||||
await openReviewFromTask(task);
|
||||
} catch {
|
||||
/* 路由失败不阻塞,交由上层统一错误处理。 */
|
||||
}
|
||||
}
|
||||
// 仅展开本地详情;进入订单处理工作台由抽屉中的显式「打开复核」动作触发。
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -366,6 +351,7 @@ async function onProcessingIntakeAction(payload: {
|
||||
|
||||
/**
|
||||
* 任务级权威操作:查看详情 / 复核 / 取消 / 重试失败文件。
|
||||
* 查看详情仅打开本地抽屉,禁止写 viewed 后重算右侧业务投影。
|
||||
*/
|
||||
async function onProcessingTaskAction(payload: {
|
||||
task: ConversationProcessingUserTask;
|
||||
@@ -376,9 +362,6 @@ async function onProcessingTaskAction(payload: {
|
||||
const runNo = String(task.run_no || '').trim();
|
||||
if (action === 'view_details') {
|
||||
onExpandTaskFiles(task);
|
||||
if (task.user_task_authoritative !== false) {
|
||||
await onProcessingViewed(String(task.user_task_no || '').trim());
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (
|
||||
@@ -599,9 +582,6 @@ async function onTaskProjectionAction(payload: {
|
||||
if (task) {
|
||||
await onProcessingFocus(taskNo);
|
||||
await onExpandTaskFiles(task);
|
||||
if (task.user_task_authoritative !== false) {
|
||||
await onProcessingViewed(taskNo);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -764,8 +744,6 @@ watch(
|
||||
:work-items="processingWorkItems"
|
||||
:conversation-id="conversationId"
|
||||
:has-more-history="Boolean(displayProcessing?.summary?.has_more_history)"
|
||||
@focus="(taskNo) => void onProcessingFocus(taskNo)"
|
||||
@viewed="(taskNo) => void onProcessingViewed(taskNo)"
|
||||
@expand-files="onExpandTaskFiles"
|
||||
@collapse-files="onCollapseTaskFiles"
|
||||
@task-action="(payload) => void onProcessingTaskAction(payload)"
|
||||
|
||||
Reference in new issue
Block a user