Переезд
This commit is contained in:
1 parent
de8afb44cc
commit
1ed6ee0c6a
5 files changed
+25
-16
No files matched your search
@@ -74,7 +74,7 @@ class getuserAPIView(APIView):
|
||||
def get(self, request):
|
||||
|
||||
dt=datetime.now()
|
||||
queryset = DictEmployee.objects.using('user_directory').get(login=request.query_params.get('userlogin'))
|
||||
queryset = DictEmployee.objects.get(login=request.query_params.get('userlogin'))
|
||||
r=CardUserSerializer(queryset).data
|
||||
print(datetime.now()-dt)
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
class="pt-2"
|
||||
icon="mdi-file-excel"
|
||||
color="green-darken-3"
|
||||
@click="excelOp('round')"
|
||||
@click="excelOp('roundfilse')"
|
||||
/>
|
||||
</v-col>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<v-icon
|
||||
icon="mdi-download"
|
||||
color="blue-grey-darken-2"
|
||||
@click="onPickFile('round')"
|
||||
@click="onPickFile('roundfilse')"
|
||||
/>
|
||||
</v-col>
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
class="pt-2"
|
||||
icon="mdi-file-excel"
|
||||
color="green-darken-3"
|
||||
@click="excelOp('vacation')"
|
||||
@click="excelOp('vacationsExcel')"
|
||||
/>
|
||||
</v-col>
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
<v-icon
|
||||
icon="mdi-download"
|
||||
color="blue-grey-darken-2"
|
||||
@click="onPickFile('vacation')"
|
||||
@click="onPickFile('vacationsExcel')"
|
||||
/>
|
||||
</v-col>
|
||||
|
||||
@@ -160,6 +160,9 @@ export default {
|
||||
const info = ref({})
|
||||
const t_dailyRound = ref('')
|
||||
const alert = ref(false)
|
||||
|
||||
|
||||
|
||||
const excelOp = (ex) => {
|
||||
axiosApiInstance.get(`api/general_vacation/dailyroundup/?excel=${ex}`).then(result => {
|
||||
let link = document.createElement("a")
|
||||
|
||||
@@ -268,11 +268,11 @@ class loadExcel():
|
||||
DailyRoundUp.objects.update_or_create(todaysDate=datetime.strptime(datas, '%d.%m.%Y').strftime('%Y-%m-%d'),
|
||||
user=df3['login'][ind], defaults={'position':base})
|
||||
|
||||
pos = DailyRoundUp.objects.values('position__name', 'position').filter(position=6,todaysDate=date.today()).annotate(Count('user'))
|
||||
# pos = DailyRoundUp.objects.values('position__name', 'position').filter(position=6,todaysDate=date.today()).annotate(Count('user'))
|
||||
|
||||
|
||||
|
||||
return pos
|
||||
return ''
|
||||
|
||||
def vacationsExcel(self):
|
||||
ed = pd.read_excel(self.file, sheet_name='Запланированные отпуска')
|
||||
|
||||
@@ -41,7 +41,10 @@ class GeneralVacationAPIView(APIView):
|
||||
class DailyRoundUpAPIView(APIView):
|
||||
|
||||
def get(self, request):
|
||||
|
||||
user = DictEmployee.objects.filter(deleted=0).values('login', 'department', 'familyname', 'name', 'parentname')
|
||||
|
||||
|
||||
re = roundExcel(user)
|
||||
if request.GET.get("excel") == 'round':
|
||||
file_path = re.excround()
|
||||
@@ -59,22 +62,24 @@ class DailyRoundUpAPIView(APIView):
|
||||
|
||||
|
||||
def post(self, request):
|
||||
|
||||
print('----------ssssssssssssssssssssssssssssss-------------------------')
|
||||
user = DictEmployee.objects.filter(deleted=0).values('login', 'id', 'fio')
|
||||
print(user, '----------ddsfsdfds-------------------------')
|
||||
re = loadExcel(user, request.data['dailyfiles'])
|
||||
pos=''
|
||||
mess = 'Файл не найден'
|
||||
try:
|
||||
getattr(re, request.GET.get("excel"))()
|
||||
print(request.GET.get("excel"), 'request.GET.get("excel")----------------')
|
||||
if request.GET.get("excel") == 'round':
|
||||
# if request.GET.get("excel") == 'round':
|
||||
|
||||
re.roundfilse()
|
||||
mess = "Файл загружен"
|
||||
if request.GET.get("excel") == 'vacation':
|
||||
re.vacationsExcel()
|
||||
print(request.data['dailyfiles'], 'request.data[dailyfiles]--------------------')
|
||||
mess = 'Файл в обраотке'
|
||||
pos=''
|
||||
# re.roundfilse()
|
||||
# mess = "Файл загружен"
|
||||
# if request.GET.get("excel") == 'vacation':
|
||||
# re.vacationsExcel()
|
||||
# print(request.data['dailyfiles'], 'request.data[dailyfiles]--------------------')
|
||||
# mess = 'Файл в обраотке'
|
||||
# pos=''
|
||||
except Exception as e:
|
||||
print(e, '-----------------------------')
|
||||
pass
|
||||
@@ -91,6 +96,7 @@ class DailyloadAPIView(APIView):
|
||||
def get(self, request):
|
||||
try:
|
||||
user = DictEmployee.objects.filter(deleted=0).values('login', 'department', 'fio', 'post')
|
||||
|
||||
dailyr = DailyRoundUp.objects.filter(todaysDate=date.today()).values_list('user', 'position__name', 'position')
|
||||
df_user = pd.DataFrame.from_records(user)
|
||||
df_daily = pd.DataFrame.from_records(dailyr)
|
||||
|
||||
Reference in new issue
Block a user