- 在环境配置中新增进度细化、订单提取取消与审计导出相关的开关 - 实现订单抽取运行的取消功能,允许管理员在运行中进行操作 - 引入审计事件的保留策略,支持三年保留期的自动清理 - 更新相关模型与服务,确保新功能的完整性与可追溯性 - 增强文档与代码注释,反映新的业务逻辑与审计要求
130 lines
5.7 KiB
TypeScript
130 lines
5.7 KiB
TypeScript
/**
|
||
* 对话页:子组件 inject 用的 handlers 对象打包(请假表单、发货消息、消息气泡)。
|
||
*/
|
||
import type { LeaveMessageHandlers } from '../components/messages/LeaveMessageBlock.vue';
|
||
import type { ShippingMessageHandlers } from '../components/messages/shippingMessageHandlers';
|
||
import type { TrainingHandlers } from '../components/messages/TrainingExamQuestionMessage.vue';
|
||
import type { useChatLeave } from '../composables/useChatLeave';
|
||
import type { useChatShipping } from '../composables/useChatShipping';
|
||
import type { useTrainingWorkspace } from '../composables/useTrainingWorkspace';
|
||
import type { Ref } from 'vue';
|
||
|
||
type LeaveHandlerSource = Pick<
|
||
ReturnType<typeof useChatLeave>,
|
||
| 'getLeaveFormPayload'
|
||
| 'getLeaveConfirmationPayload'
|
||
| 'getLeaveResultPayload'
|
||
| 'getLeaveAgentDisplayValue'
|
||
| 'getLeaveTypeLabel'
|
||
| 'formatDurationLabel'
|
||
| 'formatYesNoLabel'
|
||
| 'syncLeaveDuration'
|
||
| 'openLeaveAgentDialog'
|
||
| 'openOALeaveRequestDirectly'
|
||
| 'openOARequestDirectly'
|
||
| 'submitLeaveForm'
|
||
| 'editLeaveConfirmation'
|
||
| 'confirmLeaveSubmission'
|
||
>;
|
||
|
||
type ShippingHandlerSource = Pick<
|
||
ReturnType<typeof useChatShipping>,
|
||
| 'getShippingParseReviewPayload'
|
||
| 'getShippingMatchResultPayload'
|
||
| 'updateShippingParseReviewHeader'
|
||
| 'updateShippingParseReviewLine'
|
||
| 'addShippingParseReviewLine'
|
||
| 'removeShippingParseReviewLine'
|
||
| 'retryOrderExtractionRun'
|
||
| 'refreshOrderExtractionRun'
|
||
| 'cancelOrderExtractionRun'
|
||
| 'cancelOrderExtractionUnit'
|
||
| 'reparseOrderExtractionRun'
|
||
| 'resolveShippingCandidateDuplicate'
|
||
| 'promoteShippingCandidate'
|
||
| 'rejectShippingCandidate'
|
||
>;
|
||
|
||
type TrainingHandlerSource = ReturnType<typeof useTrainingWorkspace>;
|
||
|
||
/** 请假消息块 handlers(LeaveMessageBlock) */
|
||
export function createLeaveMessageHandlers(leave: LeaveHandlerSource): LeaveMessageHandlers {
|
||
return {
|
||
getLeaveFormPayload: leave.getLeaveFormPayload,
|
||
getLeaveConfirmationPayload: leave.getLeaveConfirmationPayload,
|
||
getLeaveResultPayload: leave.getLeaveResultPayload,
|
||
getLeaveAgentDisplayValue: leave.getLeaveAgentDisplayValue,
|
||
getLeaveTypeLabel: leave.getLeaveTypeLabel,
|
||
formatDurationLabel: leave.formatDurationLabel,
|
||
formatYesNoLabel: leave.formatYesNoLabel,
|
||
syncLeaveDuration: leave.syncLeaveDuration,
|
||
openLeaveAgentDialog: leave.openLeaveAgentDialog,
|
||
openOALeaveRequestDirectly: leave.openOALeaveRequestDirectly,
|
||
openOARequestDirectly: leave.openOARequestDirectly,
|
||
submitLeaveForm: leave.submitLeaveForm,
|
||
editLeaveConfirmation: leave.editLeaveConfirmation,
|
||
confirmLeaveSubmission: leave.confirmLeaveSubmission,
|
||
};
|
||
}
|
||
|
||
/** 发货通知订单复核与匹配消息 handlers。 */
|
||
export function createShippingMessageHandlers(shipping: ShippingHandlerSource): ShippingMessageHandlers {
|
||
return {
|
||
getParseReviewPayload: shipping.getShippingParseReviewPayload,
|
||
getMatchResultPayload: shipping.getShippingMatchResultPayload,
|
||
updateHeader: shipping.updateShippingParseReviewHeader,
|
||
updateLine: shipping.updateShippingParseReviewLine,
|
||
addLine: shipping.addShippingParseReviewLine,
|
||
removeLine: shipping.removeShippingParseReviewLine,
|
||
retryOrderExtractionRun: shipping.retryOrderExtractionRun,
|
||
refreshOrderExtractionRun: shipping.refreshOrderExtractionRun,
|
||
cancelOrderExtractionRun: shipping.cancelOrderExtractionRun,
|
||
cancelOrderExtractionUnit: shipping.cancelOrderExtractionUnit,
|
||
reparseOrderExtractionRun: shipping.reparseOrderExtractionRun,
|
||
resolveCandidateDuplicate: shipping.resolveShippingCandidateDuplicate,
|
||
promoteCandidate: shipping.promoteShippingCandidate,
|
||
rejectCandidate: shipping.rejectShippingCandidate,
|
||
};
|
||
}
|
||
|
||
/** 培训答题块 handlers(TrainingExamQuestionMessage) */
|
||
export function createTrainingHandlers(workspace: TrainingHandlerSource): TrainingHandlers {
|
||
return {
|
||
getQuestion: () => workspace.currentQuestion.value,
|
||
getCurrentQuestionIndex: () => workspace.currentQuestionIndex.value,
|
||
getAnsweredCount: () => workspace.answeredCount.value,
|
||
getTotalCount: () => workspace.totalQuestionCount.value,
|
||
getPassScore: () => workspace.passScore.value,
|
||
getScore: () => workspace.score.value,
|
||
getSelectedOptionId: () => workspace.selectedOptionId.value,
|
||
getAnswerLocked: () => workspace.answerLocked.value,
|
||
getFeedbackCorrect: () => workspace.currentFeedbackCorrect.value,
|
||
getAnswerLabel: () => {
|
||
const q = workspace.currentQuestion.value;
|
||
if (!q) return '';
|
||
return q.options?.find((o) => o.id === workspace.selectedOptionId.value)?.label || '';
|
||
},
|
||
getLatestExamFeedback: () => workspace.latestExamFeedback.value,
|
||
onSelect: workspace.selectAnswer,
|
||
onNext: workspace.moveToNextQuestion,
|
||
onPlayVideo: () => {
|
||
// 通过 DOM 事件或状态传递触发视频播放,这里我们直接让 workspace 标记视频模态框展示
|
||
// 注意:这里需要确保 TrainingWorkspacePanel 监听了对应的状态
|
||
workspace.showVideoModal.value = true;
|
||
},
|
||
onStartExam: workspace.startExam,
|
||
onRestartExam: workspace.restartExam,
|
||
getCorrectCount: () => workspace.latestSettledResult.value?.correctCount ?? workspace.correctCount.value,
|
||
getWrongCount: () => workspace.latestSettledResult.value?.wrongCount ?? workspace.wrongCount.value,
|
||
getResultScore: () => workspace.latestSettledResult.value?.score ?? workspace.score.value,
|
||
getResultPassed: () => workspace.latestSettledResult.value?.isPassed ?? workspace.isPassed.value,
|
||
getSummaryPoints: () => workspace.summaryPoints.value,
|
||
getSummaryChecklist: () => workspace.summaryChecklist.value,
|
||
};
|
||
}
|
||
|
||
/** 隐藏 file input ref 包裹,避免 template 自动解包 Ref */
|
||
export function createShippingPickerRefHolder(pickerRef: Ref<HTMLInputElement | null>) {
|
||
return { pickerRef };
|
||
}
|