From 5ef7dfb4b199cca2bfea1fb1857ca4ef9326a45f Mon Sep 17 00:00:00 2001
From: flower-string <2178503051@qq.com>
Date: Mon, 10 Mar 2025 15:10:49 +0800
Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20=E5=A5=96=E6=83=A9=E7=AE=A1?=
=?UTF-8?q?=E7=90=86=E5=92=8C=E8=96=AA=E8=B5=84=E8=AE=A1=E7=AE=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ruoyi-ui/src/api/oa/salary.js | 81 ++++++
.../oa/peoples/date/components/SalaryForm.vue | 72 +++++
.../peoples/date/components/SalaryTable.vue | 52 ++++
ruoyi-ui/src/views/oa/peoples/date/index.vue | 209 ++++++++++++++
.../views/oa/peoples/salary/staff/index.vue | 68 +++--
.../views/oa/peoples/salary/worker/index.vue | 267 ++++++++++++++++++
ruoyi-ui/src/views/system/user/index.vue | 7 +
7 files changed, 726 insertions(+), 30 deletions(-)
create mode 100644 ruoyi-ui/src/views/oa/peoples/date/components/SalaryForm.vue
create mode 100644 ruoyi-ui/src/views/oa/peoples/date/components/SalaryTable.vue
create mode 100644 ruoyi-ui/src/views/oa/peoples/date/index.vue
diff --git a/ruoyi-ui/src/api/oa/salary.js b/ruoyi-ui/src/api/oa/salary.js
index e5a6200..dabc2be 100644
--- a/ruoyi-ui/src/api/oa/salary.js
+++ b/ruoyi-ui/src/api/oa/salary.js
@@ -29,4 +29,85 @@ export function uploadOssFile(data) {
'Content-Type': 'multipart/form-data'
}
})
+}
+
+export function getCalcHistory({ payTime }) {
+ return request({
+ url: '/oa/salary/list-staff',
+ method: 'get',
+ params: {
+ payTime
+ }
+ })
+}
+
+export function getWorkersCalcHistory({ payTime }) {
+ return request({
+ url: 'oa/salary/list-worker',
+ method: 'get',
+ params: {
+ payTime
+ }
+ })
+}
+
+export function getSalaryItemDetail(salaryId) {
+ return request({
+ url: '/oa/salaryItem/list',
+ method: 'get',
+ params: {
+ salaryId
+ }
+ })
+}
+
+export function deleteSalaryItem(id) {
+ return request({
+ url: `/oa/salaryItem/${id}`,
+ method: 'delete'
+ })
+}
+
+export function createSalaryItem(data) {
+ return request({
+ url: '/oa/salaryItem',
+ method: 'post',
+ data
+ })
+}
+
+/**
+ * 处理日期字符串
+ * @param {*} input
+ * @returns
+ */
+export function convertToDateString(input) {
+ // 验证输入格式
+ if (!/^\d{6}$/.test(input)) {
+ throw new Error("Invalid input format. Expected YYYYMM");
+ }
+
+ const year = input.substring(0, 4);
+ const month = input.substring(4, 6);
+
+ // 验证月份有效性
+ const monthNum = parseInt(month, 10);
+ if (monthNum < 1 || monthNum > 12) {
+ throw new Error("Invalid month value");
+ }
+
+ // 创建日期对象
+ const date = new Date(year, monthNum - 1, 1);
+
+ // 处理无效日期(如2025-02-30)
+ if (isNaN(date.getTime())) {
+ throw new Error("Invalid date combination");
+ }
+
+ // 格式化输出
+ return [
+ date.getFullYear(),
+ (date.getMonth() + 1).toString().padStart(2, "0"),
+ "01"
+ ].join("-");
}
\ No newline at end of file
diff --git a/ruoyi-ui/src/views/oa/peoples/date/components/SalaryForm.vue b/ruoyi-ui/src/views/oa/peoples/date/components/SalaryForm.vue
new file mode 100644
index 0000000..1b5da2f
--- /dev/null
+++ b/ruoyi-ui/src/views/oa/peoples/date/components/SalaryForm.vue
@@ -0,0 +1,72 @@
+
+