Revert "fix: storId 选择追踪 — 用 onChange + selectedStorId ref + fallback"
This reverts commit 890edbc948.
This commit is contained in:
@@ -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<any>();
|
||||
|
||||
function handleSelectFromInventory() {
|
||||
let storId = selectedStorId.value;
|
||||
if (!storId) {
|
||||
storId = formApi.getValues().storId; // fallback
|
||||
}
|
||||
const storId = formApi.getValues().storId;
|
||||
if (!storId) {
|
||||
message.warning('请先选择仓库');
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user