feat(shipping-notice): 新增发货通知自动上传功能与候选资格评估
- 在环境配置中新增 SHIPPING_NOTICE_AUTO_UPLOAD_ENABLED 选项,默认关闭,需显式开启以支持自动上传。 - 引入新的 pytest.ini 文件,增加测试标记以支持自动化测试。 - 删除不再使用的 seed_shipping_notice_agents.py 文件,简化代码库。 - 更新相关 API,增强发货通知与候选资格评估功能,支持多种筛选条件。 - 增强文档与代码注释,反映新的业务逻辑与功能要求。
This commit is contained in:
1 parent
cef3d5b26a
commit
3a9fbac2fc
226 files changed
+25010
-2098
No files matched your search
+124
@@ -0,0 +1,124 @@
|
||||
<!--
|
||||
features/chat/components/shipping-review/ReviewBuildEligibilityDetailsDrawer.vue
|
||||
用途:完整建单检查项抽屉(逐行投影、阻断原因)。
|
||||
依赖:vue-i18n、ShippingOrderReviewBuildEligibility。
|
||||
逻辑:仅在用户主动展开时挂载;关闭不写服务端审计(敏感访问审计由阶段 5 统一补齐)。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import type { ShippingOrderReviewBuildEligibility } from '@/features/chat/types/shipping.api.types';
|
||||
|
||||
const props = defineProps<{
|
||||
open: boolean;
|
||||
eligibility: ShippingOrderReviewBuildEligibility | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
close: [];
|
||||
'focus-line': [lineIndex: number];
|
||||
}>();
|
||||
|
||||
const { t, te } = useI18n();
|
||||
|
||||
/**
|
||||
* 解析行级阻断原因文案。
|
||||
*/
|
||||
function blockReasonLabel(reason?: string | null): string {
|
||||
const normalized = String(reason || '').trim();
|
||||
if (!normalized) return '—';
|
||||
const key = `chat.shippingOrderReview.buildEligibility.blockReasons.${normalized}`;
|
||||
return te(key) ? t(key) : t('chat.shippingOrderReview.buildEligibility.blockReasons.unknown');
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析路由状态文案。
|
||||
*/
|
||||
function routingStatusLabel(status?: string | null): string {
|
||||
const normalized = String(status || '').trim();
|
||||
if (!normalized) return '—';
|
||||
const key = `chat.shippingOrderReview.buildEligibility.routingStatus.${normalized}`;
|
||||
return te(key) ? t(key) : t('chat.shippingOrderReview.buildEligibility.routingStatus.unknown');
|
||||
}
|
||||
|
||||
/** 异常行置顶,已通过行排后。 */
|
||||
const orderedLines = computed(() => {
|
||||
const lines = [...(props.eligibility?.line_projections || [])];
|
||||
return lines.sort((a, b) => {
|
||||
const aBlocked = a.can_build === false ? 0 : 1;
|
||||
const bBlocked = b.can_build === false ? 0 : 1;
|
||||
if (aBlocked !== bBlocked) return aBlocked - bBlocked;
|
||||
return (a.line_index ?? 0) - (b.line_index ?? 0);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-if="open && eligibility"
|
||||
class="fixed inset-0 z-40 flex justify-end bg-slate-900/30"
|
||||
data-testid="review-eligibility-details-drawer"
|
||||
@click.self="emit('close')"
|
||||
>
|
||||
<aside class="flex h-full w-full max-w-md flex-col bg-white shadow-xl dark:bg-slate-900">
|
||||
<header class="flex items-center justify-between gap-2 border-b border-slate-200 px-4 py-3 dark:border-slate-800">
|
||||
<h2 class="text-sm font-semibold">{{ t('chat.shippingOrderReview.workbench.fullChecksTitle') }}</h2>
|
||||
<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-eligibility-details-close"
|
||||
@click="emit('close')"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.workbench.closePdf') }}
|
||||
</button>
|
||||
</header>
|
||||
<div class="min-h-0 flex-1 space-y-2 overflow-y-auto p-4">
|
||||
<article
|
||||
v-for="line in orderedLines"
|
||||
:key="String(line.line_key || line.line_index)"
|
||||
class="rounded-lg border border-slate-200 p-3 text-xs dark:border-slate-700"
|
||||
:data-testid="`review-eligibility-detail-line-${line.line_key || line.line_index}`"
|
||||
>
|
||||
<div class="flex flex-wrap items-center justify-between gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="font-medium text-sky-700 hover:underline dark:text-sky-300"
|
||||
@click="emit('focus-line', Number(line.line_index ?? 0))"
|
||||
>
|
||||
{{ t('chat.shippingOrderReview.line', { index: (line.line_index ?? 0) + 1 }) }}
|
||||
</button>
|
||||
<span
|
||||
class="rounded-full px-2 py-0.5 text-[11px]"
|
||||
:class="line.can_build
|
||||
? 'bg-emerald-100 text-emerald-800 dark:bg-emerald-950 dark:text-emerald-100'
|
||||
: 'bg-rose-100 text-rose-800 dark:bg-rose-950 dark:text-rose-100'"
|
||||
>
|
||||
{{
|
||||
line.can_build
|
||||
? t('chat.shippingOrderReview.buildEligibility.lineCanBuild')
|
||||
: t('chat.shippingOrderReview.buildEligibility.lineBlocked')
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
<dl class="mt-2 grid gap-1">
|
||||
<div>
|
||||
<dt class="inline text-slate-500">{{ t('chat.shippingOrderReview.buildEligibility.routingStatusLabel') }}:</dt>
|
||||
<dd class="inline">{{ routingStatusLabel(line.routing_status) }}</dd>
|
||||
</div>
|
||||
<div v-if="line.block_reason">
|
||||
<dt class="inline text-slate-500">{{ t('chat.shippingOrderReview.buildEligibility.blockReason') }}:</dt>
|
||||
<dd class="inline">{{ blockReasonLabel(line.block_reason) }}</dd>
|
||||
</div>
|
||||
<div v-if="line.candidate_inventory_source_codes?.length">
|
||||
<dt class="inline text-slate-500">{{ t('chat.shippingOrderReview.buildEligibility.candidates') }}:</dt>
|
||||
<dd class="inline font-mono">{{ line.candidate_inventory_source_codes.join(', ') }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</article>
|
||||
<p v-if="!orderedLines.length" class="text-xs text-slate-500">
|
||||
{{ t('chat.shippingOrderReview.workbench.noLineChecks') }}
|
||||
</p>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
</template>
|
||||
Reference in new issue
Block a user