1、修复基础配置

2、修复业务模块
3、拆分页面代码
This commit is contained in:
2026-09-03 03:31:30 +08:00
parent 008ec7a6a8
commit 6f0f1842cb
25 changed files with 22346 additions and 192 deletions
@@ -2265,7 +2265,7 @@
</div>
<div class="business-crud-page__transport-plan-detail-field">
<span>合同编号</span>
<strong>{{ detailRow.contractNo || detailRow.contractName || '-' }}</strong>
<strong>{{ detailRow.contractNo || '-' }}</strong>
</div>
<div class="business-crud-page__transport-plan-detail-field">
<span>货物信息</span>
@@ -3339,7 +3339,7 @@
<div class="business-crud-page__dispatch-summary-item">
<div class="business-crud-page__dispatch-summary-label">合同编号</div>
<div class="business-crud-page__dispatch-summary-value">
{{ dispatchRow.contractName || dispatchRow.contractNo || '-' }}
{{ dispatchRow.contractNo || '-' }}
</div>
</div>
<div class="business-crud-page__dispatch-summary-item">
@@ -3389,7 +3389,11 @@
{{ parseDispatchRoutePoint(dispatchRow, 'start').name || '-' }}
</div>
<div class="business-crud-page__dispatch-route-address">
{{ parseDispatchRoutePoint(dispatchRow, 'start').address || '-' }}
{{
formatTransportPlanProvinceCityDistrict(
parseDispatchRoutePoint(dispatchRow, 'start').address
)
}}
</div>
<div class="business-crud-page__dispatch-route-contact">
{{ parseDispatchRoutePoint(dispatchRow, 'start').contact || '-' }}
@@ -3406,7 +3410,11 @@
{{ parseDispatchRoutePoint(dispatchRow, 'end').name || '-' }}
</div>
<div class="business-crud-page__dispatch-route-address">
{{ parseDispatchRoutePoint(dispatchRow, 'end').address || '-' }}
{{
formatTransportPlanProvinceCityDistrict(
parseDispatchRoutePoint(dispatchRow, 'end').address
)
}}
</div>
<div class="business-crud-page__dispatch-route-contact">
{{ parseDispatchRoutePoint(dispatchRow, 'end').contact || '-' }}
@@ -3867,7 +3875,7 @@
</el-form-item>
<el-form-item v-if="dispatchCarrierRequired" :label="dispatchCarrierLabel" required>
<el-select
v-model="dispatchItemForm.carrierName"
v-model="dispatchCarrierSelection"
:placeholder="`请选择${dispatchCarrierLabel}`"
filterable
clearable
@@ -3880,8 +3888,8 @@
:key="
item.id || item.customerName || item.carrierName || item.fullName || item.name
"
:label="item.customerName || item.carrierName || item.fullName || item.name"
: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>
@@ -4086,7 +4094,7 @@
</el-form-item>
<el-form-item v-if="dispatchCarrierRequired" :label="dispatchCarrierLabel" required>
<el-select
v-model="dispatchItemForm.carrierName"
v-model="dispatchCarrierSelection"
:placeholder="`请选择${dispatchCarrierLabel}`"
filterable
clearable
@@ -4099,8 +4107,8 @@
:key="
item.id || item.customerName || item.carrierName || item.fullName || item.name
"
:label="item.customerName || item.carrierName || item.fullName || item.name"
: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>
@@ -5446,6 +5454,7 @@ const defaultDispatchRow = () => ({
transportType: '',
carrierType: '承运商',
carrierId: '',
carrierContractId: '',
carrierName: '',
driverId: '',
driverName: '',
@@ -6255,6 +6264,16 @@ export default {
dispatchCarrierLabel() {
return this.dispatchItemForm.carrierType === '网货平台' ? '承运方' : '承运商';
},
dispatchCarrierSelection: {
get() {
return this.dispatchIsCarrierMode
? this.dispatchItemForm.carrierContractId || ''
: this.dispatchItemForm.carrierName || '';
},
set(value) {
this.handleDispatchCarrierChange(value);
},
},
dispatchStationMode() {
return ['water', 'rail', 'air'].includes(this.dispatchTransportMode);
},
@@ -12226,6 +12245,8 @@ export default {
taskEntryMode: item.taskEntryMode || 'simple',
transportType: item.transportType || plan.transportType || '',
carrierType: item.carrierType || plan.carrierType || '承运商',
carrierId: item.carrierId || plan.carrierId || '',
carrierContractId: item.carrierContractId || plan.carrierContractId || '',
carrierName: item.carrierName || plan.carrierName || '',
driverName: item.driverName || plan.driverName || '',
driverPhone: item.driverPhone || plan.driverPhone || '',
@@ -12643,11 +12664,15 @@ export default {
this.dispatchItemForm.trailerVehicleNo = '';
this.dispatchItemForm.escortName = '';
this.dispatchItemForm.escortPhone = '';
} else if (!this.isDispatchCarrierRequired(nextValue)) {
this.dispatchItemForm.carrierId = '';
this.dispatchItemForm.carrierName = '';
} else {
this.dispatchItemForm.carrierContractId = '';
if (!this.isDispatchCarrierRequired(nextValue)) {
this.dispatchItemForm.carrierId = '';
this.dispatchItemForm.carrierName = '';
}
}
this.dispatchItemForm.carrierType = nextValue;
this.loadDispatchCarrierOptions(this.dispatchRow);
},
isDispatchCarrierRequired(carrierType) {
return ['承运商', '网货平台'].includes(String(carrierType || '').trim());
@@ -12708,22 +12733,61 @@ export default {
if (this.dispatchCarrierLoading) return Promise.resolve(this.dispatchCarrierOptions);
const projectId = plan?.projectId;
const requestId = ++this.dispatchCarrierRequestId;
const carrierTypeAtRequest = this.dispatchItemForm.carrierType || '承运商';
const project = this.projectOptions.find(item => String(item.id) === String(projectId));
this.dispatchCarrierOptions = this.getProjectCarrierOptions({ ...project, ...plan });
if (!projectId) return Promise.resolve(this.dispatchCarrierOptions);
this.dispatchCarrierLoading = true;
return getProjectDetail(projectId)
.then(res => {
if (requestId !== this.dispatchCarrierRequestId) return this.dispatchCarrierOptions;
const detail = res?.data?.data || {};
this.dispatchCarrierOptions = this.getProjectCarrierOptions({
...project,
...plan,
...detail,
const carrierContractPromise = getContractList(1, 9999, {
projectId,
projectName: plan?.projectName || project?.projectName,
contractCategory: '承运商合同',
}).then(res => this.getWaybillCarrierContractOptions(extractRecords(res)));
if (carrierTypeAtRequest === '承运商') {
return carrierContractPromise
.then(options => {
if (requestId !== this.dispatchCarrierRequestId) return this.dispatchCarrierOptions;
this.dispatchCarrierOptions = options || [];
const current = this.dispatchCarrierOptions.find(
item =>
String(item.carrierContractId) ===
String(this.dispatchItemForm.carrierContractId || '')
);
if (current) {
this.dispatchItemForm.carrierName = current.carrierName;
} else if (!this.dispatchItemForm.carrierContractId) {
const matches = this.dispatchCarrierOptions.filter(
item => String(item.carrierName) === String(this.dispatchItemForm.carrierName || '')
);
if (matches.length === 1) {
this.dispatchItemForm.carrierContractId = matches[0].carrierContractId;
}
}
return this.dispatchCarrierOptions;
})
.catch(() => this.dispatchCarrierOptions)
.finally(() => {
if (requestId === this.dispatchCarrierRequestId) {
this.dispatchCarrierLoading = false;
}
});
return this.dispatchCarrierOptions;
})
.catch(() => this.dispatchCarrierOptions)
}
return Promise.all([
getProjectDetail(projectId)
.then(res => {
if (requestId !== this.dispatchCarrierRequestId) return this.dispatchCarrierOptions;
const detail = res?.data?.data || {};
this.dispatchCarrierOptions = this.getProjectCarrierOptions({
...project,
...plan,
...detail,
});
return this.dispatchCarrierOptions;
})
.catch(() => this.dispatchCarrierOptions),
carrierContractPromise.catch(() => []),
])
.then(([options]) => options)
.finally(() => {
if (requestId === this.dispatchCarrierRequestId) {
this.dispatchCarrierLoading = false;
@@ -12731,9 +12795,19 @@ export default {
});
},
handleDispatchCarrierChange(value) {
const carrier = this.dispatchCarrierOptions.find(item => item.value === String(value || ''));
const carrier = this.dispatchCarrierOptions.find(item => {
const optionValue = this.dispatchIsCarrierMode ? item.carrierContractId : item.value;
return String(optionValue || '') === String(value || '');
});
if (this.dispatchIsCarrierMode) {
this.dispatchItemForm.carrierContractId = carrier?.carrierContractId || '';
this.dispatchItemForm.carrierId = '';
this.dispatchItemForm.carrierName = carrier?.carrierName || '';
return;
}
this.dispatchItemForm.carrierContractId = '';
this.dispatchItemForm.carrierId = carrier?.id || '';
this.dispatchItemForm.carrierName = value || '';
this.dispatchItemForm.carrierName = carrier?.carrierName || value || '';
},
loadDispatchDriverOptions() {
if (this.taskDriverLoading) return Promise.resolve([]);
@@ -12837,7 +12911,54 @@ export default {
},
dispatchItemRemainingQuantity(row = {}) {
const unit = this.getDispatchQuantityUnit(row);
let remaining = this.getDispatchRemainingQuantity(unit);
const hasCargoIdentity = Boolean(
String(row.cargoName || row.goodsName || row.name || '').trim() ||
String(
row.cargoType || row.secondCargoTypeName || row.goodsType || row.type || ''
).trim()
);
const planGoodsRows = this.dispatchPlanGoodsRows;
const cargoKey = this.getDispatchCargoIdentity(row);
//
if (planGoodsRows.length && hasCargoIdentity) {
const matchedPlanRows = planGoodsRows.filter(
goods => this.getDispatchCargoIdentity(goods) === cargoKey
);
if (!matchedPlanRows.length) return 0;
const total = matchedPlanRows.reduce(
(sum, goods) =>
sum +
this.parseDispatchQuantity(
goods.quantity || goods.cargoQuantity || goods.goodsQuantity
),
0
);
const assigned = this.dispatchRows.reduce((sum, dispatchRow, index) => {
if (
index === this.dispatchItemIndex ||
!this.hasDispatchVehicleIdentifier(dispatchRow)
) {
return sum;
}
return (
sum +
this.getDispatchGoodsSourceRows(dispatchRow).reduce((goodsSum, goods) => {
if (this.getDispatchCargoIdentity(goods) !== cargoKey) return goodsSum;
return (
goodsSum +
this.parseDispatchQuantity(
goods.quantity || goods.cargoQuantity || goods.goodsQuantity
)
);
}, 0)
);
}, 0);
return Math.max(total - assigned, 0);
}
//
const remaining = this.getDispatchRemainingQuantity(unit);
const editingRow = this.dispatchRows[this.dispatchItemIndex];
if (!editingRow || !this.hasDispatchVehicleIdentifier(editingRow)) return remaining;
const editingGoodsRows = this.dispatchGoodsRows(editingRow.goodsJson);
@@ -12943,6 +13064,9 @@ export default {
if (this.isDispatchCarrierRequired(row.carrierType)) {
requiredFields.push(['carrierName', row.carrierType === '网货平台' ? '承运方' : '承运商']);
}
if (row.carrierType === '承运商') {
requiredFields.push(['carrierContractId', '承运商合同']);
}
const fullEntry = row.taskEntryMode === 'full';
const roadTransport = this.resolveTransportMode(row.transportType) === 'road';
if (fullEntry) {
@@ -13056,16 +13180,25 @@ export default {
? this.dispatchItemCargoRows
: [this.dispatchItemForm];
if (!this.validateDispatchItemData(this.dispatchItemForm, goodsRows)) return false;
const quantitiesByUnit = new Map();
const quantityGroups = new Map();
goodsRows.forEach(goods => {
const unit = this.getDispatchQuantityUnit(goods);
quantitiesByUnit.set(
unit,
(quantitiesByUnit.get(unit) || 0) + this.parseDispatchQuantity(goods.quantity)
const hasCargoIdentity = Boolean(
String(goods.cargoName || goods.goodsName || goods.name || '').trim() ||
String(
goods.cargoType || goods.secondCargoTypeName || goods.goodsType || goods.type || ''
).trim()
);
const key = hasCargoIdentity
? `cargo:${this.getDispatchCargoIdentity(goods)}`
: `unit:${unit}`;
const group = quantityGroups.get(key) || { row: goods, quantity: 0 };
group.quantity += this.parseDispatchQuantity(goods.quantity);
quantityGroups.set(key, group);
});
for (const [unit, quantity] of quantitiesByUnit.entries()) {
const remaining = this.dispatchItemRemainingQuantity({ quantityUnit: unit });
for (const { row: goods, quantity } of quantityGroups.values()) {
const unit = this.getDispatchQuantityUnit(goods);
const remaining = this.dispatchItemRemainingQuantity(goods);
if (quantity - remaining > 1e-8) {
this.$message.warning(
`本次调度${unit}合计不能超过剩余数量${this.formatDispatchQuantity(remaining)}${unit}`