feat(shipping-notice): 增强发货通知与审计功能,支持敏感数据控制与哈希链校验
- 更新发货通知工具 API,剥离不可信的操作人身份字段,确保审计安全 - 引入审计事件的哈希链校验机制,支持数据完整性验证 - 增强订单抽取与审计功能,支持敏感快照的访问控制 - 更新相关模型与服务,确保新功能的完整性与可追溯性 - 完善文档与代码注释,反映新的业务逻辑与审计要求
This commit is contained in:
1 parent
95cdfe66b0
commit
d0fe084999
225 files changed
+25923
-6653
No files matched your search
@@ -1,11 +1,12 @@
|
||||
/**
|
||||
* features/chat/components/shipping/ShippingOrderExtractionCard.vue
|
||||
* 用途:聊天主区批次进度卡——摘要计数、Run 级处理事项、当前文件阶段、健康提醒与动作。
|
||||
* 依赖:订单抽取 Run 状态卡 DTO、orderExtractionProgressDisplay、vue-router、vue-i18n。
|
||||
* 逻辑:事实一律来自后端 handling_items / primary_notice;右侧 ShippingSessionSummaryPanel 承接逐 PDF 明细。
|
||||
* 依赖:订单抽取 Run 状态卡 DTO、orderExtractionProgressDisplay、Workflow 计数投影、vue-router、vue-i18n。
|
||||
* 逻辑:有 Workflow 投影时优先展示统一 counts;否则回退 handling_items / primary_notice;
|
||||
* 右侧 ShippingWorkflowTimeline 承接逐 PDF 明细;禁止发明百分比与 ETA。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import { computed, inject, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { CircleCheck, CircleX, LoaderCircle, TriangleAlert } from 'lucide-vue-next';
|
||||
@@ -13,6 +14,7 @@ import type {
|
||||
ShippingOrderExtractionHandlingItemState,
|
||||
ShippingOrderExtractionState,
|
||||
} from '../../types/chat.types';
|
||||
import type { ShippingWorkflowItemCounts } from '../../types/shipping.api.types';
|
||||
import {
|
||||
formatOrderExtractionElapsed,
|
||||
resolveOrderExtractionUserStageKey,
|
||||
@@ -22,6 +24,7 @@ import {
|
||||
type ShippingHandlingAffectedRef,
|
||||
type ShippingHandlingRefTarget,
|
||||
} from '../../shipping/orderExtractionHandlingRefs';
|
||||
import { SHIPPING_WORKFLOW_KEY } from '../../shipping/useShippingNoticeWorkflow';
|
||||
|
||||
const props = defineProps<{
|
||||
state: ShippingOrderExtractionState;
|
||||
@@ -29,6 +32,8 @@ const props = defineProps<{
|
||||
retrying?: boolean;
|
||||
refreshing?: boolean;
|
||||
cancelling?: boolean;
|
||||
/** 可选:父级传入的 Workflow 计数;优先于 Run summary。 */
|
||||
workflowSummary?: ShippingWorkflowItemCounts | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -42,6 +47,49 @@ const route = useRoute();
|
||||
const router = useRouter();
|
||||
const confirmCancelOpen = ref(false);
|
||||
const cancelReason = ref('');
|
||||
const injectedWorkflow = inject(SHIPPING_WORKFLOW_KEY, null);
|
||||
|
||||
/**
|
||||
* 统一计数:优先 props.workflowSummary,其次 inject 的 Workflow.counts,最后回退 Run summary。
|
||||
*/
|
||||
const unifiedCounts = computed(() => {
|
||||
const fromProp = props.workflowSummary;
|
||||
if (fromProp && Number(fromProp.total || 0) > 0) return fromProp;
|
||||
const fromInject = injectedWorkflow?.workflow.value?.counts;
|
||||
if (fromInject && Number(fromInject.total || 0) > 0) return fromInject;
|
||||
return null;
|
||||
});
|
||||
|
||||
const displaySummary = computed(() => {
|
||||
const counts = unifiedCounts.value;
|
||||
if (!counts) return props.state.summary;
|
||||
return {
|
||||
totalDocuments: counts.total,
|
||||
processingDocuments: counts.processing,
|
||||
pendingDocuments: 0,
|
||||
completedDocuments: counts.completed,
|
||||
reviewRequiredDocuments: counts.pending_review,
|
||||
failedDocuments: counts.failed,
|
||||
cancelledDocuments: 0,
|
||||
candidateCount: props.state.summary.candidateCount,
|
||||
openedExistingCount: props.state.summary.openedExistingCount,
|
||||
};
|
||||
});
|
||||
|
||||
const workflowStageLabel = computed(() => {
|
||||
const stage = String(injectedWorkflow?.workflow.value?.current_stage || '').trim();
|
||||
if (!stage) return '';
|
||||
const key = `chat.shippingWorkflow.itemStatus.${stage}`;
|
||||
return te(key) ? t(key) : stage;
|
||||
});
|
||||
|
||||
const workflowLastActivityLabel = computed(() => {
|
||||
const raw = injectedWorkflow?.workflow.value?.last_activity_at;
|
||||
if (!raw) return '';
|
||||
const date = new Date(String(raw));
|
||||
if (Number.isNaN(date.getTime())) return '';
|
||||
return date.toLocaleString();
|
||||
});
|
||||
|
||||
const handlingItems = computed(() => props.state.handlingItems || []);
|
||||
|
||||
@@ -50,10 +98,10 @@ const handlingItems = computed(() => props.state.handlingItems || []);
|
||||
*/
|
||||
const isDuplicateOnlyNotice = computed(() => {
|
||||
if (handlingItems.value.length > 0) return false;
|
||||
const opened = Math.max(0, Number(props.state.summary.openedExistingCount || 0));
|
||||
const opened = Math.max(0, Number(displaySummary.value.openedExistingCount || 0));
|
||||
if (opened <= 0) return false;
|
||||
const review = Math.max(0, Number(props.state.summary.reviewRequiredDocuments || 0));
|
||||
const failed = Math.max(0, Number(props.state.summary.failedDocuments || 0));
|
||||
const review = Math.max(0, Number(displaySummary.value.reviewRequiredDocuments || 0));
|
||||
const failed = Math.max(0, Number(displaySummary.value.failedDocuments || 0));
|
||||
return review === 0 && failed === 0;
|
||||
});
|
||||
|
||||
@@ -163,7 +211,7 @@ const activityKey = computed(() => {
|
||||
|
||||
const showRetry = computed(() => (
|
||||
props.state.availableActions.includes('retry_failed_attachments')
|
||||
|| props.state.summary.failedDocuments > 0
|
||||
|| displaySummary.value.failedDocuments > 0
|
||||
));
|
||||
const showRefresh = computed(() => props.state.availableActions.includes('refresh_status'));
|
||||
const showCancel = computed(() => (
|
||||
@@ -319,31 +367,40 @@ function openCancelConfirm() {
|
||||
<div class="text-sm font-medium">{{ compactLine }}</div>
|
||||
|
||||
<div
|
||||
v-if="state.summary.totalDocuments > 0"
|
||||
v-if="displaySummary.totalDocuments > 0"
|
||||
class="mt-1.5 flex flex-wrap gap-1.5 text-[11px] opacity-90"
|
||||
data-testid="shipping-order-extraction-summary"
|
||||
>
|
||||
<span>{{ t('chat.shippingOrderExtractionSummary.total', { count: state.summary.totalDocuments }) }}</span>
|
||||
<span v-if="state.summary.processingDocuments > 0">
|
||||
{{ t('chat.shippingOrderExtractionSummary.processing', { count: state.summary.processingDocuments }) }}
|
||||
<span>{{ t('chat.shippingOrderExtractionSummary.total', { count: displaySummary.totalDocuments }) }}</span>
|
||||
<span v-if="displaySummary.processingDocuments > 0">
|
||||
{{ t('chat.shippingOrderExtractionSummary.processing', { count: displaySummary.processingDocuments }) }}
|
||||
</span>
|
||||
<span v-if="state.summary.pendingDocuments > 0">
|
||||
{{ t('chat.shippingOrderExtractionSummary.pending', { count: state.summary.pendingDocuments }) }}
|
||||
<span v-if="displaySummary.pendingDocuments > 0">
|
||||
{{ t('chat.shippingOrderExtractionSummary.pending', { count: displaySummary.pendingDocuments }) }}
|
||||
</span>
|
||||
<span v-if="state.summary.completedDocuments > 0">
|
||||
{{ t('chat.shippingOrderExtractionSummary.completed', { count: state.summary.completedDocuments }) }}
|
||||
<span v-if="displaySummary.completedDocuments > 0">
|
||||
{{ t('chat.shippingOrderExtractionSummary.completed', { count: displaySummary.completedDocuments }) }}
|
||||
</span>
|
||||
<span v-if="state.summary.reviewRequiredDocuments > 0">
|
||||
{{ t('chat.shippingOrderExtractionSummary.reviewRequired', { count: state.summary.reviewRequiredDocuments }) }}
|
||||
<span v-if="displaySummary.reviewRequiredDocuments > 0">
|
||||
{{ t('chat.shippingOrderExtractionSummary.reviewRequired', { count: displaySummary.reviewRequiredDocuments }) }}
|
||||
</span>
|
||||
<span v-if="state.summary.failedDocuments > 0">
|
||||
{{ t('chat.shippingOrderExtractionSummary.failed', { count: state.summary.failedDocuments }) }}
|
||||
<span v-if="displaySummary.failedDocuments > 0">
|
||||
{{ t('chat.shippingOrderExtractionSummary.failed', { count: displaySummary.failedDocuments }) }}
|
||||
</span>
|
||||
<span v-if="(state.summary.cancelledDocuments || 0) > 0">
|
||||
{{ t('chat.shippingOrderExtractionSummary.cancelled', { count: state.summary.cancelledDocuments }) }}
|
||||
<span v-if="(displaySummary.cancelledDocuments || 0) > 0">
|
||||
{{ t('chat.shippingOrderExtractionSummary.cancelled', { count: displaySummary.cancelledDocuments }) }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="workflowStageLabel || workflowLastActivityLabel"
|
||||
class="mt-1 text-[11px] opacity-80"
|
||||
data-testid="shipping-order-extraction-workflow-meta"
|
||||
>
|
||||
<span v-if="workflowStageLabel">{{ workflowStageLabel }}</span>
|
||||
<span v-if="workflowLastActivityLabel" class="ml-1">· {{ workflowLastActivityLabel }}</span>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="handlingItems.length"
|
||||
class="mt-2 space-y-1.5"
|
||||
|
||||
Reference in new issue
Block a user