调整收付款问题
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -164,9 +164,11 @@
|
||||
></el-col>
|
||||
<el-col :span="6"
|
||||
><el-form-item label="收款账号" prop="receiptAccountId"
|
||||
><span v-if="readonly">{{ form.bankAccount || '-' }}</span
|
||||
><el-select
|
||||
v-else
|
||||
v-model="form.receiptAccountId"
|
||||
:disabled="readonly || !form.payeeName"
|
||||
:disabled="!form.payeeName"
|
||||
:loading="receiptAccountLoading"
|
||||
filterable
|
||||
clearable
|
||||
@@ -343,7 +345,7 @@
|
||||
>
|
||||
<div class="payment-form-page__attachment-upload">
|
||||
<vehicle-attachment-upload
|
||||
:model-value="form.attachments"
|
||||
v-model="form.attachments"
|
||||
:readonly="readonly"
|
||||
:multiple="true"
|
||||
:limit="20"
|
||||
@@ -351,8 +353,7 @@
|
||||
:file-types="attachmentFileTypes"
|
||||
:show-file-list="false"
|
||||
button-text="上传附件"
|
||||
@update:model-value="normalizeAttachments"
|
||||
@success="handleManualAttachmentUpload"
|
||||
@change="normalizeAttachments"
|
||||
/>
|
||||
</div>
|
||||
</section-card>
|
||||
@@ -2045,6 +2046,9 @@ export default {
|
||||
},
|
||||
normalizeAttachments(files) {
|
||||
const existingAttachments = this.form.attachments || [];
|
||||
const userInfo = this.$store.getters.userInfo || {};
|
||||
const uploadUserName = userInfo.realName || userInfo.userName || '';
|
||||
const uploadTime = this.$dayjs().format('YYYY-MM-DD HH:mm:ss');
|
||||
this.form.attachments = (files || []).map(file => {
|
||||
const fileUrl = this.attachmentFileUrl(file);
|
||||
const existingFile = existingAttachments.find(item => {
|
||||
@@ -2058,28 +2062,11 @@ export default {
|
||||
attachmentType:
|
||||
existingFile?.attachmentType || this.resolveAttachmentTypeByFileName(file),
|
||||
description: file.description || existingFile?.description || '',
|
||||
uploadUserName: existingFile?.uploadUserName || file.uploadUserName || uploadUserName,
|
||||
uploadTime: existingFile?.uploadTime || file.uploadTime || uploadTime,
|
||||
};
|
||||
});
|
||||
},
|
||||
handleManualAttachmentUpload(uploadedFile) {
|
||||
const uploadedUrl = this.attachmentFileUrl(uploadedFile);
|
||||
const uploadedUid = uploadedFile?.uid;
|
||||
const userInfo = this.$store.getters.userInfo || {};
|
||||
const uploadUserName = userInfo.realName || userInfo.userName || '';
|
||||
const uploadTime = this.$dayjs().format('YYYY-MM-DD HH:mm:ss');
|
||||
this.form.attachments = (this.form.attachments || []).map(file => {
|
||||
const isUploadedFile =
|
||||
(uploadedUid && file.uid === uploadedUid) ||
|
||||
(uploadedUrl && this.attachmentFileUrl(file) === uploadedUrl);
|
||||
return isUploadedFile
|
||||
? {
|
||||
...file,
|
||||
uploadUserName,
|
||||
uploadTime,
|
||||
}
|
||||
: file;
|
||||
});
|
||||
},
|
||||
formatAttachmentSize(file = {}) {
|
||||
const rawSize = file.size ?? file.fileSize ?? file.attachSize;
|
||||
if (rawSize === undefined || rawSize === null || rawSize === '') return '-';
|
||||
|
||||
Reference in New Issue
Block a user