From a19a8f03f5195ff274cf06eceb17598522d32307 Mon Sep 17 00:00:00 2001
From: liuyihe <2513762445@qq.com>
Date: Mon, 10 Aug 2026 20:53:48 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../container-loading/pages/ContainersView.vue | 2 +-
.../pages/GlobalSmartLoadingView.test.ts | 18 ++++++++++++++++++
.../pages/GlobalSmartLoadingView.vue | 16 +++++++++-------
3 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/src/modules/container-loading/pages/ContainersView.vue b/src/modules/container-loading/pages/ContainersView.vue
index 5e15ac3c..71bcf161 100644
--- a/src/modules/container-loading/pages/ContainersView.vue
+++ b/src/modules/container-loading/pages/ContainersView.vue
@@ -196,7 +196,7 @@ onMounted(() => { void Promise.all([loadWarehouses(), loadRows()]) })
新增货柜
-
+
{{ row.cabinetNo }}{{ row.bookingNo }}
{{ row.containerNo || '待录入' }}
{{ statusText(row.planStatus) }}
diff --git a/src/modules/container-loading/pages/GlobalSmartLoadingView.test.ts b/src/modules/container-loading/pages/GlobalSmartLoadingView.test.ts
index 6d1ccb05..4713b7d0 100644
--- a/src/modules/container-loading/pages/GlobalSmartLoadingView.test.ts
+++ b/src/modules/container-loading/pages/GlobalSmartLoadingView.test.ts
@@ -82,6 +82,24 @@ describe('GlobalSmartLoadingView', () => {
expect(wrapper.text()).toContain('CB-1 装柜方案')
})
+ it('keeps loading containers editable and hides completed containers', async () => {
+ const loadingContainer = { ...container, id: '9007199254740995', cabinetNo: 'CB-LOADING', planStatus: 'LOADING' as const }
+ const completedContainer = { ...container, id: '9007199254740996', cabinetNo: 'CB-COMPLETED', planStatus: 'COMPLETED' as const }
+ vi.mocked(listContainers).mockResolvedValue({ records: [completedContainer, loadingContainer], page: 1, size: 100, total: 2, pages: 1 })
+ vi.mocked(getSmartLoadingPlanByBooking).mockResolvedValue({ ...plan, bookingId: loadingContainer.id, status: 'LOADING' })
+
+ const wrapper = mount(GlobalSmartLoadingView, { global: { plugins: [ElementPlus] } })
+ await flushPromises()
+
+ expect(getSmartLoadingPlanByBooking).toHaveBeenCalledWith(loadingContainer.id)
+ expect(wrapper.text()).toContain('CB-LOADING')
+ expect(wrapper.text()).toContain('装柜中')
+ expect(wrapper.text()).not.toContain('CB-COMPLETED')
+ expect(wrapper.text()).toContain('智能推荐')
+ expect(wrapper.text()).toContain('加入')
+ expect(wrapper.text()).not.toContain('推送预装')
+ })
+
it('refreshes the latest plan after A0409 without losing the selected container', async () => {
const wrapper = mount(GlobalSmartLoadingView, { global: { plugins: [ElementPlus] } })
await flushPromises()
diff --git a/src/modules/container-loading/pages/GlobalSmartLoadingView.vue b/src/modules/container-loading/pages/GlobalSmartLoadingView.vue
index def8c584..7a2520e8 100644
--- a/src/modules/container-loading/pages/GlobalSmartLoadingView.vue
+++ b/src/modules/container-loading/pages/GlobalSmartLoadingView.vue
@@ -54,7 +54,7 @@ const canAssign = computed(() => access.can('platform:firstleg:smart-loading:ass
const canDelete = computed(() => access.can('platform:firstleg:smart-loading:delete'))
const canPush = computed(() => access.can('platform:firstleg:smart-loading:push'))
const selectedContainer = computed(() => containers.value.find((item) => item.id === selectedContainerId.value) || null)
-const editable = computed(() => plan.value?.status === 'EDITING')
+const editable = computed(() => plan.value?.status === 'EDITING' || plan.value?.status === 'LOADING')
const assignedDetailIds = computed(() => new Set((plan.value?.items || []).map((item) => item.inboundDetailId)))
const totalPackages = computed(() => (plan.value?.items || []).reduce((sum, item) => sum + Number(item.packageCount || 0), 0))
const totalVolume = computed(() => (plan.value?.items || []).reduce((sum, item) => sum + Number(item.volumeCbm || 0), 0))
@@ -75,8 +75,7 @@ const queryFields = computed(() => [
{ key: 'warehouseId', type: 'select', label: '装柜仓库', options: warehouseOptions.value, width: 190 },
{ key: 'status', type: 'select', label: '柜次状态', width: 160, options: [
{ label: '可编辑', value: 'EDITING' },
- { label: '已推送预装', value: 'LOADING' },
- { label: '已完成', value: 'COMPLETED' },
+ { label: '装柜中', value: 'LOADING' },
] },
])
@@ -85,6 +84,7 @@ const filteredContainers = computed(() => {
const warehouseId = String(appliedQuery.value.warehouseId || '')
const status = String(appliedQuery.value.status || '')
return containers.value.filter((item) => {
+ if (item.planStatus === 'COMPLETED') return false
if (warehouseId && item.warehouseId !== warehouseId) return false
if (status && item.planStatus !== status) return false
if (!keyword) return true
@@ -131,7 +131,7 @@ function formatNumber(value: number, digits = 3) {
function candidateRow(source: object) { return source as SmartLoadingCandidate }
function itemRow(source: object) { return source as SmartLoadingItem }
function statusLabel(status: ContainerPlanStatus) {
- return ({ EDITING: '可编辑', LOADING: '已推送预装', COMPLETED: '已完成' } as const)[status]
+ return ({ EDITING: '可编辑', LOADING: '装柜中', COMPLETED: '已完成' } as const)[status]
}
function statusType(status: ContainerPlanStatus) {
return status === 'EDITING' ? 'primary' : status === 'LOADING' ? 'warning' : 'success'
@@ -197,7 +197,9 @@ async function load() {
const remainingPages = firstPage.pages > 1
? await Promise.all(Array.from({ length: firstPage.pages - 1 }, (_, index) => listContainers({ page: index + 2, size: 100 })))
: []
- containers.value = [firstPage, ...remainingPages].flatMap((page) => page.records)
+ containers.value = [firstPage, ...remainingPages]
+ .flatMap((page) => page.records)
+ .filter((item) => item.planStatus !== 'COMPLETED')
if (!filteredContainers.value.some((item) => item.id === selectedContainerId.value)) selectedContainerId.value = preferredContainerId()
await loadSelectedData()
} catch (error) {
@@ -371,7 +373,7 @@ onMounted(load)