From 919d06570888014fff8664a72f39407c424f8406 Mon Sep 17 00:00:00 2001 From: yinq Date: Wed, 10 Jun 2026 16:12:00 +0800 Subject: [PATCH] =?UTF-8?q?1.1.64=20=E5=88=86=E6=AC=BE=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9C=AA=E5=88=86=E6=AC=BE=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=BF=AE=E6=94=B9=E3=80=81=E5=88=A0=E9=99=A4=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E3=80=82=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oa/erp/finAccountInstallment/index.vue | 147 ++++++-- src/views/oa/finAccountInstallment/index.vue | 357 ------------------ 2 files changed, 119 insertions(+), 385 deletions(-) delete mode 100644 src/views/oa/finAccountInstallment/index.vue diff --git a/src/views/oa/erp/finAccountInstallment/index.vue b/src/views/oa/erp/finAccountInstallment/index.vue index d00b818..7d084df 100644 --- a/src/views/oa/erp/finAccountInstallment/index.vue +++ b/src/views/oa/erp/finAccountInstallment/index.vue @@ -119,23 +119,39 @@ - + - - - + + + selectedInstallmentRows.value.length > 0 && selectedInstallmentRows.value.every(isNotAllocated) ); -const installmentDialog = reactive({ visible: false, loading: false }); +const installmentDialog = reactive({ visible: false, loading: false, title: '新增回款' }); const installmentFormRef = ref(); -const installmentForm = reactive({ +const installmentFormKey = ref(0); +const getDefaultInstallmentForm = (): FinAccountInstallmentForm => ({ + accountInstallmentId: undefined, customerName: undefined, paymentAmount: undefined, paymentDate: undefined, remark: undefined, currency: 'CNY' }); +const installmentForm = reactive(getDefaultInstallmentForm()); /** 客户下拉(选项值存客户名称) */ const customerInfoList = ref([]); const getCustomerInfoListSelect = async () => { @@ -523,29 +556,87 @@ const handleInstallmentSelectionChange = (rows: FinAccountInstallmentVO[]) => { selectedInstallmentRows.value = rows; }; -const handleAddInstallment = () => { - installmentForm.customerName = undefined; - installmentForm.paymentAmount = undefined; - installmentForm.paymentDate = undefined; - installmentForm.remark = undefined; - installmentForm.currency = 'CNY'; +const resetInstallmentForm = () => { + Object.assign(installmentForm, getDefaultInstallmentForm()); +}; + +const handleAddInstallment = async () => { + resetInstallmentForm(); + installmentFormKey.value++; + installmentDialog.title = '新增回款'; installmentDialog.visible = true; + await nextTick(); + installmentFormRef.value?.clearValidate(); +}; + +/** 修改未分款回款 */ +const handleUpdate = async (row: FinAccountInstallmentVO) => { + if (!isNotAllocated(row)) { + proxy?.$modal.msgWarning('仅未分款状态的回款可修改'); + return; + } + resetInstallmentForm(); + Object.assign(installmentForm, { + accountInstallmentId: row.accountInstallmentId, + customerName: row.customerName, + paymentAmount: row.paymentAmount, + paymentDate: row.paymentDate, + remark: row.remark, + currency: row.currency || 'CNY' + }); + installmentDialog.title = '修改回款'; + installmentDialog.visible = true; + await nextTick(); + installmentFormRef.value?.clearValidate(); }; const submitInstallmentForm = async () => { const valid = await installmentFormRef.value?.validate(); if (!valid) return; installmentDialog.loading = true; + const isEdit = !!installmentForm.accountInstallmentId; try { - await addFinAccountInstallment(installmentForm); - proxy?.$modal.msgSuccess('新增成功'); + if (isEdit) { + await updateFinAccountInstallment(installmentForm); + proxy?.$modal.msgSuccess('修改成功'); + } else { + await addFinAccountInstallment(installmentForm); + proxy?.$modal.msgSuccess('新增成功'); + } installmentDialog.visible = false; + const selectedId = selectedInstallment.value?.accountInstallmentId; await getList(); + if (isEdit && selectedId === installmentForm.accountInstallmentId) { + const updated = finAccountInstallmentList.value.find((item) => item.accountInstallmentId === selectedId); + if (updated) { + selectedInstallment.value = updated; + await getDetailList(); + } + } } finally { installmentDialog.loading = false; } }; +/** 删除单条未分款回款 */ +const handleDelete = async (row: FinAccountInstallmentVO) => { + if (!isNotAllocated(row)) { + proxy?.$modal.msgWarning('仅未分款状态的回款可删除'); + return; + } + await proxy?.$modal.confirm(`是否确认删除回款编号为「${row.installmentCode}」的数据?`); + await delFinAccountInstallment(row.accountInstallmentId); + proxy?.$modal.msgSuccess('删除成功'); + if (selectedInstallment.value?.accountInstallmentId === row.accountInstallmentId) { + selectedInstallment.value = null; + finAccountInstallmentDetailList.value = []; + } + selectedInstallmentRows.value = selectedInstallmentRows.value.filter( + (item) => item.accountInstallmentId !== row.accountInstallmentId + ); + await getList(); +}; + /** 打开派发弹窗(批量勾选或操作列单条) */ const openDispatchDialog = async (rows?: FinAccountInstallmentVO[]) => { const targetRows = rows ?? selectedInstallmentRows.value; diff --git a/src/views/oa/finAccountInstallment/index.vue b/src/views/oa/finAccountInstallment/index.vue deleted file mode 100644 index 71ecce7..0000000 --- a/src/views/oa/finAccountInstallment/index.vue +++ /dev/null @@ -1,357 +0,0 @@ - - -