🐛 修复新增预结算页收付方、创建信息与预结算单号为空
This commit is contained in:
@@ -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`,
|
||||
|
||||
@@ -66,7 +66,11 @@
|
||||
<span v-else-if="field.prop === 'settlementType'" class="form-readonly">
|
||||
{{ settlementTypeName }}
|
||||
</span>
|
||||
<span v-else-if="field.prop === 'preSettlementNo'" class="form-readonly">
|
||||
<span
|
||||
v-else-if="field.prop === 'preSettlementNo'"
|
||||
class="form-readonly"
|
||||
:class="{ 'form-readonly--code': form.preSettlementNo }"
|
||||
>
|
||||
{{ form.preSettlementNo || (!form.id ? '系统自动生成' : '-') }}
|
||||
</span>
|
||||
<span v-else-if="field.prop === 'createTime'" class="form-readonly">
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user