From 5ec724188ebc1fc8e8c1ed39ddb39589781b4abd Mon Sep 17 00:00:00 2001 From: MSuMshk <2039814060@qq.com> Date: Thu, 26 Feb 2026 12:34:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E9=A6=96=E5=BC=80=E9=97=A8=E5=BA=97=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../batch/composables/useProductBatchPage.ts | 20 +++++++++++++++---- .../src/views/product/batch/index.vue | 8 ++++++-- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/apps/web-antd/src/views/product/batch/composables/useProductBatchPage.ts b/apps/web-antd/src/views/product/batch/composables/useProductBatchPage.ts index c838d04..8945381 100644 --- a/apps/web-antd/src/views/product/batch/composables/useProductBatchPage.ts +++ b/apps/web-antd/src/views/product/batch/composables/useProductBatchPage.ts @@ -1,4 +1,4 @@ -import { computed, onMounted, ref, watch } from 'vue'; +import { computed, onActivated, onMounted, ref, watch } from 'vue'; import type { StoreListItemDto } from '#/api/store'; @@ -171,6 +171,10 @@ export function useProductBatchPage() { importFile.value = file; } + async function ensureStoresLoaded() { + await loadStores(); + } + watch(selectedStoreId, () => { scopeType.value = 'all'; scopeCategoryIds.value = []; @@ -190,11 +194,11 @@ export function useProductBatchPage() { }); watch([scopeType, scopeCategoryIds, scopeProductIds], () => { - if (scopeType.value !== 'category') { + if (scopeType.value !== 'category' && scopeCategoryIds.value.length > 0) { scopeCategoryIds.value = []; } - if (scopeType.value !== 'manual') { + if (scopeType.value !== 'manual' && scopeProductIds.value.length > 0) { scopeProductIds.value = []; } }); @@ -205,7 +209,15 @@ export function useProductBatchPage() { } }); - onMounted(loadStores); + onMounted(() => { + void ensureStoresLoaded(); + }); + + onActivated(() => { + if (stores.value.length === 0 || !selectedStoreId.value) { + void ensureStoresLoaded(); + } + }); return { activeTool, diff --git a/apps/web-antd/src/views/product/batch/index.vue b/apps/web-antd/src/views/product/batch/index.vue index ec1e1c5..c903d9f 100644 --- a/apps/web-antd/src/views/product/batch/index.vue +++ b/apps/web-antd/src/views/product/batch/index.vue @@ -1,7 +1,7 @@