diff --git a/inventory-web/src/views/stock/stocktake/index.vue b/inventory-web/src/views/stock/stocktake/index.vue index d8a00cc..d23978b 100644 --- a/inventory-web/src/views/stock/stocktake/index.vue +++ b/inventory-web/src/views/stock/stocktake/index.vue @@ -843,9 +843,15 @@ const varianceList = computed(() => { }) const openInventoryList = () => { showList.value = true } + +// ★ 修改:结束盘点按钮直接调用 finishStocktake,跳过二次确认弹窗 const openFinishDialog = () => { - if (stats.value.total === 0) return - showFinishDialog.value = true + if (stats.value.total === 0) { + ElMessage.warning('暂无盘点数据') + return + } + // 直接执行结束盘点流程 + finishStocktake() } const finishStocktake = async () => { @@ -860,14 +866,11 @@ const finishStocktake = async () => { btnLoading.value = false try { - console.log('--- [结束盘点] 2. 准备弹窗确认 ---') - await ElMessageBox.confirm('确定要结束本次盘点吗?结束后将进入差异审核流程。', '结束确认', { - type: 'warning', confirmButtonText: '确定结束', cancelButtonText: '取消' - }) - console.log('--- [结束盘点] 3. 用户确认结束盘点 ---') + // ★ 简化流程:用户已在按钮点击时确认过,直接执行结束 + console.log('--- [结束盘点] 2. 开始执行结束盘点 ---') printing.value = true - console.log('--- [结束盘点] 4. 开始调用 API, session_id:', currentSessionId.value) + console.log('--- [结束盘点] 3. 开始调用 API, session_id:', currentSessionId.value) // 调用结束盘点 API const res: any = await api.finishStocktake() @@ -877,19 +880,19 @@ const finishStocktake = async () => { scannedMap.value.clear() isSessionActive.value = false showFinishDialog.value = false - console.log('--- [结束盘点] 6. 会话已清理 ---') + console.log('--- [结束盘点] 4. 会话已清理 ---') // 刷新服务器草稿计数 await checkServerDraft() - console.log('--- [结束盘点] 7. 草稿计数已刷新 ---') + console.log('--- [结束盘点] 5. 草稿计数已刷新 ---') ElMessage.success('盘点已结束,请查看差异报告进行审核') - console.log('--- [结束盘点] 8. 成功提示已显示 ---') + console.log('--- [结束盘点] 6. 成功提示已显示 ---') // ====== 强行打开差异审核对话框 ====== - console.log('--- [结束盘点] 9. 准备打开差异面板 ---') + console.log('--- [结束盘点] 7. 准备打开差异面板 ---') showVarianceDialog.value = true - console.log('--- [结束盘点] 10. showVarianceDialog 已设为 true ---') + console.log('--- [结束盘点] 8. showVarianceDialog 已设为 true ---') } catch (e: any) { console.error('--- [结束盘点] 捕获异常:', e) @@ -905,7 +908,7 @@ const finishStocktake = async () => { } finally { printing.value = false btnLoading.value = false - console.log('--- [结束盘点] 11. finally 块执行完成,loading 已重置 ---') + console.log('--- [结束盘点] 9. finally 块执行完成,loading 已重置 ---') } }