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']=model_to_dict(user.userinfo)
token['user']['is_active']=user.is_active token['user']['is_active']=user.is_active
token['user']['is_staff']=user.is_staff token['user']['is_staff']=user.is_staff
token['user']['is_superuser']=user.is_superuser
# !ТУТ СДЕЛАТь ФОТО НАВЕРНОЕ # !ТУТ СДЕЛАТь ФОТО НАВЕРНОЕ
# token['user']['last_login']= user.last_login # token['user']['last_login']= user.last_login
# print(token) # print(token)
+1 -1
View File
@@ -7,7 +7,7 @@ class Settings():
'ENGINE': 'django.db.backends.mysql', 'ENGINE': 'django.db.backends.mysql',
'NAME': 'accounting', 'NAME': 'accounting',
'USER': 'root', 'USER': 'root',
'PASSWORD': 'admin', 'PASSWORD': 'ADMIN',
'HOST': '127.0.0.1', 'HOST': '127.0.0.1',
'PORT': '3306', 'PORT': '3306',
} }
@@ -5,7 +5,7 @@
width="600" width="600"
class="mx-auto" class="mx-auto"
> >
<v-card height="480"> <v-card height="500">
<v-card-title class="pl-6"> <v-card-title class="pl-6">
Информация Информация
</v-card-title> </v-card-title>
@@ -63,7 +63,7 @@
</v-row> </v-row>
</v-card-text> </v-card-text>
<v-divider/> <v-divider/>
<v-card-actions class="align-self-end pt-0"> <v-card-actions class="align-self-end py-0">
<v-btn <v-btn
color="modal_btn" color="modal_btn"
variant="text" variant="text"
@@ -1,117 +1,107 @@
<template> <template>
<div> <div class="h-100">
<v-list-item
<v-list-item v-if="from_which=='dialog-search'" class="pl-4 h-100 text-left pa-2" @click="open=true"> v-if="from_which == 'dialog-search'"
<template v-slot:prepend> class="pl-4 h-100 text-left pa-2"
<v-avatar @click="open = true"
color="grey-darken-3" >
:image="checkremote( `${spravURL}${author.login}.jpg`)" <template v-slot:prepend>
/> <v-avatar
</template> color="grey-darken-3"
:image="checkremote(`${spravURL}${author.login}.jpg`)"
/>
</template>
<v-list-item-title :class="style_item_title()"> <v-list-item-title :class="style_item_title()">
{{author.fio}} {{ author.fio }}
</v-list-item-title> </v-list-item-title>
<v-list-item-subtitle :class="style_item_subtitle()"> <v-list-item-subtitle :class="style_item_subtitle()">
{{author.post}} {{ author.post }}
</v-list-item-subtitle> </v-list-item-subtitle>
</v-list-item> </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-list-item
<v-chip v-if="from_which == 'top-user'"
class="cursor-pointer pa-0" class="h-100 text-left pa-0 pl-0"
variant='text' @click="open = true"
label
color="grey-darken-3"
size="small"
> >
<v-avatar <v-chip
color="grey-darken-3" class="cursor-pointer pa-0"
:image="checkremote( `${spravURL}${author.login}.jpg`)" variant="text"
class="mr-2" label
/> color="grey-darken-3"
<span class="font-weight-medium text-grey-darken-3 myleft text-caption"> size="small"
{{splitname(author)}} >
<v-avatar
</span> color="grey-darken-3"
</v-chip> :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-list-item>
<v-img
v-if="from_which == 'top_comment'"
<v-img @click="open = true"
v-if="from_which=='top_comment'" cover
@click="open=true" class="cursor-pointer"
cover :src="checkremote(`${spravURL}${author.login}.jpg`)"
class="cursor-pointer" />
:src="checkremote(`${spravURL}${author.login}.jpg`)"
/>
<info-user-card <info-user-card
:author="author" :author="author"
:opendialog = open :opendialog="open"
@update:opendialog="open = $event" @update:opendialog="open = $event"
/> />
</div> </div>
</template> </template>
<script> <script>
import { ref } from 'vue' import { ref } from "vue";
import {checkremote} from '@/utils/universal_functions' import { checkremote } from "@/utils/universal_functions";
import { spravURL } from '@/utils/axios-api' import { spravURL } from "@/utils/axios-api";
import {splitname} from '@/utils/universal_functions' import { splitname } from "@/utils/universal_functions";
export default { export default {
name: "list-user", name: "list-user",
props: { props: {
author: { author: {
type: Object, type: Object,
default: {} default: {},
},
from_which: {
type: String,
default: "dialog-search"
}
}, },
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 = () => { const style_item_subtitle = () => {
if (props.from_which=="top-user") { if (props.from_which == "top-user") {
return "text-body-1 font-weight-medium" return "text-caption";
} } else return "pb-2";
else };
return "text-body-1 font-weight-medium pt-2"
}
const style_item_subtitle = () => { return {
if (props.from_which=="top-user") { open,
return "text-caption" checkremote,
} spravURL,
else style_item_title,
return "pb-2" style_item_subtitle,
} splitname,
};
return { },
open, };
checkremote,
spravURL,
style_item_title,
style_item_subtitle,
splitname
}
}
}
</script> </script>
<style> <style></style>
</style>
@@ -44,7 +44,6 @@
<v-card-text class="text-center text-body-2"> <v-card-text class="text-center text-body-2">
<p> <p>
Государственный советник Российской Федерации 2 класса Государственный советник Российской Федерации 2 класса
{{userlinks}}
</p> </p>
</v-card-text> </v-card-text>
</v-card> </v-card>
@@ -33,18 +33,21 @@
class="d-flex py-3 justify-center align-center font-weight-medium text-uppercase" class="d-flex py-3 justify-center align-center font-weight-medium text-uppercase"
> >
{{ structure.post }} {{ structure.post }}
</v-col> </v-col>
</v-row> </v-row>
</v-col> </v-col>
<v-row no-gutters> <v-row no-gutters>
<v-col lg="4" class="pa-1 heightfoto"> <v-col lg="4" class="pa-1 heightfoto">
<v-img
<list-user :author="structure" :from_which="'top_comment'" />
<!-- <v-img
class="h-100" class="h-100"
:src=" :src="
checkremote(`${spravURL}${structure.login}.jpg`) checkremote(`${spravURL}${structure.login}.jpg`)
" "
cover cover
/> /> -->
</v-col> </v-col>
<v-col <v-col
class="text-center align-self-center font-weight-medium" class="text-center align-self-center font-weight-medium"
@@ -1,5 +1,5 @@
<template> <template>
<v-app > <v-app>
<v-app-bar <v-app-bar
:elevation="accountStore.cod2user ? 2 : 0" :elevation="accountStore.cod2user ? 2 : 0"
density="compact" density="compact"
@@ -31,7 +31,7 @@
<template v-slot:append> <template v-slot:append>
<template v-if="accountStore.cod2user"> <template v-if="accountStore.cod2user">
<vcard-user :author="accountStore.user" /> <vcard-user :author="accountStore.user" />
<my-helper :pretext="accountStore.user"></my-helper>
<v-tooltip location="bottom"> <v-tooltip location="bottom">
<template v-slot:activator="{ props }"> <template v-slot:activator="{ props }">
<v-btn <v-btn
@@ -73,7 +73,7 @@
</template> </template>
<span> Сменить тему</span> <span> Сменить тему</span>
</v-tooltip> </v-tooltip>
<v-card v-show="message" class="" width="50">{{ name }}</v-card> <v-card v-show="message" class="" width="50">{{ name }}</v-card>
<v-tooltip location="bottom"> <v-tooltip location="bottom">
@@ -126,8 +126,13 @@
><v-col> ><v-col>
<v-list nav density="compact"> <v-list nav density="compact">
<template v-for="(x, key) in navigations"> <template v-for="(x, key) in navigations">
<!-- v-if="!('submenu' in x) || (x.path== '/portal' && accountStore.user.is_staff)" -->
<v-list-item <v-list-item
v-if="!('submenu' in x)" v-if="
(x.path == '/portal'
? accountStore.user.is_staff
: true) && !('submenu' in x)
"
:key="x.key" :key="x.key"
:title="x.name" :title="x.name"
:value="x.name" :value="x.name"
@@ -137,6 +142,7 @@
:target="x.link ? '_blank' : ''" :target="x.link ? '_blank' : ''"
color="navigation" color="navigation"
> >
<!-- Чтобы сделать неактивным раздел безопасность, не забыть прописать путь до него в disabled для показа --> <!-- Чтобы сделать неактивным раздел безопасность, не забыть прописать путь до него в disabled для показа -->
<template v-slot:prepend> <template v-slot:prepend>
<v-icon :icon="x.ico" /> <v-icon :icon="x.ico" />
@@ -147,7 +153,7 @@
</v-list-item> </v-list-item>
<v-list-group <v-list-group
v-else v-if="x.path != '/portal' && 'submenu' in x"
:class="rail ? 'railmenu' : ''" :class="rail ? 'railmenu' : ''"
:key="key" :key="key"
:value="x.name" :value="x.name"
@@ -266,7 +272,6 @@
permanent permanent
location="right" location="right"
@click="rail = false" @click="rail = false"
> >
<Online-users /> <Online-users />
</v-navigation-drawer> </v-navigation-drawer>
@@ -372,7 +377,7 @@ export default {
// ] // ]
const navigations = ref([ const navigations = ref([
{ {
name: "Новости", name: "Новости",
ico: "mdi-newspaper", ico: "mdi-newspaper",
path: "/news", path: "/news",
@@ -453,7 +458,7 @@ export default {
if (!item.path.startsWith("/")) { if (!item.path.startsWith("/")) {
item.path = "/" + item.path; item.path = "/" + item.path;
} }
item.path="/safety"+item.path item.path = "/safety" + item.path;
}); });
if (response.data.length > 0) { if (response.data.length > 0) {
+30 -3
View File
@@ -1,6 +1,9 @@
// Composables // Composables
import { createRouter, createWebHistory } from 'vue-router' import { createRouter, createWebHistory } from 'vue-router'
// import { useAccountStore } from "@/store/AccountStore";
// const accountStore = useAccountStore()
const routes = [ const routes = [
{ {
path: '/', path: '/',
@@ -97,7 +100,8 @@ const routes = [
component: () => import('@/views/AboutPortalPage.vue'), component: () => import('@/views/AboutPortalPage.vue'),
meta:{ meta:{
title:"О портале", title:"О портале",
ico: "mdi-information-variant" ico: "mdi-information-variant",
requiresAuth: true
} }
}, },
{ {
@@ -145,9 +149,32 @@ const router = createRouter({
history: createWebHistory(process.env.BASE_URL), history: createWebHistory(process.env.BASE_URL),
routes, routes,
}) })
// const accountStore = useAccountStore();
function isSuperuser() {
let a= false
if (a=== true) {
return true
}
else {
return false
}
}
router.beforeEach((to,from, next)=>{ router.beforeEach((to,from, next)=>{
document.title = to.meta.title; console.log(to,from, '-----sdsd----------------------------------------------------f')
next() if (to.meta.requiresAuth && isSuperuser()) {
document.title = to.meta.title;
next()
}
else {
console.log('22222222222222');
next()
}
}) })
export default router 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> <template>
<v-row no-gutters class="h-100"> <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-row no-gutters class="h-100 justify-center">
<v-col <v-col
lg="6" lg="6"
@@ -24,92 +24,114 @@
</v-col> </v-col>
</v-row> </v-row>
</v-col> </v-col>
<v-col cols="3" class="d-flex flex-column h-100"> <v-col class="d-flex flex-column h-100">
<v-row no-gutters class="h-0 overflow-auto"> <v-row no-gutters class="h-0 overflow-auto">
<v-col> <v-col>
<v-col class="v-col-auto ">
<div class="text-h6 d-flex justify-center">Ответственность</div> <div class="text-h6 d-flex justify-center">Ответственность</div>
</v-col>
<v-col class="v-col-auto"> <v-col class="v-col-auto">
<div v-if="responsibility != undefined && responsibility.length > 0" > <div
<v-expansion-panels variant="accordion"> v-if="responsibility != undefined && responsibility.length > 0"
<v-expansion-panel v-for="item in responsibility"> >
<v-expansion-panel-title > <v-expansion-panels variant="accordion">
{{ item.resp.sphere_of_responsibility }} <v-expansion-panel v-for="item in responsibility">
</v-expansion-panel-title> <v-expansion-panel-title>
<v-expansion-panel-text> {{ item.resp.sphere_of_responsibility }}
<list-user </v-expansion-panel-title>
v-for="user in item.resp.employee" <v-expansion-panel-text>
:key=user <list-user
:author="user"> v-for="user in item.resp.employee"
</list-user> :key="user"
</v-expansion-panel-text> :author="user"
</v-expansion-panel> >
</v-expansion-panels> </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>
<div v-else> <v-card-subtitle class="text-center" v-else
<div class="text-caption text-grey d-flex justify-center">Данные по ответственным отсутствуют</div> >Участников нет
</div> </v-card-subtitle>
</v-col> </v-expansion-panel-text>
<v-col class="v-col-auto"> </v-expansion-panel>
<div class="text-h6 d-flex justify-center">Комиссии</div> </v-expansion-panels>
</v-col> </div>
<v-col class="v-col-auto"> <div v-else>
<div v-if="commitee != undefined && commitee.length > 0" > <div class="text-caption text-grey d-flex justify-center">
<v-expansion-panels variant="accordion"> Данные по комиссиям отсутствуют
<v-expansion-panel v-for="item in commitee"> </div>
<v-expansion-panel-title> </div>
{{ item.comm.name }} </v-col>
</v-expansion-panel-title> </v-col>
<v-expansion-panel-text> </v-row>
<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-col> </v-col>
</v-row> </v-row>
<v-dialog v-model="openFirstPlan" :width="900" height="100%"> <v-dialog v-model="openFirstPlan" :width="900" height="100%">
<v-row class="ma-0 overflow-auto h-0"> <v-row class="ma-0 overflow-auto h-0">
<v-card class="h-100 w-100 pa-0"> <v-card class="h-100 w-100 pa-0">
<v-card-actions class="d-flex justify-space-between"> <v-card-actions class="d-flex justify-space-between">
<v-btn <v-btn
density="compact" density="compact"
variant="text" variant="text"
icon="mdi-close" icon="mdi-close"
@click="openFirstPlan = false"> @click="openFirstPlan = false"
</v-btn> >
<v-btn class="d-flex align-center" icon='mdi-file-download-outline' color="green" </v-btn>
@click="downloadFile(urlschema)"> <v-btn
</v-btn> class="d-flex align-center"
</v-card-actions> icon="mdi-file-download-outline"
color="green"
<VuePdfEmbed v-if="urlschema.endsWith('.pdf')" @click="downloadFile(urlschema)"
:source="urlschema" >
width="500" </v-btn>
@click="openFirstPlan = false"/> </v-card-actions>
<v-img
v-else <VuePdfEmbed
:src="urlschema" v-if="urlschema.endsWith('.pdf')"
class="cursor-pointer" :source="urlschema"
height="100%" width="500"
width="100%" @click="openFirstPlan = false"
@click="openFirstPlan = false"> />
</v-img> <v-img
</v-card> v-else
</v-row> :src="urlschema"
</v-dialog> class="cursor-pointer"
height="100%"
width="100%"
@click="openFirstPlan = false"
>
</v-img>
</v-card>
</v-row>
</v-dialog>
</template> </template>
<script setup> <script setup>