From 519d14d6236c8b05e91b9a01b0b2bafee78ce580 Mon Sep 17 00:00:00 2001 From: freedakgmail Date: Wed, 19 Aug 2026 07:50:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20blank=5Femployees=20=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E8=87=AA=E5=8A=A8=E5=B8=A6=E5=87=BA=E5=9F=BA?= =?UTF-8?q?=E6=9C=AC=E5=B7=A5=E8=B5=84=E7=AD=89=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因:blank_employees 和 custom 模式共用同一分支, 导致空白员工模式也会自动填充 baseSalary 修复:将 blank_employees 模式单独处理,所有金额默认0 --- backend/src/routes/payroll2.routes.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/src/routes/payroll2.routes.ts b/backend/src/routes/payroll2.routes.ts index 87f29b8..934aaf2 100644 --- a/backend/src/routes/payroll2.routes.ts +++ b/backend/src/routes/payroll2.routes.ts @@ -524,8 +524,10 @@ router.post('/batches', async (req: AuthRequest, res: Response, next: NextFuncti overtimePay = overtime?.totalPay || 0 allowance = prevPayslip?.allowance || 0 deduction = prevPayslip?.deduction || 0 - } else if (mode === 'custom' || mode === 'blank_employees') { - // 自定义/空白员工模式:取员工工资结构(非试用期) + } else if (mode === 'blank_employees') { + // 空白员工模式:拉入员工但所有金额默认0,需手动填写 + } else if (mode === 'custom') { + // 自定义模式:取员工工资结构(非试用期) const batchMonthEnd = new Date(`${month}-28T23:59:59`) const latestContract = emp.contracts?.[0] const inProbation = isInProbation(latestContract, batchMonthEnd) @@ -535,11 +537,10 @@ router.post('/batches', async (req: AuthRequest, res: Response, next: NextFuncti } else if (empBaseSalary > 0 || empPerformanceSalary > 0) { baseSalary = empBaseSalary // 绩效工资不自动带出,需手动点"获取绩效工资"按钮 - } else if (emp.monthlySalary && mode === 'custom') { + } else if (emp.monthlySalary) { // custom 模式旧数据兼容 try { baseSalary = Number(decrypt(emp.monthlySalary)) || 0 } catch { baseSalary = Number(emp.monthlySalary) || 0 } } - // blank_employees 模式:金额默认0,不自动带出 } // blank_all: 所有金额默认 0