feat(shipping-notice): 支持发货通知解析延后至 Dify 画布,优化任务创建流程
This commit is contained in:
1 parent
d46d61bfa1
commit
70e8f700ff
38 files changed
+3215
-714
No files matched your search
@@ -15,7 +15,7 @@ import ChatBrowserPanel from '@/features/chat/components/ChatBrowserPanel.vue';
|
||||
import ShippingWorkflowStepper from '@/features/chat/components/ShippingWorkflowStepper.vue';
|
||||
import { useChatPageContext } from '@/features/chat/composables/chat.context';
|
||||
import { buildShippingWorkflowSteps } from '@/features/chat/shipping';
|
||||
import type { ShippingTaskSummary } from '@/features/chat/types/shipping.api.types';
|
||||
import type { ShippingCurrentStepProgress, ShippingTaskSummary } from '@/features/chat/types/shipping.api.types';
|
||||
|
||||
const page = useChatPageContext();
|
||||
const { t } = useI18n();
|
||||
@@ -38,6 +38,12 @@ const statusMeta = (status?: string | null) => {
|
||||
const stepLabel = (step?: string | null) => {
|
||||
const map: Record<string, string> = {
|
||||
step1_notice_submit: t('chat.shippingNoticeUi.currentStep.noticeParse'),
|
||||
step2_parse_confirm: t('chat.shippingNoticeUi.currentStep.parseConfirm'),
|
||||
step3_inventory_prepare: t('chat.shippingNoticeUi.currentStep.inventoryPrepare'),
|
||||
step4_align_confirm: t('chat.shippingNoticeUi.currentStep.alignConfirm'),
|
||||
step5_match_inventory: t('chat.shippingNoticeUi.currentStep.inventoryMatch'),
|
||||
step6_generate_file: t('chat.shippingNoticeUi.currentStep.generateExcel'),
|
||||
step7_upload_freight: t('chat.shippingNoticeUi.currentStep.uploadFreight'),
|
||||
step2_inventory_prepare: t('chat.shippingNoticeUi.currentStep.inventoryPrepare'),
|
||||
step3_inventory_match: t('chat.shippingNoticeUi.currentStep.inventoryMatch'),
|
||||
step4_shortage_review: t('chat.shippingNoticeUi.currentStep.shortageHandle'),
|
||||
@@ -56,6 +62,12 @@ const currentShippingTask = computed<ShippingTaskSummary | null>(() => {
|
||||
|
||||
const currentShippingTaskSource = computed(() => currentShippingTask.value || page.activeShippingTaskDetail || null);
|
||||
const currentShippingSteps = computed(() => buildShippingWorkflowSteps(currentShippingTaskSource.value));
|
||||
const currentShippingStepProgress = computed<ShippingCurrentStepProgress | null>(() => {
|
||||
const payload = currentShippingTaskSource.value?.step_payload;
|
||||
if (!payload || typeof payload !== 'object') return null;
|
||||
const progress = (payload as Record<string, unknown>).current_step_progress;
|
||||
return progress && typeof progress === 'object' ? progress as ShippingCurrentStepProgress : null;
|
||||
});
|
||||
const currentShippingBatchProgress = computed(() => {
|
||||
const task = currentShippingTask.value;
|
||||
if (!task?.batch_index || !task?.batch_total) return '';
|
||||
@@ -67,9 +79,20 @@ const batchCompletedCount = computed(() =>
|
||||
const batchRunningCount = computed(() =>
|
||||
Number(page.shippingBatchSummary?.process_summary?.running || 0),
|
||||
);
|
||||
const batchPendingCount = computed(() =>
|
||||
Number(page.shippingBatchSummary?.process_summary?.pending || 0),
|
||||
);
|
||||
const batchFileCount = computed(() =>
|
||||
Number(page.shippingBatchSummary?.file_count || 0),
|
||||
);
|
||||
const batchCurrentIndex = computed(() =>
|
||||
Number(
|
||||
currentShippingTask.value?.batch_index
|
||||
|| page.activeShippingTaskDetail?.batch_index
|
||||
|| page.shippingBatchSummary?.process_summary?.current_index
|
||||
|| 0,
|
||||
),
|
||||
);
|
||||
const batchCompletionPercent = computed(() => {
|
||||
if (!batchFileCount.value) return 0;
|
||||
return Math.min(100, Math.max(0, Math.round((batchCompletedCount.value / batchFileCount.value) * 100)));
|
||||
@@ -175,6 +198,12 @@ const batchCompletionPercent = computed(() => {
|
||||
>
|
||||
{{ currentShippingBatchProgress }}
|
||||
</span>
|
||||
<span
|
||||
v-if="batchCurrentIndex"
|
||||
class="rounded-full bg-amber-50 px-2.5 py-1 text-xs font-medium text-amber-700"
|
||||
>
|
||||
{{ t('chat.shippingNoticeUi.batchCurrentIndex', { index: batchCurrentIndex, total: batchFileCount }) }}
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="currentShippingTaskSource" class="flex flex-wrap items-center gap-2 text-xs text-secondary">
|
||||
<span class="truncate font-medium text-primary">
|
||||
@@ -194,6 +223,40 @@ const batchCompletionPercent = computed(() => {
|
||||
compact
|
||||
class="pt-2"
|
||||
/>
|
||||
<div
|
||||
v-if="currentShippingStepProgress"
|
||||
class="mt-3 rounded-2xl border border-default/80 bg-surface/80 px-3 py-3"
|
||||
>
|
||||
<div class="flex items-center justify-between gap-3 text-xs">
|
||||
<div class="font-medium text-primary">
|
||||
{{ currentShippingStepProgress.step_title || t('chat.shippingNoticeUi.stepDetail.title') }}
|
||||
</div>
|
||||
<div class="text-muted">
|
||||
{{ currentShippingStepProgress.progress_percent ?? 0 }}%
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-1 text-sm text-secondary">
|
||||
{{ currentShippingStepProgress.message || t('chat.shippingNoticeUi.processing') }}
|
||||
</div>
|
||||
<div
|
||||
v-if="currentShippingStepProgress.detail"
|
||||
class="mt-1 text-xs text-muted"
|
||||
>
|
||||
{{ currentShippingStepProgress.detail }}
|
||||
</div>
|
||||
<div
|
||||
v-if="currentShippingStepProgress.current && currentShippingStepProgress.total"
|
||||
class="mt-1 text-xs text-muted"
|
||||
>
|
||||
{{ t('chat.shippingNoticeUi.stepDetail.counter', { current: currentShippingStepProgress.current, total: currentShippingStepProgress.total }) }}
|
||||
</div>
|
||||
<div class="mt-2 h-2 overflow-hidden rounded-full bg-slate-200">
|
||||
<div
|
||||
class="h-full rounded-full bg-sky-500 transition-all"
|
||||
:style="{ width: `${currentShippingStepProgress.progress_percent ?? 0}%` }"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-2 pt-1 text-xs">
|
||||
<button
|
||||
v-if="page.shippingBatchSummary"
|
||||
@@ -221,7 +284,7 @@ const batchCompletionPercent = computed(() => {
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="page.shippingBatchSummary" class="grid grid-cols-3 gap-2 text-right text-xs">
|
||||
<div v-if="page.shippingBatchSummary" class="grid grid-cols-4 gap-2 text-right text-xs">
|
||||
<div class="rounded-2xl bg-surface px-3 py-2">
|
||||
<div class="text-muted">{{ t('chat.shippingNoticeUi.fileCount') }}</div>
|
||||
<div class="mt-1 text-sm font-semibold text-primary">{{ batchFileCount }}</div>
|
||||
@@ -234,6 +297,10 @@ const batchCompletionPercent = computed(() => {
|
||||
<div class="text-muted">{{ t('chat.shippingNoticeUi.completedCount') }}</div>
|
||||
<div class="mt-1 text-sm font-semibold text-primary">{{ batchCompletedCount }}</div>
|
||||
</div>
|
||||
<div class="rounded-2xl bg-surface px-3 py-2">
|
||||
<div class="text-muted">{{ t('chat.shippingNoticeUi.pendingCount') }}</div>
|
||||
<div class="mt-1 text-sm font-semibold text-primary">{{ batchPendingCount }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
|
||||
Reference in new issue
Block a user