feat(shipping-notice): 增强订单文档 Profile 管理功能,新增复核与草稿管理
- 添加订单复核相关模型及 API,支持复核案例的创建、更新和确认 - 实现复核草稿的管理功能,允许用户对复核内容进行编辑和保存 - 引入复核事件审计,确保复核过程的可追溯性 - 更新数据库模型以支持复核和草稿的关系管理 - 完善相关服务逻辑,确保复核与草稿的状态管理和数据一致性 - 增强文档模板的管理能力,支持更复杂的业务场景
This commit is contained in:
1 parent
61ac6403c4
commit
b7307fc573
147 files changed
+15108
-1522
No files matched your search
@@ -23,7 +23,6 @@ import ChatMessageAttachmentList from './ChatMessageAttachmentList.vue';
|
||||
import MaintenanceDeviceResultCard from './MaintenanceDeviceResultCard.vue';
|
||||
import ShippingMatchResultCard from './ShippingMatchResultCard.vue';
|
||||
import ShippingParseReviewMessage, { type ShippingParseReviewHandlers } from './ShippingParseReviewMessage.vue';
|
||||
import ShippingNoticeCandidateReview from '../ShippingNoticeCandidateReview.vue';
|
||||
import type { ShippingMessageHandlers } from './shippingMessageHandlers';
|
||||
import TrainingExamQuestionMessage, { type TrainingHandlers } from './TrainingExamQuestionMessage.vue';
|
||||
import TrainingVideoMessage from './TrainingVideoMessage.vue';
|
||||
@@ -32,8 +31,6 @@ import TrainingResultCard from './TrainingResultCard.vue';
|
||||
import ShippingOrderExtractionCard from '../shipping/ShippingOrderExtractionCard.vue';
|
||||
import type { ChatMessage, InlineDownloadFile, SourceFileLink } from '../../types/chat.types';
|
||||
import type { ShippingMatchResultPayload } from '../../types/shipping.types';
|
||||
import type { ShippingNoticePendingAttachment } from '../../types/shipping.types';
|
||||
import type { ShippingOrderExtractionReviewAttachment } from '../../types/chat.types';
|
||||
import type { MaintenanceDevice } from '@/features/maintenance/types/ledger.types';
|
||||
import type { MaintenanceRecord } from '@/features/maintenance/types/record.types';
|
||||
|
||||
@@ -137,60 +134,12 @@ const showShippingActionsPanel = computed(() =>
|
||||
);
|
||||
const shippingOrderExtractionState = computed(() => message.shipping_order_extraction_state);
|
||||
const retryingOrderExtraction = ref(false);
|
||||
const reviewAttachmentsSection = ref<HTMLElement | null>(null);
|
||||
const shippingOrderExtractionRunNo = computed(() => {
|
||||
const payload = message.payload && typeof message.payload === 'object'
|
||||
? message.payload as Record<string, unknown>
|
||||
: {};
|
||||
return String(payload.order_extraction_run_no || '').trim();
|
||||
});
|
||||
const shippingOrderExtractionReviewAttachments = computed<ShippingNoticePendingAttachment[]>(() => {
|
||||
const payload = message.payload && typeof message.payload === 'object' ? message.payload as Record<string, unknown> : {};
|
||||
const reviews = Array.isArray(payload.shipping_order_extraction_review)
|
||||
? payload.shipping_order_extraction_review as ShippingOrderExtractionReviewAttachment[]
|
||||
: [];
|
||||
return reviews
|
||||
.filter((item) => item && Array.isArray(item.candidates) && item.candidates.length)
|
||||
.map((item) => ({
|
||||
id: `shipping-order-extraction-review-${item.intakeNo}`,
|
||||
kind: 'shipping_notice' as const,
|
||||
type: 'document' as const,
|
||||
intakeNo: item.intakeNo,
|
||||
uploadStatus: 'uploaded' as const,
|
||||
parseStatus: 'parsed' as const,
|
||||
uploadProgress: 100,
|
||||
originalFilename: item.originalFilename,
|
||||
fileSize: 0,
|
||||
candidates: item.candidates,
|
||||
}));
|
||||
});
|
||||
|
||||
const updateOrderExtractionCandidate = async (
|
||||
candidateNo: string,
|
||||
businessSummary: Record<string, unknown>,
|
||||
done: (success: boolean) => void,
|
||||
) => {
|
||||
await shippingHandlers.updateCandidate(candidateNo, businessSummary, done);
|
||||
};
|
||||
|
||||
const promoteOrderExtractionCandidate = async (candidateNo: string, done: (success: boolean) => void) => {
|
||||
await shippingHandlers.promoteCandidate(candidateNo, done);
|
||||
};
|
||||
|
||||
const rejectOrderExtractionCandidate = async (candidateNo: string, done: (success: boolean) => void) => {
|
||||
await shippingHandlers.rejectCandidate(candidateNo, done);
|
||||
};
|
||||
|
||||
const resolveOrderExtractionCandidateDuplicate = async (
|
||||
candidateNo: string,
|
||||
action: import('../../types/shipping.types').ShippingDuplicateAction,
|
||||
targetTaskNo: string | undefined,
|
||||
reason: string | undefined,
|
||||
done: (success: boolean) => void,
|
||||
) => {
|
||||
await shippingHandlers.resolveCandidateDuplicate(candidateNo, action, targetTaskNo, reason, done);
|
||||
};
|
||||
|
||||
/** 失败卡片复用原 Run 重试;按钮本地防重,成功后状态卡由 Run 轮询原位更新。 */
|
||||
const retryShippingOrderExtraction = async () => {
|
||||
if (!shippingOrderExtractionRunNo.value || retryingOrderExtraction.value) return;
|
||||
@@ -201,11 +150,6 @@ const retryShippingOrderExtraction = async () => {
|
||||
retryingOrderExtraction.value = false;
|
||||
}
|
||||
};
|
||||
const enterOrderExtractionManualReview = async () => {
|
||||
if (!shippingOrderExtractionReviewAttachments.value.length) return;
|
||||
await nextTick();
|
||||
reviewAttachmentsSection.value?.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
};
|
||||
const isLastMessage = computed(() => index === messageCount - 1 || (message.role === 'assistant' && isLatestAssistantMessage));
|
||||
const isCopied = computed(() => copiedIndex === index);
|
||||
const renderedMarkdown = computed(() => (
|
||||
@@ -732,26 +676,8 @@ function handleInlineDownload(file: InlineDownloadFile): void {
|
||||
v-if="shippingOrderExtractionState"
|
||||
:state="shippingOrderExtractionState"
|
||||
:run-no="shippingOrderExtractionRunNo"
|
||||
:has-review-attachments="shippingOrderExtractionReviewAttachments.length > 0"
|
||||
@retry="retryShippingOrderExtraction"
|
||||
@enter-manual-review="enterOrderExtractionManualReview"
|
||||
/>
|
||||
<div
|
||||
v-if="shippingOrderExtractionReviewAttachments.length"
|
||||
ref="reviewAttachmentsSection"
|
||||
class="mb-3 space-y-2"
|
||||
>
|
||||
<ShippingNoticeCandidateReview
|
||||
v-for="attachment in shippingOrderExtractionReviewAttachments"
|
||||
:key="attachment.intakeNo"
|
||||
:attachment="attachment"
|
||||
:can-force-create="false"
|
||||
@update="updateOrderExtractionCandidate"
|
||||
@resolve-duplicate="resolveOrderExtractionCandidateDuplicate"
|
||||
@promote="promoteOrderExtractionCandidate"
|
||||
@reject="rejectOrderExtractionCandidate"
|
||||
/>
|
||||
</div>
|
||||
<LeaveMessageBlock
|
||||
v-if="isLeaveMessage"
|
||||
:message="message"
|
||||
|
||||
@@ -17,7 +17,6 @@ export interface ShippingMessageHandlers {
|
||||
removeLine: (msg: ChatMessage, lineIndex: number) => Promise<boolean>;
|
||||
retryOrderExtractionRun: (runNo: string) => Promise<boolean>;
|
||||
reparseOrderExtractionRun: (runNo: string, reason: 'rule_updated' | 'field_mapping_error' | 'document_quality' | 'other') => Promise<boolean>;
|
||||
updateCandidate: (candidateNo: string, businessSummary: Record<string, unknown>, done: (success: boolean) => void) => Promise<void>;
|
||||
resolveCandidateDuplicate: (candidateNo: string, action: import('../../types/shipping.types').ShippingDuplicateAction, targetTaskNo: string | undefined, reason: string | undefined, done: (success: boolean) => void) => Promise<void>;
|
||||
promoteCandidate: (candidateNo: string, done: (success: boolean) => void) => Promise<void>;
|
||||
rejectCandidate: (candidateNo: string, done: (success: boolean) => void) => Promise<void>;
|
||||
|
||||
Reference in new issue
Block a user