调整 基础数据、运力、车船务

This commit is contained in:
2026-09-14 01:49:23 +08:00
parent dbeb174ae2
commit acbc9d3322
12 changed files with 1157 additions and 15 deletions
@@ -1199,9 +1199,7 @@ export default {
this.selectedAttachmentRows = [];
this.invoices = data.invoices || [];
this.sortAttachments();
this.contracts = this.allContracts.filter(
item => String(item.projectId) === String(this.form.projectId)
);
this.contracts = this.filterContracts(this.allContracts, this.form.projectId);
},
async initialize() {
const newRecordAudit = this.recordId
@@ -1211,6 +1209,11 @@ export default {
createTime: this.$dayjs().format('YYYY-MM-DD HH:mm:ss'),
};
this.form = createFormalSettlementForm();
if (['receivable', 'payable'].includes(this.initialData?.settlementType)) {
this.form.settlementType = this.initialData.settlementType;
this.form.settlementTypeName =
this.initialData.settlementType === 'receivable' ? '应收' : '应付';
}
if (newRecordAudit) Object.assign(this.form, newRecordAudit);
this.sources = [];
this.details = [];
@@ -1276,7 +1279,7 @@ export default {
if (!rows.length) return;
const first = rows[0];
const settlementType = this.initialData.settlementType || first.settlementType || 'payable';
const matchedContract = this.allContracts.find(
const matchedContract = this.filterContracts(this.allContracts, null, settlementType).find(
item =>
(first.contractId && String(item.id) === String(first.contractId)) ||
(first.contractNo && String(item.contractNo) === String(first.contractNo))
@@ -1284,9 +1287,7 @@ export default {
const contractId = first.contractId || matchedContract?.id || null;
const projectId = first.projectId || matchedContract?.projectId || null;
const projectName = first.projectName || matchedContract?.projectName || '';
this.contracts = this.allContracts.filter(
item => projectId && String(item.projectId) === String(projectId)
);
this.contracts = this.filterContracts(this.allContracts, projectId, settlementType);
if (projectId && !this.projects.some(item => String(item.id) === String(projectId))) {
this.projects.push({ id: projectId, name: projectName });
}
@@ -1404,6 +1405,25 @@ export default {
this.projects = [...projectMap.values()];
this.contracts = [];
},
contractCategory(settlementType = this.form.settlementType) {
if (settlementType === 'receivable') return '客户合同';
if (settlementType === 'payable') return '承运商合同';
return '';
},
filterContracts(items, projectId, settlementType = this.form.settlementType) {
const category = this.contractCategory(settlementType);
return (items || []).filter(item => {
if (projectId && String(item.projectId) !== String(projectId)) return false;
if (!category) return true;
const itemCategory = String(item.contractCategory || '').trim();
if (itemCategory) return itemCategory === category;
const itemSettlementType = String(item.settlementType || '').trim();
return (
(category === '客户合同' && itemSettlementType === 'receivable') ||
(category === '承运商合同' && itemSettlementType === 'payable')
);
});
},
async loadContracts(keyword = '') {
const projectId = this.form.projectId;
if (!projectId) {
@@ -1412,7 +1432,7 @@ export default {
}
const response = await getContractOptions(keyword, projectId);
if (String(this.form.projectId) === String(projectId)) {
this.contracts = this.unwrapData(response) || [];
this.contracts = this.filterContracts(this.unwrapData(response), projectId);
}
},
async loadFeeOptions() {
@@ -1444,16 +1464,24 @@ export default {
const contract = this.contracts.find(item => String(item.id) === String(id));
if (!contract) return;
const formalSettlementId = this.form.id;
const settlementType =
contract.settlementType ||
(contract.contractCategory === '客户合同'
? 'receivable'
: contract.contractCategory === '承运商合同'
? 'payable'
: this.form.settlementType);
Object.assign(this.form, contract, {
id: formalSettlementId,
contractId: contract.id,
payerName:
contract.payerName ||
(contract.settlementType === 'receivable' ? contract.partyB : contract.partyA),
(settlementType === 'receivable' ? contract.partyB : contract.partyA),
payeeName:
contract.payeeName ||
(contract.settlementType === 'receivable' ? contract.partyA : contract.partyB),
settlementTypeName: contract.settlementType === 'receivable' ? '应收' : '应付',
(settlementType === 'receivable' ? contract.partyA : contract.partyB),
settlementType,
settlementTypeName: settlementType === 'receivable' ? '应收' : '应付',
});
this.sources = [];
this.details = [];