fix: blank_employees 模式不再自动带出基本工资等数据

根因:blank_employees 和 custom 模式共用同一分支,
导致空白员工模式也会自动填充 baseSalary

修复:将 blank_employees 模式单独处理,所有金额默认0
This commit is contained in:
freedakgmail
2026-08-19 07:50:31 +08:00
parent 13f21252d0
commit 519d14d623
+5 -4
View File
@@ -524,8 +524,10 @@ router.post('/batches', async (req: AuthRequest, res: Response, next: NextFuncti
overtimePay = overtime?.totalPay || 0 overtimePay = overtime?.totalPay || 0
allowance = prevPayslip?.allowance || 0 allowance = prevPayslip?.allowance || 0
deduction = prevPayslip?.deduction || 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 batchMonthEnd = new Date(`${month}-28T23:59:59`)
const latestContract = emp.contracts?.[0] const latestContract = emp.contracts?.[0]
const inProbation = isInProbation(latestContract, batchMonthEnd) 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) { } else if (empBaseSalary > 0 || empPerformanceSalary > 0) {
baseSalary = empBaseSalary baseSalary = empBaseSalary
// 绩效工资不自动带出,需手动点"获取绩效工资"按钮 // 绩效工资不自动带出,需手动点"获取绩效工资"按钮
} else if (emp.monthlySalary && mode === 'custom') { } else if (emp.monthlySalary) {
// custom 模式旧数据兼容 // custom 模式旧数据兼容
try { baseSalary = Number(decrypt(emp.monthlySalary)) || 0 } catch { baseSalary = Number(emp.monthlySalary) || 0 } try { baseSalary = Number(decrypt(emp.monthlySalary)) || 0 } catch { baseSalary = Number(emp.monthlySalary) || 0 }
} }
// blank_employees 模式:金额默认0,不自动带出
} }
// blank_all: 所有金额默认 0 // blank_all: 所有金额默认 0