1、修复基础配置

2、修复业务模块
3、拆分页面代码
This commit is contained in:
2026-09-03 15:59:34 +08:00
parent 40925cb21f
commit 024e77801e
9 changed files with 720 additions and 179 deletions
@@ -1708,18 +1708,20 @@
<div
class="transport-plan-page__dispatch-item-grid transport-plan-page__dispatch-item-grid--full"
>
<template v-for="(cargo, index) in dispatchItemCargoRows" :key="cargo._key || index">
<template v-for="(group, index) in dispatchItemFreightGroups" :key="group.key">
<el-form-item :label="`单价${index + 1}`">
<el-input
v-model="cargo.unitPrice"
:model-value="dispatchFreightGroupUnitPrice(group)"
placeholder="请输入"
@input="value => handleDispatchCargoNumberInput(cargo, 'unitPrice', value)"
@input="value => handleDispatchFreightGroupNumberInput(group, value)"
@clear="() => handleDispatchFreightGroupNumberInput(group, '')"
>
<template #append
><el-select
v-model="cargo.priceUnit"
:model-value="dispatchFreightGroupPriceUnit(group)"
class="transport-plan-page__dispatch-unit-select"
placeholder="元/吨"
@change="value => handleDispatchFreightGroupPriceUnitChange(group, value)"
@visible-change="visible => visible && loadTaskFeeUnitOptions()"
><el-option
v-for="item in taskFeeUnitOptions"
@@ -1730,12 +1732,12 @@
</el-input>
</el-form-item>
<el-form-item :label="`数量合计${index + 1}`"
><el-input :model-value="formatDispatchQuantity(cargo.quantity)" disabled
><template #append>{{ cargo.quantityUnit || '吨' }}</template></el-input
><el-input :model-value="dispatchFreightGroupQuantity(group)" disabled
><template #append>{{ group.quantityUnit || '吨' }}</template></el-input
></el-form-item
>
<el-form-item :label="`运费${index + 1}`"
><el-input :model-value="dispatchCargoFreightAmount(cargo)" disabled
><el-input :model-value="dispatchFreightGroupAmount(group)" disabled
><template #suffix>{{ dispatchItemFreightCurrencyLabel }}</template></el-input
></el-form-item
>
@@ -1786,8 +1788,22 @@
:key="
item.id || item.customerName || item.carrierName || item.fullName || item.name
"
:label="item.label || item.customerName || item.carrierName || item.fullName || item.name"
:value="dispatchIsCarrierMode ? item.carrierContractId : item.value || item.customerName || item.carrierName || item.fullName || item.name"
:label="
item.label ||
item.customerName ||
item.carrierName ||
item.fullName ||
item.name
"
:value="
dispatchIsCarrierMode
? item.carrierContractId
: item.value ||
item.customerName ||
item.carrierName ||
item.fullName ||
item.name
"
/>
</el-select>
</el-form-item>
@@ -1998,8 +2014,18 @@
:key="
item.id || item.customerName || item.carrierName || item.fullName || item.name
"
:label="item.label || item.customerName || item.carrierName || item.fullName || item.name"
:value="dispatchIsCarrierMode ? item.carrierContractId : item.value || item.customerName || item.carrierName || item.fullName || item.name"
:label="
item.label || item.customerName || item.carrierName || item.fullName || item.name
"
:value="
dispatchIsCarrierMode
? item.carrierContractId
: item.value ||
item.customerName ||
item.carrierName ||
item.fullName ||
item.name
"
/>
</el-select>
</el-form-item>
@@ -3448,8 +3474,8 @@ export default {
return Number.isInteger(total) ? String(total) : String(Number(total.toFixed(2)));
}
const otherFeeTotal = Number(this.dispatchItemForm.otherFeeTotal || 0);
const freightTotal = this.dispatchItemCargoRows.reduce(
(total, cargo) => total + Number(this.dispatchCargoFreightAmount(cargo) || 0),
const freightTotal = this.dispatchItemFreightGroups.reduce(
(total, group) => total + Number(this.dispatchFreightGroupAmount(group) || 0),
0
);
const hasOtherFee = this.dispatchItemForm.otherFeeTotal !== '';
@@ -3465,8 +3491,8 @@ export default {
const total = quantity * unitPrice;
return Number.isInteger(total) ? String(total) : String(Number(total.toFixed(2)));
}
const total = this.dispatchItemCargoRows.reduce(
(sum, cargo) => sum + Number(this.dispatchCargoFreightAmount(cargo) || 0),
const total = this.dispatchItemFreightGroups.reduce(
(sum, group) => sum + Number(this.dispatchFreightGroupAmount(group) || 0),
0
);
return total
@@ -3475,6 +3501,22 @@ export default {
: String(Number(total.toFixed(2)))
: '';
},
dispatchItemFreightGroups() {
const groups = [];
const groupMap = new Map();
(this.dispatchItemCargoRows || []).forEach((cargo, index) => {
const quantityUnit = String(cargo.quantityUnit || '').trim();
const key = quantityUnit || `__empty_${index}`;
let group = groupMap.get(key);
if (!group) {
group = { key, quantityUnit, rows: [] };
groupMap.set(key, group);
groups.push(group);
}
group.rows.push(cargo);
});
return groups;
},
dispatchItemFreightCurrencyLabel() {
const value = this.dispatchItemForm.freightCurrency || 'RMB';
return this.currencyRemark(value);
@@ -7321,7 +7363,8 @@ export default {
if (carrierTypeAtRequest === '承运商') {
this.dispatchCarrierOptions = carrierContracts || [];
const current = this.dispatchCarrierOptions.find(
item => String(item.carrierContractId) === String(this.dispatchItemForm.carrierContractId)
item =>
String(item.carrierContractId) === String(this.dispatchItemForm.carrierContractId)
);
if (current) {
this.dispatchItemForm.carrierName = current.carrierName;
@@ -7446,13 +7489,47 @@ export default {
const amount = quantity * unitPrice;
return Number.isInteger(amount) ? String(amount) : String(Number(amount.toFixed(2)));
},
dispatchFreightGroupQuantity(group = {}) {
const quantity = (group.rows || []).reduce(
(sum, cargo) => sum + Number(cargo.quantity || 0),
0
);
return this.formatDispatchQuantity(quantity);
},
dispatchFreightGroupUnitPrice(group = {}) {
const prices = (group.rows || [])
.map(cargo => String(cargo.unitPrice ?? '').trim())
.filter(Boolean);
if (!prices.length || prices.some(price => price !== prices[0])) return '';
return prices[0];
},
dispatchFreightGroupPriceUnit(group = {}) {
return group.rows?.[0]?.priceUnit || (group.quantityUnit ? `元/${group.quantityUnit}` : '');
},
dispatchFreightGroupAmount(group = {}) {
const amount = (group.rows || []).reduce(
(sum, cargo) => sum + Number(this.dispatchCargoFreightAmount(cargo) || 0),
0
);
return Number.isInteger(amount) ? String(amount) : String(Number(amount.toFixed(2)));
},
handleDispatchFreightGroupNumberInput(group, value) {
this.handleFreightNumberInput(group.rows?.[0] || {}, 'unitPrice', value);
const unitPrice = group.rows?.[0]?.unitPrice || '';
(group.rows || []).forEach(cargo => {
cargo.unitPrice = unitPrice;
});
},
handleDispatchFreightGroupPriceUnitChange(group, value) {
(group.rows || []).forEach(cargo => {
cargo.priceUnit = value || '';
});
},
dispatchItemRemainingQuantity(row = {}) {
const unit = this.getDispatchQuantityUnit(row);
const hasCargoIdentity = Boolean(
String(row.cargoName || row.goodsName || row.name || '').trim() ||
String(
row.cargoType || row.secondCargoTypeName || row.goodsType || row.type || ''
).trim()
String(row.cargoType || row.secondCargoTypeName || row.goodsType || row.type || '').trim()
);
const planGoodsRows = this.dispatchPlanGoodsRows;
const cargoKey = this.getDispatchCargoIdentity(row);
@@ -7472,10 +7549,7 @@ export default {
0
);
const assigned = this.dispatchRows.reduce((sum, dispatchRow, index) => {
if (
index === this.dispatchItemIndex ||
!this.hasDispatchVehicleIdentifier(dispatchRow)
) {
if (index === this.dispatchItemIndex || !this.hasDispatchVehicleIdentifier(dispatchRow)) {
return sum;
}
return (