import { ElMessageBox } from 'element-plus' // 统一二次确认工具(需求6): // 所有「单次、不可逆、影响面大」的操作——新建 / 编辑 / 保存 / 删除 / 停用启用 / 差异写回 / 批量导入—— // 都必须先弹此确认框,且 message 需回显影响范围(对象、数量、区域等摘要)。 // 高频连续操作(连续扫码入库、工位报工、叫料)不使用本工具,避免打断作业。 // // 用法: // if (!(await confirmAction('确认删除物料「X」?将影响 N 条库存记录。', '删除确认'))) return // await doDelete() export async function confirmAction(message, title = '操作确认', options = {}) { try { await ElMessageBox.confirm(message, title, { type: 'warning', confirmButtonText: '确认', cancelButtonText: '取消', ...options }) return true } catch { return false } } export default confirmAction