P-13 Переверстка

This commit is contained in:
iriska-gri committed 2024-05-07 17:01:24 +03:00
1 parent b10128405a
commit 8690522018
6 files changed
+493 -151

No files matched your search

@@ -0,0 +1,51 @@
<template>
<v-row no-gutters class="flex-column gap pa-1">
<v-col class="bg-green flex-grow-0">
<v-card>
<v-tabs
v-model="tab"
bg-color="teal-darken-1"
slider-color="teal-lighten-3"
selected-class="active-tab"
:grow="true"
>
<v-tab
v-for="(tabitem, key) in tabs"
:value="tabitem.value"
:key="key"
>
{{ tabitem.title }}
</v-tab>
</v-tabs>
</v-card>
</v-col>
<v-col class="flex-column">
<v-window v-model="tab" class="h-100">
<slot name="item" />
</v-window>
</v-col>
</v-row>
</template>
<script>
import { ref } from "vue";
export default {
props: {
tabs: {
type: Object,
default: () => {},
},
},
setup() {
return {
tab: ref(null),
};
},
};
</script>
<style></style>
@@ -1,5 +1,5 @@
<template> <template>
<v-row class="ma-1"> <!-- <v-row class="ma-1">
<v-col lg="6" class="d-flex justify-center align-start"> <v-col lg="6" class="d-flex justify-center align-start">
<v-card :elevation="5"> <v-card :elevation="5">
<div style="width:915px;height:832px; "> <div style="width:915px;height:832px; ">
@@ -69,6 +69,11 @@
</v-col> </v-col>
</v-row> -->
<v-row>
<v-col class="bg-red">
1
</v-col>
</v-row> </v-row>
</template> </template>
<script> <script>
@@ -0,0 +1,208 @@
<template>
<v-row no-gutters class="flex-column h-100 gap">
<v-col>
<v-row no-gutters class="flex-column h-100 gap">
<v-col class="w100 flex-grow-0">
<v-card class="text-center">
<v-card-text class="font-weight-medium text-lg-h6">
Межрегиональная инспекция Федеральной налоговой службы по
централизованной обработке данных №2
<p class="font-weight-medium text-lg-subtitle-1 text-sm-caption">
создана 01.02.2018 года в соответствии с приказом ФНС России от
27.12.2017 №ММВ-7-4/1102
</p>
<p class="mt-3">
<a class="text-decoration-none" :href="caCuratorLink"
>Работа МИ ФНС России по ЦОД №2 координируется заместителем
руководителя ФНС России Будариным Андреем Владимировичем</a
>
</p>
</v-card-text>
</v-card>
</v-col>
<v-col class="d-flex">
<v-row no-gutters class="gap">
<v-col lg="3" class="flex-column">
<v-row no-gutters class="gap flex-column h-100">
<v-col class="w100 ">
<v-card class="h-100">
<v-card-title class="text-h6 text-uppercase text-center">
Начальник инспекции</v-card-title
>
<v-divider class="mb-3" />
<v-img
:src="checkremote(`${spravURL}${userlinks.login}.jpg`)"
height="200"
/>
<v-card-title class="text-h6 text-center">{{
userlinks.fio
}}</v-card-title>
<v-card-text class="text-center text-body-2">
<p>
Государственный советник Российской Федерации 2 класса
</p>
</v-card-text>
</v-card>
</v-col>
<v-col class="w100 flex-column d-flex">
<v-card class="flex-grow-1">
<v-card-title class="text-h6 text-center text-uppercase">
Штатная численность
</v-card-title>
<v-card-text class="text-h2 text-center">
<vue3-autocounter
ref="counter"
:startAmount="0"
:endAmount="getstatesize.statesize"
:duration="2"
/>
</v-card-text>
<v-card-subtitle class="text-center"
>по состоянию на
{{
new Date(getstatesize.date_created).toLocaleDateString(
"ru-RU"
)
}}
</v-card-subtitle>
</v-card>
<!-- <v-divider></v-divider> -->
<v-card class="flex-grow-1 mt-1">
<v-card-title class="text-h6 text-center text-uppercase">
Фактическая численность
</v-card-title>
<v-card-text class="text-h2 text-center">
<vue3-autocounter
ref="counter"
:startAmount="0"
:endAmount="getfactsize.factsize"
:duration="2"
/>
</v-card-text>
<v-card-subtitle class="text-center"
>по состоянию на
{{
new Date(getfactsize.date_created).toLocaleDateString(
"ru-RU"
)
}}
</v-card-subtitle>
</v-card>
</v-col>
</v-row>
</v-col>
<v-col class="bg-yellow">
<v-card class="h-100 flex-column d-flex">
<v-card-title class="text-h6 text-uppercase text-center ">
Основные направления деятельности инспекции
</v-card-title>
<v-divider class="pb-3"/>
<v-row no-gutters class=" gap justify-center ">
<!-- v-for="direction in directionworks" -->
<v-col
v-for="direction in 10"
:key="direction.id"
lg="12"
class="px-3"
>
<v-card class="d-flex" :elevation="3">
<v-col class="d-flex align-center justify-center">
<v-avatar
class="elevation-10 text-teal-darken-4"
color="teal-lighten-5"
>
<v-icon :icon="direction.icon_name"></v-icon>
</v-avatar>
</v-col>
<v-col
lg="11"
class="d-flex align-center justify-start text-h6"
>
{{ direction.direction_title }}
</v-col>
</v-card>
</v-col>
</v-row>
</v-card>
</v-col>
</v-row>
</v-col>
</v-row></v-col
>
</v-row>
</template>
<script>
import { ref } from "vue";
import { axiosApiInstance } from "@/utils/axios-api";
import { checkremote } from "@/utils/universal_functions";
import { spravURL, baseURL } from "@/utils/axios-api";
export default {
setup() {
const userlinks = ref([]);
const getfactsize = ref({ factsize: 0, date_created: new Date() });
const getstatesize = ref({ statesize: 0, date_created: new Date() });
const directionworks = ref([]);
const infouser = () => {
axiosApiInstance
.get("api/accounts/getuser/?userlogin=9966-00-001")
.then((res) => {
userlinks.value = res.data;
});
};
const getFactSize = () => {
axiosApiInstance.get("api/about_inspection/getfactsize/").then((res) => {
getfactsize.value = res.data;
});
};
const getStateSize = () => {
axiosApiInstance.get("api/about_inspection/getstatesize/").then((res) => {
getstatesize.value = res.data;
});
};
const getInspectionDirections = () => {
axiosApiInstance
.get("api/about_inspection/getinspectiondirections/")
.then((res) => {
directionworks.value = res.data;
console.log(directionworks.value);
});
};
getInspectionDirections();
getStateSize();
getFactSize();
infouser();
return {
userlinks,
checkremote,
directionworks,
getstatesize,
getfactsize,
spravURL,
baseURL,
date_now: new Date().toLocaleDateString("ru-RU"),
caCuratorLink: ref(
"https://www.nalog.gov.ru/rn77/about_fts/fts/structure_fts/ca_fns/9515034/"
),
};
},
};
</script>
<style></style>
@@ -84,7 +84,7 @@
</template> </template>
<span> Сменить тему</span> <span> Сменить тему</span>
</v-tooltip> </v-tooltip>
<v-card class="text-lg-h6 text-md-h3 text-sm-caption text-red-lighten-2" width="50">1</v-card>
<v-tooltip location="bottom"> <v-tooltip location="bottom">
<template v-slot:activator="{ props }"> <template v-slot:activator="{ props }">
+125 -103
View File
@@ -1,38 +1,71 @@
<template> <template>
<v-row no-gutters class="flex-column"> <pattern-tabs :tabs="tabs_items">
<template v-slot:item>
<v-window-item class="gap h-100" value="mainInfo">
<general-information />
</v-window-item>
<v-window-item class="gap h-100" value="structureInspection">
<structure-inspection />
</v-window-item>
<v-window-item class="gap h-100" value="openVacancies">
<h1>Открытые вакансии</h1>
</v-window-item>
<v-window-item class="gap h-100" value="contactInfo">
<contact-info />
</v-window-item>
</template>
</pattern-tabs>
<!-- -->
<!-- <v-row no-gutters class="flex-column h-100 gap">
<v-col class="w100 bg-green flex-grow-0">
<v-card> <v-card>
<v-tabs v-model="tab" bg-color="teal-darken-1" slider-color="teal-lighten-3" selected-class="active-tab" <v-tabs
:grow="true"> v-model="tab"
<v-tab v-for="tabitem in tabs_items" :value="tabitem.value">{{ tabitem.title }}</v-tab> bg-color="teal-darken-1"
slider-color="teal-lighten-3"
selected-class="active-tab"
:grow="true"
>
<v-tab
v-for="tabitem in tabs_items"
:value="tabitem.value"
>
{{tabitem.title}}
</v-tab>
</v-tabs> </v-tabs>
</v-card> </v-card>
</v-col>
<v-col> <v-col>
<v-window v-model="tab"> <v-window v-model="tab" class="h-100">
<v-window-item class="gap h-100" value="mainInfo"> <v-window-item class="gap h-100" value="mainInfo">
<v-row class="ma-1"> <v-row>
<v-col class="bg-red">
1
</v-col>
</v-row> -->
<!-- <v-row class="ma-1">
<v-row no-gutters> <v-row no-gutters>
<v-col class="d-flex flex-column gap"> <v-col class="d-flex flex-column gap">
<v-card> <v-card>
<v-card-text class="text-h6 text-center"> <v-card-text class="text-h6 text-center">
<p> <p>
Межрегиональная инспекция Федеральной налоговой службы по централизованной Межрегиональная инспекция Федеральной налоговой службы по
обработке централизованной обработке данных №2
данных №2
</p> </p>
<p> <p>
создана 01.02.2018 года в соответствии с приказом ФНС России от 27.12.2017 создана 01.02.2018 года в соответствии с приказом ФНС
№ММВ-7-4/1102 России от 27.12.2017 №ММВ-7-4/1102
</p> </p>
</v-card-text> </v-card-text>
<v-card-text class="text-h6 text-center"> <v-card-text class="text-h6 text-center">
<a class=" text-decoration-none" :href="caCuratorLink">Работа МИ ФНС <a class="text-decoration-none" :href="caCuratorLink"
России >Работа МИ ФНС России по ЦОД №2 координируется
по ЦОД №2 заместителем руководителя ФНС России Будариным Андреем
координируется заместителем Владимировичем</a
руководителя ФНС >
России
Будариным Андреем Владимировичем</a>
</v-card-text> </v-card-text>
</v-card> </v-card>
</v-col> </v-col>
@@ -40,15 +73,20 @@
<v-row> <v-row>
<v-col lg="3" class="d-flex flex-column gap"> <v-col lg="3" class="d-flex flex-column gap">
<v-card> <v-card>
<v-card-title class="text-h6 text-uppercase text-center"> Начальник <v-card-title class="text-h6 text-uppercase text-center">
инспекции</v-card-title> Начальник инспекции</v-card-title
>
<v-divider></v-divider> <v-divider></v-divider>
<div class="w-100 d-flex justify-center"> <div class="w-100 d-flex justify-center">
<v-avatar rounded="0" size="200"> <v-avatar rounded="0" size="200">
<v-img :src="checkremote(`${spravURL}${userlinks.login}.jpg`)"></v-img> <v-img
:src="checkremote(`${spravURL}${userlinks.login}.jpg`)"
></v-img>
</v-avatar> </v-avatar>
</div> </div>
<v-card-title class="text-h6 text-center">{{ userlinks.fio }}</v-card-title> <v-card-title class="text-h6 text-center">{{
userlinks.fio
}}</v-card-title>
<v-card-text class="text-center"> <v-card-text class="text-center">
<p>{{ bossRank }}</p> <p>{{ bossRank }}</p>
</v-card-text> </v-card-text>
@@ -58,12 +96,21 @@
Штатная численность Штатная численность
</v-card-title> </v-card-title>
<v-card-text class="text-h2 text-center ma-7"> <v-card-text class="text-h2 text-center ma-7">
<vue3-autocounter ref='counter' :startAmount='0' :endAmount='getstatesize.statesize' <vue3-autocounter
:duration='2' /> ref="counter"
:startAmount="0"
:endAmount="getstatesize.statesize"
:duration="2"
/>
</v-card-text> </v-card-text>
<v-card-subtitle class="text-center">по состоянию на <v-card-subtitle class="text-center"
{{ new Date(getstatesize.date_created).toLocaleDateString("ru-RU") }} >по состоянию на
{{
new Date(getstatesize.date_created).toLocaleDateString(
"ru-RU"
)
}}
</v-card-subtitle> </v-card-subtitle>
<v-divider></v-divider> <v-divider></v-divider>
@@ -73,12 +120,21 @@
</v-card-title> </v-card-title>
<v-card-text class="text-h2 text-center ma-8"> <v-card-text class="text-h2 text-center ma-8">
<vue3-autocounter ref='counter' :startAmount='0' :endAmount='getfactsize.factsize' <vue3-autocounter
:duration='2' /> ref="counter"
:startAmount="0"
:endAmount="getfactsize.factsize"
:duration="2"
/>
</v-card-text> </v-card-text>
<v-card-subtitle class="text-center">по состоянию на <v-card-subtitle class="text-center"
{{ new Date(getfactsize.date_created).toLocaleDateString("ru-RU") }} >по состоянию на
{{
new Date(getfactsize.date_created).toLocaleDateString(
"ru-RU"
)
}}
</v-card-subtitle> </v-card-subtitle>
</v-card> </v-card>
</v-col> </v-col>
@@ -90,15 +146,24 @@
</v-card-title> </v-card-title>
<v-divider></v-divider> <v-divider></v-divider>
<v-row no-gutters class="d-flex justify-center"> <v-row no-gutters class="d-flex justify-center">
<v-col v-for="direction in directionworks" :key="direction.id" lg="12"> <v-col
v-for="direction in directionworks"
:key="direction.id"
lg="12"
>
<v-card class="ma-3 d-flex" :elevation="3" :height="104"> <v-card class="ma-3 d-flex" :elevation="3" :height="104">
<v-col class="d-flex align-center justify-center"> <v-col class="d-flex align-center justify-center">
<v-avatar class="elevation-10 text-teal-darken-4" <v-avatar
color="teal-lighten-5"> class="elevation-10 text-teal-darken-4"
color="teal-lighten-5"
>
<v-icon :icon="direction.icon_name"></v-icon> <v-icon :icon="direction.icon_name"></v-icon>
</v-avatar> </v-avatar>
</v-col> </v-col>
<v-col lg="11" class="d-flex align-center justify-start text-h6"> <v-col
lg="11"
class="d-flex align-center justify-start text-h6"
>
{{ direction.direction_title }} {{ direction.direction_title }}
</v-col> </v-col>
</v-card> </v-card>
@@ -107,8 +172,8 @@
</v-card> </v-card>
</v-col> </v-col>
</v-row> </v-row>
</v-row> </v-row> -->
</v-window-item> <!-- </v-window-item>
<v-window-item class="gap h-100" value="structureInspection"> <v-window-item class="gap h-100" value="structureInspection">
<structure-inspection /> <structure-inspection />
</v-window-item> </v-window-item>
@@ -120,99 +185,56 @@
</v-window-item> </v-window-item>
</v-window> </v-window>
</v-col> </v-col>
</v-row> </v-row> -->
</template> </template>
<script> <script>
import { ref } from 'vue' import { ref } from "vue";
import { axiosApiInstance } from '@/utils/axios-api' import { axiosApiInstance } from "@/utils/axios-api";
import { checkremote } from '@/utils/universal_functions'
import { spravURL, baseURL } from '@/utils/axios-api'
import StructureInspection from '@/components/about_inspection/structure/StructureInspection.vue';
import ContactInfo from '@/components/about_inspection/contacts/ContactInfo.vue';
import { pagecounter } from '@/utils/universal_functions'
import { spravURL, baseURL } from "@/utils/axios-api";
import StructureInspection from "@/components/about_inspection/structure/StructureInspection.vue";
import ContactInfo from "@/components/about_inspection/contacts/ContactInfo.vue";
import { pagecounter } from "@/utils/universal_functions";
import PatternTabs from "@/components/UI/PatternTabs.vue";
import GeneralInformation from '@/components/about_inspection/пeneral_information/GeneralInformation.vue';
export default { export default {
components: { components: {
StructureInspection, StructureInspection,
ContactInfo, ContactInfo,
PatternTabs,
GeneralInformation,
}, },
setup() { setup() {
const userlinks = ref([])
const getfactsize = ref({ 'factsize': 0, 'date_created': new Date() })
const getstatesize = ref({ 'statesize': 0, 'date_created': new Date() })
const directionworks = ref([])
const caCuratorLink = ref('https://www.nalog.gov.ru/rn77/about_fts/fts/structure_fts/ca_fns/9515034/')
const infouser = () => {
axiosApiInstance.get('api/accounts/getuser/?userlogin=9966-00-001').then(res => {
userlinks.value = res.data
})
}
const getFactSize = () => {
axiosApiInstance.get('api/about_inspection/getfactsize/').then(res => {
getfactsize.value = res.data
})
}
const getStateSize = () => {
axiosApiInstance.get('api/about_inspection/getstatesize/').then(res => {
getstatesize.value = res.data
})
}
const getInspectionDirections = () => {
axiosApiInstance.get('api/about_inspection/getinspectiondirections/').then(res => {
directionworks.value = res.data
console.log(directionworks.value)
})
}
getInspectionDirections()
getStateSize() pagecounter();
getFactSize()
infouser()
pagecounter()
return { return {
caCuratorLink,
directionworks,
getstatesize,
getfactsize,
spravURL,
baseURL,
checkremote,
caCuratorLink,
userlinks,
tab: ref(null),
date_now: new Date().toLocaleDateString("ru-RU"),
bossRank: "Государственный советник Российской Федерации 2 класса",
tabs_items: [{ "title": "Общая информация", "value": "mainInfo" },
{ "title": "Структура инспекции", "value": "structureInspection" },
{ "title": "Открытые вакансии", "value": "openVacancies" },
{ "title": "Контактная информация", "value": "contactInfo" }],
}
}
}
tabs_items: [
{ title: "Общая информация", value: "mainInfo" },
{ title: "Структура инспекции", value: "structureInspection" },
{ title: "Открытые вакансии", value: "openVacancies" },
{ title: "Контактная информация", value: "contactInfo" },
],
};
},
};
</script> </script>
<style> <style>
.active-tab { .active-tab {
background-color: #E0F2F1; background-color: #e0f2f1;
color: #004D40; color: #004d40;
} }
a { a {
+102 -46
View File
@@ -6,10 +6,17 @@
v-model="tab" v-model="tab"
bg-color="teal-darken-1" bg-color="teal-darken-1"
slider-color="teal-darken-2" slider-color="teal-darken-2"
:grow="true"> :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="mainInfo"
<v-tab selected-class="isActiveTab" value="testings">Тестирование</v-tab> >Основная информация</v-tab
>
<v-tab selected-class="isActiveTab" value="document"
>Документация</v-tab
>
<v-tab selected-class="isActiveTab" value="testings"
>Тестирование</v-tab
>
</v-tabs> </v-tabs>
</v-card> </v-card>
</v-col> </v-col>
@@ -24,35 +31,69 @@
<!----> <!---->
<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-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
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-card-title>{{ item.name }}</v-card-title>
<v-container <v-container
v-for="category in item.categories" v-for="category in item.categories"
:key="item.id + category.id" :key="item.id + category.id"
:fluid="true" :fluid="true"
class="py-0"> class="py-0"
>
<v-card-actions v-if="category.id != 'evacuation_plan'"> <v-card-actions v-if="category.id != 'evacuation_plan'">
<v-btn <v-btn
@click="showMore[item.id + category.id] = !showMore[item.id + category.id]" @click="
variant="text"> showMore[item.id + category.id] =
!showMore[item.id + category.id]
"
variant="text"
>
{{ category.name }} {{ category.name }}
</v-btn> </v-btn>
<v-btn <v-btn
:icon="showMore[item.id + category.id] ? 'mdi-chevron-up' : 'mdi-chevron-down'" :icon="
@click="showMore[item.id + category.id] = !showMore[item.id + category.id]"> 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-btn>
</v-card-actions> </v-card-actions>
<v-expand-transition> <v-expand-transition>
<div v-show="showMore[item.id + category.id]"> <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-actions
v-for="file in category.files"
:key="file.id"
class="overflow-y-auto"
>
<v-card-text <v-card-text
class="cursor-pointer" class="cursor-pointer"
:ref_="openPDF(burl + file.url)" :ref_="openPDF(burl + file.url)"
@click="openPDF(burl + file.url), loading=true"> @click="
openPDF(burl + file.url), (loading = true)
"
>
{{ file.name }} {{ file.name }}
</v-card-text> </v-card-text>
<v-btn icon="mdi-file-pdf-box" color="red" @click="openPDF(burl + file.url), loading=true"></v-btn> <v-btn
<v-btn icon='mdi-file-download-outline' color="green" @click="downloadItem(burl + file.url, file.name)"></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> </v-card-actions>
</div> </div>
</v-expand-transition> </v-expand-transition>
@@ -60,16 +101,31 @@
</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 class="overflow-y-auto flex-grow-1 flex-shrink-1 h-100"> <v-card
class="overflow-y-auto flex-grow-1 flex-shrink-1 h-100"
>
<v-card-title>{{ responsibilityData.name }}</v-card-title> <v-card-title>{{ responsibilityData.name }}</v-card-title>
<v-container <v-container
v-for="file in responsibilityData.files" v-for="file in responsibilityData.files"
:fluid="true" :fluid="true"
class="py-0"> class="py-0"
>
<v-card-actions :key="file.id"> <v-card-actions :key="file.id">
<v-card-text>{{ file.file_name.replace(/\.[^/.]+$/, "") }}</v-card-text> <v-card-text>{{
<v-btn icon="mdi-file-pdf-box" color="red" @click="openPDF(burl + file.url), loading=true"></v-btn> file.file_name.replace(/\.[^/.]+$/, "")
<v-btn icon='mdi-file-download-outline' color="green" @click="downloadItem(burl + file.file_name, file.file_name)"></v-btn> }}</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)" --> <!-- @click="downloadItem(burl + file.file_name, file.file_name)" -->
</v-card-actions> </v-card-actions>
</v-container> </v-container>
@@ -107,19 +163,18 @@
</v-window> </v-window>
</v-col> </v-col>
</v-row> </v-row>
</template> </template>
<script setup> <script setup>
import { ref, onBeforeMount, onUpdated } from 'vue'; import { ref, onBeforeMount, onUpdated } from "vue";
import { pagecounter } from '@/utils/universal_functions'; import { pagecounter } from "@/utils/universal_functions";
import { axiosApiInstance, baseURL } from '@/utils/axios-api'; import { axiosApiInstance, baseURL } from "@/utils/axios-api";
import { saveAs } from 'file-saver'; import { saveAs } from "file-saver";
import { useRoute } from 'vue-router' import { useRoute } from "vue-router";
import VuePdfEmbed from 'vue-pdf-embed'; import VuePdfEmbed from "vue-pdf-embed";
import TestSafety from './TestSafety.vue'; import TestSafety from "./TestSafety.vue";
import MainInfoSafety from './MainInfoSafety.vue'; import MainInfoSafety from "./MainInfoSafety.vue";
pagecounter(); pagecounter();
@@ -127,26 +182,28 @@ const safetyData = ref([]);
const responsibilityData = 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() {
axiosApiInstance.get(`api/safety/files/?chapter_id=${route.params.chapter_id}`).then(result => { axiosApiInstance
safetyData.value = result.data .get(`api/safety/files/?chapter_id=${route.params.chapter_id}`)
}) .then((result) => {
safetyData.value = result.data;
});
} }
function getResponsibility() { function getResponsibility() {
axiosApiInstance.get(`api/safety/committee_files/`).then(result => { axiosApiInstance.get(`api/safety/committee_files/`).then((result) => {
responsibilityData.value = result.data responsibilityData.value = result.data;
}) });
} }
getResponsibility() getResponsibility();
onBeforeMount(() => getSafety()); onBeforeMount(() => getSafety());
// Хук обновления реализует возможность динамической подгрузки данных при переключении между вкладками раздела безопасность // Хук обновления реализует возможность динамической подгрузки данных при переключении между вкладками раздела безопасность
@@ -154,23 +211,22 @@ onUpdated(() => getSafety());
// Проверяем по 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>