feat(shipping-notice): 增强发货通知与审计功能,支持敏感数据控制与哈希链校验

- 更新发货通知工具 API,剥离不可信的操作人身份字段,确保审计安全
- 引入审计事件的哈希链校验机制,支持数据完整性验证
- 增强订单抽取与审计功能,支持敏感快照的访问控制
- 更新相关模型与服务,确保新功能的完整性与可追溯性
- 完善文档与代码注释,反映新的业务逻辑与审计要求
This commit is contained in:
hugo committed 2026-07-31 08:59:44 +08:00
1 parent 95cdfe66b0
commit d0fe084999
225 files changed
+25923 -6653

No files matched your search

@@ -0,0 +1,126 @@
/**
* features/workspace/shipping-task-center/StpProgressFactsPanel.vue
* 用途:展示后端 ui_state.summary.stp_facts,含逐行 Reservation/料号/实际库存源/文件证据。
* 依赖:ShippingTaskUiState.summary.stp_facts、vue-i18n。
* 逻辑:由 ShippingTaskWorkbench 在待办栏下方挂载;无 stp_facts 时不渲染;不发明进度。
*/
<script setup lang="ts">
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import type { ShippingStpFacts } from '@/features/chat/types/shipping.api.types';
const props = defineProps<{
facts: ShippingStpFacts | null | undefined;
}>();
const { t, te } = useI18n();
const visible = computed(() => Boolean(props.facts));
const resolutionEntries = computed(() => {
const counts = props.facts?.resolution_counts || {};
return Object.entries(counts).map(([disposition, count]) => ({ disposition, count }));
});
const lineRows = computed(() => props.facts?.line_resolutions || []);
/**
* 行级 disposition 文案;未知码回退原文。
*/
function dispositionLabel(disposition: string): string {
const key = `workspace.shippingNotice.stpFacts.disposition.${disposition}`;
return te(key) ? t(key) : disposition;
}
/**
* 行证据摘要:文件号 + 行引用键。
*/
function evidenceText(row: NonNullable<ShippingStpFacts['line_resolutions']>[number]): string {
const fileNo = String(row?.inventory_file_no || '').trim();
const ref = row?.inventory_row_ref;
const refParts = [
ref?.reservation_id,
ref?.part_number,
ref?.source_code,
].filter(Boolean).map(String);
if (fileNo && refParts.length) return `${fileNo} · ${refParts.join('/')}`;
if (fileNo) return fileNo;
if (refParts.length) return refParts.join('/');
return '—';
}
</script>
<template>
<section
v-if="visible && facts"
class="rounded-2xl border border-default/80 bg-surface px-4 py-3 text-sm"
data-testid="stp-progress-facts-panel"
>
<h3 class="mb-2 text-sm font-semibold text-secondary">
{{ $t('workspace.shippingNotice.stpFacts.title') }}
</h3>
<dl class="grid gap-2 text-xs sm:grid-cols-2">
<div>
<dt class="text-muted">{{ $t('workspace.shippingNotice.stpFacts.inventorySourceStatus') }}</dt>
<dd class="font-medium text-secondary">{{ facts.inventory_source_status || '—' }}</dd>
</div>
<div>
<dt class="text-muted">{{ $t('workspace.shippingNotice.stpFacts.inventorySourceCode') }}</dt>
<dd class="font-medium text-secondary">{{ facts.inventory_source_code || '—' }}</dd>
</div>
<div class="sm:col-span-2">
<dt class="text-muted">{{ $t('workspace.shippingNotice.stpFacts.frozenCandidates') }}</dt>
<dd class="font-medium text-secondary">
{{ (facts.frozen_candidate_codes || []).join(', ') || '—' }}
</dd>
</div>
<div v-if="facts.multi_source_excel_block" class="sm:col-span-2 rounded-lg bg-amber-50 px-3 py-2 text-amber-900">
{{ $t('workspace.shippingNotice.stpFacts.multiSourceBlock') }}
<span v-if="(facts.resolved_ok_source_codes || []).length">
({{ (facts.resolved_ok_source_codes || []).join(', ') }})
</span>
</div>
<div v-if="resolutionEntries.length" class="sm:col-span-2">
<dt class="mb-1 text-muted">{{ $t('workspace.shippingNotice.stpFacts.resolutionCounts') }}</dt>
<dd class="flex flex-wrap gap-2">
<span
v-for="item in resolutionEntries"
:key="item.disposition"
class="rounded-full border border-default/70 px-2 py-0.5 text-secondary"
>
{{ dispositionLabel(item.disposition) }}
× {{ item.count }}
</span>
</dd>
</div>
</dl>
<div v-if="lineRows.length" class="mt-3 overflow-x-auto">
<div class="mb-1 text-xs text-muted">{{ $t('workspace.shippingNotice.stpFacts.lineTableTitle') }}</div>
<table class="min-w-full border-collapse text-xs">
<thead>
<tr class="border-b border-default/70 text-left text-muted">
<th class="py-1 pr-2 font-medium">{{ $t('workspace.shippingNotice.stpFacts.colLine') }}</th>
<th class="py-1 pr-2 font-medium">{{ $t('workspace.shippingNotice.stpFacts.colReservation') }}</th>
<th class="py-1 pr-2 font-medium">{{ $t('workspace.shippingNotice.stpFacts.colPart') }}</th>
<th class="py-1 pr-2 font-medium">{{ $t('workspace.shippingNotice.stpFacts.colDisposition') }}</th>
<th class="py-1 pr-2 font-medium">{{ $t('workspace.shippingNotice.stpFacts.colSource') }}</th>
<th class="py-1 font-medium">{{ $t('workspace.shippingNotice.stpFacts.colEvidence') }}</th>
</tr>
</thead>
<tbody>
<tr
v-for="(row, index) in lineRows"
:key="`${row.line_key || row.line_index}-${index}`"
class="border-b border-default/50 align-top"
>
<td class="py-1.5 pr-2 font-mono">{{ (row.line_index ?? index) + 1 }}</td>
<td class="py-1.5 pr-2 font-mono">{{ row.effective_reservation_id || '—' }}</td>
<td class="py-1.5 pr-2 font-mono">{{ row.part_number || '—' }}</td>
<td class="py-1.5 pr-2">{{ dispositionLabel(String(row.disposition || 'unknown')) }}</td>
<td class="py-1.5 pr-2 font-mono">{{ row.resolved_inventory_source_code || '—' }}</td>
<td class="py-1.5 font-mono text-muted">{{ evidenceText(row) }}</td>
</tr>
</tbody>
</table>
</div>
</section>
</template>