From ce5c21f4fa893e834f08a20b481a81fa7bb8fa3d Mon Sep 17 00:00:00 2001 From: Jon Date: Mon, 3 Feb 2025 16:20:16 +0100 Subject: [PATCH] fix: refs #8370 change param rely on month --- src/pages/Worker/Card/WorkerTimeControl.vue | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/pages/Worker/Card/WorkerTimeControl.vue b/src/pages/Worker/Card/WorkerTimeControl.vue index c580e5202..d181c70af 100644 --- a/src/pages/Worker/Card/WorkerTimeControl.vue +++ b/src/pages/Worker/Card/WorkerTimeControl.vue @@ -345,17 +345,35 @@ const getMailStates = async (date) => { const url = `WorkerTimeControls/${route.params.id}/getMailStates`; const month = date.getMonth() + 1; const prevMonth = month == 1 ? 12 : month - 1; + const postMonth = month == 12 ? 1 : month + 1; const params = { month, year: date.getFullYear(), }; const curMonthStates = (await axios.get(url, { params })).data; + + if (prevMonth == 12) { + params.year = params.year - 1; + } const prevMonthStates = ( await axios.get(url, { params: { ...params, month: prevMonth } }) ).data; - workerTimeControlMails.value = curMonthStates.concat(prevMonthStates); + if (postMonth == 1) { + params.year = date.getFullYear() + 1; + } + + const postMonthStates = ( + await axios.get(url, { + params: { ...params, month: postMonth }, + }) + ).data; + + workerTimeControlMails.value = curMonthStates.concat( + prevMonthStates, + postMonthStates + ); }; const showWorkerTimeForm = (propValue, formType) => {