feat(shipping-notice): 添加订单文档 Profile 盲测集和样本管理功能,支持创建、执行和批准盲测,增强订单冻结和库存核验功能
This commit is contained in:
1 parent
c35223d49d
commit
abd8fc1e16
98 files changed
+4629
-528
No files matched your search
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
import { buildShippingSubmitDecisionTurn, buildShippingTurnRefs } from './shippingTurnActions';
|
||||
import { reportShippingDebugEvent } from './shippingDebugReporter';
|
||||
import { uploadFileAsset } from '@/shared/api/file-assets.api';
|
||||
import type { StartChatTurnOptions } from '../types/chat-turn.types';
|
||||
import type { ChatMessage, ChatSessionItem } from '../types/chat.types';
|
||||
import type { ComputedRef, Ref } from 'vue';
|
||||
@@ -57,6 +58,30 @@ export function createShippingDecisionHandlers(ctx: ShippingDecisionContext) {
|
||||
void ctx.refreshShippingActions();
|
||||
};
|
||||
|
||||
/**
|
||||
* 在 Chat 操作中选择并上传人工货代回执,返回当前用户私有的 FileAsset 编号。
|
||||
* 取消选择不会提交“已手工上传”动作,确保后端的证据门禁没有绕过路径。
|
||||
*/
|
||||
const selectManualUploadEvidence = () => new Promise<File | null>((resolve) => {
|
||||
const picker = document.createElement('input');
|
||||
picker.type = 'file';
|
||||
picker.accept = 'image/*,.pdf';
|
||||
picker.style.display = 'none';
|
||||
document.body.appendChild(picker);
|
||||
let settled = false;
|
||||
const finish = (file: File | null) => {
|
||||
if (settled) return;
|
||||
settled = true;
|
||||
picker.remove();
|
||||
resolve(file);
|
||||
};
|
||||
picker.addEventListener('change', () => finish(picker.files?.[0] || null), { once: true });
|
||||
picker.addEventListener('cancel', () => finish(null), { once: true });
|
||||
// 部分浏览器不会触发 cancel;窗口重新获得焦点后仍未选择文件即视为取消。
|
||||
window.addEventListener('focus', () => setTimeout(() => finish(picker.files?.[0] || null), 0), { once: true });
|
||||
picker.click();
|
||||
});
|
||||
|
||||
/**
|
||||
* 提交发货人工决策,经 Chat Turn 统一 SSE 返回。
|
||||
*/
|
||||
@@ -108,12 +133,18 @@ export function createShippingDecisionHandlers(ctx: ShippingDecisionContext) {
|
||||
manualUploadInFlightTaskIds.add(normalizedTaskId);
|
||||
const userText = (displayText || '我已在货代系统完成上传').trim();
|
||||
try {
|
||||
const evidenceFile = await selectManualUploadEvidence();
|
||||
if (!evidenceFile) {
|
||||
ctx.msg.warning('请先选择货代上传截图或回执文件');
|
||||
return false;
|
||||
}
|
||||
const evidence = await uploadFileAsset(evidenceFile);
|
||||
const ok = await ctx.startChatTurn({
|
||||
agentId: ctx.currentAgentId.value,
|
||||
inputType: 'action',
|
||||
displayText: userText,
|
||||
actionType: 'shipping.mark_manual_uploaded',
|
||||
payload: { task_no: normalizedTaskId },
|
||||
payload: { task_no: normalizedTaskId, evidence_asset_no: evidence.asset_no },
|
||||
refs: buildShippingTurnRefs(normalizedTaskId, ctx.getActiveShippingBatchNo()),
|
||||
hooks: {
|
||||
onAssistantMessageFinished: async (assistantMsg) => {
|
||||
|
||||
Reference in new issue
Block a user