调整收付款问题

This commit is contained in:
2026-08-31 19:29:57 +08:00
parent dea760ea1c
commit 449e4e1884
8 changed files with 149 additions and 51 deletions
+57 -13
View File
@@ -16,7 +16,7 @@
<el-row :gutter="24">
<el-col :span="6">
<el-form-item label="结算单" prop="settlementIds">
<el-input :model-value="settlementLabel" readonly placeholder="请选择应正式结算单">
<el-input :model-value="settlementLabel" readonly placeholder="请选择应正式结算单">
<template v-if="!readonly" #append>
<el-button @click="openSettlementDialog">选择</el-button>
</template>
@@ -414,7 +414,7 @@
<el-dialog
v-model="settlementDialog.visible"
title="选择应正式结算单"
title="选择应正式结算单"
width="86%"
append-to-body
>
@@ -423,18 +423,19 @@
v-model="settlementDialog.keyword"
clearable
placeholder="结算单号项目或合同"
@keyup.enter="loadSettlementCandidates"
@keyup.enter="handleSettlementSearch"
/>
<el-button type="primary" @click="loadSettlementCandidates">查询</el-button>
<el-button type="primary" @click="handleSettlementSearch">查询</el-button>
</div>
<el-table
ref="settlementTable"
v-loading="settlementDialog.loading"
:data="settlementDialog.rows"
row-key="id"
border
@selection-change="settlementDialog.selection = $event"
>
<el-table-column type="selection" width="52" align="center" />
<el-table-column type="selection" width="52" align="center" reserve-selection />
<el-table-column prop="formalSettlementNo" label="结算单号" min-width="170" />
<el-table-column prop="projectName" label="所属项目" min-width="150" />
<el-table-column prop="deptName" label="所属组织" min-width="150" />
@@ -454,6 +455,17 @@
</template>
</el-table-column>
</el-table>
<div class="invoice-form-page__dialog-pagination">
<el-pagination
v-model:current-page="settlementDialog.page.current"
v-model:page-size="settlementDialog.page.size"
:total="settlementDialog.page.total"
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper"
@current-change="loadSettlementCandidates"
@size-change="handleSettlementSizeChange"
/>
</div>
<template #footer>
<el-button @click="settlementDialog.visible = false">取消</el-button>
<el-button type="primary" @click="confirmSettlements">确定</el-button>
@@ -539,6 +551,7 @@ export default {
keyword: '',
rows: [],
selection: [],
page: { current: 1, size: 10, total: 0 },
},
rules: {
settlementIds: [{ validator: this.validateSettlements, trigger: 'change' }],
@@ -798,23 +811,49 @@ export default {
},
async openSettlementDialog() {
this.settlementDialog.visible = true;
this.settlementDialog.page.current = 1;
this.settlementDialog.selection = [];
this.$nextTick(() => this.$refs.settlementTable?.clearSelection());
await this.loadSettlementCandidates();
},
async loadSettlementCandidates() {
this.settlementDialog.loading = true;
try {
const data = this.unwrapData(
await api.getSettlementCandidates(this.settlementDialog.keyword)
await api.getSettlementCandidates(
this.settlementDialog.page.current,
this.settlementDialog.page.size,
{
keyword: this.settlementDialog.keyword,
contractCategory: '客户合同',
settlementType: 'receivable',
invoiceStatus: 'unreceived',
}
)
);
const rows = Array.isArray(data) ? data : data?.records || [];
this.settlementDialog.rows = rows;
this.settlementDialog.page.total = Number(
Array.isArray(data) ? data.length : data?.total || 0
);
this.settlementDialog.rows = Array.isArray(data) ? data : data?.records || [];
} finally {
this.settlementDialog.loading = false;
}
},
handleSettlementSearch() {
this.settlementDialog.page.current = 1;
this.settlementDialog.selection = [];
this.$refs.settlementTable?.clearSelection();
this.loadSettlementCandidates();
},
handleSettlementSizeChange() {
this.settlementDialog.page.current = 1;
this.loadSettlementCandidates();
},
async confirmSettlements() {
const rows = this.settlementDialog.selection;
if (!rows.length) {
this.$message.warning('请至少选择一张应正式结算单');
this.$message.warning('请至少选择一张应正式结算单');
return;
}
await this.applySettlements(rows);
@@ -962,19 +1001,19 @@ export default {
},
handleDetailLink(row, column) {
if (column.prop === 'documentNo') {
this.openPayableDetail(row);
this.openReceivableDetail(row);
return;
}
if (column.prop === 'waybillNo') this.openWaybillDetail(row);
},
async openPayableDetail(row) {
async openReceivableDetail(row) {
let detailId = row.sourceDetailId || '';
if (!detailId && row.documentNo) {
try {
const data = this.unwrapData(
await getReceivablePayableDetailList(1, 1, {
documentNo: row.documentNo,
settlementType: 'payable',
settlementType: 'receivable',
})
);
detailId = (Array.isArray(data) ? data : data?.records || [])[0]?.id || '';
@@ -983,11 +1022,11 @@ export default {
}
}
if (!detailId) {
this.$message.info('当前记录未找到对应的应明细');
this.$message.info('当前记录未找到对应的应明细');
return;
}
this.$router.push({
path: '/settlement/payable-detail',
path: '/settlement/receivable-detail',
query: { detailId },
});
},
@@ -1186,6 +1225,11 @@ export default {
.invoice-form-page__dialog-search .el-input {
width: 360px;
}
.invoice-form-page__dialog-pagination {
display: flex;
justify-content: flex-end;
margin-top: 12px;
}
.invoice-form-page :deep(.el-table) {
--el-table-border-color: #eff1f7;
}