29 lines
1.4 KiB
Plaintext
29 lines
1.4 KiB
Plaintext
|
|
The file /home/project/src/components/warehouse/ProductList.tsx has been updated. Made 1 replacement.
|
|||
|
|
|
|||
|
|
Here's the result of running `cat -n` on a snippet of the edited file:
|
|||
|
|
29→ onDelete
|
|||
|
|
30→}: ProductListProps) {
|
|||
|
|
31→ const { isMobile } = useResponsive();
|
|||
|
|
32→
|
|||
|
|
33→ // 按名称和克重分组(优先使用 total_weight),无克重的产品直接按名称分组
|
|||
|
|
34→ const groupProductsByNameAndWeight = () => {
|
|||
|
|
35→ const groups: Record<string, Record<string, ProductWithInventory[]>> = {};
|
|||
|
|
36→ products.forEach(product => {
|
|||
|
|
37→ if (!groups[product.product_name]) {
|
|||
|
|
38→ groups[product.product_name] = {};
|
|||
|
|
39→ }
|
|||
|
|
40→ const weight = product.total_weight || product.weight;
|
|||
|
|
41→ // 如果没有克重,使用特殊标记 '__no_weight__'
|
|||
|
|
42→ const weightKey = weight ? String(weight) : '__no_weight__';
|
|||
|
|
43→ if (!groups[product.product_name][weightKey]) {
|
|||
|
|
44→ groups[product.product_name][weightKey] = [];
|
|||
|
|
45→ }
|
|||
|
|
46→ groups[product.product_name][weightKey].push(product);
|
|||
|
|
47→ });
|
|||
|
|
48→ return groups;
|
|||
|
|
49→ };
|
|||
|
|
50→
|
|||
|
|
51→ // 格式化克重显示(含经线/纬线细分)
|
|||
|
|
52→ const formatWeightDisplay = (product: ProductWithInventory) => {
|
|||
|
|
53→ const total = product.total_weight || product.weight;
|
|||
|
|
54→ if (product.warp_weight && product.weft_weight) {
|