fix(stocktake): auto-refresh inventory drafts silently after scanning to ensure real-time outer stats
This commit is contained in:
@ -889,6 +889,8 @@ const syncToBackend = (uuid: string, quantity: number, remark: string) => {
|
||||
api.addDraft({ uuid, quantity, remark })
|
||||
.then(() => {
|
||||
syncStatus.value = 'success'
|
||||
// 静默刷新统计数字
|
||||
fetchInventoryList(true)
|
||||
})
|
||||
.catch(() => {
|
||||
syncStatus.value = 'failed'
|
||||
@ -970,8 +972,9 @@ const filteredVarianceList = computed(() => {
|
||||
})
|
||||
|
||||
// ★ 新增: 获取盘点清单数据(合并全量应盘物资 + 已盘点记录)
|
||||
const fetchInventoryList = async () => {
|
||||
listLoading.value = true
|
||||
// silent: 是否静默模式(不显示 loading,不报错)
|
||||
const fetchInventoryList = async (silent = false) => {
|
||||
if (!silent) listLoading.value = true
|
||||
try {
|
||||
// 1. 获取已盘点记录
|
||||
const res: any = await request({
|
||||
@ -983,9 +986,9 @@ const fetchInventoryList = async () => {
|
||||
keyword: listKeyword.value
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
const scannedDrafts = res?.items || []
|
||||
|
||||
|
||||
// 保存全量草稿记录用于全局统计
|
||||
allScannedDrafts.value = scannedDrafts
|
||||
|
||||
@ -1034,9 +1037,9 @@ const fetchInventoryList = async () => {
|
||||
listData.value = mergedData.slice(start, start + listLimit.value)
|
||||
|
||||
} catch (e) {
|
||||
ElMessage.error('获取盘点清单失败')
|
||||
if (!silent) ElMessage.error('获取盘点清单失败')
|
||||
} finally {
|
||||
listLoading.value = false
|
||||
if (!silent) listLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user