R62 Fix A1-A6:请假预览全非工作日处理
这个提交包含在:
+11
-3
@@ -233,10 +233,13 @@ function buildNaturalWorkingDaysPreview(body) {
|
||||
weekendDayCount: 0,
|
||||
adjustedWorkdayCount: 0,
|
||||
calendarApplied: false,
|
||||
isNonWorkingRange: false,
|
||||
};
|
||||
}
|
||||
|
||||
async function resolveWorkingDaysPreview(fastify, employee, body) {
|
||||
async function resolveWorkingDaysPreview(fastify, employee, body, options = {}) {
|
||||
const allowNonWorkingRange = Boolean(options.allowNonWorkingRange);
|
||||
|
||||
if (!employee?.legal_entity_id) {
|
||||
return buildNaturalWorkingDaysPreview(body);
|
||||
}
|
||||
@@ -288,11 +291,14 @@ async function resolveWorkingDaysPreview(fastify, employee, body) {
|
||||
startSession: body.startSession,
|
||||
endSession: body.endSession,
|
||||
calendarDays: calendar.days,
|
||||
allowNonWorkingRange,
|
||||
});
|
||||
}
|
||||
|
||||
async function resolveRequestedDaysForCreate(fastify, employee, body) {
|
||||
const preview = await resolveWorkingDaysPreview(fastify, employee, body);
|
||||
const preview = await resolveWorkingDaysPreview(fastify, employee, body, {
|
||||
allowNonWorkingRange: false,
|
||||
});
|
||||
return preview.requestedDays;
|
||||
}
|
||||
|
||||
@@ -579,7 +585,9 @@ async function leaveRoutes(fastify) {
|
||||
},
|
||||
async (request, reply) => {
|
||||
const query = parseWorkingDaysPreviewQuery(request.query);
|
||||
const preview = await resolveWorkingDaysPreview(fastify, request.employee, query);
|
||||
const preview = await resolveWorkingDaysPreview(fastify, request.employee, query, {
|
||||
allowNonWorkingRange: true,
|
||||
});
|
||||
|
||||
return sendData(reply, request, preview);
|
||||
},
|
||||
|
||||
在新工单中引用
屏蔽一个用户