From f630e7e4d50ba22da8f42336196a02dbae850ced Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 10 八月 2026 17:54:32 +0800
Subject: [PATCH] refactor(erp): 优化采购发票和财务付款审核流程
---
src/views/erp/finance/payment/index.vue | 71 ++++++++++++++++++++++++-----------
1 files changed, 49 insertions(+), 22 deletions(-)
diff --git a/src/views/erp/finance/payment/index.vue b/src/views/erp/finance/payment/index.vue
index a2aa1bc..8a9658e 100644
--- a/src/views/erp/finance/payment/index.vue
+++ b/src/views/erp/finance/payment/index.vue
@@ -3,6 +3,7 @@
import type { ErpFinancePaymentApi } from '#/api/erp/finance/payment';
import { ref } from 'vue';
+import { useRouter } from 'vue-router';
import { Page, useVbenModal } from '@vben/common-ui';
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
@@ -13,19 +14,27 @@
import {
deleteFinancePayment,
exportFinancePayment,
+ getFinancePaymentApproveProcessList,
getFinancePaymentPage,
- updateFinancePaymentStatus,
} from '#/api/erp/finance/payment';
import { $t } from '#/locales';
import { useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
+import ProcessSelectModal from './modules/process-select-modal.vue';
/** ERP 浠樻鍗曞垪琛� */
defineOptions({ name: 'ErpFinancePayment' });
+const router = useRouter();
+
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: Form,
+ destroyOnClose: true,
+});
+
+const [ProcessModal, processModalApi] = useVbenModal({
+ connectedComponent: ProcessSelectModal,
destroyOnClose: true,
});
@@ -65,22 +74,36 @@
}
}
-/** 瀹℃壒/鍙嶅鎵规搷浣� */
-async function handleUpdateStatus(
- row: ErpFinancePaymentApi.FinancePayment,
- status: number,
-) {
+/** 鎻愪氦瀹℃壒 - 鍏堣幏鍙栨祦绋嬪垪琛� */
+async function handleSubmit(row: ErpFinancePaymentApi.FinancePayment) {
const hideLoading = message.loading({
- content: `纭畾${status === 20 ? '瀹℃壒' : '鍙嶅鎵�'}璇ヤ粯娆惧崟鍚楋紵`,
+ content: '鑾峰彇瀹℃壒娴佺▼...',
duration: 0,
});
try {
- await updateFinancePaymentStatus(row.id!, status);
- message.success(`${status === 20 ? '瀹℃壒' : '鍙嶅鎵�'}鎴愬姛`);
- handleRefresh();
- } finally {
+ const processList = await getFinancePaymentApproveProcessList();
+ hideLoading();
+ if (!processList || processList.length === 0) {
+ message.warning('鏆傛棤鍙敤瀹℃壒娴佺▼锛岃鍏堥厤缃� BPM 娴佺▼');
+ return;
+ }
+ // 鎵撳紑娴佺▼閫夋嫨寮圭獥
+ processModalApi.setData({ id: row.id, processList }).open();
+ } catch {
hideLoading();
}
+}
+
+/** 鏌ョ湅瀹℃壒璇︽儏 */
+function handleProcessDetail(row: ErpFinancePaymentApi.FinancePayment) {
+ if (!row.processInstanceId) {
+ message.warning('璇ヤ粯娆惧崟灏氭湭鎻愪氦瀹℃壒');
+ return;
+ }
+ router.push({
+ name: 'BpmProcessInstanceDetail',
+ query: { id: row.processInstanceId },
+ });
}
const checkedIds = ref<number[]>([]);
@@ -134,6 +157,7 @@
<template>
<Page auto-content-height><FormModal @success="handleRefresh" />
+ <ProcessModal @success="handleRefresh" />
<Grid table-title="浠樻鍗曞垪琛�">
<template #toolbar-tools>
<TableAction
@@ -189,22 +213,24 @@
type: 'link',
icon: ACTION_ICON.EDIT,
auth: ['erp:finance-payment:update'],
- ifShow: () => row.status !== 20,
+ ifShow: () => row.status !== 20 && row.status !== 15,
onClick: handleEdit.bind(null, row),
},
{
- label: row.status === 10 ? '瀹℃壒' : '鍙嶅鎵�',
+ label: '鎻愪氦瀹℃牳',
type: 'link',
icon: ACTION_ICON.AUDIT,
- auth: ['erp:finance-payment:update-status'],
- popConfirm: {
- title: `纭${row.status === 10 ? '瀹℃壒' : '鍙嶅鎵�'}${row.no}鍚楋紵`,
- confirm: handleUpdateStatus.bind(
- null,
- row,
- row.status === 10 ? 20 : 10,
- ),
- },
+ auth: ['erp:finance-payment:update'],
+ ifShow: () => row.status === 10,
+ onClick: handleSubmit.bind(null, row),
+ },
+ {
+ label: '鏌ョ湅瀹℃壒',
+ type: 'link',
+ icon: ACTION_ICON.VIEW,
+ auth: ['erp:finance-payment:query'],
+ ifShow: () => row.status !== 10 && !!row.processInstanceId,
+ onClick: handleProcessDetail.bind(null, row),
},
{
label: $t('common.delete'),
@@ -212,6 +238,7 @@
danger: true,
icon: ACTION_ICON.DELETE,
auth: ['erp:finance-payment:delete'],
+ ifShow: () => row.status !== 15,
popConfirm: {
title: $t('ui.actionMessage.deleteConfirm', [row.no]),
confirm: handleDelete.bind(null, [row.id!]),
--
Gitblit v1.9.3