@@ -1448,7 +1448,7 @@
|
||||
<el-select
|
||||
:model-value="
|
||||
dialogForm.carrierType === '承运商'
|
||||
? dialogForm.carrierContractId
|
||||
? taskCarrierSelectedValue
|
||||
: dialogForm.carrierName
|
||||
"
|
||||
clearable
|
||||
@@ -1465,7 +1465,7 @@
|
||||
>
|
||||
<el-option
|
||||
v-for="item in taskCarrierOptions"
|
||||
:key="item.id || item.carrierName"
|
||||
:key="carrierOptionValue(item)"
|
||||
:label="
|
||||
dialogForm.carrierType === '承运商'
|
||||
? formatTaskCarrierContractLabel(item)
|
||||
@@ -1473,7 +1473,7 @@
|
||||
"
|
||||
:value="
|
||||
dialogForm.carrierType === '承运商'
|
||||
? item.id
|
||||
? carrierOptionValue(item)
|
||||
: item.carrierName || item.partyB
|
||||
"
|
||||
/>
|
||||
@@ -1953,6 +1953,8 @@ const createDialogForm = () => ({
|
||||
carrierType: '承运商',
|
||||
carrierName: '',
|
||||
carrierContractId: '',
|
||||
carrierPartyId: '',
|
||||
carrierPartyRole: '',
|
||||
escortName: '',
|
||||
escortPhone: '',
|
||||
departureAddress: '',
|
||||
@@ -2256,6 +2258,13 @@ export default {
|
||||
if (!this.taskCarrierLoading && !this.taskCarrierOptions.length) return '暂无可用承运商合同';
|
||||
return '请选择';
|
||||
},
|
||||
taskCarrierSelectedValue() {
|
||||
return this.carrierOptionValue({
|
||||
id: this.dialogForm.carrierContractId,
|
||||
carrierPartyId: this.dialogForm.carrierPartyId,
|
||||
carrierName: this.dialogForm.carrierName,
|
||||
});
|
||||
},
|
||||
detailStatusType() {
|
||||
const typeMap = {
|
||||
pending: 'success',
|
||||
@@ -2391,11 +2400,23 @@ export default {
|
||||
driverOptionText,
|
||||
formatTaskCarrierContractLabel(item = {}) {
|
||||
const carrierName = item.carrierName || item.partyB || '';
|
||||
const roleLabel =
|
||||
item.carrierPartyRole === 'C' || item.carrierPartyRole === '丙'
|
||||
? '丙方'
|
||||
: item.carrierPartyRole === 'B' || item.carrierPartyRole === '乙'
|
||||
? '乙方'
|
||||
: '';
|
||||
const contractLabel = formatContractOptionLabel(item);
|
||||
if (carrierName && contractLabel) {
|
||||
return `${carrierName}(${contractLabel})`;
|
||||
const nameWithRole = roleLabel && carrierName ? `${carrierName}(${roleLabel})` : carrierName;
|
||||
if (nameWithRole && contractLabel) {
|
||||
return `${nameWithRole} - ${contractLabel}`;
|
||||
}
|
||||
return carrierName || contractLabel;
|
||||
return nameWithRole || contractLabel;
|
||||
},
|
||||
carrierOptionValue(item = {}) {
|
||||
return [item.id || '', item.carrierPartyId || '', item.carrierName || item.partyB || ''].join(
|
||||
'__'
|
||||
);
|
||||
},
|
||||
syncStandaloneTagTitle() {
|
||||
if (!this.isStandalonePage) return;
|
||||
@@ -4555,6 +4576,8 @@ export default {
|
||||
},
|
||||
handleCarrierTypeChange() {
|
||||
this.dialogForm.carrierContractId = '';
|
||||
this.dialogForm.carrierPartyId = '';
|
||||
this.dialogForm.carrierPartyRole = '';
|
||||
this.dialogForm.carrierName = '';
|
||||
this.dialogForm.carrierId = '';
|
||||
this.clearDialogDriverVehicleFields();
|
||||
@@ -4565,17 +4588,25 @@ export default {
|
||||
}
|
||||
if (this.dialogForm.carrierType === '自运') {
|
||||
this.dialogForm.carrierContractId = '';
|
||||
this.dialogForm.carrierPartyId = '';
|
||||
this.dialogForm.carrierPartyRole = '';
|
||||
}
|
||||
this.loadTaskCarrierOptions();
|
||||
},
|
||||
handleTaskCarrierChange(contractId) {
|
||||
const contract = this.taskCarrierOptions.find(item =>
|
||||
[item.id, item.carrierName, item.partyB].some(
|
||||
value => String(value || '') === String(contractId || '')
|
||||
)
|
||||
handleTaskCarrierChange(selectedValue) {
|
||||
const contract = this.taskCarrierOptions.find(
|
||||
item =>
|
||||
this.carrierOptionValue(item) === String(selectedValue || '') ||
|
||||
[item.id, item.carrierName, item.partyB].some(
|
||||
value => String(value || '') === String(selectedValue || '')
|
||||
)
|
||||
);
|
||||
this.dialogForm.carrierContractId =
|
||||
this.dialogForm.carrierType === '承运商' && contract?.id ? contract.id : '';
|
||||
this.dialogForm.carrierPartyId =
|
||||
this.dialogForm.carrierType === '承运商' ? contract?.carrierPartyId || '' : '';
|
||||
this.dialogForm.carrierPartyRole =
|
||||
this.dialogForm.carrierType === '承运商' ? contract?.carrierPartyRole || '' : '';
|
||||
this.dialogForm.carrierName = contract?.carrierName || '';
|
||||
this.dialogForm.carrierId = contract?.carrierId || contract?.customerId || '';
|
||||
this.clearDialogDriverVehicleFields();
|
||||
@@ -4758,30 +4789,45 @@ export default {
|
||||
.map(item => ({
|
||||
...item,
|
||||
carrierName:
|
||||
item.carrierName ||
|
||||
item.partyB ||
|
||||
item.partyBName ||
|
||||
item.contractPartyB ||
|
||||
item.customerContractPartyB ||
|
||||
item.carrierName ||
|
||||
'',
|
||||
carrierId:
|
||||
item.customerId ||
|
||||
item.partyBId ||
|
||||
item.partyBUserId ||
|
||||
item.contractPartyBId ||
|
||||
item.customerContractPartyBId ||
|
||||
item.carrierId ||
|
||||
'',
|
||||
carrierPartyId: item.carrierPartyId || '',
|
||||
carrierPartyRole: item.carrierPartyRole || '',
|
||||
}))
|
||||
.filter(item => item.carrierName);
|
||||
const current =
|
||||
contracts.find(item => String(item.id) === String(this.dialogForm.carrierContractId)) ||
|
||||
this.taskCarrierOptions.find(
|
||||
item =>
|
||||
this.carrierOptionValue(item) === this.taskCarrierSelectedValue ||
|
||||
(String(item.id) === String(this.dialogForm.carrierContractId) &&
|
||||
(!this.dialogForm.carrierPartyId ||
|
||||
String(item.carrierPartyId) === String(this.dialogForm.carrierPartyId)) &&
|
||||
(!this.dialogForm.carrierName ||
|
||||
item.carrierName === this.dialogForm.carrierName))
|
||||
) ||
|
||||
this.taskCarrierOptions.find(item => item.carrierName === this.dialogForm.carrierName);
|
||||
if (current) {
|
||||
this.dialogForm.carrierContractId = current.id;
|
||||
this.dialogForm.carrierPartyId = current.carrierPartyId || '';
|
||||
this.dialogForm.carrierPartyRole = current.carrierPartyRole || '';
|
||||
this.dialogForm.carrierName = current.carrierName;
|
||||
this.dialogForm.carrierId = current.carrierId || '';
|
||||
} else {
|
||||
this.dialogForm.carrierContractId = '';
|
||||
this.dialogForm.carrierPartyId = '';
|
||||
this.dialogForm.carrierPartyRole = '';
|
||||
this.dialogForm.carrierName = '';
|
||||
this.dialogForm.carrierId = '';
|
||||
}
|
||||
@@ -4792,19 +4838,22 @@ export default {
|
||||
.map(item => ({
|
||||
...item,
|
||||
carrierName:
|
||||
item.carrierName ||
|
||||
item.partyB ||
|
||||
item.partyBName ||
|
||||
item.contractPartyB ||
|
||||
item.customerContractPartyB ||
|
||||
item.carrierName ||
|
||||
'',
|
||||
carrierId:
|
||||
item.customerId ||
|
||||
item.partyBId ||
|
||||
item.partyBUserId ||
|
||||
item.contractPartyBId ||
|
||||
item.customerContractPartyBId ||
|
||||
item.carrierId ||
|
||||
'',
|
||||
carrierPartyId: item.carrierPartyId || '',
|
||||
carrierPartyRole: item.carrierPartyRole || '',
|
||||
}))
|
||||
.filter(item => item.carrierName);
|
||||
const current = this.taskCarrierOptions.find(
|
||||
|
||||
Reference in New Issue
Block a user