From 8380351529c54a7198bd9e4219684fc67f4f854b Mon Sep 17 00:00:00 2001 From: weicw1996 Date: Thu, 15 Oct 2026 16:56:52 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8D=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E9=A2=84=E7=BB=93=E7=AE=97=E9=A1=B5=E6=94=B6=E4=BB=98=E6=96=B9?= =?UTF-8?q?=E3=80=81=E5=88=9B=E5=BB=BA=E4=BF=A1=E6=81=AF=E4=B8=8E=E9=A2=84?= =?UTF-8?q?=E7=BB=93=E7=AE=97=E5=8D=95=E5=8F=B7=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/settlement/preSettlement.js | 2 + .../components/pre-settlement-editor.vue | 51 ++++++++++++++++--- 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/src/api/settlement/preSettlement.js b/src/api/settlement/preSettlement.js index bb61417..e35f2a6 100644 --- a/src/api/settlement/preSettlement.js +++ b/src/api/settlement/preSettlement.js @@ -24,6 +24,8 @@ export const getContractList = (current, size, params) => export const getFeeOptions = () => request({ url: `${baseUrl}/fee-options`, method: 'get' }); +export const getNextNo = () => request({ url: `${baseUrl}/next-no`, method: 'get' }); + export const getCandidateDetails = (current, size, params) => request({ url: `${baseUrl}/candidate-details`, diff --git a/src/views/settlement/components/pre-settlement-editor.vue b/src/views/settlement/components/pre-settlement-editor.vue index 7a63786..d17e63c 100644 --- a/src/views/settlement/components/pre-settlement-editor.vue +++ b/src/views/settlement/components/pre-settlement-editor.vue @@ -66,7 +66,11 @@ {{ settlementTypeName }} - + {{ form.preSettlementNo || (!form.id ? '系统自动生成' : '-') }} @@ -944,9 +948,11 @@ import { adjustDetail, getCandidateDetails, getContractList, + getContractOptions, getDetail, getDetailFees, getFeeOptions, + getNextNo, removeDetail, save, submit, @@ -1283,6 +1289,11 @@ export default { }, async initialize() { this.resetEditor(); + // 新增页在保存前没有创建人/创建日期,先按当前登录用户与当前时间展示将要落库的值 + if (!this.recordId) { + this.form.createUserName = this.userInfo?.realName || this.userInfo?.userName || ''; + this.form.createTime = this.$dayjs().format('YYYY-MM-DD HH:mm:ss'); + } if (!this.publicMode) { await this.loadFeeOptions(); await this.loadFeeCategoryOptions(); @@ -1293,15 +1304,36 @@ export default { else if (this.initialData) { await this.applyInitialData(); this.form.exchangeRateDate = this.$dayjs().format('YYYY-MM-DD'); + await this.refreshPreSettlementNo(); await this.fetchBfiExchangeRate(); + } else if (!this.publicMode) { + await this.refreshPreSettlementNo(); } }, + async refreshPreSettlementNo() { + if (this.form.id) return; + const response = await getNextNo(); + this.form.preSettlementNo = response.data?.data || ''; + }, async applyInitialData() { const rows = Array.isArray(this.initialData?.rows) ? this.initialData.rows : []; if (!rows.length) return; const first = rows[0]; const settlementType = this.initialData.settlementType || first.settlementType || 'payable'; const contractId = first.contractId || ''; + let contractPartyA = first.payerName || ''; + let contractPartyB = first.payeeName || ''; + if (contractId && (!contractPartyA || !contractPartyB)) { + try { + const { data } = await getContractOptions(first.contractNo || ''); + const matched = (data?.data || []).find(item => String(item.id) === String(contractId)); + contractPartyA = contractPartyA || matched?.partyA || ''; + contractPartyB = contractPartyB || matched?.partyB || ''; + } catch (error) { + contractPartyA = ''; + contractPartyB = ''; + } + } if (!this.contractOptions.some(item => String(item.id) === String(contractId))) { this.contractOptions.push({ id: contractId, @@ -1312,8 +1344,8 @@ export default { deptId: first.deptId, deptName: first.deptName, settlementType, - partyA: first.payerName, - partyB: first.payeeName, + partyA: contractPartyA, + partyB: contractPartyB, }); } this.handleContractChange(contractId); @@ -1325,8 +1357,8 @@ export default { projectName: first.projectName || this.form.projectName, deptId: first.deptId || this.form.deptId, deptName: first.deptName || this.form.deptName, - payerName: first.payerName || this.form.payerName, - payeeName: first.payeeName || this.form.payeeName, + payerName: this.form.payerName || contractPartyA, + payeeName: this.form.payeeName || contractPartyB, settlementType, currency: first.currency || 'RMB', localCurrency: first.localCurrency || 'RMB', @@ -1589,8 +1621,9 @@ export default { this.form.deptId = contract.deptId; this.form.deptName = contract.deptName; this.form.settlementType = contract.settlementType || 'payable'; - this.form.payerName = contract.partyA; - this.form.payeeName = contract.partyB; + // 部分候选合同只带 id/名称,缺甲方乙方;此时保留已带出的收付方,不要清成 undefined + if (contract.partyA) this.form.payerName = contract.partyA; + if (contract.partyB) this.form.payeeName = contract.partyB; this.form.currency = contract.settlementCurrency || 'RMB'; this.summaryFees = []; if (this.form.currency !== 'RMB') { @@ -2992,6 +3025,10 @@ export default { line-height: 32px; color: #303133; } + + .form-readonly--code { + color: var(--el-color-primary); + } } .dialog-section-title {