调整业务模块
This commit is contained in:
@@ -7296,16 +7296,13 @@ export default {
|
||||
},
|
||||
handleDispatchCarrierTypeChange(value) {
|
||||
const nextValue = value || '';
|
||||
this.dispatchItemForm.carrierName = '';
|
||||
this.dispatchItemForm.carrierId = '';
|
||||
this.dispatchItemForm.carrierContractId = '';
|
||||
if (nextValue === '承运商') {
|
||||
this.dispatchItemForm.trailerVehicleNo = '';
|
||||
this.dispatchItemForm.escortName = '';
|
||||
this.dispatchItemForm.escortPhone = '';
|
||||
} else {
|
||||
this.dispatchItemForm.carrierContractId = '';
|
||||
if (nextValue === '网货平台') {
|
||||
this.dispatchItemForm.carrierId = '';
|
||||
this.dispatchItemForm.carrierName = '';
|
||||
}
|
||||
}
|
||||
this.dispatchItemForm.carrierType = nextValue;
|
||||
this.loadDispatchCarrierOptions(this.dispatchRow);
|
||||
@@ -7379,8 +7376,11 @@ export default {
|
||||
});
|
||||
return Promise.all([detailPromise, contractPromise])
|
||||
.then(([, carrierContracts]) => {
|
||||
if (carrierTypeAtRequest === '承运商') {
|
||||
this.dispatchCarrierOptions = carrierContracts || [];
|
||||
if (carrierTypeAtRequest !== '自运') {
|
||||
this.dispatchCarrierOptions = (carrierContracts || []).map(item => ({
|
||||
...item,
|
||||
value: item.carrierContractId || item.id,
|
||||
}));
|
||||
const current = this.dispatchCarrierOptions.find(
|
||||
item =>
|
||||
String(item.carrierContractId) === String(this.dispatchItemForm.carrierContractId)
|
||||
@@ -7408,19 +7408,37 @@ export default {
|
||||
},
|
||||
getWaybillCarrierContractOptions(contracts = []) {
|
||||
const counts = contracts.reduce((result, item) => {
|
||||
const name = String(item.partyB || '').trim();
|
||||
const name = String(
|
||||
item.partyB ||
|
||||
item.partyBName ||
|
||||
item.contractPartyB ||
|
||||
item.customerContractPartyB ||
|
||||
''
|
||||
).trim();
|
||||
if (name) result[name] = (result[name] || 0) + 1;
|
||||
return result;
|
||||
}, {});
|
||||
return contracts
|
||||
.map(contract => {
|
||||
const carrierName = String(contract.partyB || '').trim();
|
||||
const carrierName = String(
|
||||
contract.partyB ||
|
||||
contract.partyBName ||
|
||||
contract.contractPartyB ||
|
||||
contract.customerContractPartyB ||
|
||||
''
|
||||
).trim();
|
||||
if (!carrierName || !contract.id) return null;
|
||||
const identifier = contract.contractName || contract.contractNo || contract.id;
|
||||
return {
|
||||
id: contract.id,
|
||||
value: contract.id,
|
||||
carrierContractId: contract.id,
|
||||
carrierId:
|
||||
contract.partyBId ||
|
||||
contract.partyBUserId ||
|
||||
contract.contractPartyBId ||
|
||||
contract.customerContractPartyBId ||
|
||||
'',
|
||||
carrierName,
|
||||
fullName: carrierName,
|
||||
label: counts[carrierName] > 1 ? `${carrierName}(${identifier})` : carrierName,
|
||||
@@ -7464,9 +7482,9 @@ export default {
|
||||
const optionValue = this.dispatchIsCarrierMode ? item.carrierContractId : item.value;
|
||||
return String(optionValue || '') === String(value || '');
|
||||
});
|
||||
if (this.dispatchIsCarrierMode) {
|
||||
if (this.dispatchItemForm.carrierType !== '自运') {
|
||||
this.dispatchItemForm.carrierContractId = carrier?.carrierContractId || '';
|
||||
this.dispatchItemForm.carrierId = '';
|
||||
this.dispatchItemForm.carrierId = carrier?.carrierId || '';
|
||||
this.dispatchItemForm.carrierName = carrier?.carrierName || '';
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user