feat: fix table alignment in product view and implement self-service password update with role masking

This commit is contained in:
DXC
2026-03-23 11:41:09 +08:00
parent f701ed7fc8
commit ec5331ffb3
4 changed files with 393 additions and 44 deletions

View File

@ -142,6 +142,7 @@
highlight-current-row
header-cell-class-name="table-header-gray"
@sort-change="handleSortChange"
:key="hasColumnPermission('sn_bn') ? 'sn' : 'nosn'"
>
<template v-for="col in allColumns" :key="col.prop">
<el-table-column
@ -818,7 +819,7 @@ const displayData = computed(() => {
const key = `${item.sku || ''}_${item.spec_model || item.spec || ''}`
if (aggMap.has(key)) {
const existing = aggMap.get(key)
// 累加库存数量
// 累加库存数量(原地修改已拷贝的对象,不影响原始数据)
existing.qty_stock = (existing.qty_stock || 0) + (item.qty_stock || 0)
existing.qty_available = (existing.qty_available || 0) + (item.qty_available || 0)
existing.stock_quantity = (existing.stock_quantity || 0) + (item.stock_quantity || 0)
@ -829,7 +830,9 @@ const displayData = computed(() => {
existing.raw_material_cost = (existing.raw_material_cost || 0) + (item.raw_material_cost || 0)
existing.unit_total_cost = (existing.unit_total_cost || 0) + (item.unit_total_cost || 0)
} else {
aggMap.set(key, { ...item })
// 【关键修复】使用 Object.assign 深拷贝第一条记录的所有字段,
// 绝不能只保留 sku 和 qty否则其他列公司/名称/规格等)会读不到数据
aggMap.set(key, Object.assign({}, item))
}
}
return Array.from(aggMap.values())