This commit is contained in:
Alex committed 2024-04-19 13:53:25 +03:00
1 parent 631cecc8cd
commit 2aeb3ef513
8 files changed
+158 -105

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'
@@ -378,7 +378,7 @@ export default {
// ]
const navigations = [
const navigations = ref([
{
name: 'Структура',
@@ -421,16 +421,6 @@ export default {
ico: 'mdi-newspaper',
path: "/news"
},
{
name: 'Безопасность',
ico: 'mdi-security',
submenu: [
{
name: 'Пожарная безопасность',
path: "/fire_safety"
},
]
},
{
name: 'О портале',
ico: 'mdi-information-variant',
@@ -453,8 +443,8 @@ export default {
// ico: 'mdi-cake-variant',
// path: "/fnshol"
// }
]
])
const imageSrc = computed(() => {
return new URL(`@/assets/FNS-logo-xs.png`, import.meta.url).href;
})
@@ -464,7 +454,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: "Разделы безопасности",
+63 -28
View File
@@ -22,28 +22,62 @@
<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-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"
<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
flat
>
<v-expansion-panel
elevation=0
v-for="category in safetyData.categories"
:key="category.id"
class="py-0">
<v-card-actions v-if="category.id != 'evacuation_plan'">
<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 size="small" variant="text" icon="mdi-file-pdf-box" color="red" @click="openPDF(file.url), loading=true"></v-btn>
<v-btn size="small" 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-card-actions v-if="category.id != 'evacuation_plan'">
<v-btn
@click="showMore[item.id + category.id] = !showMore[item.id + category.id]"
@click="showMore[ category.id] = !showMore[category.id]"
variant="text">
{{ category.name }}
</v-btn>
{{ category.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]">
:icon="showMore[ category.id] ? 'mdi-chevron-up' : 'mdi-chevron-down'"
@click="showMore[category.id] = !showMore[ category.id]">
</v-btn>
</v-card-actions>
<v-expand-transition>
<div v-show="showMore[item.id + category.id]">
</v-card-actions>-->
<!-- <v-expand-transition>
<div v-show="showMore[ category.id]">
<v-card-actions v-for="file in category.files" :key="file.id" class="overflow-y-auto">
<v-card-text
class="cursor-pointer"
@@ -54,12 +88,13 @@
<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-expand-transition> -->
</v-expansion-panel>
</v-expansion-panels>
</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 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"
@@ -137,12 +172,12 @@ const route = useRoute();
// Вынес запрос в отдельную функцию, чтобы избежать дублирования одного и того же запроса на сервер.
function getSafety() {
axiosApiInstance.get(`api/safety/files/?chapter_id=${route.params.chapter_id}`).then(result => {
axiosApiInstance.get(`api/safety/files/?chapter=${route.params.chapter}`).then(result => {
safetyData.value = result.data
console.log(safetyData.value);
// console.log(safetyData.value);
loading.value=true
pdfSource.value =burl + safetyData.value[0].categories[1].files[0].url
console.log(safetyData.value);
pdfSource.value =burl + safetyData.value.categories[0].files[0].url
// console.log(safetyData.value);
})
}
@@ -150,7 +185,7 @@ const formainpage = computed({
get() {
let arr=[]
if(safetyData.value.length>0){
safetyData.value[0].categories.forEach(element => {
safetyData.value.categories.forEach(element => {
element.files.forEach((e)=>{
if(e.formainpage==true){
arr.push(e)}
@@ -172,10 +207,10 @@ getResponsibility()
onBeforeMount(() => getSafety());
// Проверяем по ID на какой категории срабатывает клик на раскрытии/скрытии, чтобы избежать срабатывания у всех категорий одновременно
showMore.value = safetyData.value.reduce((acc, value) => {
acc[value.id] = false
return acc
}, {});
// showMore.value = safetyData.value.reduce((acc, value) => {
// acc[value.id] = false
// return acc
// }, {});
const downloadItem = (url, fileName) => {
axiosApiInstance.get(url, {responseType: 'blob'})