From 865a1281002374f503a35c9099d89df53466a2aa Mon Sep 17 00:00:00 2001 From: zhouz <> Date: Wed, 22 Jul 2026 13:38:14 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"fix:=20storId=20=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E8=BF=BD=E8=B8=AA=20=E2=80=94=20=E7=94=A8=20onChange=20+=20sel?= =?UTF-8?q?ectedStorId=20ref=20+=20fallback"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 890edbc948c368786e65ee74500a9886b4b9aba1. --- .../src/views/wms/iostorinv/modules/form.vue | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/wms/iostorinv/modules/form.vue b/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/wms/iostorinv/modules/form.vue index 51a00748..b9fa52c6 100644 --- a/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/wms/iostorinv/modules/form.vue +++ b/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/wms/iostorinv/modules/form.vue @@ -61,9 +61,6 @@ const [Form, formApi] = useVbenForm({ options: storOptions, placeholder: '请选择仓库', fieldNames: { label: 'label', value: 'value' }, - onChange: (val: string) => { - selectedStorId.value = val || ''; - }, }, }, { @@ -135,14 +132,14 @@ function updateSummary() { }); } -// 当前选中的仓库 ID(独立追踪,避免 formApi.getValues() 拿到旧值) -const selectedStorId = ref(''); - // 仓库切换 → 清空明细 -watch(selectedStorId, () => { - detailList.value = []; - updateSummary(); -}); +watch( + () => formApi.getValues().storId, + () => { + detailList.value = []; + updateSummary(); + }, +); function handleDeleteDetail(index: number) { detailList.value.splice(index, 1); @@ -153,10 +150,7 @@ function handleDeleteDetail(index: number) { const inventorySelectRef = ref(); function handleSelectFromInventory() { - let storId = selectedStorId.value; - if (!storId) { - storId = formApi.getValues().storId; // fallback - } + const storId = formApi.getValues().storId; if (!storId) { message.warning('请先选择仓库'); return;