feat(shipping-notice): 新增发货通知重复检测与处理接口,支持重复决策保存与重新执行检测
This commit is contained in:
1 parent
729546a7b7
commit
ceb49461e8
72 files changed
+14270
-460
No files matched your search
@@ -14,6 +14,7 @@ import {
|
||||
type ComputedRef,
|
||||
type Ref,
|
||||
} from 'vue';
|
||||
import { useAuthStore } from '@/features/auth/stores/auth.store';
|
||||
import { agentUsesWorkspaceStepperProgress, isShippingNoticeAgent as resolveShippingNoticeAgent } from '@/shared/utils/agent-registry.utils';
|
||||
import type { AgentRegistryFields } from '@/shared/utils/agent-registry.utils';
|
||||
import { hasActiveRunningChatRun } from '../shipping/shippingActionBusy';
|
||||
@@ -667,6 +668,68 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
t,
|
||||
});
|
||||
|
||||
const showShippingDuplicateDialog = ref(false);
|
||||
const shippingDuplicateAttachmentId = ref<string | null>(null);
|
||||
const shippingDuplicateAttachment = computed(() => {
|
||||
const id = shippingDuplicateAttachmentId.value;
|
||||
if (!id) return null;
|
||||
return shippingIntakes.noticeAttachments.value.find((item) => item.id === id) || null;
|
||||
});
|
||||
const canForceCreateShippingDuplicate = computed(() => {
|
||||
const user = useAuthStore().user;
|
||||
if (!user) return false;
|
||||
if (String(user.role || '') === 'admin') return true;
|
||||
return Boolean(user.feature_permissions?.shipping_notice_force_create);
|
||||
});
|
||||
|
||||
/**
|
||||
* 打开首个(或指定)阻断型重复附件的处理弹窗。
|
||||
*/
|
||||
const openShippingDuplicateDialog = (attachmentId?: string) => {
|
||||
const targetId =
|
||||
attachmentId
|
||||
|| shippingIntakes.noticeAttachments.value.find(
|
||||
(item) => item.duplicate?.blocking && !item.duplicateResolution?.action,
|
||||
)?.id
|
||||
|| null;
|
||||
if (!targetId) {
|
||||
msg.warning(t('chat.shippingNoticeDuplicateNeedsResolution'));
|
||||
return;
|
||||
}
|
||||
shippingDuplicateAttachmentId.value = targetId;
|
||||
showShippingDuplicateDialog.value = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 提交重复决策并写回附件状态。
|
||||
*/
|
||||
const resolveShippingDuplicateDialog = async (payload: {
|
||||
action: import('../types/shipping.types').ShippingDuplicateAction;
|
||||
targetTaskNo?: string;
|
||||
reason?: string;
|
||||
}) => {
|
||||
const id = shippingDuplicateAttachmentId.value;
|
||||
if (!id) return;
|
||||
try {
|
||||
await shippingIntakes.resolveDuplicateAttachment(
|
||||
id,
|
||||
payload.action,
|
||||
payload.targetTaskNo,
|
||||
payload.reason,
|
||||
);
|
||||
msg.success(t('chat.shippingNoticeDuplicateResolved'));
|
||||
} catch (e: unknown) {
|
||||
msg.warning(e instanceof Error ? e.message : t('chat.shippingNoticeDuplicateResolveFailed'));
|
||||
}
|
||||
};
|
||||
|
||||
const removeShippingDuplicateDialogAttachment = async () => {
|
||||
const id = shippingDuplicateAttachmentId.value;
|
||||
if (!id) return;
|
||||
await shippingIntakes.removeNoticeAttachment(id);
|
||||
shippingDuplicateAttachmentId.value = null;
|
||||
};
|
||||
|
||||
const {
|
||||
handleShippingAutoUploadFile,
|
||||
handleShippingAutoUploadNoticeBatch,
|
||||
@@ -755,6 +818,8 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
isShippingNoticeBatchSubmitting,
|
||||
hasBlockingNoticeIntake: () => shippingIntakes.hasBlockingUploadOrParse.value,
|
||||
hasNoticeIntakeFailures: () => shippingIntakes.hasParseFailures.value,
|
||||
hasBlockingNoticeDuplicates: () => shippingIntakes.hasBlockingDuplicates.value,
|
||||
openShippingDuplicateDialog,
|
||||
getParsedIntakeNos: shippingIntakes.getParsedIntakeNos,
|
||||
refreshShippingActions,
|
||||
shippingSuggestedPrompt,
|
||||
@@ -1067,6 +1132,15 @@ export function useChatShipping(options: UseChatShippingOptions) {
|
||||
handleShippingLocalFilesSelected,
|
||||
removeShippingNoticeAttachment: shippingIntakes.removeNoticeAttachment,
|
||||
retryShippingNoticeAttachment: shippingIntakes.retryNoticeAttachment,
|
||||
showShippingDuplicateDialog,
|
||||
shippingDuplicateAttachment,
|
||||
canForceCreateShippingDuplicate,
|
||||
openShippingDuplicateDialog,
|
||||
resolveShippingDuplicateDialog,
|
||||
removeShippingDuplicateDialogAttachment,
|
||||
closeShippingDuplicateDialog: () => {
|
||||
showShippingDuplicateDialog.value = false;
|
||||
},
|
||||
tryHandleShippingAttachmentAutoFlow,
|
||||
tryHandleShippingSend,
|
||||
onConversationIdChanging,
|
||||
|
||||
Reference in new issue
Block a user