年假计算

parent 648c5679
...@@ -104,13 +104,13 @@ const ensureLeavePeriod = async ( ...@@ -104,13 +104,13 @@ const ensureLeavePeriod = async (
let periodId: number; let periodId: number;
let usedDays: number; let usedDays: number;
let status: string; let status: 'active' | 'expired';
if ((existing as any[]).length > 0) { if ((existing as any[]).length > 0) {
const row = (existing as any[])[0]; const row = (existing as any[])[0];
periodId = row.id; periodId = row.id;
usedDays = Number(row.used_days); usedDays = Number(row.used_days);
status = row.status; status = row.status as 'active' | 'expired';
} else { } else {
// 数据库中没有记录,创建一条(以便后续使用结转余额) // 数据库中没有记录,创建一条(以便后续使用结转余额)
const [result] = await pool.execute( const [result] = await pool.execute(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment