From 03f8d9cd6512726501f7b300fe0c2cd01cacdee0 Mon Sep 17 00:00:00 2001 From: iriska-gri <79623434+iriska-gri@users.noreply.github.com> Date: Mon, 23 Oct 2023 17:04:52 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=D1=8B=D0=B2=D0=BE=D0=B4=20=D0=BD=D0=B0?= =?UTF-8?q?=20=D1=8D=D0=BA=D1=80=D0=B0=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db.sqlite3 | Bin 376832 -> 376832 bytes front/src/views/HomePage.vue | 24 ++++++++++++++-- general_vacation/models.py | 2 +- general_vacation/serializers.py | 9 +++++- general_vacation/urls.py | 1 + general_vacation/views.py | 47 +++++++++++++++++--------------- 6 files changed, 56 insertions(+), 27 deletions(-) diff --git a/db.sqlite3 b/db.sqlite3 index 386f1caab281b9e4287fdb49db2fc8df584a9190..e0b7ba9593abbc479ffed1610b08cdd60c116b9b 100644 GIT binary patch delta 5057 zcmeI0ZEO@p7{_mCclHYH?$9b!8Hp`OHH2$sZuj=~OwfYHCZdSE7AO?Td!f9vK%qeQ zR>YP=<)z?O6O-x(@B?TFkxMW}jG*y@Sc3_gpj0C!4d7ceDhA`+EbP&3=c}K3x&8ll z@0Vwu-PzfBb}pSRO{YuukJc;NB9TZf+ZM1*KJbtQD%wsgK61a*(HSk9Aa`i>CyPm? z)>$8`fMZw4)xg{LfHDR|x;l@=Myr|f<#M&;^^8--?COiP_r;`aUkuN_Q~VmbctMo_IlAXECB7zPCNtZP*jyA zfFc?1;OBs~S9s2g_Atzx^nePls)w~Vrw6Prlpl77d&S>^%Hn1eCvhW2Ni1$W?haEU z-ubUURkr#Pcwc5M-1MToxfX7Eq!&ElRrRtKw)BGbLa+Neuw{egD*p*gX>Yv-*d}LN zuPK?C6T6CPBIqCV2l^THp>NPd^o4HdG5tZkTpy_;eHc2Y-9*Pxi*`kO$Gfiz?!Fi6 zvi7I;t9DhptbMIr&_2^X(LU7P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2=JI@= zZ+`jR@44jeGMPXo6UZ8Rs13j-T7_L5yS0gh+73VX*3GWr39WXyGVDuD`^}ZUiB!0r z>!F90wJtfj%w6MZnK%?S_;6@Tq2koJYX;`RLvvx5Jr`y-?o|A~N~z^ooiuZ-UnX;m z+wbRC%qy?G!D^~v0Q=k7?|e3!nceMt;2e!BT{8bWYp~Z%u}>B&elae!8CJ*irS^&$ zwpnQ64tl&UA;-UAG~COi<`jlItX?J^8ot3{J3KP`HmeR-h^QG|6^@wUNE6^TZg(N% zOx8Nb|2@t*;*OflRyl|K`YcP@Yky$J6dD_sTD~wg&(_Ffp2l|P*^o!JUtr5*=#Uza zp^NP9q275$OR;4g5jUcvu5etLE7 zc28Q_gjWG&10;DLULn`vWwIH2$vZJY#xYJtF-ERHmaNApS&NrQ122+Qc!AWhhb+Sg z$uLYW`5K-l|HKe^8PAcwVvxLmXUX)B7@+Mec9Y-2B2OVhex4>y^b?;xL)cFfANCPb zy~I1ah=WfNlRd<~Zes6~#OM>mNEb11IJ&1E05p9TY92Q+z&M_tSppN5RaS%6gytzaiMK#9(aRxfa>*6

0IM+HEi)|F}h%)AgD!KkDPAK9WkWNTSf(cI;~ASGA#sX=Z=DL2c` zUFr>LqxTQgUoYFK9(A(pqpYe`sBXG*qwUS9e+i}1cTQ>@>Mittzvoj7D=0UQsR15| zB@8RDkYk3mq?DVeUR}sRH9_U7VvJL@vKSjEE-p34O~dk+azoUxDi$);MX|l9(XjM| yc53l0 + {{t_daily}} kk + + - + {{x.status}} @@ -153,7 +156,7 @@ import { axiosApiInstance } from '@/utils/axios-api' import CalendarFull from '@/components/UI/Calendar-full.vue' import NewsListHome from '@/components/news-list-home.vue' - + import {getfromserver} from '@/utils/universal_functions' export default { components: { @@ -166,12 +169,14 @@ setup(){ const t_baseCriteria = ref([]) + const t_daily = ref('') onMounted(() => { - proba() + proba(), + dailyfun() }) const appStore = useAppStore() @@ -204,7 +209,19 @@ .then(data => { t_baseCriteria.value = data.data.results }) + + } + + function dailyfun(){ + // getfromserver(`api/general_vacation/dailyload/`, t_daily.value) + axiosApiInstance.get('api/general_vacation/dailyload/') + .then(data => { + console.log(data.data); + t_daily.value = data.data + }) + } + return { accountStore, stat, @@ -212,6 +229,7 @@ onlines, appStore, proba, + t_daily } } } diff --git a/general_vacation/models.py b/general_vacation/models.py index 92e7a9502..09012964b 100644 --- a/general_vacation/models.py +++ b/general_vacation/models.py @@ -22,7 +22,7 @@ class DailyRoundUp(models.Model): verbose_name_plural = "Ежедневный обход" def __str__(self): - return str(self.name) + return str(self.position) class GeneralVacation(models.Model): CHOICES = ( diff --git a/general_vacation/serializers.py b/general_vacation/serializers.py index 9207d8fa9..374f14287 100644 --- a/general_vacation/serializers.py +++ b/general_vacation/serializers.py @@ -11,4 +11,11 @@ class PlanCalendarSerializer(serializers.ModelSerializer): class Meta: model = PlanCalendar - fields ='__all__' \ No newline at end of file + fields ='__all__' + +class DailyRoundUpSerializer(serializers.ModelSerializer): + + class Meta: + model = DailyRoundUp + fields ='__all__' + \ No newline at end of file diff --git a/general_vacation/urls.py b/general_vacation/urls.py index 25473cf6b..64537d7d6 100644 --- a/general_vacation/urls.py +++ b/general_vacation/urls.py @@ -5,4 +5,5 @@ from .views import * urlpatterns = [ path('generalvacation/', GeneralVacationAPIView.as_view(), name='generalvacation'), path('dailyroundup/', DailyRoundUpAPIView.as_view(), name='dailyroundup'), + path('dailyload/', DailyloadAPIView.as_view(), name='dailyload'), ] \ No newline at end of file diff --git a/general_vacation/views.py b/general_vacation/views.py index 4a2a13aef..1b8e4179a 100644 --- a/general_vacation/views.py +++ b/general_vacation/views.py @@ -1,4 +1,4 @@ -import datetime +from datetime import datetime import os from openpyxl import load_workbook import openpyxl @@ -196,30 +196,15 @@ class DailyRoundUpAPIView(APIView): ws.cell(row = k+3, column=8).value = f"=F{k+1}-H{k+1}-J{k+1}-L{k+1}" ws.cell(row = k+3, column=8).font = Font(name='Times New Roman', size=14, bold=True) - # print(ws.write(k+3, col, 'hhh'), '-------------------1') wb.save(file_path) - # urllib.request.urlretrieve(file_path, 'Пупка.xlsx') - # file_path = 'media/DailyRoundUp.xlsx' return Response(file_path) - # with ExcelWriter(file_path, mode="a" if os.path.exists(file_path) else "w" , if_sheet_exists='replace') as writer: - # # - # for i in df['department'].unique(): - # for i in df['department'].unique(): - # k = pd.DataFrame(df[(df.department==i)][['tabel', 'familyname', 'name', 'parentname']]) - # # k.to_excel(writer,header=None,index=None) - # print(i) - # print(k) - # return Response('') - # - # - # df.to_excel(table) def post(self, request): @@ -236,7 +221,7 @@ class DailyRoundUpAPIView(APIView): # DailyRoundUp.objects.update_or_create(todaysDate=datetime.datetime.strptime(datas, '%d.%m.%Y').strftime('%Y-%m-%d'), defaults={'user':self.request.user, 'position':base}) df.columns = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l"] - df=df.iloc[6:, ] + df=df.iloc[6:] df= df[df.b.notna()] df= df[df.a.notna()] df['b']=df['b'].str[-3:] @@ -253,7 +238,6 @@ class DailyRoundUpAPIView(APIView): df3=df3[['login', 'f', 'h', 'j','l']] - # base=BasePosition.objects.get(pk=keys) for ind in df3.index: keys = '' @@ -266,11 +250,30 @@ class DailyRoundUpAPIView(APIView): else: keys = 6 base=BasePosition.objects.get(pk=keys) - DailyRoundUp.objects.update_or_create(todaysDate=datetime.datetime.strptime(datas, '%d.%m.%Y').strftime('%Y-%m-%d'), + DailyRoundUp.objects.update_or_create(todaysDate=datetime.strptime(datas, '%d.%m.%Y').strftime('%Y-%m-%d'), user=df3['login'][ind], defaults={'position':base}) - - print(base) + + + + # serializer_for_daily = DailyRoundUpSerializer( + # instance=daily, # Передаём набор записей + # many=True # Указываем, что на вход подаётся именно набор записей + # ) - return Response('') + return Response("") + + +class DailyloadAPIView(APIView): + def get(self, request): + daily = DailyRoundUp.objects.filter(todaysDate=datetime.now()) + print(daily, '-----------------------------') + + # + # serializer_for_daily = DailyRoundUpSerializer( + # instance=daily, # Передаём набор записей + # many=True # Указываем, что на вход подаётся именно набор записей + # ) + return Response('kkkk') + # return Response({"Обход":serializer_for_daily}) \ No newline at end of file