Merge branch 'razrab'
This commit is contained in:
commit
9b7ab51bdd
12 files changed
+177
-201
No files matched your search
+49
-27
@@ -13,21 +13,30 @@ from rest_framework_simplejwt.views import TokenObtainPairView
|
||||
from django.contrib.auth import get_user_model
|
||||
User = get_user_model()
|
||||
myDEBUG=True
|
||||
|
||||
# class Authexception(Exception):
|
||||
# def __init__(self, *args):
|
||||
# self.message = args[0] if args else "None"
|
||||
|
||||
class MyTokenObtainPairSerializer(TokenObtainPairSerializer):
|
||||
@classmethod
|
||||
def get_token(cls, user):
|
||||
|
||||
token = super().get_token(user.userinfo)
|
||||
try:
|
||||
token = super().get_token(user.userinfo)
|
||||
|
||||
# TODO В зависимости от базы Алексея, добавить поля или нет - надо подумать
|
||||
|
||||
|
||||
token['user']=model_to_dict(user.userinfo)
|
||||
token['user']['is_active']=user.is_active
|
||||
token['user']['is_staff']=user.is_staff
|
||||
# !ТУТ СДЕЛАТь ФОТО НАВЕРНОЕ
|
||||
# token['user']['last_login']= user.last_login
|
||||
return token
|
||||
# TODO В зависимости от базы Алексея, добавить поля или нет - надо подумать
|
||||
|
||||
|
||||
token['user']=model_to_dict(user.userinfo)
|
||||
token['user']['is_active']=user.is_active
|
||||
token['user']['is_staff']=user.is_staff
|
||||
# !ТУТ СДЕЛАТь ФОТО НАВЕРНОЕ
|
||||
# token['user']['last_login']= user.last_login
|
||||
# print(token)
|
||||
return token
|
||||
except Exception as e:
|
||||
print("ERRRORRRRRRRR")
|
||||
print (e)
|
||||
|
||||
|
||||
|
||||
@@ -41,29 +50,42 @@ class CustomAuth(ModelBackend):
|
||||
username = kwargs['username']
|
||||
password = kwargs['password']
|
||||
status_code=0
|
||||
|
||||
# !ТУт стучим в AD, потом к Алексею
|
||||
if myDEBUG!=True:
|
||||
|
||||
resp= requests.post('http://10.252.44.13:8005/getAD', json.dumps({'user': username, 'password':password, 'usercheck': username}))
|
||||
|
||||
# if True:
|
||||
status_code=resp.status_code
|
||||
else:
|
||||
status_code=200
|
||||
if status_code==200:
|
||||
try:
|
||||
|
||||
user = DictEmployee.objects.using('user_directory').get(login=username)
|
||||
if user.deleted!=1:
|
||||
homeuser, created = User.objects.get_or_create(username=username)
|
||||
homeuser.last_login= timezone.now()
|
||||
user.is_active=homeuser.is_active
|
||||
user.is_staff=homeuser.is_staff
|
||||
user.last_login=homeuser.last_login.strftime('%Y-%d-%m %H:%M:%S')
|
||||
homeuser.save()
|
||||
homeuser.last_login=user.last_login
|
||||
user.id=homeuser.id
|
||||
homeuser.userinfo = user
|
||||
return homeuser
|
||||
if status_code==200:
|
||||
# try:
|
||||
|
||||
user = DictEmployee.objects.using('user_directory').get(login=username)
|
||||
|
||||
if user.deleted!=1:
|
||||
homeuser, created = User.objects.get_or_create(username=username)
|
||||
if created:
|
||||
homeuser.set_unusable_password()
|
||||
|
||||
homeuser.last_login= timezone.now()
|
||||
user.is_active=homeuser.is_active
|
||||
user.is_staff=homeuser.is_staff
|
||||
user.last_login=homeuser.last_login.strftime('%Y-%d-%m %H:%M:%S')
|
||||
homeuser.save()
|
||||
homeuser.last_login=user.last_login
|
||||
user.id=homeuser.id
|
||||
homeuser.userinfo = user
|
||||
# print("OOOOOOOOOOOOOOOOOOOO")
|
||||
# print(homeuser)
|
||||
return homeuser
|
||||
|
||||
except User.DoesNotExist:
|
||||
pass
|
||||
# except Exception as e:
|
||||
# print (e)
|
||||
elif status_code==403:
|
||||
return None
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ class User(AbstractBaseUser, PermissionsMixin):
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
# last_login = models.DateTimeField(auto_now=True, null=True)
|
||||
# external=models.ForeignKey(DictEmployee,db_constraint=False, null=True, on_delete=models.PROTECT)
|
||||
objects = UserManager()
|
||||
# objects = UserManager()
|
||||
USERNAME_FIELD = 'username'
|
||||
# REQUIRED_FIELDS = ['username']
|
||||
def __str__(self):
|
||||
|
||||
Binary file not shown.
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "front",
|
||||
"version": "0.0.22",
|
||||
"version": "0.0.23",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "front",
|
||||
"version": "0.0.22",
|
||||
"version": "0.0.23",
|
||||
"dependencies": {
|
||||
"@fullcalendar/core": "^6.1.8",
|
||||
"@fullcalendar/daygrid": "^6.1.8",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "front",
|
||||
"version": "0.0.22",
|
||||
"version": "0.0.23",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 490 KiB After Width: | Height: | Size: 1.8 MiB |
@@ -0,0 +1,25 @@
|
||||
<template>
|
||||
<v-alert
|
||||
v-model="alert"
|
||||
border="start"
|
||||
variant="tonal"
|
||||
closable
|
||||
close-label="Close Alert"
|
||||
color="deep-purple-accent-4"
|
||||
title="Closable Alert"
|
||||
>
|
||||
Aenean imperdiet. Quisque id odio. Cras dapibus. Pellentesque ut neque. Cras dapibus.
|
||||
|
||||
Vivamus consectetuer hendrerit lacus. Sed mollis, eros et ultrices tempus, mauris ipsum aliquam libero, non adipiscing dolor urna a orci. Sed mollis, eros et ultrices tempus, mauris ipsum aliquam libero, non adipiscing dolor urna a orci. Curabitur blandit mollis lacus. Curabitur ligula sapien, tincidunt non, euismod vitae, posuere imperdiet, leo.
|
||||
</v-alert>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
@@ -1,39 +1,55 @@
|
||||
<template>
|
||||
<v-row class="justify-center">
|
||||
|
||||
<v-col cols="12"
|
||||
class="text-h6 text-grey text-center d-flex align-baseline align-self-center text--lighten-1 font-weight-light"
|
||||
>
|
||||
|
||||
<!-- :rules="[val => (!!val && val.length > 0) || 'Добавьте файл']" -->
|
||||
<v-row class="justify-center align-center ma-3">
|
||||
|
||||
<v-col cols="1" class="px-0 pt-5">
|
||||
|
||||
<v-btn
|
||||
|
||||
class="mr-2"
|
||||
color="modal_btn"
|
||||
@click="excelOp"
|
||||
>
|
||||
Скачать
|
||||
</v-btn>
|
||||
|
||||
<!-- <v-spacer></v-spacer> -->
|
||||
<v-file-input
|
||||
:rules="[val => (!!val && val.length > 0) || 'Добавьте файл']"
|
||||
accept=".xlsx"
|
||||
v-model="dailyfiles"
|
||||
variant="underlined"
|
||||
density="compact"
|
||||
label="Выберите файл"
|
||||
class="mr-2"></v-file-input>
|
||||
|
||||
<!-- <v-spacer></v-spacer> -->
|
||||
<v-btn
|
||||
color="modal_btn"
|
||||
@click="onPickFile">
|
||||
Загрузить
|
||||
</v-btn>
|
||||
<my-helper :pretext="info.mess"/>
|
||||
<v-icon icon="mdi-file-excel"
|
||||
|
||||
color="green-darken-3"
|
||||
|
||||
@click="excelOp"/>
|
||||
|
||||
|
||||
</v-col>
|
||||
|
||||
<v-col
|
||||
cols="10"
|
||||
class="text-h6 text-grey text-center d-flex align-baseline align-self-center text--lighten-1 font-weight-light px-0"
|
||||
>
|
||||
|
||||
<v-file-input
|
||||
|
||||
accept=".xlsx"
|
||||
v-model="dailyfiles"
|
||||
variant="underlined"
|
||||
density="compact"
|
||||
label="Выберите файл"
|
||||
hide-details
|
||||
class="mr-2"/>
|
||||
|
||||
|
||||
|
||||
|
||||
</v-col>
|
||||
<v-col cols="1" class="px-0 pb-0 pt-7">
|
||||
<v-icon icon="mdi-download"
|
||||
|
||||
color="blue-grey-darken-2"
|
||||
|
||||
@click="onPickFile"/>
|
||||
<!-- <v-btn
|
||||
icon="mdi-download"
|
||||
|
||||
color="blue-grey-darken-4"
|
||||
variant="plain"
|
||||
@click="onPickFile"/> -->
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -48,6 +64,7 @@ export default {
|
||||
const visiting = ref({})
|
||||
const info = ref({})
|
||||
const t_dailyRound = ref('')
|
||||
const alert = ref(false)
|
||||
const excelOp = () => {
|
||||
axiosApiInstance.get(`api/general_vacation/dailyroundup/`).then(result => {
|
||||
let link = document.createElement("a")
|
||||
@@ -68,6 +85,7 @@ export default {
|
||||
})
|
||||
showInfo.value = true
|
||||
dailyfiles.value = ''
|
||||
alert.value = true
|
||||
|
||||
|
||||
}
|
||||
@@ -94,7 +112,8 @@ export default {
|
||||
info,
|
||||
detailRound,
|
||||
t_dailyRound,
|
||||
showInfo
|
||||
showInfo,
|
||||
alert
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -267,7 +267,7 @@
|
||||
<v-main v-else class="d-flex justify-center align-center text-h3 bg-teal-lighten-2">
|
||||
<div>
|
||||
<p class="text-center">Добро пожаловать на портал МИ ФНС по ЦОД № 2</p>
|
||||
<p class="mt-3 text-subtitle-1 text-center">Авторизуйтесь, для получения доступа к контенту портала</p>
|
||||
<p class="mt-3 text-subtitle-1 text-center">Авторизуйтесь для получения доступа к контенту портала</p>
|
||||
</div>
|
||||
</v-main>
|
||||
<v-navigation-drawer v-if="accountStore.cod2user"
|
||||
|
||||
@@ -82,36 +82,56 @@
|
||||
</v-row>
|
||||
</v-card>
|
||||
<v-card
|
||||
|
||||
v-else class="h-100 d-flex justify-center"
|
||||
:image="imageLenta"
|
||||
>
|
||||
>
|
||||
<v-card-text class="align-self-center flex-column">
|
||||
<v-file-input
|
||||
v-bind="props"
|
||||
accept=".xlsx"
|
||||
v-model="dailyfiles"
|
||||
variant="underlined"
|
||||
density="compact"
|
||||
label="Выберите файл"
|
||||
hide-details
|
||||
|
||||
|
||||
/>
|
||||
|
||||
</v-card-text>
|
||||
|
||||
<p class="align-self-center text-h5 text-center">
|
||||
<v-row justify="center">
|
||||
<!-- <p class="align-self-center text-h5 "> -->
|
||||
<!-- <v-row justify="center"> -->
|
||||
|
||||
|
||||
|
||||
|
||||
<v-dialog
|
||||
<!-- <v-dialog
|
||||
v-model="dialoground"
|
||||
persistent
|
||||
width="500"
|
||||
>
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn
|
||||
color="teal-darken-2"
|
||||
<template v-slot:activator="{ props }"> -->
|
||||
|
||||
<!-- <v-btn
|
||||
append-icon="mdi-note-plus"
|
||||
size="large"
|
||||
color="teal-darken-4"
|
||||
variant="text"
|
||||
v-bind="props"
|
||||
>
|
||||
Загрузить
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-card>
|
||||
</v-btn> -->
|
||||
|
||||
<!-- </template> -->
|
||||
<!-- <v-card>
|
||||
<v-card-title>
|
||||
<span class="text-h5">Загрузить файл</span>
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<v-container>
|
||||
|
||||
<load-round/>
|
||||
</v-container>
|
||||
|
||||
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
@@ -126,13 +146,13 @@
|
||||
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</v-dialog> -->
|
||||
|
||||
|
||||
</v-row>
|
||||
<!-- </v-row> -->
|
||||
<!-- Данные по сотрудникам не загружены -->
|
||||
<!-- <v-btn icon="mdi-calendar" size="x-large"></v-btn> -->
|
||||
</p>
|
||||
<!-- </p> -->
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
@@ -157,7 +177,7 @@
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<my-helper :pretext="t_daily.length"/>
|
||||
<!-- <my-helper :pretext="t_daily.length"/> -->
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
@@ -319,6 +339,7 @@
|
||||
const menuGetUserDialog = ref(false)
|
||||
const iduser = ref('')
|
||||
const dialoground = ref(false)
|
||||
const dailyfiles = ref('')
|
||||
|
||||
|
||||
|
||||
@@ -411,7 +432,8 @@
|
||||
getcard,
|
||||
iduser,
|
||||
imageLenta,
|
||||
dialoground
|
||||
dialoground,
|
||||
dailyfiles
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,134 +1,22 @@
|
||||
<template>
|
||||
<v-container class="my-auto">
|
||||
<v-row justify="center">
|
||||
<!-- <v-alert
|
||||
class="d-flex align-self-center"
|
||||
v-model="showInfo"
|
||||
:border="'start'"
|
||||
variant="tonal"
|
||||
type="info"
|
||||
max-width="max-content"
|
||||
closable>{{ info.mess }}
|
||||
</v-alert> -->
|
||||
<!-- v-if="!showInfo" -->
|
||||
<v-col cols="7"
|
||||
class="text-h6 text-grey text-center d-flex align-baseline align-self-center text--lighten-1 font-weight-light"
|
||||
>
|
||||
{{t_dailyRound}}
|
||||
|
||||
<v-btn class="mr-2" @click="detailRound">
|
||||
Уточнение
|
||||
</v-btn>
|
||||
<v-btn
|
||||
|
||||
class="mr-2"
|
||||
color="modal_btn"
|
||||
@click="excelOp"
|
||||
>
|
||||
Скачать
|
||||
</v-btn>
|
||||
|
||||
<!-- <v-spacer></v-spacer> -->
|
||||
<v-file-input
|
||||
:rules="[val => (!!val && val.length > 0) || 'Добавьте файл']"
|
||||
accept=".xlsx"
|
||||
v-model="dailyfiles"
|
||||
variant="underlined"
|
||||
density="compact"
|
||||
label="Выберите файл"
|
||||
class="mr-2"></v-file-input>
|
||||
|
||||
<!-- <v-spacer></v-spacer> -->
|
||||
<v-btn
|
||||
color="modal_btn"
|
||||
@click="onPickFile">
|
||||
Загрузить
|
||||
</v-btn>
|
||||
|
||||
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row justify="center">
|
||||
<v-col cols="2">
|
||||
<v-alert
|
||||
v-model="showInfo"
|
||||
:border="'start'"
|
||||
variant="tonal"
|
||||
type="info"
|
||||
width="max-content"
|
||||
closable>
|
||||
{{ info.mess }}
|
||||
</v-alert>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-container>
|
||||
|
||||
<load-round/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref } from 'vue'
|
||||
import { baseURL } from '@/utils/axios-api'
|
||||
import {getfromserver} from '@/utils/universal_functions'
|
||||
import { axiosApiInstance } from '@/utils/axios-api'
|
||||
import LoadRound from '@/components/load-round.vue'
|
||||
|
||||
|
||||
export default {
|
||||
setup(){
|
||||
const dailyfiles = ref('')
|
||||
const visiting = ref({})
|
||||
const info = ref({})
|
||||
const t_dailyRound = ref('')
|
||||
const excelOp = () => {
|
||||
axiosApiInstance.get(`api/general_vacation/dailyroundup/`).then(result => {
|
||||
let link = document.createElement("a")
|
||||
link.href = baseURL+result.data.path
|
||||
link.click()
|
||||
link.remove()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const onPickFile = () => {
|
||||
|
||||
const sdata = new FormData()
|
||||
sdata.append('dailyfiles', dailyfiles.value[0])
|
||||
axiosApiInstance.post(`api/general_vacation/dailyroundup/`, sdata).then(result => {
|
||||
info.value = result.data
|
||||
console.log(result.data, '----------------')
|
||||
})
|
||||
showInfo.value = true
|
||||
dailyfiles.value = ''
|
||||
|
||||
|
||||
}
|
||||
components: {
|
||||
LoadRound
|
||||
},
|
||||
|
||||
const detailRound = () => {
|
||||
|
||||
axiosApiInstance.get(`api/general_vacation/dailyload/?id=6`)
|
||||
.then(data => {
|
||||
console.log(data.data);
|
||||
|
||||
t_dailyRound.value = data.data
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
const showInfo = ref(false)
|
||||
|
||||
return {
|
||||
visiting,
|
||||
excelOp,
|
||||
baseURL,
|
||||
dailyfiles,
|
||||
onPickFile,
|
||||
info,
|
||||
detailRound,
|
||||
t_dailyRound,
|
||||
showInfo
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
Binary file not shown.
Reference in new issue
Block a user