From 52b78f5fcbfa3bb55012287fddd76b0f9eb5b771 Mon Sep 17 00:00:00 2001 From: iriska-gri <79623434+iriska-gri@users.noreply.github.com> Date: Tue, 7 Nov 2023 15:35:46 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=B8=D1=81=D0=BA=20=D0=B2=20?= =?UTF-8?q?=D0=BA=D0=B0=D1=80=D0=BE=D1=82=D0=BE=D1=87=D0=BA=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/db.sqlite3 | Bin 380928 -> 380928 bytes src/front/src/components/digital-letna.vue | 17 ++++++++++------- src/general_vacation/views.py | 12 +++++++----- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/db.sqlite3 b/src/db.sqlite3 index 1a8ef2ad5f346f15b9efc160415829a709022f9f..534514b56c55992af122070b8131ef878ed46afd 100644 GIT binary patch delta 145 zcmV;C0B-+)pcjCk7mynP#~(d+_49{{9nWN9s7a&m8XEp%^iEplmR zXmmm*2mmi38vzMBmoTpd7nft~0%ZgaGyq_i% - + {{t_dailyRound.position}} - + { + console.log(data, '-------------------data'); t_dailyRound.value = data.data - result.value=JSON.parse(JSON.stringify(data.data)) + result.value=JSON.parse(JSON.stringify(data.data.daily)) }) } @@ -238,16 +239,18 @@ export default { axiosApiInstance.get('api/general_vacation/dailyload/') .then(data => { - t_daily.value = data.data + t_daily.value = data.data.daily }) } const filterItems = (query) => { + console.log(t_dailyRound.value['daily'], '----------t_dailyRound.value'); + result.value={} - Object.keys(t_dailyRound.value).map(el1 => { - let myarr = t_dailyRound.value[el1].filter((el) =>el.fio.toLowerCase().includes(query.toLowerCase())) + Object.keys(t_dailyRound.value['daily']).map(el1 => { + let myarr = t_dailyRound.value['daily'][el1].filter((el) =>el.fio.toLowerCase().includes(query.toLowerCase())) if(myarr.length>0) { @@ -268,7 +271,7 @@ export default { } else { - result.value = JSON.parse(JSON.stringify(t_dailyRound.value)) + result.value = JSON.parse(JSON.stringify(t_dailyRound.value['daily'])) } diff --git a/src/general_vacation/views.py b/src/general_vacation/views.py index d305903a6..7c0d99393 100644 --- a/src/general_vacation/views.py +++ b/src/general_vacation/views.py @@ -297,10 +297,11 @@ class DailyloadAPIView(APIView): result={} - + if request.GET.__contains__('id'): df=df.loc[df['idpos']==int(request.GET.get("id"))] + pos=df['pos'].unique()[0] if request.GET.__contains__('searchname'): df = df.loc[df["fio"].str.contains(request.GET.get("searchname"))] @@ -312,17 +313,18 @@ class DailyloadAPIView(APIView): result[row['department']].append({'login':row['login'],'fio':row['fio'], 'post':row['post'], 'pos':row['pos']}) else: result[row['department']]=[{'login':row['login'],'fio':row['fio'], 'post':row['post'], 'pos':row['pos']}] - + daily = result + else: - + pos='' daily = DailyRoundUp.objects.values('position__name', 'position').filter(todaysDate=date.today()).annotate(Count('user')) except Exception as e: - + pos='' daily="" - return Response(daily) + return Response({'daily':daily, 'position':pos}) class SearchUserAPIView(APIView): def post(self, request):