Merge pull request 'fix: 修改汇总区块NaN,添加自定义组件的理论重量' (#363) from fix_group into @hera/dev

Reviewed-on: daoyoucloud/tachycode#363
Reviewed-by: sealday <zhanglin@daoyoucloud.com>
This commit is contained in:
sealday 2024-03-13 15:26:32 +08:00
commit 7a77536fc1
2 changed files with 15 additions and 4 deletions

View File

@ -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]);
}); });

View File

@ -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';