This commit is contained in:
iriska-gri committed 2024-05-23 17:03:39 +03:00
1 parent 5b6b271c44
commit df9a32223c
10 files changed
+234 -417

No files matched your search

+1
View File
@@ -30,6 +30,7 @@ class MyTokenObtainPairSerializer(TokenObtainPairSerializer):
token['user']=model_to_dict(user.userinfo)
token['user']['is_active']=user.is_active
token['user']['is_staff']=user.is_staff
token['user']['is_superuser']=user.is_superuser
# !ТУТ СДЕЛАТь ФОТО НАВЕРНОЕ
# token['user']['last_login']= user.last_login
# print(token)
+1 -1
View File
@@ -7,7 +7,7 @@ class Settings():
'ENGINE': 'django.db.backends.mysql',
'NAME': 'accounting',
'USER': 'root',
'PASSWORD': 'admin',
'PASSWORD': 'ADMIN',
'HOST': '127.0.0.1',
'PORT': '3306',
}
@@ -5,7 +5,7 @@
width="600"
class="mx-auto"
>
<v-card height="480">
<v-card height="500">
<v-card-title class="pl-6">
Информация
</v-card-title>
@@ -63,7 +63,7 @@
</v-row>
</v-card-text>
<v-divider/>
<v-card-actions class="align-self-end pt-0">
<v-card-actions class="align-self-end py-0">
<v-btn
color="modal_btn"
variant="text"
@@ -1,117 +1,107 @@
<template>
<div>
<v-list-item v-if="from_which=='dialog-search'" class="pl-4 h-100 text-left pa-2" @click="open=true">
<template v-slot:prepend>
<v-avatar
color="grey-darken-3"
:image="checkremote( `${spravURL}${author.login}.jpg`)"
/>
</template>
<div class="h-100">
<v-list-item
v-if="from_which == 'dialog-search'"
class="pl-4 h-100 text-left pa-2"
@click="open = true"
>
<template v-slot:prepend>
<v-avatar
color="grey-darken-3"
:image="checkremote(`${spravURL}${author.login}.jpg`)"
/>
</template>
<v-list-item-title :class="style_item_title()">
{{author.fio}}
{{ author.fio }}
</v-list-item-title>
<v-list-item-subtitle :class="style_item_subtitle()">
{{author.post}}
{{ author.post }}
</v-list-item-subtitle>
</v-list-item>
<v-list-item v-if="from_which=='top-user'" class="h-100 text-left pa-0 pl-0 " @click="open=true">
<v-chip
class="cursor-pointer pa-0"
variant='text'
label
color="grey-darken-3"
size="small"
<v-list-item
v-if="from_which == 'top-user'"
class="h-100 text-left pa-0 pl-0"
@click="open = true"
>
<v-avatar
color="grey-darken-3"
:image="checkremote( `${spravURL}${author.login}.jpg`)"
class="mr-2"
/>
<span class="font-weight-medium text-grey-darken-3 myleft text-caption">
{{splitname(author)}}
</span>
</v-chip>
<v-chip
class="cursor-pointer pa-0"
variant="text"
label
color="grey-darken-3"
size="small"
>
<v-avatar
color="grey-darken-3"
:image="checkremote(`${spravURL}${author.login}.jpg`)"
class="mr-2"
/>
<span class="font-weight-medium text-grey-darken-3 myleft text-caption">
{{ splitname(author) }}
</span>
</v-chip>
</v-list-item>
<v-img
v-if="from_which=='top_comment'"
@click="open=true"
cover
class="cursor-pointer"
:src="checkremote(`${spravURL}${author.login}.jpg`)"
/>
<v-img
v-if="from_which == 'top_comment'"
@click="open = true"
cover
class="cursor-pointer"
:src="checkremote(`${spravURL}${author.login}.jpg`)"
/>
<info-user-card
:author="author"
:opendialog = open
:opendialog="open"
@update:opendialog="open = $event"
/>
</div>
</template>
<script>
import { ref } from 'vue'
import {checkremote} from '@/utils/universal_functions'
import { spravURL } from '@/utils/axios-api'
import {splitname} from '@/utils/universal_functions'
import { ref } from "vue";
import { checkremote } from "@/utils/universal_functions";
import { spravURL } from "@/utils/axios-api";
import { splitname } from "@/utils/universal_functions";
export default {
name: "list-user",
props: {
author: {
type: Object,
default: {}
},
from_which: {
type: String,
default: "dialog-search"
}
props: {
author: {
type: Object,
default: {},
},
setup(props){
const open = ref(false)
from_which: {
type: String,
default: "dialog-search",
},
},
setup(props) {
const open = ref(false);
const style_item_title = () => {
if (props.from_which == "top-user") {
return "text-body-1 font-weight-medium";
} else return "text-body-1 font-weight-medium pt-2";
};
const style_item_title = () => {
if (props.from_which=="top-user") {
return "text-body-1 font-weight-medium"
}
else
return "text-body-1 font-weight-medium pt-2"
}
const style_item_subtitle = () => {
if (props.from_which == "top-user") {
return "text-caption";
} else return "pb-2";
};
const style_item_subtitle = () => {
if (props.from_which=="top-user") {
return "text-caption"
}
else
return "pb-2"
}
return {
open,
checkremote,
spravURL,
style_item_title,
style_item_subtitle,
splitname
}
}
}
return {
open,
checkremote,
spravURL,
style_item_title,
style_item_subtitle,
splitname,
};
},
};
</script>
<style>
</style>
<style></style>
@@ -44,7 +44,6 @@
<v-card-text class="text-center text-body-2">
<p>
Государственный советник Российской Федерации 2 класса
{{userlinks}}
</p>
</v-card-text>
</v-card>
@@ -33,18 +33,21 @@
class="d-flex py-3 justify-center align-center font-weight-medium text-uppercase"
>
{{ structure.post }}
</v-col>
</v-row>
</v-col>
<v-row no-gutters>
<v-col lg="4" class="pa-1 heightfoto">
<v-img
<list-user :author="structure" :from_which="'top_comment'" />
<!-- <v-img
class="h-100"
:src="
checkremote(`${spravURL}${structure.login}.jpg`)
"
cover
/>
/> -->
</v-col>
<v-col
class="text-center align-self-center font-weight-medium"
@@ -1,5 +1,5 @@
<template>
<v-app >
<v-app>
<v-app-bar
:elevation="accountStore.cod2user ? 2 : 0"
density="compact"
@@ -31,7 +31,7 @@
<template v-slot:append>
<template v-if="accountStore.cod2user">
<vcard-user :author="accountStore.user" />
<my-helper :pretext="accountStore.user"></my-helper>
<v-tooltip location="bottom">
<template v-slot:activator="{ props }">
<v-btn
@@ -73,7 +73,7 @@
</template>
<span> Сменить тему</span>
</v-tooltip>
<v-card v-show="message" class="" width="50">{{ name }}</v-card>
<v-tooltip location="bottom">
@@ -126,8 +126,13 @@
><v-col>
<v-list nav density="compact">
<template v-for="(x, key) in navigations">
<!-- v-if="!('submenu' in x) || (x.path== '/portal' && accountStore.user.is_staff)" -->
<v-list-item
v-if="!('submenu' in x)"
v-if="
(x.path == '/portal'
? accountStore.user.is_staff
: true) && !('submenu' in x)
"
:key="x.key"
:title="x.name"
:value="x.name"
@@ -137,6 +142,7 @@
:target="x.link ? '_blank' : ''"
color="navigation"
>
<!-- Чтобы сделать неактивным раздел безопасность, не забыть прописать путь до него в disabled для показа -->
<template v-slot:prepend>
<v-icon :icon="x.ico" />
@@ -147,7 +153,7 @@
</v-list-item>
<v-list-group
v-else
v-if="x.path != '/portal' && 'submenu' in x"
:class="rail ? 'railmenu' : ''"
:key="key"
:value="x.name"
@@ -266,7 +272,6 @@
permanent
location="right"
@click="rail = false"
>
<Online-users />
</v-navigation-drawer>
@@ -372,7 +377,7 @@ export default {
// ]
const navigations = ref([
{
{
name: "Новости",
ico: "mdi-newspaper",
path: "/news",
@@ -453,7 +458,7 @@ export default {
if (!item.path.startsWith("/")) {
item.path = "/" + item.path;
}
item.path="/safety"+item.path
item.path = "/safety" + item.path;
});
if (response.data.length > 0) {
+30 -3
View File
@@ -1,6 +1,9 @@
// Composables
import { createRouter, createWebHistory } from 'vue-router'
// import { useAccountStore } from "@/store/AccountStore";
// const accountStore = useAccountStore()
const routes = [
{
path: '/',
@@ -97,7 +100,8 @@ const routes = [
component: () => import('@/views/AboutPortalPage.vue'),
meta:{
title:"О портале",
ico: "mdi-information-variant"
ico: "mdi-information-variant",
requiresAuth: true
}
},
{
@@ -145,9 +149,32 @@ const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes,
})
// const accountStore = useAccountStore();
function isSuperuser() {
let a= false
if (a=== true) {
return true
}
else {
return false
}
}
router.beforeEach((to,from, next)=>{
document.title = to.meta.title;
next()
console.log(to,from, '-----sdsd----------------------------------------------------f')
if (to.meta.requiresAuth && isSuperuser()) {
document.title = to.meta.title;
next()
}
else {
console.log('22222222222222');
next()
}
})
export default router
@@ -1,230 +0,0 @@
<template>
<v-row no-gutters class="flex-column h-100 gap pa-1">
<v-col class="w100 h-100 flex-grow-0">
<v-card>
<v-tabs
v-model="tab"
bg-color="bg_tab"
slider-color="slider_tab"
selected-class="isActiveTab"
:grow="true"
>
<v-tab value="mainInfo">Основная информация</v-tab>
<v-tab value="document">Документация</v-tab>
<v-tab value="testings">Тестирование</v-tab>
</v-tabs>
</v-card>
</v-col>
<v-col class="w100 h-100">
<v-window v-model="tab" class="h-100">
<v-window-item no-gutters class="gap h-100" value="mainInfo">
<MainInfoSafety
:formainpage="safetyData.mainpage_file"
></MainInfoSafety>
</v-window-item>
<v-window-item value="document" class="h-100">
<v-row no-gutters class="gap h-100">
<v-col lg="6">
<v-card class="h-100 flex-column d-flex gap">
<v-row class="ma-0 overflow-auto pb-1">
<v-card
class="overflow-y-auto flex-grow-1 flex-shrink-1 h-100"
>
<v-card-title>{{ safetyData.name }}</v-card-title>
<v-expansion-panels multiple flat>
<v-expansion-panel
elevation="0"
v-for="category in safetyData.categories"
:key="category.id"
class="py-0"
>
<v-expansion-panel-title class="font-weight-medium">{{
category.category__name
}}</v-expansion-panel-title>
<v-expansion-panel-text>
<div
v-for="file in category.files"
:key="file.id"
class="overflow-y-auto d-flex justify-space-between"
>
<div
class="cursor-pointer"
@click="openPDF(file.url), (loading = true)"
>
{{ file.name }}
</div>
<div>
<v-btn
variant="text"
icon="mdi-file-pdf-box"
color="red"
@click="openPDF(file.url), (loading = true)"
></v-btn>
<v-btn
variant="text"
icon="mdi-file-download-outline"
color="green"
@click="
downloadItem(burl + file.url, file.name)
"
></v-btn>
</div>
</div>
</v-expansion-panel-text>
</v-expansion-panel>
</v-expansion-panels>
</v-card>
</v-row>
<v-row class="ma-0 overflow-auto bg-yellow">
<v-card class="overflow-y-auto flex-grow-1 h-100">
<v-card-title>{{ responsibilityData.name }}</v-card-title>
<v-container
v-for="file in responsibilityData.files"
:fluid="true"
class="py-0"
>
<v-card-actions :key="file.id">
<v-card-text
class="cursor-pointer"
@click="
openPDF(checkNameFiles(file)), (loading = true)
"
>
{{
get_name(
decodeURI(file.file_name.replace(/\.[^/.]+$/, ""))
)
}}
</v-card-text>
<v-btn
icon="mdi-file-pdf-box"
color="red"
@click="
openPDF(checkNameFiles(file)), (loading = true)
"
>
</v-btn>
<v-btn
icon="mdi-file-download-outline"
color="green"
@click="
downloadItem(
burl + checkNameFiles(file),
get_name(decodeURI(file.file_name))
)
"
>
</v-btn>
</v-card-actions>
</v-container>
</v-card>
</v-row>
</v-card>
</v-col>
<v-col>
<v-card class="h-100 flex-column d-flex gap">
<v-row class="ma-0 overflow-auto h-0">
<v-card
v-show="showFile"
class="mr-2 flex-grow-1 flex-shrink-1 h-100 pa-2 overflow-auto"
>
<v-container v-if="loading">
<v-progress-linear
:rounded="5"
indeterminate
color="teal"
>
</v-progress-linear>
</v-container>
<VuePdfEmbed
:source="pdfSource"
width="720"
@rendered="loading = false"
/>
</v-card>
</v-row>
<v-card-actions v-show="showFile">
<v-btn position="sticky" block @click="showFile = false"
>Закрыть</v-btn
>
</v-card-actions>
</v-card>
</v-col>
</v-row>
</v-window-item>
<v-window-item value="testings" no-gutters class="gap h-100">
</v-window-item>
</v-window>
</v-col>
</v-row>
</template>
<script setup>
import { ref, onBeforeMount } from "vue";
import { pagecounter } from "@/utils/universal_functions";
import { axiosApiInstance, baseURL } from "@/utils/axios-api";
import { saveAs } from "file-saver";
import { useRoute } from "vue-router";
import VuePdfEmbed from "vue-pdf-embed";
import TestSafety from "./TestSafety.vue";
import MainInfoSafety from "./MainInfoSafety.vue";
pagecounter();
const safetyData = ref({});
const responsibilityData = ref();
const showMore = ref(false);
const showFile = ref(true);
let pdfSource = ref("");
const loading = ref(false);
const tab = ref("");
const burl = baseURL.slice(0, -1);
const route = useRoute();
// Вынес запрос в отдельную функцию, чтобы избежать дублирования одного и того же запроса на сервер.
function getSafety() {
axiosApiInstance
.get(`api/safety/?chapter=${route.params.chapter}`)
.then((result) => {
safetyData.value = result.data;
loading.value = true;
// pdfSource.value = burl + safetyData.value.categories[0].files[0].url
console.log(safetyData.value);
});
}
onBeforeMount(() => getSafety());
const downloadItem = (url, fileName) => {
axiosApiInstance.get(url, { responseType: "blob" }).then((response) => {
saveAs(response.data, fileName);
});
};
function openPDF(url) {
pdfSource.value = burl + url;
showFile.value = true;
}
function get_name(namestr) {
let arr = namestr.split("/");
return arr[arr.length - 1];
}
// function checkNameFiles(obj) {
// if (obj.file_name.includes('/media/comitee_files/')) {
// return obj.file_name
// }
// else {
// return spravURLBase + `files/committee1_docs/${obj.id_committee1}/${get_name(obj.file_name)}`
// }
// }
</script>
<style>
.isActiveTab {
background-color: #e0f2f1;
color: #004d40;
}
</style>
+104 -82
View File
@@ -1,6 +1,6 @@
<template>
<v-row no-gutters class="h-100">
<v-col cols="9" class="flex-column">
<v-col cols="8" class="flex-column">
<v-row no-gutters class="h-100 justify-center">
<v-col
lg="6"
@@ -24,92 +24,114 @@
</v-col>
</v-row>
</v-col>
<v-col cols="3" class="d-flex flex-column h-100">
<v-row no-gutters class="h-0 overflow-auto">
<v-col>
<v-col class="v-col-auto ">
<div class="text-h6 d-flex justify-center">Ответственность</div>
</v-col>
<v-col class="v-col-auto">
<div v-if="responsibility != undefined && responsibility.length > 0" >
<v-expansion-panels variant="accordion">
<v-expansion-panel v-for="item in responsibility">
<v-expansion-panel-title >
{{ item.resp.sphere_of_responsibility }}
</v-expansion-panel-title>
<v-expansion-panel-text>
<list-user
v-for="user in item.resp.employee"
:key=user
:author="user">
</list-user>
</v-expansion-panel-text>
</v-expansion-panel>
</v-expansion-panels>
<v-col class="d-flex flex-column h-100">
<v-row no-gutters class="h-0 overflow-auto">
<v-col>
<div class="text-h6 d-flex justify-center">Ответственность</div>
<v-col class="v-col-auto">
<div
v-if="responsibility != undefined && responsibility.length > 0"
>
<v-expansion-panels variant="accordion">
<v-expansion-panel v-for="item in responsibility">
<v-expansion-panel-title>
{{ item.resp.sphere_of_responsibility }}
</v-expansion-panel-title>
<v-expansion-panel-text>
<list-user
v-for="user in item.resp.employee"
:key="user"
:author="user"
>
</list-user>
</v-expansion-panel-text>
</v-expansion-panel>
</v-expansion-panels>
</div>
<div v-else>
<div class="text-caption text-grey d-flex justify-center">
Данные по ответственным отсутствуют
</div>
</div>
</v-col>
<div class="text-h6 d-flex justify-center">Комиссии</div>
<v-col class="v-col-auto">
<div v-if="commitee != undefined && commitee.length > 0">
<v-expansion-panels variant="accordion">
<v-expansion-panel v-for="item in commitee" :key="item">
<v-expansion-panel-title>
{{ item.comm.name }}
</v-expansion-panel-title>
<v-expansion-panel-text class="d-block">
<div v-if="item.comm.com_members.length > 0">
<list-user
class="text-subtitle-1"
v-for="user in item.comm.com_members"
:key="user"
:author="user"
>
</list-user>
</div>
<div v-else>
<div class="text-caption text-grey d-flex justify-center">Данные по ответственным отсутствуют</div>
</div>
</v-col>
<v-col class="v-col-auto">
<div class="text-h6 d-flex justify-center">Комиссии</div>
</v-col>
<v-col class="v-col-auto">
<div v-if="commitee != undefined && commitee.length > 0" >
<v-expansion-panels variant="accordion">
<v-expansion-panel v-for="item in commitee">
<v-expansion-panel-title>
{{ item.comm.name }}
</v-expansion-panel-title>
<v-expansion-panel-text>
<list-user
v-for="user in item.comm.com_members"
:key=user
:author="user">
</list-user>
</v-expansion-panel-text>
</v-expansion-panel>
</v-expansion-panels>
</div>
<div v-else>
<div class="text-caption text-grey d-flex justify-center">Данные по комиссиям отсутствуют</div>
</div>
</v-col>
</v-col>
</v-row>
<v-card-subtitle class="text-center" v-else
>Участников нет
</v-card-subtitle>
</v-expansion-panel-text>
</v-expansion-panel>
</v-expansion-panels>
</div>
<div v-else>
<div class="text-caption text-grey d-flex justify-center">
Данные по комиссиям отсутствуют
</div>
</div>
</v-col>
</v-col>
</v-row>
</v-col>
</v-row>
<v-dialog v-model="openFirstPlan" :width="900" height="100%">
<v-row class="ma-0 overflow-auto h-0">
<v-card class="h-100 w-100 pa-0">
<v-card-actions class="d-flex justify-space-between">
<v-btn
density="compact"
variant="text"
icon="mdi-close"
@click="openFirstPlan = false">
</v-btn>
<v-btn class="d-flex align-center" icon='mdi-file-download-outline' color="green"
@click="downloadFile(urlschema)">
</v-btn>
</v-card-actions>
<VuePdfEmbed v-if="urlschema.endsWith('.pdf')"
:source="urlschema"
width="500"
@click="openFirstPlan = false"/>
<v-img
v-else
:src="urlschema"
class="cursor-pointer"
height="100%"
width="100%"
@click="openFirstPlan = false">
</v-img>
</v-card>
</v-row>
</v-dialog>
<v-row class="ma-0 overflow-auto h-0">
<v-card class="h-100 w-100 pa-0">
<v-card-actions class="d-flex justify-space-between">
<v-btn
density="compact"
variant="text"
icon="mdi-close"
@click="openFirstPlan = false"
>
</v-btn>
<v-btn
class="d-flex align-center"
icon="mdi-file-download-outline"
color="green"
@click="downloadFile(urlschema)"
>
</v-btn>
</v-card-actions>
<VuePdfEmbed
v-if="urlschema.endsWith('.pdf')"
:source="urlschema"
width="500"
@click="openFirstPlan = false"
/>
<v-img
v-else
:src="urlschema"
class="cursor-pointer"
height="100%"
width="100%"
@click="openFirstPlan = false"
>
</v-img>
</v-card>
</v-row>
</v-dialog>
</template>
<script setup>