🐛 修复新增预结算页收付方、创建信息与预结算单号为空
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 getFeeOptions = () => request({ url: `${baseUrl}/fee-options`, method: 'get' });
|
||||||
|
|
||||||
|
export const getNextNo = () => request({ url: `${baseUrl}/next-no`, method: 'get' });
|
||||||
|
|
||||||
export const getCandidateDetails = (current, size, params) =>
|
export const getCandidateDetails = (current, size, params) =>
|
||||||
request({
|
request({
|
||||||
url: `${baseUrl}/candidate-details`,
|
url: `${baseUrl}/candidate-details`,
|
||||||
|
|||||||
@@ -66,7 +66,11 @@
|
|||||||
<span v-else-if="field.prop === 'settlementType'" class="form-readonly">
|
<span v-else-if="field.prop === 'settlementType'" class="form-readonly">
|
||||||
{{ settlementTypeName }}
|
{{ settlementTypeName }}
|
||||||
</span>
|
</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 ? '系统自动生成' : '-') }}
|
{{ form.preSettlementNo || (!form.id ? '系统自动生成' : '-') }}
|
||||||
</span>
|
</span>
|
||||||
<span v-else-if="field.prop === 'createTime'" class="form-readonly">
|
<span v-else-if="field.prop === 'createTime'" class="form-readonly">
|
||||||
@@ -944,9 +948,11 @@ import {
|
|||||||
adjustDetail,
|
adjustDetail,
|
||||||
getCandidateDetails,
|
getCandidateDetails,
|
||||||
getContractList,
|
getContractList,
|
||||||
|
getContractOptions,
|
||||||
getDetail,
|
getDetail,
|
||||||
getDetailFees,
|
getDetailFees,
|
||||||
getFeeOptions,
|
getFeeOptions,
|
||||||
|
getNextNo,
|
||||||
removeDetail,
|
removeDetail,
|
||||||
save,
|
save,
|
||||||
submit,
|
submit,
|
||||||
@@ -1283,6 +1289,11 @@ export default {
|
|||||||
},
|
},
|
||||||
async initialize() {
|
async initialize() {
|
||||||
this.resetEditor();
|
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) {
|
if (!this.publicMode) {
|
||||||
await this.loadFeeOptions();
|
await this.loadFeeOptions();
|
||||||
await this.loadFeeCategoryOptions();
|
await this.loadFeeCategoryOptions();
|
||||||
@@ -1293,15 +1304,36 @@ export default {
|
|||||||
else if (this.initialData) {
|
else if (this.initialData) {
|
||||||
await this.applyInitialData();
|
await this.applyInitialData();
|
||||||
this.form.exchangeRateDate = this.$dayjs().format('YYYY-MM-DD');
|
this.form.exchangeRateDate = this.$dayjs().format('YYYY-MM-DD');
|
||||||
|
await this.refreshPreSettlementNo();
|
||||||
await this.fetchBfiExchangeRate();
|
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() {
|
async applyInitialData() {
|
||||||
const rows = Array.isArray(this.initialData?.rows) ? this.initialData.rows : [];
|
const rows = Array.isArray(this.initialData?.rows) ? this.initialData.rows : [];
|
||||||
if (!rows.length) return;
|
if (!rows.length) return;
|
||||||
const first = rows[0];
|
const first = rows[0];
|
||||||
const settlementType = this.initialData.settlementType || first.settlementType || 'payable';
|
const settlementType = this.initialData.settlementType || first.settlementType || 'payable';
|
||||||
const contractId = first.contractId || '';
|
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))) {
|
if (!this.contractOptions.some(item => String(item.id) === String(contractId))) {
|
||||||
this.contractOptions.push({
|
this.contractOptions.push({
|
||||||
id: contractId,
|
id: contractId,
|
||||||
@@ -1312,8 +1344,8 @@ export default {
|
|||||||
deptId: first.deptId,
|
deptId: first.deptId,
|
||||||
deptName: first.deptName,
|
deptName: first.deptName,
|
||||||
settlementType,
|
settlementType,
|
||||||
partyA: first.payerName,
|
partyA: contractPartyA,
|
||||||
partyB: first.payeeName,
|
partyB: contractPartyB,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.handleContractChange(contractId);
|
this.handleContractChange(contractId);
|
||||||
@@ -1325,8 +1357,8 @@ export default {
|
|||||||
projectName: first.projectName || this.form.projectName,
|
projectName: first.projectName || this.form.projectName,
|
||||||
deptId: first.deptId || this.form.deptId,
|
deptId: first.deptId || this.form.deptId,
|
||||||
deptName: first.deptName || this.form.deptName,
|
deptName: first.deptName || this.form.deptName,
|
||||||
payerName: first.payerName || this.form.payerName,
|
payerName: this.form.payerName || contractPartyA,
|
||||||
payeeName: first.payeeName || this.form.payeeName,
|
payeeName: this.form.payeeName || contractPartyB,
|
||||||
settlementType,
|
settlementType,
|
||||||
currency: first.currency || 'RMB',
|
currency: first.currency || 'RMB',
|
||||||
localCurrency: first.localCurrency || 'RMB',
|
localCurrency: first.localCurrency || 'RMB',
|
||||||
@@ -1589,8 +1621,9 @@ export default {
|
|||||||
this.form.deptId = contract.deptId;
|
this.form.deptId = contract.deptId;
|
||||||
this.form.deptName = contract.deptName;
|
this.form.deptName = contract.deptName;
|
||||||
this.form.settlementType = contract.settlementType || 'payable';
|
this.form.settlementType = contract.settlementType || 'payable';
|
||||||
this.form.payerName = contract.partyA;
|
// 部分候选合同只带 id/名称,缺甲方乙方;此时保留已带出的收付方,不要清成 undefined
|
||||||
this.form.payeeName = contract.partyB;
|
if (contract.partyA) this.form.payerName = contract.partyA;
|
||||||
|
if (contract.partyB) this.form.payeeName = contract.partyB;
|
||||||
this.form.currency = contract.settlementCurrency || 'RMB';
|
this.form.currency = contract.settlementCurrency || 'RMB';
|
||||||
this.summaryFees = [];
|
this.summaryFees = [];
|
||||||
if (this.form.currency !== 'RMB') {
|
if (this.form.currency !== 'RMB') {
|
||||||
@@ -2992,6 +3025,10 @@ export default {
|
|||||||
line-height: 32px;
|
line-height: 32px;
|
||||||
color: #303133;
|
color: #303133;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.form-readonly--code {
|
||||||
|
color: var(--el-color-primary);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog-section-title {
|
.dialog-section-title {
|
||||||
|
|||||||
Reference in New Issue
Block a user