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
+644 -302

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 }">
+210 -188
View File
@@ -1,221 +1,243 @@
<template> <template>
<v-row no-gutters class="flex-column"> <pattern-tabs :tabs="tabs_items">
<v-card> <template v-slot:item>
<v-tabs v-model="tab" bg-color="teal-darken-1" slider-color="teal-lighten-3" selected-class="active-tab" <v-window-item class="gap h-100" value="mainInfo">
:grow="true"> <general-information />
<v-tab v-for="tabitem in tabs_items" :value="tabitem.value">{{ tabitem.title }}</v-tab> </v-window-item>
</v-tabs> <v-window-item class="gap h-100" value="structureInspection">
</v-card> <structure-inspection />
<v-col> </v-window-item>
<v-window v-model="tab"> <v-window-item class="gap h-100" value="openVacancies">
<v-window-item class="gap h-100" value="mainInfo"> <h1>Открытые вакансии</h1>
<v-row class="ma-1"> </v-window-item>
<v-row no-gutters> <v-window-item class="gap h-100" value="contactInfo">
<v-col class="d-flex flex-column gap"> <contact-info />
<v-card> </v-window-item>
<v-card-text class="text-h6 text-center"> </template>
<p> </pattern-tabs>
Межрегиональная инспекция Федеральной налоговой службы по централизованной <!-- -->
обработке <!-- <v-row no-gutters class="flex-column h-100 gap">
данных №2 <v-col class="w100 bg-green flex-grow-0">
</p>
<p>
создана 01.02.2018 года в соответствии с приказом ФНС России от 27.12.2017
№ММВ-7-4/1102
</p>
</v-card-text>
<v-card-text class="text-h6 text-center">
<a class=" text-decoration-none" :href="caCuratorLink">Работа МИ ФНС
России
по ЦОД №2
координируется заместителем
руководителя ФНС
России
Будариным Андреем Владимировичем</a>
</v-card-text>
</v-card>
</v-col>
</v-row>
<v-row>
<v-col lg="3" class="d-flex flex-column gap">
<v-card>
<v-card-title class="text-h6 text-uppercase text-center"> Начальник
инспекции</v-card-title>
<v-divider></v-divider>
<div class="w-100 d-flex justify-center">
<v-avatar rounded="0" size="200">
<v-img :src="checkremote(`${spravURL}${userlinks.login}.jpg`)"></v-img>
</v-avatar>
</div>
<v-card-title class="text-h6 text-center">{{ userlinks.fio }}</v-card-title>
<v-card-text class="text-center">
<p>{{ bossRank }}</p>
</v-card-text>
</v-card>
<v-card>
<v-card-title class="text-h6 text-center text-uppercase">
Штатная численность
</v-card-title>
<v-card-text class="text-h2 text-center ma-7">
<vue3-autocounter ref='counter' :startAmount='0' :endAmount='getstatesize.statesize'
:duration='2' />
</v-card-text>
<v-card-subtitle class="text-center">по состоянию на <v-card>
{{ new Date(getstatesize.date_created).toLocaleDateString("ru-RU") }} <v-tabs
</v-card-subtitle> v-model="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-card>
</v-col>
<v-col>
<v-window v-model="tab" class="h-100">
<v-window-item class="gap h-100" value="mainInfo">
<v-row>
<v-col class="bg-red">
1
</v-col>
</v-row> -->
<!-- <v-row class="ma-1">
<v-row no-gutters>
<v-col class="d-flex flex-column gap">
<v-card>
<v-card-text class="text-h6 text-center">
<p>
Межрегиональная инспекция Федеральной налоговой службы по
централизованной обработке данных №2
</p>
<p>
создана 01.02.2018 года в соответствии с приказом ФНС
России от 27.12.2017 №ММВ-7-4/1102
</p>
</v-card-text>
<v-divider></v-divider> <v-card-text class="text-h6 text-center">
<a class="text-decoration-none" :href="caCuratorLink"
>Работа МИ ФНС России по ЦОД №2 координируется
заместителем руководителя ФНС России Будариным Андреем
Владимировичем</a
>
</v-card-text>
</v-card>
</v-col>
</v-row>
<v-row>
<v-col lg="3" class="d-flex flex-column gap">
<v-card>
<v-card-title class="text-h6 text-uppercase text-center">
Начальник инспекции</v-card-title
>
<v-divider></v-divider>
<div class="w-100 d-flex justify-center">
<v-avatar rounded="0" size="200">
<v-img
:src="checkremote(`${spravURL}${userlinks.login}.jpg`)"
></v-img>
</v-avatar>
</div>
<v-card-title class="text-h6 text-center">{{
userlinks.fio
}}</v-card-title>
<v-card-text class="text-center">
<p>{{ bossRank }}</p>
</v-card-text>
</v-card>
<v-card>
<v-card-title class="text-h6 text-center text-uppercase">
Штатная численность
</v-card-title>
<v-card-text class="text-h2 text-center ma-7">
<vue3-autocounter
ref="counter"
:startAmount="0"
:endAmount="getstatesize.statesize"
:duration="2"
/>
</v-card-text>
<v-card-title class="text-h6 text-center text-uppercase"> <v-card-subtitle class="text-center"
Фактическая численность >по состоянию на
</v-card-title> {{
new Date(getstatesize.date_created).toLocaleDateString(
"ru-RU"
)
}}
</v-card-subtitle>
<v-card-text class="text-h2 text-center ma-8"> <v-divider></v-divider>
<vue3-autocounter ref='counter' :startAmount='0' :endAmount='getfactsize.factsize'
:duration='2' />
</v-card-text>
<v-card-subtitle class="text-center">по состоянию на <v-card-title class="text-h6 text-center text-uppercase">
{{ new Date(getfactsize.date_created).toLocaleDateString("ru-RU") }} Фактическая численность
</v-card-subtitle> </v-card-title>
</v-card>
</v-col>
<v-col lg="9"> <v-card-text class="text-h2 text-center ma-8">
<v-card> <vue3-autocounter
<v-card-title class=" text-h6 text-uppercase text-center"> ref="counter"
Основные направления деятельности инспекции :startAmount="0"
</v-card-title> :endAmount="getfactsize.factsize"
<v-divider></v-divider> :duration="2"
<v-row no-gutters class="d-flex justify-center"> />
<v-col v-for="direction in directionworks" :key="direction.id" lg="12"> </v-card-text>
<v-card class="ma-3 d-flex" :elevation="3" :height="104">
<v-col class="d-flex align-center justify-center"> <v-card-subtitle class="text-center"
<v-avatar class="elevation-10 text-teal-darken-4" >по состоянию на
color="teal-lighten-5"> {{
<v-icon :icon="direction.icon_name"></v-icon> new Date(getfactsize.date_created).toLocaleDateString(
</v-avatar> "ru-RU"
</v-col> )
<v-col lg="11" class="d-flex align-center justify-start text-h6"> }}
{{ direction.direction_title }} </v-card-subtitle>
</v-col> </v-card>
</v-card> </v-col>
</v-col>
</v-row> <v-col lg="9">
</v-card> <v-card>
</v-col> <v-card-title class="text-h6 text-uppercase text-center">
</v-row> Основные направления деятельности инспекции
</v-row> </v-card-title>
</v-window-item> <v-divider></v-divider>
<v-window-item class="gap h-100" value="structureInspection"> <v-row no-gutters class="d-flex justify-center">
<structure-inspection /> <v-col
</v-window-item> v-for="direction in directionworks"
<v-window-item class="gap h-100" value="openVacancies"> :key="direction.id"
<h1>Открытые вакансии</h1> lg="12"
</v-window-item> >
<v-window-item class="gap h-100" value="contactInfo"> <v-card class="ma-3 d-flex" :elevation="3" :height="104">
<contact-info /> <v-col class="d-flex align-center justify-center">
</v-window-item> <v-avatar
</v-window> class="elevation-10 text-teal-darken-4"
</v-col> color="teal-lighten-5"
</v-row> >
<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-row> -->
<!-- </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>
</v-window>
</v-col>
</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() return {
infouser()
pagecounter()
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 {
color: inherit; color: inherit;
} }
</style> </style>
+168 -112
View File
@@ -1,84 +1,140 @@
<template> <template>
<v-row no-gutters class="flex-column h-100 gap pa-1"> <v-row no-gutters class="flex-column h-100 gap pa-1">
<v-col lg="1" class="w100 h-100"> <v-col lg="1" class="w100 h-100">
<v-card> <v-card>
<v-tabs <v-tabs
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-tabs> >
</v-card> <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>
<v-col class="w100 h-100"> <v-col class="w100 h-100">
<v-window v-model="tab" class="h-100"> <v-window v-model="tab" class="h-100">
<v-window-item no-gutters class="gap h-100" value="mainInfo"> <v-window-item no-gutters class="gap h-100" value="mainInfo">
<MainInfoSafety></MainInfoSafety> <MainInfoSafety></MainInfoSafety>
</v-window-item> </v-window-item>
<v-window-item value="document" class="h-100"> <v-window-item value="document" class="h-100">
<v-row no-gutters class="gap h-100 "> <v-row no-gutters class="gap h-100">
<v-col lg="6"> <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-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-card-title>{{ item.name }}</v-card-title> v-for="item in safetyData"
<v-container :key="item.id"
v-for="category in item.categories" class="overflow-y-auto flex-grow-1 flex-shrink-1 h-100"
:key="item.id + category.id" >
:fluid="true" <v-card-title>{{ item.name }}</v-card-title>
class="py-0"> <v-container
<v-card-actions v-if="category.id != 'evacuation_plan'"> v-for="category in item.categories"
<v-btn :key="item.id + category.id"
@click="showMore[item.id + category.id] = !showMore[item.id + category.id]" :fluid="true"
variant="text"> class="py-0"
{{ category.name }} >
</v-btn> <v-card-actions v-if="category.id != 'evacuation_plan'">
<v-btn <v-btn
:icon="showMore[item.id + category.id] ? 'mdi-chevron-up' : 'mdi-chevron-down'" @click="
@click="showMore[item.id + category.id] = !showMore[item.id + category.id]"> showMore[item.id + category.id] =
</v-btn> !showMore[item.id + category.id]
</v-card-actions> "
<v-expand-transition> variant="text"
<div v-show="showMore[item.id + category.id]"> >
<v-card-actions v-for="file in category.files" :key="file.id" class="overflow-y-auto"> {{ category.name }}
<v-card-text </v-btn>
class="cursor-pointer" <v-btn
:ref_="openPDF(burl + file.url)" :icon="
@click="openPDF(burl + file.url), loading=true"> showMore[item.id + category.id]
{{ file.name }} ? 'mdi-chevron-up'
</v-card-text> : 'mdi-chevron-down'
<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> @click="
</v-card-actions> showMore[item.id + category.id] =
</div> !showMore[item.id + category.id]
</v-expand-transition> "
</v-container> >
</v-card> </v-btn>
</v-row> </v-card-actions>
<v-row class="ma-0 overflow-auto h-0"> <v-expand-transition>
<v-card class="overflow-y-auto flex-grow-1 flex-shrink-1 h-100"> <div v-show="showMore[item.id + category.id]">
<v-card-title>{{ responsibilityData.name }}</v-card-title> <v-card-actions
<v-container v-for="file in category.files"
v-for="file in responsibilityData.files" :key="file.id"
:fluid="true" class="overflow-y-auto"
class="py-0"> >
<v-card-actions :key="file.id"> <v-card-text
<v-card-text>{{ file.file_name.replace(/\.[^/.]+$/, "") }}</v-card-text> class="cursor-pointer"
<v-btn icon="mdi-file-pdf-box" color="red" @click="openPDF(burl + file.url), loading=true"></v-btn> :ref_="openPDF(burl + file.url)"
<v-btn icon='mdi-file-download-outline' color="green" @click="downloadItem(burl + file.file_name, file.file_name)"></v-btn> @click="
<!-- @click="downloadItem(burl + file.file_name, file.file_name)" --> openPDF(burl + file.url), (loading = true)
</v-card-actions> "
</v-container> >
</v-card> {{ file.name }}
</v-row> </v-card-text>
</v-card> <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-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">
@@ -99,27 +155,26 @@
</v-card-actions> </v-card-actions>
</v-card> --> </v-card> -->
</v-col> </v-col>
</v-row> </v-row>
</v-window-item>
<v-window-item value="testings" no-gutters class="gap h-100 ">
<TestSafety></TestSafety>
</v-window-item> </v-window-item>
</v-window> <v-window-item value="testings" no-gutters class="gap h-100">
<TestSafety></TestSafety>
</v-window-item>
</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,27 +211,26 @@ 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>
.isActiveTab { .isActiveTab {
background-color: #68c3ff70; background-color: #68c3ff70;
} }
</style> </style>