From 851c3a9c1f366ac3fcaf43757d6fb934288864ce Mon Sep 17 00:00:00 2001 From: yueli Date: Thu, 10 Sep 2026 15:57:15 +0800 Subject: [PATCH] =?UTF-8?q?feat(my-requests):=20=E4=B8=BB=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=B1=95=E7=A4=BA=E6=95=B0=E9=87=8F=EF=BC=8C=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E7=B1=BB=E5=9E=8B=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 问题 ---- 主列表只有「物料数 N 种」(种类数),具体数量藏在展开行的明细表里, 不展开就看不到。 改动 ---- · 移除「类型」列(type_label); · 新增「数量」列,紧跟申请单号,橙色加粗; · 新增 totalQty() 汇总单据总数量。 totalQty 只认 quantity 字段,无需按 type 分支 —— 因为聚合端点已做字段 归一化(报废的 scrap_qty → quantity)。这正是当初做归一化的价值。 数值经 Number(sum.toFixed(4)) 处理,去掉 1.0000 这类无意义的小数尾巴。 顺带移除已无引用的 typeTagType()。 --- inventory-web/src/views/my-requests/index.vue | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/inventory-web/src/views/my-requests/index.vue b/inventory-web/src/views/my-requests/index.vue index a3053ee..27edaeb 100644 --- a/inventory-web/src/views/my-requests/index.vue +++ b/inventory-web/src/views/my-requests/index.vue @@ -49,14 +49,18 @@ - + + + + - - @@ -158,11 +162,16 @@ const statusTagType = (s: number) => { } return map[s] ?? 'info' } -const typeTagType = (t: string) => { - const map: Record = { - outbound: 'primary', borrow: 'warning', scrap: 'danger', - } - return map[t] || 'info' +// 单据的总数量 = 各明细数量之和 +// +// 数量字段已由后端归一化(报废的 scrap_qty → quantity),此处只认 quantity, +// 无需按 type 分支处理 —— 这正是聚合端点做字段归一化的意义。 +const totalQty = (row: any): string => { + const items = row?.items || [] + if (!items.length) return '-' + const sum = items.reduce((acc: number, it: any) => acc + (Number(it.quantity) || 0), 0) + // 去掉无意义的小数尾巴(1.0000 → 1) + return String(Number(sum.toFixed(4))) } const fetchData = async () => {