Merge pull request 'fix: 修改小结组件不显示赔偿' (#509) from fix_recordSummary into @hera/dev
Reviewed-on: daoyoucloud/tachycode#509
This commit is contained in:
commit
fb1af9a34a
@ -161,10 +161,14 @@ const subtotal = (rule: any, itemData: any, productCategory: any, reqWeightRules
|
|||||||
let unit: string;
|
let unit: string;
|
||||||
if (rule?.conversion_logic_id === ConversionLogics.Keep) {
|
if (rule?.conversion_logic_id === ConversionLogics.Keep) {
|
||||||
count = itemData.count;
|
count = itemData.count;
|
||||||
unit = item ? rule.unit : productCategory.unit;
|
unit = item ? rule.unit || '' : productCategory.unit || '';
|
||||||
} else if (rule?.conversion_logic_id === ConversionLogics.Product) {
|
} else if (rule?.conversion_logic_id === ConversionLogics.Product) {
|
||||||
count = productCategory.convertible ? itemData.count * itemData.product.ratio : itemData.count;
|
count = productCategory.convertible ? itemData.count * itemData.product.ratio : itemData.count;
|
||||||
unit = item ? rule.unit : productCategory.convertible ? productCategory.conversion_unit : productCategory.unit;
|
unit = item
|
||||||
|
? rule.unit || ''
|
||||||
|
: productCategory.convertible
|
||||||
|
? productCategory.conversion_unit || ''
|
||||||
|
: productCategory.unit || '';
|
||||||
} else if (rule?.conversion_logic_id === ConversionLogics.ProductWeight) {
|
} else if (rule?.conversion_logic_id === ConversionLogics.ProductWeight) {
|
||||||
count = item ? itemData.count : (itemData.count * itemData.product.weight) / 1000;
|
count = item ? itemData.count : (itemData.count * itemData.product.weight) / 1000;
|
||||||
unit = '吨';
|
unit = '吨';
|
||||||
@ -181,11 +185,13 @@ const subtotal = (rule: any, itemData: any, productCategory: any, reqWeightRules
|
|||||||
);
|
);
|
||||||
if (!weightRule) return;
|
if (!weightRule) return;
|
||||||
if (weightRule.conversion_logic_id === ConversionLogics.Keep) {
|
if (weightRule.conversion_logic_id === ConversionLogics.Keep) {
|
||||||
count = ((itemData.count || 0) * weightRule.weight) / 1000;
|
count = item ? (itemData.count || 0) * weightRule.weight : ((itemData.count || 0) * weightRule.weight) / 1000;
|
||||||
unit = '吨';
|
unit = '吨';
|
||||||
} else if (weightRule.conversion_logic_id === ConversionLogics.Product) {
|
} else if (weightRule.conversion_logic_id === ConversionLogics.Product) {
|
||||||
const sacl = productCategory.convertible ? itemData.product.ratio : 1;
|
const sacl = productCategory.convertible ? itemData.product.ratio : 1;
|
||||||
count = ((itemData.count || 0) * sacl * weightRule.weight) / 1000;
|
count = item
|
||||||
|
? (itemData.count || 0) * sacl * weightRule.weight
|
||||||
|
: ((itemData.count || 0) * sacl * weightRule.weight) / 1000;
|
||||||
unit = '吨';
|
unit = '吨';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import { CustomComponentType, CustomFC, CustomFunctionComponent } from '@hera/pl
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { formatCurrency, formatQuantity } from '../../utils/currencyUtils';
|
import { formatCurrency, formatQuantity } from '../../utils/currencyUtils';
|
||||||
import { useCachedRequest, useLeaseItems } from '../hooks';
|
import { useCachedRequest, useLeaseItems, useProductFeeItems } from '../hooks';
|
||||||
import { RecordItems } from '../../interfaces/records';
|
import { RecordItems } from '../../interfaces/records';
|
||||||
const cache = [];
|
const cache = [];
|
||||||
export const RecordSummary = observer((): any => {
|
export const RecordSummary = observer((): any => {
|
||||||
@ -75,12 +75,13 @@ export const RecordSummary = observer((): any => {
|
|||||||
// 报价小结
|
// 报价小结
|
||||||
const quoteSummary = {};
|
const quoteSummary = {};
|
||||||
form.values.items?.forEach((item) => {
|
form.values.items?.forEach((item) => {
|
||||||
|
const productCategory = reqProduct.data.data?.find(
|
||||||
|
(product) => product.category_id === item.product?.category_id,
|
||||||
|
)?.category;
|
||||||
|
if (!(JSON.stringify(productCategory?.attr) === `["6"]`)) {
|
||||||
if (!item.product || !item.count) return;
|
if (!item.product || !item.count) return;
|
||||||
const element = _.cloneDeep(item);
|
const element = _.cloneDeep(item);
|
||||||
// 获取产品的分类数据信息
|
// 获取产品的分类数据信息
|
||||||
const productCategory = reqProduct.data.data?.find(
|
|
||||||
(product) => product.category_id === element.product?.category_id,
|
|
||||||
)?.category;
|
|
||||||
if (!productCategory) return;
|
if (!productCategory) return;
|
||||||
element.product.category = productCategory;
|
element.product.category = productCategory;
|
||||||
// 基础小结
|
// 基础小结
|
||||||
@ -124,6 +125,7 @@ export const RecordSummary = observer((): any => {
|
|||||||
calcProductCount(contractSummary, ruleCalc, productCategory);
|
calcProductCount(contractSummary, ruleCalc, productCategory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
summaryProduct['0'] = weight;
|
summaryProduct['0'] = weight;
|
||||||
contractSummary['0'] = contractWeight;
|
contractSummary['0'] = contractWeight;
|
||||||
|
Loading…
Reference in New Issue
Block a user