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 () => {