Files
KCGL/inventory-web
yueli ce767e39ac feat(scan): 扫码时检测单据失效,避免白扫一场
场景
----
库管正在扫码,这张单被撤回/驳回/执行了。若不检测,库管会一直扫到
提交时才发现单据已作废(后端会拒绝),前面的工作白做。

实现
----
新增 checkRequestStillValid():重新拉一次「已通过(status=1)」列表,
看当前单据是否还在其中。不在 → 已被撤回/驳回/执行,立即弹窗告知并
清空界面(草稿后端也已同步清除)。复用现有列表接口,无需新增端点。

触发时机(覆盖两类场景):
  · 页面重新可见时(visibilitychange)—— PDA 熄屏唤醒、切回标签页
  · 每 60 秒一次 —— 库管一直在页面上扫、没切走

三点取舍:
  · 仅购物车非空时检测(正在作业才打扰),空清单不发请求;
  · 60 秒轮询而非实时推送 —— 引入 WebSocket 长连接成本过高,
    此处最多浪费 1 分钟扫码,相比"扫完几十分钟才发现"已足够;
  · 检测失败不阻断作业(仅 console.warn)—— 后端提交时仍会做最终校验,
    前端检测是为了早发现,不是安全防线。

出库 create.vue 与借库 borrow.vue 两页同款实现。
2026-09-11 09:06:51 +08:00
..
2026-01-28 17:44:39 +08:00
2026-01-26 13:47:53 +08:00
2026-01-26 13:47:53 +08:00
2026-01-26 13:47:53 +08:00
2026-01-26 13:47:53 +08:00

Vue 3 + TypeScript + Vite

This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 <script setup> SFCs, check out the script setup docs to learn more.

Learn more about the recommended Project Setup and IDE Support in the Vue Docs TypeScript Guide.