From f7e06aaee32674791f63d6e5111c0d0a3f4de4a3 Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期五, 28 八月 2026 15:13:13 +0800
Subject: [PATCH] feat(hrm): 新增班次/排班页面,优化薪酬核算
---
src/views/hrm/salary/calculation/index.vue | 84 ++++++++++++++++++++++++++++++++++++++++-
1 files changed, 81 insertions(+), 3 deletions(-)
diff --git a/src/views/hrm/salary/calculation/index.vue b/src/views/hrm/salary/calculation/index.vue
index 8536a41..33a1f36 100644
--- a/src/views/hrm/salary/calculation/index.vue
+++ b/src/views/hrm/salary/calculation/index.vue
@@ -16,9 +16,11 @@
import {
calculateSalary,
confirmSalary,
+ deleteSalaryCalculation,
exportSalaryCalculation,
getSalaryCalculationPage,
previewSalaryCalculation,
+ revokeSalaryCalculation,
saveSalaryCalculation,
} from '#/api/hrm/salary/calculation';
import { getDeptList } from '#/api/system/dept';
@@ -153,7 +155,7 @@
handleRefresh();
}
-/** 鎵归噺纭 */
+/** 鎵归噺纭閫変腑鐨勮褰� */
async function handleBatchConfirm() {
const records = gridApi.grid.getCheckboxRecords() as HrmSalaryCalculationApi.SalaryCalculation[];
if (records.length === 0) {
@@ -164,6 +166,58 @@
await confirmSalary(ids);
message.success('纭鎴愬姛');
handleRefresh();
+}
+
+/** 鎵归噺淇濆瓨閫変腑鐨勬牳绠楄褰曪紙浠呭緟纭鐘舵�侊級 */
+async function handleBatchSave() {
+ const records = gridApi.grid.getCheckboxRecords() as HrmSalaryCalculationApi.SalaryCalculation[];
+ if (records.length === 0) {
+ message.warning('璇烽�夋嫨瑕佷繚瀛樼殑璁板綍');
+ return;
+ }
+ const pending = records.filter((r) => r.status === 0);
+ if (pending.length === 0) {
+ message.warning('閫変腑鐨勮褰曞潎闈炲緟纭鐘舵�侊紝鏃犻渶淇濆瓨');
+ return;
+ }
+ const first = pending[0];
+ if (!first?.period) {
+ message.warning('缂哄皯鏍哥畻鍛ㄦ湡');
+ return;
+ }
+ await saveSalaryCalculation({ period: first.period, list: pending });
+ message.success('鎵归噺淇濆瓨鎴愬姛');
+ handleRefresh();
+}
+
+/** 鎾ら攢纭锛堝凡纭 鈫� 寰呯‘璁わ紝鍙噸鏂版牳绠楋級 */
+async function handleRevoke(row: HrmSalaryCalculationApi.SalaryCalculation) {
+ Modal.confirm({
+ title: '鎾ら攢纭',
+ content: `纭畾鎾ら攢銆�${row.no}銆戠殑纭鍚楋紵鎾ら攢鍚庡彲閲嶆柊鏍哥畻銆俙,
+ okText: '纭畾',
+ cancelText: '鍙栨秷',
+ onOk: async () => {
+ await revokeSalaryCalculation([row.id!]);
+ message.success('鎾ら攢鎴愬姛');
+ handleRefresh();
+ },
+ });
+}
+
+/** 鍒犻櫎寰呯‘璁ょ殑鏍哥畻璁板綍 */
+async function handleDelete(row: HrmSalaryCalculationApi.SalaryCalculation) {
+ Modal.confirm({
+ title: '纭鍒犻櫎',
+ content: `纭畾鍒犻櫎銆�${row.no}銆戠殑鏍哥畻璁板綍鍚楋紵鍒犻櫎鍚庨渶閲嶆柊鏍哥畻銆俙,
+ okText: '纭畾',
+ cancelText: '鍙栨秷',
+ onOk: async () => {
+ await deleteSalaryCalculation(row.id!);
+ message.success('鍒犻櫎鎴愬姛');
+ handleRefresh();
+ },
+ });
}
/** 瀵煎嚭钖叕鏍哥畻 */
@@ -182,7 +236,6 @@
keepSource: true,
checkboxConfig: {
highlight: true,
- reserve: true,
},
proxyConfig: {
ajax: {
@@ -193,6 +246,10 @@
...formValues,
}),
},
+ },
+ pagingConfig: {
+ pageSize: 20,
+ pageSizes: [20, 50, 100],
},
rowConfig: {
keyField: 'id',
@@ -261,7 +318,7 @@
v-if="previewData.length > 0"
:columns="usePreviewColumns()"
:data-source="previewData"
- :pagination="false"
+ :pagination="{ pageSize: 20, showSizeChanger: true, showTotal: (t) => `鍏� ${t} 浜篳 }"
:scroll="{ x: 1800, y: 400 }"
size="small"
row-key="userId"
@@ -430,6 +487,12 @@
onClick: handleBatchConfirm,
},
{
+ label: '鎵归噺淇濆瓨',
+ type: 'primary',
+ auth: ['hrm:salary-calculation:save'],
+ onClick: handleBatchSave,
+ },
+ {
label: $t('ui.actionTitle.export'),
type: 'primary',
icon: ACTION_ICON.DOWNLOAD,
@@ -454,6 +517,21 @@
ifShow: row.status === 0,
onClick: handleConfirm.bind(null, row),
},
+ {
+ label: '鍒犻櫎',
+ type: 'link',
+ danger: true,
+ auth: ['hrm:salary-calculation:delete'],
+ ifShow: row.status === 0,
+ onClick: handleDelete.bind(null, row),
+ },
+ {
+ label: '鎾ら攢纭',
+ type: 'link',
+ auth: ['hrm:salary-calculation:confirm'],
+ ifShow: row.status === 10,
+ onClick: handleRevoke.bind(null, row),
+ },
]"
/>
</template>
--
Gitblit v1.9.3