This commit is contained in:
2026-08-07 20:07:37 +08:00
parent 28d0b81c5a
commit 99413ee155
27 changed files with 1065 additions and 595 deletions
@@ -61,6 +61,7 @@ const actionLoadingIds = ref(new Set<string>())
const formRef = ref<FormInstance>()
let warehouseLoadSequence = 0
let locationLoadSequence = 0
let drawerLoadSequence = 0
const filters = ref<LocationFilters>({ warehouseId: '', zoneCode: '', locationCode: '', locationType: '', status: '' })
const appliedFilters = ref<AppliedLocationFilters>({ warehouseId: '', zoneCode: '', locationCode: '', locationType: '', status: '' })
@@ -335,6 +336,7 @@ async function loadDetail(row: PlatformLocationResource, mode: 'view' | 'edit')
ElMessage.warning('仅支持编辑国内仓库位')
return
}
const sequence = ++drawerLoadSequence
const scope = recordScope(row)
drawerMode.value = mode
drawerOpen.value = true
@@ -343,6 +345,7 @@ async function loadDetail(row: PlatformLocationResource, mode: 'view' | 'edit')
detail.value = null
try {
const result = await getPlatformLocation(scope.warehouseId, row.id)
if (sequence !== drawerLoadSequence || !drawerOpen.value) return
detail.value = result
if (mode === 'edit') {
assignForm(result.location)
@@ -350,9 +353,10 @@ async function loadDetail(row: PlatformLocationResource, mode: 'view' | 'edit')
void formRef.value?.clearValidate()
}
} catch (error) {
if (sequence !== drawerLoadSequence) return
drawerError.value = getApiErrorDetails(error, '库位详情加载失败,请稍后重试')
} finally {
drawerLoading.value = false
if (sequence === drawerLoadSequence) drawerLoading.value = false
}
}
@@ -475,6 +479,13 @@ watch(
)
watch([page, pageSize], () => { void loadLocations() })
watch(drawerOpen, (open) => {
if (open) return
drawerLoadSequence += 1
drawerLoading.value = false
drawerError.value = null
detail.value = null
})
watch(() => form.warehouseId, (warehouseId) => {
if (drawerMode.value !== 'create') return
const warehouse = warehouses.value.find((item) => String(item.id) === warehouseId)