Files
KCGL/inventory-web
yueli 1aa31334b1 fix(scrap): 报废申请页搜索/选择解耦,审批人常驻必填
一、搜索丢失已选(核心 bug)
主表格 :data="stockList" 同时充当搜索结果与选择容器。Element Plus 的
setData 在 reserveSelection 为假时走 clearSelection(),进而 emit
selection-change([]),故每次重新搜索都会清空选中态、「已选 N 条」归零。
(源码路径:table/src/store/index.mjs:34-52 → store/watcher.mjs:145-152)

改为「购物车 + 选择弹窗」结构,对齐出库选单页:
  · 主表格数据源改为 cart(已选清单),删除复选列,改「移除」按钮;
  · 新增「选择库存物品」弹窗,搜索框移入其中;
  · 表格 row-key + :reserve-selection="true",跨搜索/翻页保留勾选;
  · 点行勾选、改数量自动勾选、数字框 @click.stop 防冒泡反转勾选;
  · 服务端搜索(350ms 防抖)+ 分页 20/50/100/200;
  · uniqueKey 取 source_table_id(三表主键各自独立,必须带表名前缀)。

二、审批人字段不显示
原为 v-if="approvalVisible",仅库管代建或命中需审批物料时才渲染。
因全库仅 1 个物料标记 is_approval_required,该条件几乎从不成立。
现改为常驻,并用 el-form rules 声明 approver_id / remark 双必填;
打开弹窗即调用 checkScrapApproval 预检并展示提示文案。

三、顺带修复
库位列此前恒为空:三张库存表 to_dict 只输出 warehouse_loc,而模板绑定
warehouse_location。已在 loadStockList 中归一化。

SFC 编译与 vue-tsc 通过,无新增类型错误。
2026-09-10 11:32:56 +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.