From 5ad280a8b363db594d0d3797ff53adcef396eb4a Mon Sep 17 00:00:00 2001 From: wjh Date: Wed, 13 Mar 2024 15:07:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=B1=87=E6=80=BB?= =?UTF-8?q?=E5=8C=BA=E5=9D=97NaN=EF=BC=8C=E6=B7=BB=E5=8A=A0=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E7=BB=84=E4=BB=B6=E7=9A=84=E7=90=86=E8=AE=BA?= =?UTF-8?q?=E9=87=8D=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/schema-components/GroupBlock.tsx | 1 + .../client/custom-components/RecordDetails.tsx | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/packages/plugins/@hera/plugin-core/src/client/schema-components/GroupBlock.tsx b/packages/plugins/@hera/plugin-core/src/client/schema-components/GroupBlock.tsx index 168573b22..1880ed6fd 100644 --- a/packages/plugins/@hera/plugin-core/src/client/schema-components/GroupBlock.tsx +++ b/packages/plugins/@hera/plugin-core/src/client/schema-components/GroupBlock.tsx @@ -63,6 +63,7 @@ export const GroupBlock = (props) => { params?.config?.measures?.forEach((measuresItem) => { const value = measuresItem.fieldFormat.fieldValue; + if (!data[value]) data[value] = 0; data[value] = fieldTransformers(measuresItem, data[value]); }); diff --git a/packages/plugins/@hera/plugin-rental/src/client/custom-components/RecordDetails.tsx b/packages/plugins/@hera/plugin-rental/src/client/custom-components/RecordDetails.tsx index 94476fd99..7a4891415 100644 --- a/packages/plugins/@hera/plugin-rental/src/client/custom-components/RecordDetails.tsx +++ b/packages/plugins/@hera/plugin-rental/src/client/custom-components/RecordDetails.tsx @@ -75,7 +75,7 @@ export const RecordDetails = () => { const unit = item.product.category.convertible ? item.product.category.conversion_unit : item.product.category.unit; - + const weight = count * item.product.weight; if (productItem[key]) { productItem[key].count += count; } else { @@ -85,13 +85,19 @@ export const RecordDetails = () => { sort: item.product.category.sort, unit, count, + weight: formatQuantity(weight, 2) + 'KG', }; } }); for (const key in productItem) { items.push(productItem[key]); 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) { productItem[key].span = 1; const children = []; @@ -101,11 +107,15 @@ export const RecordDetails = () => { } children.push(feeItems[key][feeKey].label + ' ' + formatQuantity(feeItems[key][feeKey].count, 2)); } - items.push({ label: '维修赔偿', children, }); + } else { + items.push({ + label: '维修赔偿', + children: [''], + }); } } } @@ -113,7 +123,7 @@ export const RecordDetails = () => { if (reqRecordItems.loading || reqRecordItemFeeItems.loading) { return ; } - return ; + return ; }; RecordDetails.displayName = 'RecordDetails';