fix(stocktake): fetch inventory baseline immediately upon session start to show correct initial stats
This commit is contained in:
@ -79,7 +79,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="stats-dashboard" @click="openInventoryList">
|
||||
<div class="stats-dashboard" @click="openInventoryList" v-loading="listLoading">
|
||||
<div class="stat-card">
|
||||
<div class="stat-val">{{ stats.total }}</div>
|
||||
<div class="stat-label">总品项</div>
|
||||
@ -625,6 +625,9 @@ const doStartNewSession = async () => {
|
||||
isSessionActive.value = true
|
||||
// ★ 标记当前阶段为 scanning(扫码中)
|
||||
localStorage.setItem('stocktake_phase', 'scanning')
|
||||
// ★ 立即加载统计基数
|
||||
await fetchAllStockItems()
|
||||
await fetchInventoryList()
|
||||
ElMessage.success('新盘点会话已开始')
|
||||
} catch (e: any) {
|
||||
if (e !== 'cancel') {
|
||||
@ -674,6 +677,10 @@ const resumeSession = async () => {
|
||||
// 直接恢复会话状态
|
||||
isSessionActive.value = true
|
||||
|
||||
// ★ 立即加载统计基数
|
||||
await fetchAllStockItems()
|
||||
await fetchInventoryList()
|
||||
|
||||
// ★ 智能路由:根据本地记忆的阶段决定下一步
|
||||
const phase = localStorage.getItem('stocktake_phase')
|
||||
if (phase === 'review') {
|
||||
@ -1039,9 +1046,10 @@ const openInventoryList = async () => {
|
||||
listPage.value = 1
|
||||
listKeyword.value = ''
|
||||
listStatusFilter.value = 'all'
|
||||
// 获取盘点基数(应盘物资清单)
|
||||
await fetchAllStockItems()
|
||||
// 获取已盘点列表
|
||||
// 如果基数未加载则先加载,否则只刷新已盘点记录
|
||||
if (allStockItems.value.length === 0) {
|
||||
await fetchAllStockItems()
|
||||
}
|
||||
await fetchInventoryList()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user