- handleCarrierContractChange(route, value)">
+ handleCarrierContractChange(route, value)">
@@ -527,7 +527,7 @@ export default {
route.escortName = '';
route.escortPhone = '';
}
- if (value === '自运') {
+ if (value !== '承运商') {
route.carrierContractId = '';
route.carrierName = '';
}
@@ -539,6 +539,12 @@ export default {
route.carrierContractId = contract?.contractId || '';
route.carrierName = contract?.carrierName || '';
},
+ carrierOptionLabel(item) {
+ const duplicateCount = this.carrierOptions.filter(option => option.carrierName === item.carrierName).length;
+ return duplicateCount > 1
+ ? `${item.carrierName}(${item.contractName || item.contractId})`
+ : item.carrierName;
+ },
driverOptionLabel(item) { return item.driverName || item.name || ''; },
driverOptionKey(item) { return item.id || item.driverId || this.driverOptionLabel(item) || item.mobile; },
handleDriverChange(route, value) {
@@ -611,9 +617,9 @@ export default {
if (!this.validateRoutePhones(route)) return;
if (route.documentType === '运单') {
if (this.isRoad(route)) {
- if (route.carrierType !== '自运' && (!route.carrierContractId || !route.carrierName || !route.vehicleNo)) return this.$message.warning('请选择承运商并填写车牌号');
+ if (route.carrierType === '承运商' && (!route.carrierContractId || !route.carrierName || !route.vehicleNo)) return this.$message.warning('请选择承运商并填写车牌号');
if (route.carrierType !== '承运商' && (!route.driverName || !route.driverPhone || !route.vehicleNo || !route.trailerVehicleNo || !route.escortName || !route.escortPhone)) return this.$message.warning('请补全自运或网货平台的车辆与人员信息');
- } else if (!route.vehicleNo || !route.captainName || !route.driverPhone || !route.containerNo || !route.cabinNo || (route.carrierType !== '自运' && (!route.carrierContractId || !route.carrierName))) {
+ } else if (!route.vehicleNo || !route.captainName || !route.driverPhone || !route.containerNo || !route.cabinNo || (route.carrierType === '承运商' && (!route.carrierContractId || !route.carrierName))) {
return this.$message.warning('请补全非公路运输的承运信息');
}
}
diff --git a/src/views/business/loading-manage.vue b/src/views/business/loading-manage.vue
index 3199a11..805303b 100644
--- a/src/views/business/loading-manage.vue
+++ b/src/views/business/loading-manage.vue
@@ -823,7 +823,7 @@
@@ -1606,7 +1606,7 @@ export default {
this.dialogForm.waybillIdsJson,
this.dialogForm.loadingSubNos
);
- if (this.dialogForm.carrierType === '自运') {
+ if (this.dialogForm.carrierType !== '承运商') {
this.dialogForm.carrierContractId = '';
this.dialogForm.carrierName = '';
}
@@ -2131,7 +2131,7 @@ export default {
normalizePayload() {
this.syncRouteAddressFields();
this.rebuildSummaryFromWaybills(false);
- if (this.dialogForm.carrierType === '自运') {
+ if (this.dialogForm.carrierType !== '承运商') {
this.dialogForm.carrierContractId = '';
this.dialogForm.carrierName = '';
}
@@ -2142,6 +2142,7 @@ export default {
taskInfoJson: JSON.stringify({
carrierType: this.dialogForm.carrierType,
carrierName: this.dialogForm.carrierName,
+ carrierContractId: this.dialogForm.carrierContractId,
driverName: this.dialogForm.driverName,
driverPhone: this.dialogForm.driverPhone,
vehicleNo: this.dialogForm.vehicleNo,
@@ -2194,7 +2195,7 @@ export default {
ElMessage.warning('请输入车牌号');
return false;
}
- if (this.dialogForm.carrierType !== '自运' && !this.dialogForm.carrierContractId) {
+ if (this.dialogForm.carrierType === '承运商' && !this.dialogForm.carrierContractId) {
ElMessage.warning('请选择承运商合同');
return false;
}
@@ -2316,10 +2317,13 @@ export default {
this.dialogForm.escortName = '';
this.dialogForm.escortPhone = '';
}
- if (this.dialogForm.carrierType === '自运') {
+ if (this.dialogForm.carrierType !== '承运商') {
this.dialogForm.carrierContractId = '';
this.dialogForm.carrierName = '';
+ this.taskCarrierOptions = [];
+ return;
}
+ this.loadTaskCarrierOptions();
},
handleTaskCarrierChange(contractId) {
const contract = this.taskCarrierOptions.find(item => String(item.id) === String(contractId));
@@ -2427,7 +2431,7 @@ export default {
},
async loadTaskCarrierOptions() {
const requestId = ++this.taskCarrierRequestId;
- if (!this.selectedWaybillRows.length) {
+ if (this.dialogForm.carrierType !== '承运商' || !this.selectedWaybillRows.length) {
this.taskCarrierOptions = [];
this.taskCarrierLoading = false;
this.dialogForm.carrierContractId = '';
@@ -2436,7 +2440,10 @@ export default {
}
this.taskCarrierLoading = true;
try {
- const response = await loadingApi.getCarrierContracts();
+ const projectIds = [
+ ...new Set(this.selectedWaybillRows.map(row => row.projectId).filter(Boolean)),
+ ];
+ const response = await loadingApi.getCarrierContracts(projectIds);
if (requestId !== this.taskCarrierRequestId) return [];
const contracts = response.data?.data || response.data || [];
this.taskCarrierOptions = contracts;