原 handleQuantityChange 只发请求,不回写 diff_qty,差异列要重新打开抽屉
才会刷新。
现改为在发请求的同时本地计算:
row.diff_qty = val - row.stock_qty (保留 4 位小数,与后端 round 一致,
避免浮点尾差显示成 4.999999999)
★ 盲盘保护:后端在 blind 模式下把 stock_qty 置为 null(绝不下发账面数),
此时**完全跳过**减法,保持 diff_qty 原状(null → 渲染为「—」)。
若不判断,null 参与运算会算出错误差异,等于从 UI 侧绕过了盲盘限制。
请求失败时原有的 fetchInventoryList() 会拉回服务端数据,本地算出的差异
随之被覆盖,不会留下错误值。
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.