Merge branch 'Alex' into razrab

This commit is contained in:
iriska-gri committed 2024-02-29 14:33:08 +03:00
commit 4bb29d7f2b
9 files changed
+90 -42

No files matched your search

+26 -9
View File
@@ -60,15 +60,22 @@
</v-card> </v-card>
</v-row> </v-row>
<v-row class="ma-0 overflow-auto h-0"> <v-row class="ma-0 overflow-auto h-0">
<v-card <v-card class="overflow-y-auto flex-grow-1 flex-shrink-1 h-100">
title="Здесь отображаем файлы по пожарной комиссии" <v-card-title>{{ responsibilityData.name }}</v-card-title>
class="overflow-y-auto flex-grow-1 flex-shrink-1 h-100"> <v-container
v-for="file in responsibilityData.files"
:fluid="true"
class="py-0">
<v-card-actions :key="file.id">
<v-card-text>{{ file.file_name }}</v-card-text>
</v-card-actions>
</v-container>
</v-card> </v-card>
</v-row> </v-row>
</v-card> </v-card>
</v-col> </v-col>
<v-col> <v-col>
<v-card class="h-100 flex-column d-flex gap"> <!-- <v-card class="h-100 flex-column d-flex gap">
<v-row class="ma-0 overflow-auto h-0"> <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-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-container v-if="loading">
@@ -87,7 +94,7 @@
block block
@click="showFile = false">Закрыть</v-btn> @click="showFile = false">Закрыть</v-btn>
</v-card-actions> </v-card-actions>
</v-card> </v-card> -->
</v-col> </v-col>
</v-row> </v-row>
</v-window-item> </v-window-item>
@@ -114,13 +121,14 @@ import MainInfoSafety from './MainInfoSafety.vue';
pagecounter(); pagecounter();
const safetyData = ref([]); const safetyData = ref([]);
const responsibilityData = ref();
const showMore = ref(false); const showMore = ref(false);
const showFile = ref(false); const showFile = ref(false);
let pdfSource = ''; let pdfSource = '';
const loading = ref(false); const loading = ref(false);
const tab = ref('') const tab = ref('');
const burl = baseURL.slice(0,-1) const burl = baseURL.slice(0,-1);
const route = useRoute() const route = useRoute();
// Вынес запрос в отдельную функцию, чтобы избежать дублирования одного и того же запроса на сервер. // Вынес запрос в отдельную функцию, чтобы избежать дублирования одного и того же запроса на сервер.
function getSafety() { function getSafety() {
@@ -129,9 +137,18 @@ function getSafety() {
}) })
} }
function getResponsibility() {
axiosApiInstance.get(`api/safety/committee_files/`).then(result => {
responsibilityData.value = result.data
console.log(responsibilityData.value);
})
}
getResponsibility()
onBeforeMount(() => getSafety()); onBeforeMount(() => getSafety());
// Хук обновления реализует возможность динамической подгрузки данных при переключении между вкладками раздела безопасность // Хук обновления реализует возможность динамической подгрузки данных при переключении между вкладками раздела безопасность
onUpdated(() => getSafety()) onUpdated(() => getSafety());
// Проверяем по ID на какой категории срабатывает клик на раскрытии/скрытии, чтобы избежать срабатывания у всех категорий одновременно // Проверяем по ID на какой категории срабатывает клик на раскрытии/скрытии, чтобы избежать срабатывания у всех категорий одновременно
showMore.value = safetyData.value.reduce((acc, value) => { showMore.value = safetyData.value.reduce((acc, value) => {
+36 -28
View File
@@ -1,24 +1,16 @@
<template> <template>
<v-card class="h-100"> <v-card class="h-100">
<my-helper :pretext = getSchemas />
<v-row no-gutters class="h-100"> <v-row no-gutters class="h-100">
<v-col cols="3" class="w100">
<v-card class="h-100 d-flex flex-column">
<v-card-title class="text-wrap">Ответственные за противопожарную безопасность</v-card-title>
<v-row class="ma-0 overflow-auto h-0">
<v-card class="pa-1 overflow-y-auto flex-grow-1 flex-shrink-1 h-100">
</v-card>
</v-row>
</v-card>
</v-col>
<v-col cols="9"> <v-col cols="9">
<v-card class="h-100 d-flex flex-column bg-red"> <v-card class="h-100 d-flex flex-column">
<v-row class="ma-0 overflow-auto h-0"> <v-row class="ma-0 overflow-auto h-0">
<v-col cols="6"> <v-col
cols="6"
class="h-100 gap">
<v-card class="h-100"> <v-card class="h-100">
<v-img <v-img
class="cursor-pointer" class="cursor-pointer"
:src="`${burl}/media/newsimage/2024/02/01/wallpaperflare.com_wallpaper_2.jpg`" :src="`${burl}/media/safety/schemas/Схема1.jpg`"
height="100%" height="100%"
@click="openFirstPlan = true"> @click="openFirstPlan = true">
</v-img> </v-img>
@@ -33,7 +25,7 @@
@click="openFirstPlan = false"> @click="openFirstPlan = false">
</v-btn> </v-btn>
<v-img <v-img
:src="`${burl}/media/newsimage/2024/02/01/wallpaperflare.com_wallpaper_2.jpg`" :src="`${burl}/media/safety/schemas/Схема1.jpg`"
class="cursor-pointer" class="cursor-pointer"
height="100%" height="100%"
width="100%" width="100%"
@@ -43,10 +35,12 @@
</v-row> </v-row>
</v-dialog> </v-dialog>
</v-col> </v-col>
<v-col cols="6"> <v-col
cols="6"
class="h-100 gap">
<v-card class="h-100"> <v-card class="h-100">
<v-img <v-img
:src="`${burl}/media/newsimage/2024/02/01/wallpaperflare.com_wallpaper_2.jpg`" :src="`${burl}/media/safety/schemas/Схема2.jpg`"
class="cursor-pointer" class="cursor-pointer"
height="100%" height="100%"
@click="openSecondPlan = true"> @click="openSecondPlan = true">
@@ -61,7 +55,7 @@
@click="openSecondPlan = false"> @click="openSecondPlan = false">
</v-btn> </v-btn>
<v-img <v-img
:src="`${burl}/media/newsimage/2024/02/01/wallpaperflare.com_wallpaper_2.jpg`" :src="`${burl}/media/safety/schemas/Схема2.jpg`"
class="cursor-pointer" class="cursor-pointer"
height="100%" height="100%"
width="100%" width="100%"
@@ -74,13 +68,13 @@
</v-col> </v-col>
</v-row> </v-row>
<v-row class="ma-0 overflow-auto h-0"> <v-row class="ma-0 overflow-auto h-0">
<v-col > <v-col class="h-100 gap">
<v-card class="h-100"> <v-card class="h-100">
<v-img <v-img
:src="`${burl}/media/newsimage/2024/02/01/wallpaperflare.com_wallpaper_1.jpg`" @click="openImg = true" :src="`${burl}/media/safety/schemas/План.jpg`" @click="openImg = true"
class="cursor-pointer" class="cursor-pointer"
height="380" height="100%"
cover> width="100%">
</v-img> </v-img>
<v-dialog v-model="openImg" :width="900" height="100%"> <v-dialog v-model="openImg" :width="900" height="100%">
<v-row class="ma-0 overflow-auto h-0"> <v-row class="ma-0 overflow-auto h-0">
@@ -92,7 +86,7 @@
@click="openImg = false"> @click="openImg = false">
</v-btn> </v-btn>
<v-img <v-img
:src="`${burl}/media/newsimage/2024/02/01/wallpaperflare.com_wallpaper_1.jpg`" :src="`${burl}/media/safety/schemas/План.jpg`"
class="cursor-pointer" class="cursor-pointer"
height="100%" height="100%"
width="100%" width="100%"
@@ -106,11 +100,25 @@
</v-row> </v-row>
</v-card> </v-card>
</v-col> </v-col>
<v-col cols="3" class="w100">
<v-card class="h-100 d-flex flex-column">
<v-card-title class="text-wrap">Ответственные за противопожарную безопасность</v-card-title>
<v-row class="ma-0 overflow-auto h-0">
<v-card class="pa-1 overflow-y-auto flex-grow-1 flex-shrink-1 h-100">
<list-user
v-for="item in responsibility"
:author="item">
</list-user>
</v-card>
</v-row>
</v-card>
</v-col>
</v-row> </v-row>
</v-card> </v-card>
</template> </template>
<script setup> <script setup>
import listUser from '@/components/UI/fiousercard/listUser.vue';
import { baseURL, axiosApiInstance } from '@/utils/axios-api' import { baseURL, axiosApiInstance } from '@/utils/axios-api'
import { ref } from 'vue'; import { ref } from 'vue';
@@ -118,15 +126,15 @@ const burl = baseURL.slice(0,-1)
const openImg = ref(false) const openImg = ref(false)
const openFirstPlan = ref(false) const openFirstPlan = ref(false)
const openSecondPlan = ref(false) const openSecondPlan = ref(false)
const responsibility = ref([])
const getSchemas = ref([]) function getResponsibility() {
axiosApiInstance.get(`api/safety/responsibility/`).then(result => {
function getData() { responsibility.value = result.data.users
axiosApiInstance.get(`api/safety/files/?chapter_id=fire_safety`).then(result => {
getSchemas.value = result.data
}) })
} }
getData() getResponsibility()
</script> </script>
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 185 KiB

After

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

+3 -1
View File
@@ -4,5 +4,7 @@ from rest_framework.routers import DefaultRouter
from .views import * from .views import *
urlpatterns = [ urlpatterns = [
path('files/', SafetyFileAPIView.as_view(), name='safety_files') path('files/', SafetyFileAPIView.as_view(), name='safety_files'),
path('responsibility/', SafetyResponsebilityAPIView.as_view(), name='responsibility'),
path('committee_files/', CommitteeFilesAPIView.as_view(), name='committee_files')
] ]
+21 -1
View File
@@ -5,6 +5,8 @@ from rest_framework.views import APIView
from rest_framework.response import Response from rest_framework.response import Response
from .serializers import * from .serializers import *
from .models import * from .models import *
from userauth.serializers import *
from userauth.models import *
# Create your views here. # Create your views here.
class SafetyFileAPIView(APIView): class SafetyFileAPIView(APIView):
@@ -30,4 +32,22 @@ class SafetyFileAPIView(APIView):
'files': [file for file in files] 'files': [file for file in files]
}) })
return Response(data) return Response(data)
class SafetyResponsebilityAPIView(APIView):
def get(self, request):
fireuser = OrderResponsibility.objects.get(id=54)
responsobility_users = OrderResponsibilitySerializer(fireuser)
return Response(responsobility_users.data)
class CommitteeFilesAPIView(APIView):
def get(self, request):
committee_files = Committee1.objects.get(id=106)
files = Committee1Serializer(committee_files)
return Response(files.data)
+4 -3
View File
@@ -8,16 +8,17 @@ class FileResponsiblitySerializer(serializers.ModelSerializer):
class Meta: class Meta:
model = OrderResponsibilityFiles model = OrderResponsibilityFiles
fields = ['file_name', 'id'] fields = ['file_name', 'id', 'id_order_responsibility']
class ResponsibilityUsersSerializer(serializers.ModelSerializer): class ResponsibilityUsersSerializer(serializers.ModelSerializer):
fio=serializers.CharField(source='id_dict_employee.fio') fio=serializers.CharField(source='id_dict_employee.fio')
id = serializers.IntegerField(source='id_dict_employee.id') id = serializers.IntegerField(source='id_dict_employee.id')
login = serializers.CharField(source='id_dict_employee.login')
class Meta: class Meta:
model=OrderResponsibilityEmployee model=OrderResponsibilityEmployee
fields=['fio','id'] fields=['fio','id', 'login']
class OrderResponsibilitySerializer(serializers.ModelSerializer): class OrderResponsibilitySerializer(serializers.ModelSerializer):
@@ -30,7 +31,7 @@ class OrderResponsibilitySerializer(serializers.ModelSerializer):
fields = '__all__' fields = '__all__'
def respons_users(self,obj): def respons_users(self,obj):
data = OrderResponsibilityEmployee.objects.filter(id_order_responsibility=obj.respons_users.id_order_responsibility) data = OrderResponsibilityEmployee.objects.filter(id_order_responsibility=obj.id)
return ResponsibilityUsersSerializer(data,many=True).data return ResponsibilityUsersSerializer(data,many=True).data
class Committee1FilesSerializer(serializers.ModelSerializer): class Committee1FilesSerializer(serializers.ModelSerializer):