diff --git a/inventory-web/src/views/stock/stocktake/index.vue b/inventory-web/src/views/stock/stocktake/index.vue index f8b9277..d3705fb 100644 --- a/inventory-web/src/views/stock/stocktake/index.vue +++ b/inventory-web/src/views/stock/stocktake/index.vue @@ -666,24 +666,16 @@ const resumeSession = async () => { }) const total = res?.total || 0 + const firstDraft = res?.items?.[0] - if (total === 0) { + if (total === 0 || !firstDraft) { ElMessage.warning('没有找到未完成的盘点记录') return } - // ★ 获取实际草稿数据用于恢复(分页加载,单次最多500条) - const fullRes = await request({ - url: '/v1/inbound/stock/draft/list', - method: 'get', - params: { page: 1, limit: 500 } - }) - const drafts = fullRes?.items || [] - - // 恢复已扫描的数据 - 简化为直接激活会话 - // 从草稿中获取 session_id - const sessionIds = [...new Set(drafts.map((d: any) => d.session_id))] - currentSessionId.value = sessionIds[0] + // ★ 直接从第一条草稿恢复 session_id,不再拉取全量草稿 + // 避免 limit=500 请求触发后端 query.all() + N+1 性能瓶颈 + currentSessionId.value = firstDraft.session_id || '' // 直接恢复会话状态 isSessionActive.value = true