This commit is contained in:
2026-08-28 18:22:17 +08:00
parent a3ff00eaaf
commit 4fb8c74b5c
4 changed files with 117 additions and 23 deletions
+14 -7
View File
@@ -823,7 +823,7 @@
</div>
<div class="loading-manage-dialog__grid loading-manage-dialog__task-grid">
<el-form-item
v-if="dialogForm.carrierType !== '自运'"
v-if="dialogForm.carrierType === '承运商'"
label="承运商"
required
>
@@ -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;