Переработка структуры раздела безопасность
This commit is contained in:
1 parent
470d2e1fe0
commit
370f45eb1e
4 files changed
+164
-37
No files matched your search
@@ -366,8 +366,13 @@ export default {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Безопасность',
|
name: 'Безопасность',
|
||||||
ico: 'mdi-routes',
|
ico: 'mdi-security',
|
||||||
path: "/securyty"
|
submenu: [
|
||||||
|
{
|
||||||
|
name: 'Пожарная безопасность',
|
||||||
|
path: "/fire_safety"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'О портале',
|
name: 'О портале',
|
||||||
|
|||||||
@@ -74,6 +74,15 @@ const routes = [
|
|||||||
ico: "mdi-ticket"
|
ico: "mdi-ticket"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/fire_safety',
|
||||||
|
name: 'FireSafety',
|
||||||
|
component: () => import('@/views/safety/FireSafety.vue'),
|
||||||
|
meta: {
|
||||||
|
title: "Пожарная безопасность",
|
||||||
|
ico: "mdi-fire-extinguisher",
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/inspection',
|
path: '/inspection',
|
||||||
name: 'AboutInspectionPage',
|
name: 'AboutInspectionPage',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-row class="pa-2">
|
<!-- <v-row class="pa-2">
|
||||||
<v-col cols="5" class="d-flex flex-column justify-start h-screen gap">
|
<v-col cols="5" class="d-flex flex-column justify-start h-screen gap">
|
||||||
<v-card v-for="item in safetyData" :key="item.id" class="overflow-y-auto mb-2 h-auto">
|
<v-card v-for="item in safetyData" :key="item.id" class="overflow-y-auto mb-2 h-auto">
|
||||||
<v-card-title>{{ item.name }}</v-card-title>
|
<v-card-title>{{ item.name }}</v-card-title>
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
</v-card>
|
</v-card>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row> -->
|
||||||
<!-- <v-dialog v-model="showFile" width="auto" height="auto">
|
<!-- <v-dialog v-model="showFile" width="auto" height="auto">
|
||||||
<v-card>
|
<v-card>
|
||||||
<v-container v-if="loading">
|
<v-container v-if="loading">
|
||||||
@@ -61,45 +61,45 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onBeforeMount } from 'vue';
|
// import { ref, onBeforeMount } from 'vue';
|
||||||
import { pagecounter } from '@/utils/universal_functions';
|
// import { pagecounter } from '@/utils/universal_functions';
|
||||||
import { axiosApiInstance, safetyURL } from '@/utils/axios-api';
|
// import { axiosApiInstance, safetyURL } from '@/utils/axios-api';
|
||||||
import { saveAs } from 'file-saver';
|
// import { saveAs } from 'file-saver';
|
||||||
import VuePdfEmbed from 'vue-pdf-embed';
|
// import VuePdfEmbed from 'vue-pdf-embed';
|
||||||
|
|
||||||
pagecounter();
|
// pagecounter();
|
||||||
|
|
||||||
const safetyData = ref([]);
|
// const safetyData = 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)
|
||||||
|
|
||||||
onBeforeMount(() => {
|
// onBeforeMount(() => {
|
||||||
axiosApiInstance.get(`api/safety/files/`).then(result => {
|
// axiosApiInstance.get(`api/safety/files/`).then(result => {
|
||||||
safetyData.value = result.data
|
// safetyData.value = result.data
|
||||||
})
|
// })
|
||||||
});
|
// });
|
||||||
|
|
||||||
// Проверяем по ID на какой категории срабатывает клик на раскрытии/скрытии, чтобы избежать срабатывания у всех категорий одновременно
|
// // Проверяем по ID на какой категории срабатывает клик на раскрытии/скрытии, чтобы избежать срабатывания у всех категорий одновременно
|
||||||
showMore.value = safetyData.value.reduce((acc, value) => {
|
// showMore.value = safetyData.value.reduce((acc, value) => {
|
||||||
acc[value.id] = false
|
// acc[value.id] = false
|
||||||
return acc
|
// return acc
|
||||||
}, {});
|
// }, {});
|
||||||
|
|
||||||
const downloadItem = (url, fileName) => {
|
// const downloadItem = (url, fileName) => {
|
||||||
axiosApiInstance.get(url, {responseType: 'blob'})
|
// axiosApiInstance.get(url, {responseType: 'blob'})
|
||||||
.then(response => {
|
// .then(response => {
|
||||||
saveAs(response.data, fileName)
|
// saveAs(response.data, fileName)
|
||||||
})
|
// })
|
||||||
};
|
// };
|
||||||
|
|
||||||
function openPDF(url) {
|
// function openPDF(url) {
|
||||||
showFile.value = true
|
// showFile.value = true
|
||||||
if (showFile) {
|
// if (showFile) {
|
||||||
return pdfSource = url
|
// return pdfSource = url
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -0,0 +1,113 @@
|
|||||||
|
<template>
|
||||||
|
<v-container :fluid="true">
|
||||||
|
<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="document">Библиотека документов</v-tab>
|
||||||
|
<v-tab selected-class="isActiveTab" value="comission">Комиссии</v-tab>
|
||||||
|
</v-tabs>
|
||||||
|
</v-card>
|
||||||
|
<v-window v-model="tab">
|
||||||
|
<v-window-item value="document">
|
||||||
|
<v-row class="mt-1">
|
||||||
|
<v-col cols="5" class="d-flex flex-column justify-start h-screen gap">
|
||||||
|
<v-card v-for="item in safetyData" :key="item.id" class="overflow-y-auto mb-2 h-auto">
|
||||||
|
<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-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>{{ file.name }}</v-card-text>
|
||||||
|
<v-btn icon="mdi-file-pdf-box" color="red" @click="openPDF(safetyURL + file.url), loading=true"></v-btn>
|
||||||
|
<v-btn icon='mdi-file-download-outline' color="green" @click="downloadItem(safetyURL + file.url, file.name)"></v-btn>
|
||||||
|
</v-card-actions>
|
||||||
|
</div>
|
||||||
|
</v-expand-transition>
|
||||||
|
</v-container>
|
||||||
|
</v-card>
|
||||||
|
</v-col>
|
||||||
|
<v-col cols="7">
|
||||||
|
<v-card v-show="showFile" class="h-screen overflow-y-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-actions>
|
||||||
|
<v-btn block @click="showFile = false">Закрыть</v-btn>
|
||||||
|
</v-card-actions>
|
||||||
|
</v-card>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</v-window-item>
|
||||||
|
</v-window>
|
||||||
|
|
||||||
|
</v-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, onBeforeMount } from 'vue';
|
||||||
|
import { pagecounter } from '@/utils/universal_functions';
|
||||||
|
import { axiosApiInstance, safetyURL } from '@/utils/axios-api';
|
||||||
|
import { saveAs } from 'file-saver';
|
||||||
|
import VuePdfEmbed from 'vue-pdf-embed';
|
||||||
|
|
||||||
|
pagecounter();
|
||||||
|
|
||||||
|
const safetyData = ref([]);
|
||||||
|
const showMore = ref(false);
|
||||||
|
const showFile = ref(false);
|
||||||
|
let pdfSource = '';
|
||||||
|
const loading = ref(false);
|
||||||
|
const tab = ref('')
|
||||||
|
|
||||||
|
|
||||||
|
onBeforeMount(() => {
|
||||||
|
axiosApiInstance.get(`api/safety/files/`).then(result => {
|
||||||
|
safetyData.value = result.data
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
// Проверяем по 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)
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
function openPDF(url) {
|
||||||
|
showFile.value = true
|
||||||
|
if (showFile) {
|
||||||
|
return pdfSource = url
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.isActiveTab {
|
||||||
|
background-color: #68c3ff70;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in new issue
Block a user