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