1、调整配载、总单
2、新增收付款模块
This commit is contained in:
@@ -822,23 +822,26 @@
|
||||
/>
|
||||
</div>
|
||||
<div class="loading-manage-dialog__grid loading-manage-dialog__task-grid">
|
||||
<el-form-item v-if="!['自运', '网货平台'].includes(dialogForm.carrierType)" label="承运商" required>
|
||||
<el-form-item
|
||||
v-if="dialogForm.carrierType !== '自运'"
|
||||
label="承运商"
|
||||
required
|
||||
>
|
||||
<el-select
|
||||
v-model="dialogForm.carrierName"
|
||||
v-model="dialogForm.carrierContractId"
|
||||
clearable
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
:remote-method="loadCarrierOptions"
|
||||
:loading="carrierLoading"
|
||||
placeholder="请输入"
|
||||
@visible-change="visible => visible && loadCarrierOptions(dialogForm.carrierName)"
|
||||
:disabled="dialogReadonly || !selectedWaybillRows.length"
|
||||
:loading="taskCarrierLoading"
|
||||
:placeholder="taskCarrierPlaceholder"
|
||||
@change="handleTaskCarrierChange"
|
||||
@visible-change="visible => visible && loadTaskCarrierOptions()"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in carrierOptions"
|
||||
:key="item.id || item.fullName || item.customerName || item.carrierName"
|
||||
:label="item.fullName || item.customerName || item.carrierName || item.name"
|
||||
:value="item.fullName || item.customerName || item.carrierName || item.name"
|
||||
v-for="item in taskCarrierOptions"
|
||||
:key="item.id"
|
||||
:label="item.carrierName"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -1054,6 +1057,7 @@ const createDialogForm = () => ({
|
||||
driverPhone: '',
|
||||
carrierType: '承运商',
|
||||
carrierName: '',
|
||||
carrierContractId: '',
|
||||
escortName: '',
|
||||
escortPhone: '',
|
||||
departureAddress: '',
|
||||
@@ -1165,13 +1169,16 @@ export default {
|
||||
cargoTypeOptions: [],
|
||||
driverOptions: [],
|
||||
carrierOptions: [],
|
||||
taskCarrierOptions: [],
|
||||
planOptions: [],
|
||||
projectLoading: false,
|
||||
customerLoading: false,
|
||||
cargoTypeLoading: false,
|
||||
driverLoading: false,
|
||||
carrierLoading: false,
|
||||
taskCarrierLoading: false,
|
||||
planLoading: false,
|
||||
taskCarrierRequestId: 0,
|
||||
carrierTypeOptions,
|
||||
statusOptions: loadingStatusOptions,
|
||||
dataSourceOptions: loadingManageConfig.dataSourceOptions,
|
||||
@@ -1199,6 +1206,11 @@ export default {
|
||||
dialogReadonly() {
|
||||
return this.dialogMode === 'view';
|
||||
},
|
||||
taskCarrierPlaceholder() {
|
||||
if (!this.selectedWaybillRows.length) return '请先选择运单';
|
||||
if (!this.taskCarrierLoading && !this.taskCarrierOptions.length) return '暂无可用承运商合同';
|
||||
return '请选择';
|
||||
},
|
||||
dialogTitle() {
|
||||
const titleMap = {
|
||||
add: '新建配载',
|
||||
@@ -1567,6 +1579,10 @@ export default {
|
||||
this.dialogForm.waybillIdsJson,
|
||||
this.dialogForm.loadingSubNos
|
||||
);
|
||||
if (this.dialogForm.carrierType === '自运') {
|
||||
this.dialogForm.carrierContractId = '';
|
||||
this.dialogForm.carrierName = '';
|
||||
}
|
||||
this.syncProcessProjectOptions();
|
||||
this.restoreRouteAndCargo();
|
||||
this.restoreRouteChangeRecords();
|
||||
@@ -1604,6 +1620,9 @@ export default {
|
||||
this.candidateRows = [];
|
||||
this.candidateSelection = [];
|
||||
this.selectedWaybillRows = [];
|
||||
this.taskCarrierRequestId += 1;
|
||||
this.taskCarrierOptions = [];
|
||||
this.taskCarrierLoading = false;
|
||||
this.routeNodes = [];
|
||||
this.cargoRows = [];
|
||||
this.candidatePage.currentPage = 1;
|
||||
@@ -1855,10 +1874,12 @@ export default {
|
||||
);
|
||||
this.selectedWaybillRows = rows.filter(Boolean);
|
||||
this.rebuildSummaryFromWaybills(false);
|
||||
await this.loadTaskCarrierOptions();
|
||||
return;
|
||||
}
|
||||
this.selectedWaybillRows = this.splitText(loadingSubNos).map(waybillNo => ({ waybillNo }));
|
||||
this.rebuildSummaryFromWaybills(false);
|
||||
await this.loadTaskCarrierOptions();
|
||||
},
|
||||
async loadCandidateWaybills() {
|
||||
this.candidateLoading = true;
|
||||
@@ -1933,6 +1954,7 @@ export default {
|
||||
});
|
||||
this.selectedWaybillRows = nextRows;
|
||||
this.rebuildSummaryFromWaybills();
|
||||
await this.loadTaskCarrierOptions();
|
||||
this.$refs.candidateTableRef?.clearSelection?.();
|
||||
this.candidateSelection = [];
|
||||
} finally {
|
||||
@@ -1942,6 +1964,7 @@ export default {
|
||||
removeSelectedWaybill(index) {
|
||||
this.selectedWaybillRows.splice(index, 1);
|
||||
this.rebuildSummaryFromWaybills();
|
||||
this.loadTaskCarrierOptions();
|
||||
},
|
||||
rebuildSummaryFromWaybills(rebuildRoute = true) {
|
||||
const rows = this.selectedWaybillRows;
|
||||
@@ -2071,6 +2094,10 @@ export default {
|
||||
normalizePayload() {
|
||||
this.syncRouteAddressFields();
|
||||
this.rebuildSummaryFromWaybills(false);
|
||||
if (this.dialogForm.carrierType === '自运') {
|
||||
this.dialogForm.carrierContractId = '';
|
||||
this.dialogForm.carrierName = '';
|
||||
}
|
||||
return {
|
||||
...this.dialogForm,
|
||||
routeJson: JSON.stringify(this.routeNodes),
|
||||
@@ -2130,14 +2157,15 @@ export default {
|
||||
ElMessage.warning('请输入车牌号');
|
||||
return false;
|
||||
}
|
||||
if (this.dialogForm.carrierType !== '自运' && !this.dialogForm.carrierContractId) {
|
||||
ElMessage.warning('请选择承运商合同');
|
||||
return false;
|
||||
}
|
||||
if (['自运', '网货平台'].includes(this.dialogForm.carrierType)) {
|
||||
if (!this.dialogForm.driverName || !this.dialogForm.driverPhone) {
|
||||
ElMessage.warning('请输入司机和司机手机号');
|
||||
return false;
|
||||
}
|
||||
} else if (!this.dialogForm.carrierName) {
|
||||
ElMessage.warning('请选择承运商');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
@@ -2217,9 +2245,14 @@ export default {
|
||||
const ids = this.selectionRows.map(row => row.id).join(',');
|
||||
const res = await loadingApi.batchComplete(ids);
|
||||
const result = res.data?.data || {};
|
||||
ElMessage.success(
|
||||
`批量完成成功 ${result.successCount || 0} 条,跳过 ${result.skippedCount || 0} 条`
|
||||
);
|
||||
const summary = `批量完成成功 ${result.successCount || 0} 条,跳过 ${
|
||||
result.skippedCount || 0
|
||||
} 条`;
|
||||
if (result.skippedCount && result.skippedReasons?.length) {
|
||||
ElMessage.warning(`${summary};${result.skippedReasons.join(';')}`);
|
||||
} else {
|
||||
ElMessage.success(summary);
|
||||
}
|
||||
this.loadTable();
|
||||
})
|
||||
.catch(() => {});
|
||||
@@ -2245,10 +2278,17 @@ export default {
|
||||
this.dialogForm.trailerVehicleNo = '';
|
||||
this.dialogForm.escortName = '';
|
||||
this.dialogForm.escortPhone = '';
|
||||
} else if (['自运', '网货平台'].includes(this.dialogForm.carrierType)) {
|
||||
}
|
||||
if (this.dialogForm.carrierType === '自运') {
|
||||
this.dialogForm.carrierContractId = '';
|
||||
this.dialogForm.carrierName = '';
|
||||
}
|
||||
},
|
||||
handleTaskCarrierChange(contractId) {
|
||||
const contract = this.taskCarrierOptions.find(item => String(item.id) === String(contractId));
|
||||
this.dialogForm.carrierContractId = contract?.id || '';
|
||||
this.dialogForm.carrierName = contract?.carrierName || '';
|
||||
},
|
||||
handleDriverChange(value) {
|
||||
const driver = this.driverOptions.find(item => (item.driverName || item.name) === value);
|
||||
if (driver && !this.dialogForm.driverPhone) {
|
||||
@@ -2343,6 +2383,46 @@ export default {
|
||||
this.carrierLoading = false;
|
||||
}
|
||||
},
|
||||
async loadTaskCarrierOptions() {
|
||||
const requestId = ++this.taskCarrierRequestId;
|
||||
if (!this.selectedWaybillRows.length) {
|
||||
this.taskCarrierOptions = [];
|
||||
this.taskCarrierLoading = false;
|
||||
this.dialogForm.carrierContractId = '';
|
||||
this.dialogForm.carrierName = '';
|
||||
return [];
|
||||
}
|
||||
this.taskCarrierLoading = true;
|
||||
try {
|
||||
const response = await loadingApi.getCarrierContracts();
|
||||
if (requestId !== this.taskCarrierRequestId) return [];
|
||||
const contracts = response.data?.data || response.data || [];
|
||||
this.taskCarrierOptions = contracts;
|
||||
const current =
|
||||
contracts.find(
|
||||
item => String(item.id) === String(this.dialogForm.carrierContractId)
|
||||
) ||
|
||||
contracts.find(
|
||||
item => item.carrierName === this.dialogForm.carrierName
|
||||
);
|
||||
if (current) {
|
||||
this.dialogForm.carrierContractId = current.id;
|
||||
this.dialogForm.carrierName = current.carrierName;
|
||||
} else {
|
||||
this.dialogForm.carrierContractId = '';
|
||||
this.dialogForm.carrierName = '';
|
||||
}
|
||||
return contracts;
|
||||
} catch (error) {
|
||||
if (requestId !== this.taskCarrierRequestId) return [];
|
||||
this.taskCarrierOptions = [];
|
||||
this.dialogForm.carrierContractId = '';
|
||||
this.dialogForm.carrierName = '';
|
||||
return [];
|
||||
} finally {
|
||||
if (requestId === this.taskCarrierRequestId) this.taskCarrierLoading = false;
|
||||
}
|
||||
},
|
||||
async loadPlanOptions(keyword = '') {
|
||||
this.planLoading = true;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user