调整 基础数据、运力、车船务
This commit is contained in:
@@ -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 = [];
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
page-mode
|
||||
:record-id="recordId"
|
||||
:readonly="readonly"
|
||||
:initial-data="transferPayload"
|
||||
:initial-data="editorInitialData"
|
||||
/>
|
||||
</basic-container>
|
||||
</template>
|
||||
@@ -35,6 +35,14 @@ export default {
|
||||
pageTitle() {
|
||||
return this.readonly ? '查看正式结算' : this.recordId ? '编辑正式结算' : '新增正式结算';
|
||||
},
|
||||
editorInitialData() {
|
||||
const settlementType = this.$route.query.settlementType;
|
||||
if (!this.transferPayload && !settlementType) return null;
|
||||
return {
|
||||
...(this.transferPayload || {}),
|
||||
...(settlementType ? { settlementType } : {}),
|
||||
};
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
editorVisible(value) {
|
||||
|
||||
@@ -299,7 +299,11 @@ export default {
|
||||
openCreate() {
|
||||
this.$router.push({
|
||||
path: '/settlement/formal-settlement/form',
|
||||
query: { mode: 'add', name: '新增正式结算' },
|
||||
query: {
|
||||
mode: 'add',
|
||||
name: '新增正式结算',
|
||||
settlementType: this.activeSettlementType,
|
||||
},
|
||||
});
|
||||
},
|
||||
openEdit(row) {
|
||||
|
||||
Reference in New Issue
Block a user