This commit is contained in:
wujinliang
2026-08-26 15:32:22 +08:00
parent 627b9602d1
commit a67f6300f8
5 changed files with 30 additions and 10 deletions
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue'
import { computed, onMounted, ref, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { FileUp } from '@lucide/vue'
import { ElMessage, type UploadFile } from 'element-plus'
@@ -28,13 +28,16 @@ const customsDialogOpen = ref(false)
const customsFile = ref<File | null>(null)
const customsSaving = ref(false)
const customsError = ref<ApiErrorDetails | null>(null)
let loadSequence = 0
const planId = computed(() => String(route.params.planId || ''))
const warehouseId = computed(() => typeof route.query.warehouseId === 'string' ? route.query.warehouseId : '')
const canManageCustoms = computed(() => access.can('platform:firstleg:customs:manage'))
async function loadDetail() {
const sequence = ++loadSequence
detail.value = null
if (!planId.value || !warehouseId.value) {
detail.value = null
loading.value = false
error.value = { code: 'MISSING_WAREHOUSE_CONTEXT', message: '该清单缺少所属仓库信息,无法安全查询详情,请返回列表重新进入。' }
return
}
@@ -49,17 +52,18 @@ async function loadDetail() {
throw cause
}),
])
if (sequence !== loadSequence) return
if (result.summary.status !== 'COMPLETED') {
detail.value = null
error.value = { code: 'MODE_STATUS_MISMATCH', message: '该计划尚未形成正式装柜清单,请从预装清单入口查看。' }
return
}
detail.value = { ...result, customsDocument }
} catch (cause) {
if (sequence !== loadSequence) return
detail.value = null
error.value = getApiErrorDetails(cause, '装柜清单详情加载失败,请稍后重试')
} finally {
loading.value = false
if (sequence === loadSequence) loading.value = false
}
}
@@ -129,6 +133,7 @@ async function completeCustomsDocument() {
}
onMounted(() => void loadDetail())
watch([planId, warehouseId], () => void loadDetail())
</script>
<template>