Merge remote-tracking branch 'origin/52_fire' into develop

This commit is contained in:
Nukeap committed 2024-05-16 15:42:36 +03:00
commit 3efc8fdfcd
14 files changed
+347 -394

No files matched your search

+23 -14
View File
@@ -295,7 +295,7 @@ import { useTheme } from "vuetify";
import AuthForm from '@/components/UI/Auth-form.vue'
import OnlineUsers from '@/components/UI/fiousercard/onlineUsers.vue'
import CardLike from '@/components/cardLike.vue'
import { clearAxios } from '@/utils/axios-api'
import { axiosApiInstance, clearAxios } from '@/utils/axios-api'
import { baseURL } from '@/utils/axios-api'
import VcardUser from '@/components/UI/fiousercard/vcardUser.vue'
@@ -381,7 +381,7 @@ export default {
// ]
const navigations = [
const navigations = ref([
{
name: 'Структура',
@@ -424,16 +424,6 @@ export default {
ico: 'mdi-newspaper',
path: "/news"
},
{
name: 'Безопасность',
ico: 'mdi-security',
submenu: [
{
name: 'Пожарная безопасность',
path: "/fire_safety"
},
]
},
{
name: 'О портале',
ico: 'mdi-information-variant',
@@ -456,8 +446,8 @@ export default {
// ico: 'mdi-cake-variant',
// path: "/fnshol"
// }
]
])
const imageSrc = computed(() => {
return new URL(`@/assets/FNS-logo-xs.png`, import.meta.url).href;
})
@@ -467,7 +457,26 @@ export default {
// feedalert.value=true
}
const getSafetyChapter = () => {
axiosApiInstance.get('api/safety/gettypes/').then(response => {
response.data.forEach(item => {
if(!item.path.startsWith('/')) {
item.path = '/' + item.path
}
});
if (response.data.length > 0) {
let safetyMenu = {
name: 'Безопасность',
ico: 'mdi-security',
submenu: response.data
}
navigations.value.splice(5, 0, safetyMenu)
}
})
}
getSafetyChapter()
return {
theme,
+1 -1
View File
@@ -75,7 +75,7 @@ const routes = [
}
},
{
path: '/:chapter_id',
path: '/:chapter',
component: () => import('@/views/safety/ChaptersSafety.vue'),
meta: {
title: "Разделы безопасности",
+2 -2
View File
@@ -1,7 +1,7 @@
import {useAccountStore} from '@/store/AccountStore'
import axios from "axios";
const spravURL = 'http://10.252.44.33/accounting6/images/photo/'
const spravURLBase = 'http://10.252.44.33/accounting6/'
const baseURL = process.env.NODE_ENV == 'development'? 'http://127.0.0.1:8000/': `http://${window.location.host}/`;
const baseWS = process.env.NODE_ENV == 'development'? 'ws://127.0.0.1:8000/': `ws://${window.location.host}/`;
// const baseURL = process.env.NODE_ENV == 'development'? 'http://127.0.0.1:8000/': `http://10.252.44.60:9965/`;
@@ -89,4 +89,4 @@ async error => {
})
export { axiosApiInstance, clearAxios, baseURL,spravURL,baseWS }
export { axiosApiInstance, clearAxios, baseURL,spravURL, spravURLBase, baseWS }
+154 -202
View File
@@ -1,236 +1,188 @@
<template>
<v-row no-gutters class="flex-column h-100 gap pa-1">
<v-col lg="1" class="w100 h-100">
<v-card>
<v-tabs
v-model="tab"
bg-color="teal-darken-1"
slider-color="teal-darken-2"
:grow="true"
>
<v-tab selected-class="isActiveTab" value="mainInfo"
>Основная информация</v-tab
>
<v-tab selected-class="isActiveTab" value="document"
>Документация</v-tab
>
<v-tab selected-class="isActiveTab" 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></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 my-3 overflow-auto h-0 pb-1">
<v-card
v-for="item in safetyData"
:key="item.id"
class="overflow-y-auto flex-grow-1 flex-shrink-1 h-100"
>
<v-card-title>{{ item.name }}</v-card-title>
<v-container
v-for="category in item.categories"
:key="item.id + category.id"
:fluid="true"
class="py-0"
>
<v-card-actions v-if="category.id != 'evacuation_plan'">
<v-btn
@click="
showMore[item.id + category.id] =
!showMore[item.id + category.id]
"
variant="text"
>
{{ category.name }}
</v-btn>
<v-btn
:icon="
showMore[item.id + category.id]
? 'mdi-chevron-up'
: 'mdi-chevron-down'
"
@click="
showMore[item.id + category.id] =
!showMore[item.id + category.id]
"
>
</v-btn>
</v-card-actions>
<v-expand-transition>
<div v-show="showMore[item.id + category.id]">
<v-card-actions
v-for="file in category.files"
:key="file.id"
class="overflow-y-auto"
>
<v-card-text
class="cursor-pointer"
:ref_="openPDF(burl + file.url)"
@click="
openPDF(burl + file.url), (loading = true)
"
>
{{ file.name }}
</v-card-text>
<v-btn
icon="mdi-file-pdf-box"
color="red"
@click="
openPDF(burl + file.url), (loading = true)
"
></v-btn>
<v-btn
icon="mdi-file-download-outline"
color="green"
@click="downloadItem(burl + file.url, file.name)"
></v-btn>
</v-card-actions>
</div>
</v-expand-transition>
</v-container>
</v-card>
</v-row>
<v-row class="ma-0 overflow-auto h-0">
<v-card
class="overflow-y-auto flex-grow-1 flex-shrink-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>{{
file.file_name.replace(/\.[^/.]+$/, "")
}}</v-card-text>
<v-btn
icon="mdi-file-pdf-box"
color="red"
@click="openPDF(burl + file.url), (loading = true)"
></v-btn>
<v-btn
icon="mdi-file-download-outline"
color="green"
@click="
downloadItem(burl + file.file_name, file.file_name)
"
></v-btn>
<!-- @click="downloadItem(burl + file.file_name, file.file_name)" -->
</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">
<TestSafety></TestSafety>
</v-window-item>
</v-window>
</v-col>
</v-row>
<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="formainpage"></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 ">
<TestSafety></TestSafety>
</v-window-item>
</v-window>
</v-col>
</v-row>
</template>
<script setup>
import { ref, onBeforeMount, onUpdated } 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 { ref, onBeforeMount, computed } from 'vue';
import { pagecounter } from '@/utils/universal_functions';
import { axiosApiInstance, baseURL, spravURLBase } 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";
import VuePdfEmbed from 'vue-pdf-embed';
import TestSafety from './TestSafety.vue';
import MainInfoSafety from './MainInfoSafety.vue';
pagecounter();
const safetyData = ref([]);
const safetyData = ref({categories:[]});
const responsibilityData = ref();
const showMore = ref(false);
const showFile = ref(false);
let pdfSource = "";
const showFile = ref(true);
let pdfSource = ref("");
const loading = ref(false);
const tab = ref("");
const tab = ref('');
const burl = baseURL.slice(0, -1);
const route = useRoute();
// Вынес запрос в отдельную функцию, чтобы избежать дублирования одного и того же запроса на сервер.
function getSafety() {
axiosApiInstance
.get(`api/safety/files/?chapter_id=${route.params.chapter_id}`)
.then((result) => {
safetyData.value = result.data;
});
axiosApiInstance.get(`api/safety/files/?chapter=${route.params.chapter}`).then(result => {
safetyData.value = result.data
// console.log(safetyData.value);
loading.value = true
pdfSource.value = burl + safetyData.value.categories[0].files[0].url
// console.log(safetyData.value);
})
}
const formainpage = computed({
get() {
let arr = []
safetyData.value.categories.forEach(element => {
element.files.forEach((e) => {
if (e.formainpage == true) {
arr.push(e)
}
})
})
return arr
}
})
function getResponsibility() {
axiosApiInstance.get(`api/safety/committee_files/`).then((result) => {
responsibilityData.value = result.data;
});
axiosApiInstance.get(`api/safety/committee_files/`).then(result => {
responsibilityData.value = result.data
})
}
getResponsibility();
getResponsibility()
onBeforeMount(() => getSafety());
// Хук обновления реализует возможность динамической подгрузки данных при переключении между вкладками раздела безопасность
onUpdated(() => getSafety());
// Проверяем по ID на какой категории срабатывает клик на раскрытии/скрытии, чтобы избежать срабатывания у всех категорий одновременно
showMore.value = safetyData.value.reduce((acc, value) => {
acc[value.id] = false;
return acc;
}, {});
const downloadItem = (url, fileName) => {
axiosApiInstance.get(url, { responseType: "blob" }).then((response) => {
saveAs(response.data, fileName);
});
axiosApiInstance.get(url, { responseType: 'blob' })
.then(response => {
saveAs(response.data, fileName)
})
};
function openPDF(url) {
showFile.value = true;
if (showFile) {
return (pdfSource = 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: #68c3ff70;
background-color: #E0F2F1;
color: #004D40;
}
</style>
</style>
+55 -108
View File
@@ -1,106 +1,19 @@
<template>
<v-card class="h-100">
<v-row no-gutters class="h-100">
<v-col cols="9">
<v-card class="h-100 d-flex flex-column">
<v-row class="ma-0 overflow-auto h-0">
<v-col
cols="6"
class="h-100 gap">
<v-card class="h-100">
<v-img
class="cursor-pointer"
:src="`${burl}/media/safety/schemas/Схема1.jpg`"
height="100%"
@click="openFirstPlan = true">
</v-img>
</v-card>
<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 flex-grow-0">
<v-btn
density="compact"
variant="text"
icon="mdi-close"
@click="openFirstPlan = false">
</v-btn>
<v-img
:src="`${burl}/media/safety/schemas/Схема1.jpg`"
class="cursor-pointer"
height="100%"
width="100%"
@click="openFirstPlan = false">
</v-img>
</v-card>
</v-row>
</v-dialog>
</v-col>
<v-col
cols="6"
class="h-100 gap">
<v-card class="h-100">
<v-img
:src="`${burl}/media/safety/schemas/Схема2.jpg`"
class="cursor-pointer"
height="100%"
@click="openSecondPlan = true">
</v-img>
<v-dialog v-model="openSecondPlan" :width="900" height="100%">
<v-row class="ma-0 overflow-auto h-0">
<v-card class="h-100 w-100 pa-0 flex-grow-0">
<v-btn
density="compact"
variant="text"
icon="mdi-close"
@click="openSecondPlan = false">
</v-btn>
<v-img
:src="`${burl}/media/safety/schemas/Схема2.jpg`"
class="cursor-pointer"
height="100%"
width="100%"
@click="openSecondPlan = false">
</v-img>
</v-card>
</v-row>
</v-dialog>
</v-card>
</v-col>
</v-row>
<v-row class="ma-0 overflow-auto h-0">
<v-col class="h-100 gap">
<v-card class="h-100">
<v-img
:src="`${burl}/media/safety/schemas/План.jpg`" @click="openImg = true"
class="cursor-pointer"
height="100%"
width="100%">
</v-img>
<v-dialog v-model="openImg" :width="900" height="100%">
<v-row class="ma-0 overflow-auto h-0">
<v-card class="h-100 w-100 pa-0 flex-grow-0">
<v-btn
density="compact"
variant="text"
icon="mdi-close"
@click="openImg = false">
</v-btn>
<v-img
:src="`${burl}/media/safety/schemas/План.jpg`"
class="cursor-pointer"
height="100%"
width="100%"
@click="openImg = false">
</v-img>
</v-card>
</v-row>
</v-dialog>
</v-card>
</v-col>
</v-row>
</v-card>
<v-row no-gutters class="gap h-100 ">
<v-col cols="9" class="flex-column" >
<v-row no-gutters class="h-100 justify-center">
<v-col lg="6" class="meheight" v-for="schema in formainpage" :key="schema.id">
<VuePdfEmbed v-if="schema.url.endsWith('.pdf')" :source="burl + schema.url" width="500" />
<v-img v-else
class="cursor-pointer"
:src="burl + schema.url"
@click="openFirstPlan_opener(schema)">
</v-img>
</v-col>
</v-row>
</v-col>
<v-col cols="3" class="w100">
<v-col 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">
@@ -112,23 +25,52 @@
</list-user>
</v-card>
</v-row>
</v-card>
</v-card>
<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 flex-grow-0">
<v-btn
density="compact"
variant="text"
icon="mdi-close"
@click="openFirstPlan = false">
</v-btn>
<v-img
:src="urlschema"
class="cursor-pointer"
height="100%"
width="100%"
@click="openFirstPlan = false">
</v-img>
</v-card>
</v-row>
</v-dialog>
</v-col>
</v-row>
</v-card>
</template>
<script setup>
import { baseURL, axiosApiInstance } from '@/utils/axios-api'
import { ref } from 'vue';
import VuePdfEmbed from 'vue-pdf-embed';
defineProps(
{
formainpage: Object,
require:true
},
)
const urlschema=ref(null)
const burl = baseURL.slice(0,-1)
const openImg = ref(false)
const openFirstPlan = ref(false)
const openSecondPlan = ref(false)
const responsibility = ref([])
function openFirstPlan_opener(schema){
urlschema.value = burl + schema.url
openFirstPlan.value = true
}
function getResponsibility() {
axiosApiInstance.get(`api/safety/responsibility/`).then(result => {
responsibility.value = result.data.users
@@ -137,5 +79,10 @@ function getResponsibility() {
getResponsibility()
</script>
</script>
<style>
.meheight {
max-height: 44vh;
}
</style>