fix: 修改汇总区块NaN,添加自定义组件的理论重量
This commit is contained in:
		
							parent
							
								
									4bd5a1beda
								
							
						
					
					
						commit
						5ad280a8b3
					
				@ -63,6 +63,7 @@ export const GroupBlock = (props) => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  params?.config?.measures?.forEach((measuresItem) => {
 | 
					  params?.config?.measures?.forEach((measuresItem) => {
 | 
				
			||||||
    const value = measuresItem.fieldFormat.fieldValue;
 | 
					    const value = measuresItem.fieldFormat.fieldValue;
 | 
				
			||||||
 | 
					    if (!data[value]) data[value] = 0;
 | 
				
			||||||
    data[value] = fieldTransformers(measuresItem, data[value]);
 | 
					    data[value] = fieldTransformers(measuresItem, data[value]);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -75,7 +75,7 @@ export const RecordDetails = () => {
 | 
				
			|||||||
      const unit = item.product.category.convertible
 | 
					      const unit = item.product.category.convertible
 | 
				
			||||||
        ? item.product.category.conversion_unit
 | 
					        ? item.product.category.conversion_unit
 | 
				
			||||||
        : item.product.category.unit;
 | 
					        : item.product.category.unit;
 | 
				
			||||||
 | 
					      const weight = count * item.product.weight;
 | 
				
			||||||
      if (productItem[key]) {
 | 
					      if (productItem[key]) {
 | 
				
			||||||
        productItem[key].count += count;
 | 
					        productItem[key].count += count;
 | 
				
			||||||
      } else {
 | 
					      } else {
 | 
				
			||||||
@ -85,13 +85,19 @@ export const RecordDetails = () => {
 | 
				
			|||||||
          sort: item.product.category.sort,
 | 
					          sort: item.product.category.sort,
 | 
				
			||||||
          unit,
 | 
					          unit,
 | 
				
			||||||
          count,
 | 
					          count,
 | 
				
			||||||
 | 
					          weight: formatQuantity(weight, 2) + 'KG',
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    for (const key in productItem) {
 | 
					    for (const key in productItem) {
 | 
				
			||||||
      items.push(productItem[key]);
 | 
					      items.push(productItem[key]);
 | 
				
			||||||
      productItem[key].children = formatQuantity(productItem[key].count, 2) + productItem[key].unit;
 | 
					      productItem[key].children = formatQuantity(productItem[key].count, 2) + productItem[key].unit;
 | 
				
			||||||
      productItem[key].span = 2;
 | 
					      productItem[key].span = 1;
 | 
				
			||||||
 | 
					      items.push({
 | 
				
			||||||
 | 
					        label: '理论重量',
 | 
				
			||||||
 | 
					        children: [productItem[key].weight],
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (key in feeItems) {
 | 
					      if (key in feeItems) {
 | 
				
			||||||
        productItem[key].span = 1;
 | 
					        productItem[key].span = 1;
 | 
				
			||||||
        const children = [];
 | 
					        const children = [];
 | 
				
			||||||
@ -101,11 +107,15 @@ export const RecordDetails = () => {
 | 
				
			|||||||
          }
 | 
					          }
 | 
				
			||||||
          children.push(feeItems[key][feeKey].label + ' ' + formatQuantity(feeItems[key][feeKey].count, 2));
 | 
					          children.push(feeItems[key][feeKey].label + ' ' + formatQuantity(feeItems[key][feeKey].count, 2));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					 | 
				
			||||||
        items.push({
 | 
					        items.push({
 | 
				
			||||||
          label: '维修赔偿',
 | 
					          label: '维修赔偿',
 | 
				
			||||||
          children,
 | 
					          children,
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					      } else {
 | 
				
			||||||
 | 
					        items.push({
 | 
				
			||||||
 | 
					          label: '维修赔偿',
 | 
				
			||||||
 | 
					          children: [''],
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@ -113,7 +123,7 @@ export const RecordDetails = () => {
 | 
				
			|||||||
  if (reqRecordItems.loading || reqRecordItemFeeItems.loading) {
 | 
					  if (reqRecordItems.loading || reqRecordItemFeeItems.loading) {
 | 
				
			||||||
    return <Spin />;
 | 
					    return <Spin />;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return <Descriptions items={items} column={2} />;
 | 
					  return <Descriptions items={items} column={3} />;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RecordDetails.displayName = 'RecordDetails';
 | 
					RecordDetails.displayName = 'RecordDetails';
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user