1、调整业务模块

This commit is contained in:
2026-09-02 03:22:51 +08:00
parent 80a15fc626
commit 252df72f87
19 changed files with 1354 additions and 177 deletions
+63 -4
View File
@@ -207,6 +207,26 @@ const getFirstValue = (row, props) => {
const getGoodsRows = row => parseJsonArray(row.goodsList || row.goodsRows || row.goodsJson);
const getDetailedGoodsRows = row => {
const goodsRows = [
row.goodsJson,
row.goodsList,
row.goodsRows,
row.cargoList,
row.cargoRows,
row.goods,
]
.map(source => {
if (source === undefined || source === null || source === '') return [];
if (Array.isArray(source)) return source;
if (typeof source === 'object') return [source];
return parseJsonArray(source);
})
.filter(source => source.length)
.sort((left, right) => right.length - left.length);
return goodsRows[0] || [];
};
const getBillingRows = row => {
const freightRows = parseJsonArray(row.freightList || row.freightRows || row.freightJson);
if (freightRows.length) return freightRows;
@@ -218,9 +238,25 @@ const getBillingRows = row => {
const joinText = list => list.filter(item => !isEmpty(item)).join('/');
const formatGoodsInfo = row => {
const goodsRows = [
row.goodsJson,
row.goodsList,
row.goodsRows,
row.cargoList,
row.cargoRows,
row.goods,
]
.map(source => {
if (source === undefined || source === null || source === '') return [];
if (Array.isArray(source)) return source;
if (typeof source === 'object') return [source];
return parseJsonArray(source);
})
.filter(source => source.length)
.sort((left, right) => right.length - left.length)[0] || [];
const text = getFirstValue(row, ['goodsInfo', 'cargoInfo']);
if (text) return text;
return getGoodsRows(row)
if (!goodsRows.length) return text || '';
return goodsRows
.map(item => {
const name = getFirstValue(item, ['cargoName', 'goodsName', 'name']);
const type = getFirstValue(item, ['cargoType', 'goodsType', 'typeName']);
@@ -228,12 +264,13 @@ const formatGoodsInfo = row => {
normalizeNumericDisplayValue(
getFirstValue(item, ['quantity', 'cargoQuantity', 'goodsQuantity'])
),
getFirstValue(item, ['quantityUnit', 'cargoUnit', 'unit']),
getFirstValue(item, ['quantityUnit', 'goodsQuantityUnit', 'cargoUnit', 'unit']) ||
getFirstValue(row, ['quantityUnit', 'goodsQuantityUnit', 'cargoUnit', 'unit']),
]);
return joinText([name, type, quantity]);
})
.filter(Boolean)
.join('; ');
.join('; ') || text || '';
};
const formatGoodsField = (row, props) => {
@@ -246,6 +283,28 @@ const formatGoodsField = (row, props) => {
const formatUnitPrice = row => {
const value = normalizeNumericDisplayValue(getFirstValue(row, ['unitPrice', 'price']));
const unit = getFirstValue(row, ['priceUnit', 'billingUnit', 'unit']);
const goodsRows = getDetailedGoodsRows(row);
if (goodsRows.length > 1) {
const billingRows = getBillingRows(row);
const goodsPrices = goodsRows
.map((item, index) => {
const itemPrice = normalizeNumericDisplayValue(
getFirstValue(item, ['unitPrice', 'price'])
);
if (!isEmpty(itemPrice)) return itemPrice;
return normalizeNumericDisplayValue(
getFirstValue(billingRows[index] || {}, ['unitPrice', 'price'])
);
})
.filter(itemPrice => !isEmpty(itemPrice));
const priceKeys = goodsPrices.map(itemPrice => {
const numericPrice = Number(itemPrice);
return Number.isFinite(numericPrice) ? String(numericPrice) : String(itemPrice).trim();
});
if (new Set(priceKeys).size > 1) return '-';
}
if (!isEmpty(value)) return unit ? `${value}(${unit})` : value;
const billing = getBillingRows(row).find(
item => !isEmpty(normalizeNumericDisplayValue(item.unitPrice))