Merge branch 'II' into razrab

This commit is contained in:
iriska-gri committed 2023-11-20 16:51:26 +03:00
commit fa11b7d6e1
8 files changed
+131 -22

No files matched your search

BIN
View File
Binary file not shown.
+112 -11
View File
@@ -1,7 +1,107 @@
<template> <template>
<v-row>
<v-col class="flex-column d-flex">
<v-row class="flex-grow-0 mhight">
<v-col class=" flex-column d-flex">
<v-row class="flex-grow-0 align-self-end">
<v-col>
<v-icon
class="pt-2"
icon="mdi-file-excel"
color="green-darken-3"
@click="excelOp('round')"
/>
</v-col>
<!-- :rules="[val => (!!val && val.length > 0) || 'Добавьте файл']" --> </v-row>
<v-row class="justify-center align-center ma-3"> <v-row>
<v-col>
<v-file-input
accept=".xlsx"
v-model="dailyfiles"
variant="underlined"
density="compact"
label="Выберите файл"
hide-details
class="mr-2"
/>
</v-col>
<v-col class="flex-grow-0 align-self-center mb-2">
<v-icon
icon="mdi-download"
color="blue-grey-darken-2"
@click="onPickFile"
/>
</v-col>
</v-row>
</v-col>
<v-col class=" flex-column d-flex">
<v-row class="flex-grow-0 align-self-end">
<v-col>
<v-icon
class="pt-2"
icon="mdi-file-excel"
color="green-darken-3"
@click="excelOp('vacation')"
/>
</v-col>
</v-row>
<v-row>
<v-col>
<v-file-input
accept=".xlsx"
v-model="dailyfiles"
variant="underlined"
density="compact"
label="Выберите файл"
hide-details
class="mr-2"
/>
</v-col>
<v-col class="flex-grow-0 align-self-center mb-2">
<v-icon
icon="mdi-download"
color="blue-grey-darken-2"
@click="onPickFile"
/>
</v-col>
</v-row>
</v-col>
<v-col></v-col>
<v-col></v-col>
<v-col></v-col>
<v-col></v-col>
</v-row>
<!-- <v-row>
<v-col v-for="(x) in 6" :key=x class=" flex-column d-flex">
{{x}}
</v-col>
</v-row> -->
</v-col>
</v-row>
<!-- <v-row class="flex-grow-0">
<v-col class="bg-red">
1
</v-col>
<v-col class="bg-yellow">
2
</v-col>
</v-row> -->
<!-- <v-row class="justify-center align-center ma-3">
<v-col cols="1" class="px-0 pt-5"> <v-col cols="1" class="px-0 pt-5">
@@ -40,15 +140,10 @@
color="blue-grey-darken-2" color="blue-grey-darken-2"
@click="onPickFile"/> @click="onPickFile"/>
<!-- <v-btn
icon="mdi-download"
color="blue-grey-darken-4"
variant="plain"
@click="onPickFile"/> -->
</v-col> </v-col>
</v-row> </v-row> -->
</template> </template>
@@ -65,8 +160,8 @@ export default {
const info = ref({}) const info = ref({})
const t_dailyRound = ref('') const t_dailyRound = ref('')
const alert = ref(false) const alert = ref(false)
const excelOp = () => { const excelOp = (ex) => {
axiosApiInstance.get(`api/general_vacation/dailyroundup/`).then(result => { axiosApiInstance.get(`api/general_vacation/dailyroundup/?excel=${ex}`).then(result => {
let link = document.createElement("a") let link = document.createElement("a")
link.href = baseURL+result.data.path link.href = baseURL+result.data.path
link.click() link.click()
@@ -74,6 +169,10 @@ export default {
}) })
} }
// const excelVacation = () => {
// }
@@ -123,5 +222,7 @@ export default {
</script> </script>
<style> <style>
.mhight {
height: 150px;
}
</style> </style>
+6 -6
View File
@@ -1,13 +1,13 @@
from django.contrib import admin from django.contrib import admin
from .models import * from .models import *
# class GeneralVacationAdmin(admin.ModelAdmin): class GeneralVacationAdmin(admin.ModelAdmin):
# fields = ('login', 'planned_date', 'count_days', 'type_of_vacation', 'start_work_period', 'end_work_period') fields = ('login', 'planned_date', 'count_days', 'type_of_vacation', 'start_work_period', 'end_work_period')
# list_display=('get_name', 'login', 'planned_date', 'count_days', 'type_of_vacation', 'start_work_period', 'end_work_period') list_display=('get_name', 'login', 'planned_date', 'count_days', 'type_of_vacation', 'start_work_period', 'end_work_period')
# readonly_fields=('get_name',) readonly_fields=('get_name',)
# def get_name(self, obj): def get_name(self, obj):
# return obj.user.fio() return obj.user.fio()
class PlanCalendarAdmin(admin.ModelAdmin): class PlanCalendarAdmin(admin.ModelAdmin):
list_display = ('name', 'start_work_period', 'end_work_period') list_display = ('name', 'start_work_period', 'end_work_period')
+3 -1
View File
@@ -15,7 +15,7 @@ class roundExcel():
pass pass
def excround(self): def excround(self):
print(self.df )
self.df['tabel'] = self.df['login'].str.split('-', expand = True)[1]+self.df['login'].str.split('-', expand = True)[2] self.df['tabel'] = self.df['login'].str.split('-', expand = True)[1]+self.df['login'].str.split('-', expand = True)[2]
file_path = 'media/DailyRoundUp.xlsx' file_path = 'media/DailyRoundUp.xlsx'
thins = Side(border_style="thin") thins = Side(border_style="thin")
@@ -167,6 +167,8 @@ class roundExcel():
PIXELS_PER_CHAR = 7 PIXELS_PER_CHAR = 7
return (width) / PIXELS_PER_CHAR return (width) / PIXELS_PER_CHAR
def excelvacation(self):
print('helooooooooooooooooooooooooooooooooooooo')
# def excroundread(self): # def excroundread(self):
# file = request.data['dailyfiles'] # file = request.data['dailyfiles']
# ed = pd.read_excel(file) # ed = pd.read_excel(file)
+4 -4
View File
@@ -1,11 +1,11 @@
from rest_framework import serializers from rest_framework import serializers
from .models import * from .models import *
# class GeneralVacationSerializer(serializers.ModelSerializer): class GeneralVacationSerializer(serializers.ModelSerializer):
# class Meta: class Meta:
# model = GeneralVacation model = GeneralVacation
# fields ='__all__' fields ='__all__'
class PlanCalendarSerializer(serializers.ModelSerializer): class PlanCalendarSerializer(serializers.ModelSerializer):
+6
View File
@@ -47,7 +47,13 @@ class DailyRoundUpAPIView(APIView):
def get(self, request): def get(self, request):
user = DictEmployee.objects.using('user_directory').filter(deleted=0).values('login', 'department', 'familyname', 'name', 'parentname') user = DictEmployee.objects.using('user_directory').filter(deleted=0).values('login', 'department', 'familyname', 'name', 'parentname')
re = roundExcel(user) re = roundExcel(user)
if request.GET.get("excel") == 'round':
file_path = re.excround() file_path = re.excround()
if request.GET.get("excel") == 'vacation':
file_path = re.excelvacation()
Binary file not shown.
BIN
View File
Binary file not shown.