Merge branch 'fil_P-10' of https://sulaco.nodered.ru:5333/COD2/PORTAL_COD2 into fil_P-10

This commit is contained in:
Andrei Filippov committed 2024-05-27 12:26:08 +03:00
commit e315e2824a
20 files changed
+648 -781

No files matched your search

+4 -4
View File
@@ -50,11 +50,11 @@ class GetVacancies(ListAPIView):
class PostResponseVacancies(ListAPIView):
def post(self, request):
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
a = ResponseVacancy.objects.create(**json.loads(request.data['data']), file = request.data['file'] if 'file' in request.data else None)
data = {'sendto':[a.vacancy.department.id_chief.lotus], 'subject': f'Отклик на вакансию {a.vacancy.name} от {a.fio}', 'body_text':f'Почта:{a.email} ----- Телефон: {a.tel} ---- Сопроводительное письмо: {a.text}'}
okib = DictDepartment.objects.get(id=22)
data = {'sendto':[a.vacancy.department.id_chief.lotus, okib.id_chief.lotus], 'subject': f'Отклик на вакансию {a.vacancy.name} от {a.fio}', 'body_text':f'Почта:{a.email} ----- Телефон: {a.tel} ---- Сопроводительное письмо: {a.text}'}
try:
requests.post('http://10.252.44.13:8005/', data = data, files = [request.data['file']] if 'file' in request.data else [], timeout=2)
except Exception as e:
+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)
+9 -4
View File
@@ -17,12 +17,17 @@ class getuserAPIView(APIView):
Параметр: userlogin
Пример: GET /api/accounts/getuser/?userlogin=9966-00-107
Результат: Выдает все данные о пользователе
Если дать дополнительный параметр fullinfo = True, то будет выдаваться информация с комиссиями и ответсвенностью
"""
resp = None
fullinfo = request.query_params.get('fullinfo')
queryset = DictEmployee.objects.get(login=request.query_params.get('userlogin'))
if(fullinfo is None or fullinfo == False ):
resp = InfoUserCardSerializer(queryset).data
return Response(CardUserSerializer(queryset).data)
else:
resp = CardUserSerializer(queryset).data
return Response(resp)
+5 -1
View File
@@ -1,5 +1,9 @@
from django.contrib import admin
from django.utils.safestring import mark_safe
from .models import *
# Register your models here.
class ExclusionDatesAdmin(admin.ModelAdmin):
list_display=('exclusiondate',)
admin.site.register(ExclusionDates, ExclusionDatesAdmin)
+26 -12
View File
@@ -2,7 +2,7 @@ from django.db import models
from accounts.models import *
# Create your models here.
from django.conf import settings
from enum import Enum
# from enum import Enum
from ckeditor_uploader.fields import RichTextUploadingField
class CalendarEventsName(models.Model):
@@ -10,18 +10,18 @@ class CalendarEventsName(models.Model):
name=models.CharField(max_length=300, verbose_name='Название Календаря')
author = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT, verbose_name='Автор Календаря')
class EnumChoice(Enum):
@classmethod
def get_choices(cls):
return [(enum_.name, enum_.value) for enum_ in cls]
# class EnumChoice(Enum):
# @classmethod
# def get_choices(cls):
# return [(enum_.name, enum_.value) for enum_ in cls]
class FrequencyEvents(EnumChoice):
default = "Без периода"
daily = "Ежедневно"
weekly = "Еженедельно"
monthly = "Ежемесячно"
annually = "Ежегодно"
twice_a_year = "Два раза в год"
# class FrequencyEvents(EnumChoice):
# default = "Без периода"
# daily = "Ежедневно"
# weekly = "Еженедельно"
# monthly = "Ежемесячно"
# annually = "Ежегодно"
# twice_a_year = "Два раза в год"
class CalendarEvents(models.Model):
""" Основные данные по событиям"""
@@ -55,6 +55,7 @@ class ParticipantsEvent(models.Model):
participant = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT, verbose_name='Участник события')
event = models.ForeignKey(CalendarEvents, on_delete=models.PROTECT, related_name='get_calendar_events', verbose_name='Событие')
# <<<<<<< HEAD
################################################
# Модели(Таблицы) для хранения календаря
@@ -92,3 +93,16 @@ class TableEventParticipant(models.Model):
# =======
class ExclusionDates(models.Model):
""" Таблица, которая содержит даты-исключения. То есть, все праздничные дни,
которые не попадают на выходные и все будни, которые праздничные """
exclusiondate = models.DateField(null=True, blank= True, verbose_name='Дата-исключение')
class Meta:
verbose_name = "Дата-исключение"
verbose_name_plural = "Даты-исключение"
def __str__(self):
return str(self.exclusiondate)
# >>>>>>> 96ceeb3252de4f48195eb5969f6b3d1d7affbe84
+1
View File
@@ -127,6 +127,7 @@ class CardUserSerializer(serializers.ModelSerializer):
return Committee2Serializer(obj.user_committe2.all(), many=True).data
class InfoUserCardSerializer(serializers.ModelSerializer):
""" Собирает необходимую информацию о пользователе, содержит необходимые
поля для отрисовки карточки информации о пользователе при клике на фамилию
@@ -63,7 +63,7 @@ export default {
type: String,
default: 'd'
}
},
},
setup(props, {emit}) {
const filterStore = usePortalFilterStore()
@@ -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 класса
</p>
</v-card-text>
</v-card>
@@ -13,7 +13,7 @@
</v-row>
</v-col>
<v-col class="d-flex ">
<v-col class="d-flex">
<v-row no-gutters :class="smAndDown ? ' flex-column' : ''">
<v-col
:md="mdAndDown ? '12' : ''"
@@ -22,100 +22,98 @@
v-for="structure in structures"
:key="structure.id"
>
<v-row no-gutters class="flex-grow-0">
<v-col class="flex-column d-flex">
<v-row no-gutters class="mb-2 mt-1 justify-center d-flex mx-1">
<v-card class="flex-column d-flex flex-grow-1" :elevation="10">
<v-card-text class="pa-0">
<v-col lg="12" class="pa-0">
<v-row no-gutters>
<v-col
class="d-flex py-3 justify-center align-center font-weight-medium text-uppercase"
>
{{ structure.post }}
<v-row no-gutters class="flex-grow-0">
<v-col class="flex-column d-flex">
<v-row no-gutters class="mb-2 mt-1 justify-center d-flex mx-1">
<v-card class="flex-column d-flex flex-grow-1" :elevation="10">
<v-card-text class="pa-0">
<v-col lg="12" class="pa-0">
<v-row no-gutters>
<v-col
class="d-flex py-3 justify-center align-center font-weight-medium text-uppercase"
>
{{ structure.post }}
</v-col>
</v-row>
</v-col>
</v-row>
</v-col>
<v-row no-gutters>
<v-col lg="4" class="pa-1 heightfoto">
<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"
>
{{ structure.fio }}
</v-col>
</v-row>
</v-card-text>
</v-card> </v-row>
</v-col>
<!-- :class="mdAndDown ? 'flex-column gap' : ''" -->
</v-row>
<v-row no-gutters :class="lgAndDown ?'':'gap h-0 overflow-auto'">
<v-col lg=12 >
<v-row
no-gutters
class="gap mb-1"
v-for="boss in structure.deps"
:key="boss.id"
>
<v-col class="d-flex flex-column">
<v-card
class="flex-column d-flex flex-grow-1 mx-1"
:elevation="5"
>
<v-card-text class="pa-1 pt-3 px-3 flex-column">
<v-col lg="12" class="minh pa-0">
<v-row no-gutters>
<v-col
class="text-wrap text-center text-body-2 font-weight-medium text-uppercase"
>
{{ boss.name }}
<v-col lg="4" class="pa-1 heightfoto">
<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="flex-grow-0">
<v-tooltip location="top">
<template v-slot:activator="{ props }">
<span v-bind="props">
<v-icon
size="large"
color="green"
icon="mdi-arrow-top-right"
/>
</span>
</template>
<v-row>
<v-col> Перейти на страницу отдела </v-col>
</v-row>
</v-tooltip>
<v-col
class="text-center align-self-center font-weight-medium"
>
{{ structure.fio }}
</v-col>
</v-row>
</v-col>
<v-row no-gutters>
<list-user :author="boss.chief_deps" />
</v-row>
</v-card-text>
</v-card>
</v-col> </v-row>
</v-col>
</v-card-text>
</v-card>
</v-row>
</v-col>
<!-- :class="mdAndDown ? 'flex-column gap' : ''" -->
</v-row>
</v-row>
<!-- -->
<!-- -->
<v-row no-gutters :class="lgAndDown ? '' : 'gap h-0 overflow-auto'">
<v-col lg="12">
<v-row
no-gutters
class="gap mb-1"
v-for="boss in structure.deps"
:key="boss.id"
>
<v-col class="d-flex flex-column">
<v-card
class="flex-column d-flex flex-grow-1 mx-1"
:elevation="5"
>
<v-card-text class="pa-1 pt-3 px-3 flex-column">
<v-col lg="12" class="minh pa-0">
<v-row no-gutters>
<v-col
class="text-wrap text-center text-body-2 font-weight-medium text-uppercase"
>
{{ boss.name }}
</v-col>
<v-col class="flex-grow-0">
<v-tooltip location="top">
<template v-slot:activator="{ props }">
<span v-bind="props">
<v-icon
size="large"
color="green"
icon="mdi-arrow-top-right"
/>
</span>
</template>
<v-row>
<v-col> Перейти на страницу отдела </v-col>
</v-row>
</v-tooltip>
</v-col>
</v-row>
</v-col>
<v-row no-gutters>
<list-user :author="boss.chief_deps" />
</v-row>
</v-card-text>
</v-card>
</v-col>
</v-row>
</v-col>
</v-row>
</v-col>
</v-row>
</v-col>
</v-row>
</template>
<script>
@@ -145,7 +143,7 @@ export default {
spravURL,
mdAndDown,
lgAndDown,
smAndDown
smAndDown,
};
},
};
@@ -1,6 +1,48 @@
<template>
<v-row no-gutters>
<v-col class="flex-grow-0 d-flex flex-column"
><v-card class="h-100 rounded-0 d-flex flex-colmn" width="250">
<v-row no-gutters class="flex-column">
<v-col class="flex-grow-0">
<v-btn></v-btn>
</v-col>
<v-col class="w100" lg="3">
<v-locale-provider locale="ru">
<v-date-picker
ref="cal"
v-model="selectdate"
color="btn_text"
class="rounded-0 minCal"
max-width="250"
hide-header
show-adjacent-months
>
<v-btn @click="refpuk"> </v-btn>
</v-date-picker>
</v-locale-provider>
</v-col>
<v-col></v-col>
</v-row>
<!-- <v-date-picker show-adjacent-months></v-date-picker> -->
</v-card></v-col
>
<v-col class="bg-green">
<v-btn @click="drawer_right = !drawer_right">
{{ drawer_right }}
</v-btn>
</v-col>
<div>
<v-navigation-drawer
v-model="drawer_right"
floating
permanent
location="right"
rail-width="400"
rail
>
</v-navigation-drawer>
</v-row>
<!-- <div>
<v-btn @click="f_feedbackdata"> ical</v-btn>
<v-file-input
@@ -15,32 +57,55 @@
accept=".ics"
@input="handleFilesUpload"
/>
</div>
</div> -->
</template>
<script>
import { axiosApiInstance } from "@/utils/axios-api";
import { ref, computed } from "vue";
import { axiosApiInstance } from "@/utils/axios-api";
import { ref, computed, onMounted } from "vue";
import ical from "ical.js";
import { useWeekendsStore } from '@/store/WeekendsStore'
// const burl = baseURL.slice(0, -1);
export default {
setup() {
const week= useWeekendsStore()
const drawer_right = ref(false);
const cal = ref(null)
const participant = ref("");
const calendar = ref("");
const calendarEvents = ref([]);
const selectdate = ref(new Date())
const hol = ['2024-05-09', '2024-05-11']
const participant = ref("");
const calendar = ref("");
const calendarEvents = ref([]);
const addWeekend = () => {
console.log(week);
}
addWeekend()
onMounted(()=>{
cal.value.$el.querySelectorAll(".v-date-picker-month__day").forEach((e)=>{
if (hol.includes(e.getAttribute("data-v-date"))) {
e.querySelectorAll("span").forEach(n=>{n.classList.add("text-red")})
}
})
})
function f_feedbackdata() {
axiosApiInstance
.post(`api/calendar_of_events/calendarEvents/`, {
participants: participant.value,
calendar: calendar.value }).then((data) => {
console.log(data, "datas");
function f_feedbackdata() {
axiosApiInstance
.post(`api/calendar_of_events/calendarEvents/`, {
participants: participant.value,
calendar: calendar.value,
})
.then((data) => {
console.log(data, "datas");
});
}
const handleFilesUpload = (event) => {
@@ -54,11 +119,9 @@ function f_feedbackdata() {
const readFile = (file) => {
const reader = new FileReader();
reader.readAsText(file);
reader.onload = (event) => {
reader.onload = (event) => {
parseICS(event.target.result);
};
};
const parseICS = (text) => {
const jcalData = ical.parse(text);
@@ -73,7 +136,7 @@ function f_feedbackdata() {
let attendees = [];
event.attendees.map((att) => {
attendees.push(att.jCal[1].cn);
});
});
return {
name: event.summary,
description: event.description,
@@ -83,23 +146,38 @@ function f_feedbackdata() {
place: event.location,
// attendees: attendees, ? Такая же история 0 в базе нет
cdate: new Date(event.component.jCal[1][6][3]),
content: ''
content: "",
};
});
participant.value = name;
calendar.value = calendarEvents;
};
return {
handleFilesUpload,
calendarEvents,
f_feedbackdata
f_feedbackdata,
drawer_right,
selectdate,
cal
};
}}
},
};
</script>
<style></style>
<style>
.minCal .v-date-picker-month__day {
height: 31px;
width: 31px;
}
.minCal .v-btn--icon.v-btn--density-default {
width: calc(var(--v-btn-height) + 12px);
height: calc(var(--v-btn-height) + 6px);
}
.minCal .v-btn__content {
font-weight: 410;
}
</style>
@@ -1,7 +1,7 @@
<template>
<div>
<v-btn @click="useICalReader"> ical</v-btn>
<my-helper :pretext="events" />
<!-- <my-helper :pretext="events" /> -->
<v-sheet
class="d-flex"
height="54"
+26 -19
View File
@@ -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" />
<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_superuser
: 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,6 +377,11 @@ export default {
// ]
const navigations = ref([
{
name: "Новости",
ico: "mdi-newspaper",
path: "/news",
},
{
name: "Структура",
ico: "mdi-source-branch",
@@ -407,15 +417,11 @@ export default {
// },
// ],
// },
{
name: "Новости",
ico: "mdi-newspaper",
path: "/news",
},
{
name: "О портале",
ico: "mdi-information-variant",
path: "/portal",
name: "Календарь",
ico: "mdi-calendar",
path: "/ical",
},
{
@@ -423,10 +429,11 @@ export default {
ico: "mdi-city",
path: "/inspection",
},
{
name: "ical",
ico: "mdi-calendar",
path: "/ical",
name: "О портале",
ico: "mdi-information-variant",
path: "/portal",
},
// {
@@ -451,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) {
@@ -460,7 +467,7 @@ export default {
ico: "mdi-security",
submenu: response.data,
};
navigations.value.splice(5, 0, safetyMenu);
navigations.value.splice(4, 0, safetyMenu);
}
});
};
+127 -107
View File
@@ -1,153 +1,173 @@
// Composables
import { createRouter, createWebHistory } from 'vue-router'
import { createRouter, createWebHistory } from "vue-router";
import { useAccountStore } from "@/store/AccountStore";
const routes = [
{
path: '/',
component: () => import('@/layouts/default/DefaultPortal.vue'),
meta:{
title:"Вход"
path: "/",
component: () => import("@/layouts/default/DefaultPortal.vue"),
meta: {
title: "Вход",
},
children: [
{
path: '/',
name: 'HomePage',
component: () => import('@/views/HomePage.vue'),
meta:{
title:"Портал МИ ФНС России по ЦОД №2",
ico: "mdi-arrow-top-right"
}
path: "/",
name: "HomePage",
component: () => import("@/views/HomePage.vue"),
meta: {
title: "Портал МИ ФНС России по ЦОД №2",
ico: "mdi-arrow-top-right",
},
},
{
path: '/okib',
name: 'OKiBPage',
component: () => import('@/views/nested_view/o_OKiB.vue'),
meta:{
title:"Отдел кадров и безопасности",
ico: "mdi-comment-account-outline"
}
path: "/okib",
name: "OKiBPage",
component: () => import("@/views/nested_view/o_OKiB.vue"),
meta: {
title: "Отдел кадров и безопасности",
ico: "mdi-comment-account-outline",
},
},
{
path: '/providing',
name: 'ProvidingActivitiesPage',
component: () => import('@/views/ProvidingActivitiesPage.vue'),
meta:{
title:"Обеспечивающая деятельность",
ico: "mdi-bulletin-board"
}
path: "/providing",
name: "ProvidingActivitiesPage",
component: () => import("@/views/ProvidingActivitiesPage.vue"),
meta: {
title: "Обеспечивающая деятельность",
ico: "mdi-bulletin-board",
},
},
{
path: '/faq',
name: 'FAQPage',
component: () => import('@/views/FAQPage.vue'),
meta:{
title:"Часто задаваемые вопросы",
ico: "mdi-comment-question-outline"
}
path: "/faq",
name: "FAQPage",
component: () => import("@/views/FAQPage.vue"),
meta: {
title: "Часто задаваемые вопросы",
ico: "mdi-comment-question-outline",
},
},
{
path: '/feedback',
name: 'FeedbackPage',
component: () => import('@/views/FeedbackPage.vue'),
meta:{
title:"Обратная связь",
ico: "mdi-thumb-up-outline"
}
path: "/feedback",
name: "FeedbackPage",
component: () => import("@/views/FeedbackPage.vue"),
meta: {
title: "Обратная связь",
ico: "mdi-thumb-up-outline",
},
},
{
path: '/labor',
name: 'LaborProtection',
component: () => import('@/views/LaborProtection.vue'),
meta:{
title:"Охрана труда",
ico: "mdi-pharmacy"
}
path: "/labor",
name: "LaborProtection",
component: () => import("@/views/LaborProtection.vue"),
meta: {
title: "Охрана труда",
ico: "mdi-pharmacy",
},
},
{
path: '/securyty',
name: 'SecurityPage',
component: () => import('@/views/SecurityPage.vue'),
meta:{
title:"Безопасность",
ico: "mdi-security"
}
path: "/securyty",
name: "SecurityPage",
component: () => import("@/views/SecurityPage.vue"),
meta: {
title: "Безопасность",
ico: "mdi-security",
},
},
{
path: '/safety/:chapter',
component: () => import('@/views/safety/ChaptersSafety.vue'),
path: "/safety/:chapter",
component: () => import("@/views/safety/ChaptersSafety.vue"),
meta: {
title: "Разделы безопасности",
ico: "mdi-fire-extinguisher",
}
},
},
{
path: '/inspection',
name: 'AboutInspectionPage',
component: () => import('@/views/AboutInspectionPage.vue'),
meta:{
title:"Об инспекции",
ico: "mdi-city"
}
path: "/inspection",
name: "AboutInspectionPage",
component: () => import("@/views/AboutInspectionPage.vue"),
meta: {
title: "Об инспекции",
ico: "mdi-city",
},
},
{
path: '/portal',
name: 'AboutPortalPage',
component: () => import('@/views/AboutPortalPage.vue'),
meta:{
title:"О портале",
ico: "mdi-information-variant"
}
path: "/portal",
name: "AboutPortalPage",
component: () => import("@/views/AboutPortalPage.vue"),
meta: {
title: "О портале",
ico: "mdi-information-variant",
requiresAuth: true,
},
},
{
path: '/news',
name: 'AboutNewsPage',
component: () => import('@/views/NewsPage.vue'),
meta:{
title:"Лента новостей",
ico: "mdi-newspaper"
}
path: "/news",
name: "AboutNewsPage",
component: () => import("@/views/NewsPage.vue"),
meta: {
title: "Лента новостей",
ico: "mdi-newspaper",
},
},
{
path: '/newsfull',
name: 'FullNewsPage',
component: () => import('@/components/news-full.vue'),
meta:{
title:"Одна новость",
ico: "mdi-newspaper"
}
path: "/newsfull",
name: "FullNewsPage",
component: () => import("@/components/news-full.vue"),
meta: {
title: "Одна новость",
ico: "mdi-newspaper",
},
},
{
path: '/fnshol',
name: 'FnsHol.vue',
component: () => import('@/views/FnsHol.vue'),
meta:{
title:"К празднику",
ico: "mdi-city"
}
path: "/fnshol",
name: "FnsHol.vue",
component: () => import("@/views/FnsHol.vue"),
meta: {
title: "К празднику",
ico: "mdi-city",
},
},
{
path: '/ical',
name: 'Calendar',
component: () => import('@/components/calendar_of_events/load-ical.vue'),
meta:{
title:"Для работы над календарем",
ico: "mdi-account"
}
path: "/ical",
name: "Calendar",
component: () =>
import("@/components/calendar_of_events/load-ical.vue"),
meta: {
title: "Для работы над календарем",
ico: "mdi-account",
},
},
],
},
]
];
const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes,
})
router.beforeEach((to,from, next)=>{
document.title = to.meta.title;
next()
})
});
export default router
function isSuperuser() {
const accountStore = useAccountStore();
if (accountStore.user.is_superuser === false) {
return true;
} else {
return false;
}
}
router.beforeEach((to, from, next) => {
if (to.meta.requiresAuth && isSuperuser()) {
document.title = to.meta.title;
next("/");
} else {
document.title = to.meta.title;
next();
}
});
export default router;
+17
View File
@@ -0,0 +1,17 @@
// Utilities
import { defineStore } from 'pinia'
import { ref } from 'vue'
export const useWeekendsStore = defineStore('weekends', () => {
const week = ref({ '2024': {'05': '09'} })
return { week }
},
)
@@ -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>
@@ -11,9 +11,9 @@
<v-window-item class="gap h-100" value="document">
<documentation-safety :docSections = "safetyData" />
</v-window-item>
<v-window-item class="gap h-100" value="testings">
<!-- <v-window-item class="gap h-100" value="testings">
<TestSafety></TestSafety>
</v-window-item>
</v-window-item> -->
</template>
</pattern-tabs>
</template>
@@ -49,8 +49,6 @@ export default {
.then((result) => {
safetyData.value = result.data;
loading.value = true;
// pdfSource.value = burl + safetyData.value.categories[0].files[0].url
console.log(safetyData.value, "-------------------------------");
});
};
getSafety()
@@ -63,7 +61,7 @@ export default {
tabs_items: [
{ title: "Основная информация", value: "mainInfo" },
{ title: "Документация", value: "document" },
{ title: "Тестирование", value: "testings" },
// { title: "Тестирование", value: "testings" },
],
};
},
@@ -3,65 +3,9 @@
<v-col class="d-flex">
<v-row no-gutters class="flex-column gap">
<v-col lg="6" class="w100 d-flex flex-column">
<v-card class="h-100 w-100 d-flex flex-column pb-1 rounded-0">
<v-card-title>
<span class="text-h4 text-wrap"> Комиссии </span>
</v-card-title>
<v-row no-gutters class="h-0 overflow-auto flex-column flex-nowrap">
<v-col
class="flex-grow-0"
v-for="(comm, key) in docSections.type_comm"
:key="key"
>
<v-card-subtitle class="text-wrap">
<span class="text-subtitle-1 text-wrap">
{{ comm.comm.name }}
</span>
</v-card-subtitle>
<v-list :lines="false" density="compact" nav>
<v-row
no-gutters
v-for="file in comm.comm.comitee_files"
:key="file.id"
>
<v-col>
<v-list-item
:active="filId == file.id"
color="primary"
density="compact"
@click="
openPDF(file)
"
>
<span class="text-body-2 text-wrap">
{{
get_name(
decodeURI(file.file_name.replace(/\.[^/.]+$/, ""))
)
}}
</span>
</v-list-item></v-col
>
<v-col class="flex-grow-0 align-self-center">
<v-icon
icon="mdi-file-download-outline"
@click="
downloadItem(file)
"
/></v-col>
</v-row>
</v-list>
</v-col>
</v-row>
</v-card>
</v-col>
<v-col class="w100 d-flex flex-column">
<v-card class="h-100 w-100 d-flex flex-column rounded-0">
<v-card-title>
<span class="text-h4 text-wrap"> Ответсвенности </span>
<span class="text-h6 text-wrap"> Ответственность </span>
</v-card-title>
<v-row no-gutters class="h-0 overflow-auto flex-column flex-nowrap">
@@ -87,25 +31,62 @@
:active="filId == file.id"
color="primary"
density="compact"
@click="
openPDF(file)
"
@click="openPDF(file)">
<span class="text-body-2 text-wrap">
{{ get_name(decodeURI(file.file_name.replace(/\.[^/.]+$/, ""))) }}
</span>
</v-list-item>
</v-col>
<v-col class="flex-grow-0 align-self-center">
<v-icon
icon="mdi-file-download-outline"
@click="downloadItem(file)"
/></v-col>
</v-row>
</v-list>
</v-col>
</v-row>
</v-card>
</v-col>
<v-col class="w100 d-flex flex-column">
<v-card class="h-100 w-100 d-flex flex-column pb-1 rounded-0">
<v-card-title>
<span class="text-h6 text-wrap"> Комиссии </span>
</v-card-title>
<v-row no-gutters class="h-0 overflow-auto flex-column flex-nowrap">
<v-col
class="flex-grow-0"
v-for="(comm, key) in docSections.type_comm"
:key="key">
<v-card-subtitle class="text-wrap">
<span class="text-subtitle-1 text-wrap">
{{ comm.comm.name }}
</span>
</v-card-subtitle>
<v-list :lines="false" density="compact" nav>
<v-row
no-gutters
v-for="file in comm.comm.comitee_files"
:key="file.id">
<v-col>
<v-list-item
:active="filId == file.id"
color="primary"
density="compact"
@click="openPDF(file)"
>
<span class="text-body-2 text-wrap">
{{
get_name(
decodeURI(file.file_name.replace(/\.[^/.]+$/, ""))
)
}}
{{ get_name(decodeURI(file.file_name.replace(/\.[^/.]+$/, ""))) }}
</span>
</v-list-item></v-col
>
<v-col class="flex-grow-0 align-self-center">
<v-icon
icon="mdi-file-download-outline"
@click="
downloadItem(file)
"
@click="downloadItem(file)"
/></v-col>
</v-row>
</v-list>
@@ -117,29 +98,22 @@
</v-col>
<v-col class="d-flex flex-column">
<v-card class="flex-column h-100 d-flex rounded-0">
<v-row no-gutters class="h-0 overflow-auto">
<v-col class="d-flex flex-column "
:class="!loading?'align-center align-self-center':''">
<v-container v-if="loading">
<v-progress-linear :rounded="5" indeterminate color="teal" />
</v-container>
<VuePdfEmbed
<VuePdfEmbed
v-show="showFile"
:source="pdfSource"
width="720"
@rendered="loading = false"
@loading-failed="handlePdfError"
/>
@loading-failed="handlePdfError"/>
<v-card-text v-show="!showFile" >
<span class="text-h5 text-grey"
>
{{ err }}
<span class="text-h5 text-grey">
{{ err }}
</span>
</v-card-text>
@@ -160,7 +134,6 @@ import { ref, computed } from "vue";
import { axiosApiInstance, baseURL, spravURLBase } from "@/utils/axios-api";
import { saveAs } from "file-saver";
import VuePdfEmbed from "vue-pdf-embed";
import { triggerRef } from "vue";
export default {
props: {
@@ -194,20 +167,14 @@ export default {
});
};
const openPDF = (file) => {
console.log(file, "fil");
const openPDF = (file) => {
let source =development.value ? burl + file.file_name : spravURLBase + `files/${file.typeoffile == 'comm' ? 'committee1_docs' : 'order_responsibility_docs'}/${file.parent}/${get_name(file.file_name)}`
if(source!=pdfSource.value){
loading.value = true
pdfSource.value = source
}
showFile.value = true;
filId.value = file.id;
};
const development = computed({
@@ -215,7 +182,6 @@ export default {
return process.env.NODE_ENV == "development" ? true : false;
}
})
// process.env.NODE_ENV == "development" ? true : false;
const get_name = (namestr) => {
let arr = namestr.split("/");
@@ -232,37 +198,21 @@ export default {
showFile.value=false
err.value = "Файл не найден";
loading.value = false;
// if (error.status === 404) {
// console.error('PDF file not found');
// // Дополнительная логика или обработка ошибки 404 здесь
// } else {
// console.error('An error occurred while loading the PDF:', error);
// }
};
const firstFile = () => {
let files = []
props.docSections.type_comm.forEach(el => {
// console.log(el);
files.push(...el.comm.comitee_files)
});
props.docSections.type_resp.forEach(el => {
files.push(...el.resp.get_resp_files)
});
pdfSource.value =development.value ? burl + files[0].file_name : spravURLBase + `files/${files[0].typeoffile == 'comm' ? 'committee1_docs' : 'order_responsibility_docs'}/${files[0].parent}/${get_name(files[0].file_name)}`
// = source
// pdfSource.value =
// burl + files[0].file_name;
pdfSource.value =
development.value ? burl + files[0].file_name : spravURLBase + `files/${files[0].typeoffile == 'comm' ? 'committee1_docs' : 'order_responsibility_docs'}/${files[0].parent}/${get_name(files[0].file_name)}`
filId.value = files[0].id;
console.log(pdfSource.value, "-------------------------------");
};
firstFile();
+104 -89
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,99 +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>
<v-expansion-panel v-for="item in responsibility">
<v-expansion-panel-title class="font-weight-medium">
{{ 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 >
<v-expansion-panel v-for="item in commitee">
<v-expansion-panel-title class="font-weight-medium">
{{ 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>
<!-- <div class=" overflow-y-auto h-100 bg-orange">
</div> -->
<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>