From 749cb2f4ad815c5a68c19fe961d5ca2149a84dd4 Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期四, 17 九月 2026 11:28:54 +0800
Subject: [PATCH] feat(mes): 新增员工排班明细页面,修复计划排程菜单404
---
src/views/erp/finance/payment/index.vue | 124 ++++++++++++++++++++++++++++++++++-------
1 files changed, 102 insertions(+), 22 deletions(-)
diff --git a/src/views/erp/finance/payment/index.vue b/src/views/erp/finance/payment/index.vue
index a2aa1bc..cf696df 100644
--- a/src/views/erp/finance/payment/index.vue
+++ b/src/views/erp/finance/payment/index.vue
@@ -2,9 +2,10 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { ErpFinancePaymentApi } from '#/api/erp/finance/payment';
-import { ref } from 'vue';
+import { onMounted, ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui';
+import { useUserStore } from '@vben/stores';
import { downloadFileFromBlobPart, isEmpty } from '@vben/utils';
import { message } from 'ant-design-vue';
@@ -13,25 +14,56 @@
import {
deleteFinancePayment,
exportFinancePayment,
+ getFinancePaymentApproverUserIds,
getFinancePaymentPage,
- updateFinancePaymentStatus,
+ submitFinancePayment,
} from '#/api/erp/finance/payment';
import { $t } from '#/locales';
import { useGridColumns, useGridFormSchema } from './data';
+import AuditModal from './modules/audit-modal.vue';
import Form from './modules/form.vue';
/** ERP 浠樻鍗曞垪琛� */
defineOptions({ name: 'ErpFinancePayment' });
+
+const userStore = useUserStore();
+
+/** 褰撳墠涓氬姟绫诲瀷鐨勫鎵逛汉缂栧彿闆嗗悎锛岀敤浜庡垽鏂槸鍚﹀睍绀哄鏍告寜閽� */
+const approverIds = ref<number[]>([]);
+/** 褰撳墠鐧诲綍鐢ㄦ埛缂栧彿 */
+const currentUserId = userStore.userInfo?.id;
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: Form,
destroyOnClose: true,
});
-/** 鍒锋柊琛ㄦ牸 */
+const [AuditModalComp, auditModalApi] = useVbenModal({
+ connectedComponent: AuditModal,
+ destroyOnClose: true,
+});
+
+/** 鍒锋柊琛ㄦ牸銆佸鎵逛汉闆嗗悎 */
function handleRefresh() {
gridApi.query();
+ loadApproverIds();
+}
+
+/** 鍔犺浇褰撳墠涓氬姟绫诲瀷鐨勫鎵逛汉缂栧彿闆嗗悎 */
+async function loadApproverIds() {
+ try {
+ approverIds.value = (await getFinancePaymentApproverUserIds()) ?? [];
+ } catch {
+ approverIds.value = [];
+ }
+}
+
+/** 褰撳墠鐢ㄦ埛鏄惁涓鸿涓氬姟绫诲瀷鐨勫鎵逛汉锛屼笖鍗曟嵁澶勪簬瀹℃壒涓� */
+function canAudit(row: ErpFinancePaymentApi.FinancePayment) {
+ return (
+ row.status === 15 && approverIds.value.includes(currentUserId as number)
+ );
}
/** 瀵煎嚭琛ㄦ牸 */
@@ -65,22 +97,43 @@
}
}
-/** 瀹℃壒/鍙嶅鎵规搷浣� */
-async function handleUpdateStatus(
- row: ErpFinancePaymentApi.FinancePayment,
- status: number,
-) {
+/** 鎻愪氦瀹℃牳 - 鍚庣鎸夊鎵归厤缃牎楠屽鎵逛汉锛屾棤闇�鍓嶇閫夋嫨娴佺▼ */
+async function handleSubmit(row: ErpFinancePaymentApi.FinancePayment) {
const hideLoading = message.loading({
- content: `纭畾${status === 20 ? '瀹℃壒' : '鍙嶅鎵�'}璇ヤ粯娆惧崟鍚楋紵`,
+ content: '姝e湪鎻愪氦瀹℃牳...',
duration: 0,
});
try {
- await updateFinancePaymentStatus(row.id!, status);
- message.success(`${status === 20 ? '瀹℃壒' : '鍙嶅鎵�'}鎴愬姛`);
+ await submitFinancePayment(row.id!);
+ message.success('鎻愪氦鎴愬姛锛岀瓑寰呭鎵逛汉瀹℃牳');
handleRefresh();
} finally {
hideLoading();
}
+}
+
+/** 瀹℃牳 - 閫氳繃 / 涓嶉�氳繃 */
+function handleAudit(row: ErpFinancePaymentApi.FinancePayment, pass: boolean) {
+ auditModalApi.setData({ pass, row }).open();
+}
+
+/** 鏌ョ湅瀹℃壒璁板綍 - 杞婚噺绾у鎵逛笉鍐嶈烦杞� BPM 娴佺▼璇︽儏 */
+function handleViewProcess(row: ErpFinancePaymentApi.FinancePayment) {
+ const parts: string[] = [];
+ if (row.reviewerName) {
+ parts.push(`瀹℃牳浜猴細${row.reviewerName}`);
+ }
+ if (row.reviewTime) {
+ parts.push(`瀹℃牳鏃堕棿锛�${row.reviewTime}`);
+ }
+ if (row.reviewRemark) {
+ parts.push(`瀹℃牳鎰忚锛�${row.reviewRemark}`);
+ }
+ if (parts.length === 0) {
+ message.info('璇ヤ粯娆惧崟鏆傛棤瀹℃牳璁板綍');
+ return;
+ }
+ message.info(parts.join('銆�'));
}
const checkedIds = ref<number[]>([]);
@@ -130,10 +183,15 @@
checkboxChange: handleRowCheckboxChange,
},
});
+
+onMounted(() => {
+ loadApproverIds();
+});
</script>
<template>
<Page auto-content-height><FormModal @success="handleRefresh" />
+ <AuditModalComp @success="handleRefresh" />
<Grid table-title="浠樻鍗曞垪琛�">
<template #toolbar-tools>
<TableAction
@@ -189,22 +247,43 @@
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.AUDIT,
+ auth: ['erp:finance-payment:audit'],
+ // 浠呫�屽鎵逛腑 + 褰撳墠鐧诲綍鐢ㄦ埛鏄鎵逛汉銆嶆墠鏄剧ず锛屽叾浠栦汉鐪嬩笉鍒拌鎸夐挳
+ ifShow: canAudit(row),
+ onClick: handleAudit.bind(null, row, true),
+ },
+ {
+ label: '瀹℃牳涓嶉�氳繃',
+ type: 'link',
+ danger: true,
+ icon: ACTION_ICON.AUDIT,
+ auth: ['erp:finance-payment:audit'],
+ ifShow: canAudit(row),
+ onClick: handleAudit.bind(null, row, false),
+ },
+ {
+ label: '鏌ョ湅瀹℃壒',
+ type: 'link',
+ icon: ACTION_ICON.VIEW,
+ auth: ['erp:finance-payment:query'],
+ ifShow: () => row.status === 20 || !!row.reviewRemark,
+ onClick: handleViewProcess.bind(null, row),
},
{
label: $t('common.delete'),
@@ -212,6 +291,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