Merge branch 'develop' into 38_calendar_back

This commit is contained in:
iriska-gri committed 2024-05-23 08:18:21 +03:00
commit bf3766e6d5
31 files changed
+1400 -586

No files matched your search

+2 -2
View File
@@ -1,6 +1,6 @@
<template>
<v-row no-gutters class="flex-column gap pa-1">
<v-col class="bg-green flex-grow-0">
<v-col class="v-col-auto">
<v-card>
<v-tabs
v-model="tab"
@@ -21,7 +21,7 @@
</v-card>
</v-col>
<v-col class="flex-column">
<v-col class="">
<v-window v-model="tab" class="h-100">
<slot name="item" />
</v-window>
@@ -44,19 +44,21 @@
<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">
<general-information-size
:size="getstatesize"
:size="getfactsize"
:title="'Фактическая численнность'"
/>
</v-col>
<v-col class="w100 flex-column d-flex">
<general-information-size
:size="getfactsize"
:size="getstatesize"
:title="'Штатная численность'"
/>
</v-col>
@@ -81,7 +83,7 @@
:key="direction.id"
>
<v-card class="d-flex" :elevation="3">
<v-col class="d-flex align-center">
<v-col class="d-flex align-center v-col-auto">
<v-avatar
class="elevation-10 text-teal-darken-4"
color="teal-lighten-5"
@@ -119,7 +119,8 @@
<span class="text-h6"> Базовые требования к соискателю </span>
</v-card-title>
<v-card-text class="mx-5 my-0 ckeditor_ul">
<div class="py-1" v-html="vacancyDescription.functional"></div>
<!-- {{vacancyDescription}} -->
<div class="py-1" v-html="vacancyDescription.requirements"></div>
</v-card-text>
<v-divider />
<response-vacancies id="response" :idVacations=vacancySelect />
@@ -0,0 +1,70 @@
<template>
<div>
<!-- <my-helper :pretext="kl" /> -->
<v-btn @click="useICalReader"> ical</v-btn>
</div>
</template>
<script>
// import {useICalReader} from '@/utils/universal_functions'
import { baseURL, axiosApiInstance } from "@/utils/axios-api";
import { ref } from "vue";
import ical from "ical.js";
const burl = baseURL.slice(0, -1);
export default {
setup() {
const participant = ref("");
const calendar = ref("");
const useICalReader = async () => {
const response = await fetch(`${burl}/media/ical/calendar.ics`);
const data = await response.text();
const jcalData = ical.parse(data);
const icalComponent = new ical.Component(jcalData);
const name = icalComponent.getFirstPropertyValue("x-wr-calname");
const events = icalComponent
.getAllSubcomponents("vevent")
.map((vevent) => new ical.Event(vevent));
const calendarEvents = events.map((event) => {
let attendees = [];
event.attendees.map((att) => {
attendees.push(att.jCal[1].cn);
});
return {
summary: event.summary,
description: event.description,
organizer: event.organizer,
start: event.startDate.toJSDate(),
end: event.endDate.toJSDate(),
location: event.location,
attendees: attendees,
};
});
participant.value = name;
calendar.value = calendarEvents;
f_feedbackdata();
};
function f_feedbackdata() {
axiosApiInstance
.post(`api/calendar_of_events/calendarEvents/`, {
participants: participant.value,
calendar: calendar.value,
})
.then((data) => {
console.log(data, "datas");
});
}
return {
useICalReader,
};
},
};
</script>
<style></style>
@@ -1,105 +1,104 @@
<template>
<div>
<v-btn @click="f_feedbackdata"> ical</v-btn>
<v-file-input
:show-size="1000"
color="deep-purple-accent-4"
label="File input"
placeholder="Select your files"
prepend-icon="mdi-paperclip"
variant="outlined"
counter
multiple
accept=".ics"
@input="handleFilesUpload"
/>
<div>
<my-helper :pretext="events" />
<v-sheet
class="d-flex"
height="54"
tile
>
<v-select
v-model="type"
:items="types"
class="ma-2"
label="View Mode"
variant="outlined"
dense
hide-details
></v-select>
<v-select
v-model="weekday"
:items="weekdays"
class="ma-2"
label="weekdays"
variant="outlined"
dense
hide-details
></v-select>
</v-sheet>
<v-sheet>
<v-calendar
ref="calendar"
v-model="value"
:events="events"
:view-mode="type"
:weekdays="weekday"
></v-calendar>
</v-sheet>
</div>
</template>
<script>
import { axiosApiInstance } from "@/utils/axios-api";
import { ref, computed } from "vue";
import ical from "ical.js";
import { useDate } from 'vuetify'
import myHelper from '../UI/my-helper.vue'
export default {
setup() {
const participant = ref("");
const calendar = ref("");
const calendarEvents = ref([]);
function f_feedbackdata() {
axiosApiInstance
.post(`api/calendar_of_events/calendarEvents/`, {
participants: participant.value,
calendar: calendar.value,
})
.then((data) => {
console.log(data, "datas");
});
}
const handleFilesUpload = (event) => {
const file = event.target.files[0];
if (file) {
readFile(file);
}
};
const readFile = (file) => {
const reader = new FileReader();
reader.readAsText(file);
reader.onload = (event) => {
parseICS(event.target.result);
};
};
const parseICS = (text) => {
const jcalData = ical.parse(text);
const icalComponent = new ical.Component(jcalData);
const name = icalComponent.getFirstPropertyValue("x-wr-calname");
const events = icalComponent
.getAllSubcomponents("vevent")
.map((vevent) => new ical.Event(vevent));
const calendarEvents = events.map((event) => {
let attendees = [];
event.attendees.map((att) => {
attendees.push(att.jCal[1].cn);
});
return {
name: event.summary,
description: event.description,
// organizer: event.organizer, Может, удалить?
startdate: event.startDate.toJSDate(),
enddate: event.endDate.toJSDate(),
place: event.location,
// attendees: attendees, ? Такая же история 0 в базе нет
cdate: new Date(event.component.jCal[1][6][3]),
content: ''
};
});
participant.value = name;
calendar.value = calendarEvents;
};
return {
handleFilesUpload,
calendarEvents,
f_feedbackdata
};
components: { myHelper },
data: () => ({
type: 'month',
types: ['month', 'week', 'day'],
weekday: [0, 1, 2, 3, 4, 5, 6],
weekdays: [
{ title: 'Sun - Sat', value: [0, 1, 2, 3, 4, 5, 6] },
{ title: 'Mon - Sun', value: [1, 2, 3, 4, 5, 6, 0] },
{ title: 'Mon - Fri', value: [1, 2, 3, 4, 5] },
{ title: 'Mon, Wed, Fri', value: [1, 3, 5] },
],
value: [new Date()],
events: [],
colors: ['blue', 'indigo', 'deep-purple', 'cyan', 'green', 'orange', 'grey darken-1'],
titles: ['Meeting', 'Holiday', 'PTO', 'Travel', 'Event', 'Birthday', 'Conference', 'Party'],
}),
mounted () {
const adapter = useDate()
this.getEvents({ start: adapter.startOfDay(adapter.startOfMonth(new Date())), end: adapter.endOfDay(adapter.endOfMonth(new Date())) })
},
};
methods: {
getEvents ({ start, end }) {
const events = []
const min = start
const max = end
const days = (max.getTime() - min.getTime()) / 86400000
const eventCount = this.rnd(days, days + 20)
for (let i = 0; i < eventCount; i++) {
const allDay = this.rnd(0, 3) === 0
const firstTimestamp = this.rnd(min.getTime(), max.getTime())
const first = new Date(firstTimestamp - (firstTimestamp % 900000))
const secondTimestamp = this.rnd(2, allDay ? 288 : 8) * 900000
const second = new Date(first.getTime() + secondTimestamp)
events.push({
title: this.titles[this.rnd(0, this.titles.length - 1)],
start: first,
end: second,
color: this.colors[this.rnd(0, this.colors.length - 1)],
allDay: !allDay,
})
}
this.events = events
},
getEventColor (event) {
return event.color
},
rnd (a, b) {
return Math.floor((b - a + 1) * Math.random()) + a
},
},
}
</script>
<style></style>
<style>
</style>
+13 -11
View File
@@ -1,5 +1,5 @@
<template>
<v-app>
<v-app >
<v-app-bar
:elevation="accountStore.cod2user ? 2 : 0"
density="compact"
@@ -266,6 +266,7 @@
permanent
location="right"
@click="rail = false"
>
<Online-users />
</v-navigation-drawer>
@@ -396,16 +397,16 @@ export default {
// },
],
},
{
name: "Деятельность",
ico: "mdi-bulletin-board",
submenu: [
{
name: "Обеспечивающая",
path: "/providing",
},
],
},
// {
// name: "Деятельность",
// ico: "mdi-bulletin-board",
// submenu: [
// {
// name: "Обеспечивающая",
// path: "/providing",
// },
// ],
// },
{
name: "Новости",
ico: "mdi-newspaper",
@@ -450,6 +451,7 @@ export default {
if (!item.path.startsWith("/")) {
item.path = "/" + item.path;
}
item.path="/safety"+item.path
});
if (response.data.length > 0) {
+4 -1
View File
@@ -1,7 +1,7 @@
import '@mdi/font/css/materialdesignicons.css'
import 'vuetify/styles'
import { VCalendar } from 'vuetify/labs/VCalendar'
import { createVuetify } from 'vuetify'
import { ru } from 'vuetify/locale'
@@ -14,6 +14,9 @@ export default createVuetify({
locale: {
messages: { ru },
},
components: {
VCalendar,
},
theme: {
defaultTheme: 'light'
},
+1 -1
View File
@@ -75,7 +75,7 @@ const routes = [
}
},
{
path: '/:chapter',
path: '/safety/:chapter',
component: () => import('@/views/safety/ChaptersSafety.vue'),
meta: {
title: "Разделы безопасности",
@@ -0,0 +1,230 @@
<template>
<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="safetyData.mainpage_file"
></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">
</v-window-item>
</v-window>
</v-col>
</v-row>
</template>
<script setup>
import { ref, onBeforeMount } 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 VuePdfEmbed from "vue-pdf-embed";
import TestSafety from "./TestSafety.vue";
import MainInfoSafety from "./MainInfoSafety.vue";
pagecounter();
const safetyData = ref({});
const responsibilityData = ref();
const showMore = ref(false);
const showFile = ref(true);
let pdfSource = ref("");
const loading = ref(false);
const tab = ref("");
const burl = baseURL.slice(0, -1);
const route = useRoute();
// Вынес запрос в отдельную функцию, чтобы избежать дублирования одного и того же запроса на сервер.
function getSafety() {
axiosApiInstance
.get(`api/safety/?chapter=${route.params.chapter}`)
.then((result) => {
safetyData.value = result.data;
loading.value = true;
// pdfSource.value = burl + safetyData.value.categories[0].files[0].url
console.log(safetyData.value);
});
}
onBeforeMount(() => getSafety());
const downloadItem = (url, fileName) => {
axiosApiInstance.get(url, { responseType: "blob" }).then((response) => {
saveAs(response.data, fileName);
});
};
function openPDF(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: #e0f2f1;
color: #004d40;
}
</style>
+67 -174
View File
@@ -1,188 +1,81 @@
<template>
<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>
<pattern-tabs :tabs="tabs_items">
<template v-slot:item>
<v-window-item class="gap h-100 " value="mainInfo">
<MainInfoSafety
:formainpage="safetyData.mainpage_file"
:responsibility="safetyData.type_resp"
:commitee="safetyData.type_comm"
></MainInfoSafety>
</v-window-item>
<v-window-item class="gap h-100" value="document">
<documentation-safety :docSections = "safetyData" />
</v-window-item>
<v-window-item class="gap h-100" value="testings">
<TestSafety></TestSafety>
</v-window-item>
</template>
</pattern-tabs>
</template>
<script setup>
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'
<script>
import { ref, onMounted, onUpdated } from "vue";
import VuePdfEmbed from 'vue-pdf-embed';
import TestSafety from './TestSafety.vue';
import MainInfoSafety from './MainInfoSafety.vue';
import { pagecounter } from "@/utils/universal_functions";
import PatternTabs from "@/components/UI/PatternTabs.vue";
import { useRoute } from "vue-router";
import TestSafety from "@/views/safety/TestSafety.vue";
import MainInfoSafety from "@/views/safety/MainInfoSafety.vue";
import { axiosApiInstance } from "@/utils/axios-api";
import DocumentationSafety from "./DocumentationSafety.vue";
pagecounter();
export default {
components: {
PatternTabs,
TestSafety,
MainInfoSafety,
DocumentationSafety,
},
const safetyData = ref({categories:[]});
const responsibilityData = ref();
const showMore = ref(false);
const showFile = ref(true);
let pdfSource = ref("");
const loading = ref(false);
const tab = ref('');
const burl = baseURL.slice(0, -1);
const route = useRoute();
setup() {
pagecounter();
// Вынес запрос в отдельную функцию, чтобы избежать дублирования одного и того же запроса на сервер.
function getSafety() {
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 safetyData = ref({});
const loading = ref(false);
const route = useRoute();
const getSafety = () => {
axiosApiInstance
.get(`api/safety/?chapter=${route.params.chapter}`)
.then((result) => {
safetyData.value = result.data;
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
}
})
onMounted(() => getSafety())
onUpdated(() => getSafety())
function getResponsibility() {
axiosApiInstance.get(`api/safety/committee_files/`).then(result => {
responsibilityData.value = result.data
})
}
return {
safetyData,
getResponsibility()
onBeforeMount(() => getSafety());
const downloadItem = (url, fileName) => {
axiosApiInstance.get(url, { responseType: 'blob' })
.then(response => {
saveAs(response.data, fileName)
})
tabs_items: [
{ title: "Основная информация", value: "mainInfo" },
{ title: "Документация", value: "document" },
{ title: "Тестирование", value: "testings" },
],
};
},
};
function openPDF(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: #E0F2F1;
color: #004D40;
.active-tab {
background-color: #e0f2f1;
color: #004d40;
}
</style>
a {
color: inherit;
}
</style>
@@ -0,0 +1,292 @@
<template>
<v-row no-gutters class="h-100 gap">
<v-col class="d-flex">
<v-row no-gutters class="flex-column gap">
<v-col lg="6" class="w100 d-flex flex-column">
<v-card class="h-100 w-100 d-flex flex-column pb-1 rounded-0">
<v-card-title>
<span class="text-h4 text-wrap"> Комиссии </span>
</v-card-title>
<v-row no-gutters class="h-0 overflow-auto flex-column flex-nowrap">
<v-col
class="flex-grow-0"
v-for="(comm, key) in docSections.type_comm"
:key="key"
>
<v-card-subtitle class="text-wrap">
<span class="text-subtitle-1 text-wrap">
{{ comm.comm.name }}
</span>
</v-card-subtitle>
<v-list :lines="false" density="compact" nav>
<v-row
no-gutters
v-for="file in comm.comm.comitee_files"
:key="file.id"
>
<v-col>
<v-list-item
:active="filId == file.id"
color="primary"
density="compact"
@click="
openPDF(file)
"
>
<span class="text-body-2 text-wrap">
{{
get_name(
decodeURI(file.file_name.replace(/\.[^/.]+$/, ""))
)
}}
</span>
</v-list-item></v-col
>
<v-col class="flex-grow-0 align-self-center">
<v-icon
icon="mdi-file-download-outline"
@click="
downloadItem(file)
"
/></v-col>
</v-row>
</v-list>
</v-col>
</v-row>
</v-card>
</v-col>
<v-col class="w100 d-flex flex-column">
<v-card class="h-100 w-100 d-flex flex-column rounded-0">
<v-card-title>
<span class="text-h4 text-wrap"> Ответсвенности </span>
</v-card-title>
<v-row no-gutters class="h-0 overflow-auto flex-column flex-nowrap">
<v-col
class="flex-grow-0"
v-for="(comm, key) in docSections.type_resp"
:key="key"
>
<v-card-subtitle class="text-wrap">
<span class="text-subtitle-1 text-wrap">
{{ comm.resp.name }}
</span>
</v-card-subtitle>
<v-list :lines="false" density="compact" nav>
<v-row
no-gutters
v-for="file in comm.resp.get_resp_files"
:key="file.id"
>
<v-col>
<v-list-item
:active="filId == file.id"
color="primary"
density="compact"
@click="
openPDF(file)
"
>
<span class="text-body-2 text-wrap">
{{
get_name(
decodeURI(file.file_name.replace(/\.[^/.]+$/, ""))
)
}}
</span>
</v-list-item></v-col
>
<v-col class="flex-grow-0 align-self-center">
<v-icon
icon="mdi-file-download-outline"
@click="
downloadItem(file)
"
/></v-col>
</v-row>
</v-list>
</v-col>
</v-row>
</v-card>
</v-col>
</v-row>
</v-col>
<v-col class="d-flex flex-column">
<v-card class="flex-column h-100 d-flex rounded-0">
<v-row no-gutters class="h-0 overflow-auto">
<v-col class="d-flex flex-column "
:class="!loading?'align-center align-self-center':''">
<v-container v-if="loading">
<v-progress-linear :rounded="5" indeterminate color="teal" />
</v-container>
<VuePdfEmbed
v-show="showFile"
:source="pdfSource"
width="720"
@rendered="loading = false"
@loading-failed="handlePdfError"
/>
<v-card-text v-show="!showFile" >
<span class="text-h5 text-grey"
>
{{ err }}
</span>
</v-card-text>
</v-col>
</v-row>
<v-divider />
<v-card-actions v-show="showFile">
<v-btn position="sticky" block @click="closeFile">Закрыть</v-btn>
</v-card-actions>
</v-card>
</v-col>
</v-row>
</template>
<script>
import { ref, computed } from "vue";
import { axiosApiInstance, baseURL, spravURLBase } from "@/utils/axios-api";
import { saveAs } from "file-saver";
import VuePdfEmbed from "vue-pdf-embed";
import { triggerRef } from "vue";
export default {
props: {
docSections: {
type: Object,
default: () => {
type_comm;
},
},
},
components: {
VuePdfEmbed,
},
setup(props, { emit }) {
const loading = ref(true);
const burl = baseURL.slice(0, -1);
const pdfSource = ref("");
const showFile = ref(true);
const filId = ref(null);
const err = ref("Файл не выбран");
const downloadItem = (file) => {
let url = development.value ? burl + file.file_name : spravURLBase + `files/${file.typeoffile == 'comm' ? 'committee1_docs' : 'order_responsibility_docs'}/${file.parent}/${get_name(file.file_name)}`
console.log(burl + file.file_name);
axiosApiInstance.get(url, { responseType: "blob" }).then((response) => {
saveAs(response.data, get_name(decodeURI(file.file_name)));
});
};
const openPDF = (file) => {
console.log(file, "fil");
let source =development.value ? burl + file.file_name : spravURLBase + `files/${file.typeoffile == 'comm' ? 'committee1_docs' : 'order_responsibility_docs'}/${file.parent}/${get_name(file.file_name)}`
if(source!=pdfSource.value){
loading.value = true
pdfSource.value = source
}
showFile.value = true;
filId.value = file.id;
};
const development = computed({
get() {
return process.env.NODE_ENV == "development" ? true : false;
}
})
// process.env.NODE_ENV == "development" ? true : false;
const get_name = (namestr) => {
let arr = namestr.split("/");
return arr[arr.length - 1];
};
const closeFile = () => {
err.value = "Файл не выбран"
showFile.value = false;
filId.value = null;
};
const handlePdfError = (error) => {
showFile.value=false
err.value = "Файл не найден";
loading.value = false;
// if (error.status === 404) {
// console.error('PDF file not found');
// // Дополнительная логика или обработка ошибки 404 здесь
// } else {
// console.error('An error occurred while loading the PDF:', error);
// }
};
const firstFile = () => {
let files = []
props.docSections.type_comm.forEach(el => {
// console.log(el);
files.push(...el.comm.comitee_files)
});
props.docSections.type_resp.forEach(el => {
files.push(...el.resp.get_resp_files)
});
pdfSource.value =development.value ? burl + files[0].file_name : spravURLBase + `files/${files[0].typeoffile == 'comm' ? 'committee1_docs' : 'order_responsibility_docs'}/${files[0].parent}/${get_name(files[0].file_name)}`
// = source
// pdfSource.value =
// burl + files[0].file_name;
filId.value = files[0].id;
console.log(pdfSource.value, "-------------------------------");
};
firstFile();
return {
downloadItem,
openPDF,
get_name,
handlePdfError,
loading,
pdfSource,
filId,
burl,
showFile,
closeFile,
err,
};
},
};
// http://10.252.44.33/accounting6/index.php?controller=OrderResponsibility&action=DownloadFile&fld_file=222&fld_order_responsibility=11
// http://10.252.44.33/accounting6/index.php?controller=Committee&action=DownloadFile&fld_file=412&fld_committee=29
// \\10.252.44.33\Webserver\data\htdocs\accounting6\files\committee1_docs\2
// \\10.252.44.33\Webserver\data\htdocs\accounting6\files\order_responsibility_docs\12
</script>
<style></style>
+140 -72
View File
@@ -1,88 +1,156 @@
<template>
<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-row no-gutters class="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"
@click="openFirstPlan_opener(schema)"
/>
<v-img
v-else
class="cursor-pointer"
:src="burl + schema.url"
@click="openFirstPlan_opener(schema)"
>
</v-img>
</v-col>
<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">
<v-card class="pa-1 overflow-y-auto flex-grow-1 flex-shrink-1 h-100">
<list-user
v-for="item in responsibility"
:key=item
:author="item">
</list-user>
</v-card>
</v-row>
</v-card>
<v-dialog v-model="openFirstPlan" :width="900" height="100%">
</v-row>
</v-col>
<v-col cols="3" class="d-flex flex-column h-100">
<v-row no-gutters class="h-0 overflow-auto">
<v-col>
<v-col class="v-col-auto ">
<div class="text-h6 d-flex justify-center">Ответственные</div>
</v-col>
<v-col class="v-col-auto">
<div v-if="responsibility != undefined && responsibility.length > 0" >
<v-expansion-panels>
<v-expansion-panel v-for="item in responsibility">
<v-expansion-panel-title class="font-weight-medium">
{{ item.resp.sphere_of_responsibility }}
</v-expansion-panel-title>
<v-expansion-panel-text>
<list-user
v-for="user in item.resp.employee"
:key=user
:author="user">
</list-user>
</v-expansion-panel-text>
</v-expansion-panel>
</v-expansion-panels>
</div>
<div v-else>
<div class="text-caption text-grey d-flex justify-center">Данные по ответственным отсутствуют</div>
</div>
</v-col>
<v-col class="v-col-auto">
<div class="text-h6 d-flex justify-center">Комиссии</div>
</v-col>
<v-col class="v-col-auto">
<div v-if="commitee != undefined && commitee.length > 0" >
<v-expansion-panels >
<v-expansion-panel v-for="item in commitee">
<v-expansion-panel-title class="font-weight-medium">
{{ item.comm.name }}
</v-expansion-panel-title>
<v-expansion-panel-text>
<list-user
v-for="user in item.comm.com_members"
:key=user
:author="user">
</list-user>
</v-expansion-panel-text>
</v-expansion-panel>
</v-expansion-panels>
</div>
<div v-else>
<div class="text-caption text-grey d-flex justify-center">Данные по комиссиям отсутствуют</div>
</div>
</v-col>
</v-col>
</v-row>
<!-- <div class=" overflow-y-auto h-100 bg-orange">
</div> -->
</v-col>
</v-row>
<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-card class="h-100 w-100 pa-0">
<v-card-actions class="d-flex justify-space-between">
<v-btn
density="compact"
variant="text"
icon="mdi-close"
@click="openFirstPlan = false">
</v-btn>
<v-btn class="d-flex align-center" icon='mdi-file-download-outline' color="green"
@click="downloadFile(urlschema)">
</v-btn>
</v-card-actions>
<VuePdfEmbed v-if="urlschema.endsWith('.pdf')"
:source="urlschema"
width="500"
@click="openFirstPlan = false"/>
<v-img
v-else
:src="urlschema"
class="cursor-pointer"
height="100%"
width="100%"
@click="openFirstPlan = false">
</v-img>
</v-card>
</v-row>
</v-dialog>
</v-col>
</v-row>
</template>
<script setup>
import { baseURL, axiosApiInstance } from '@/utils/axios-api'
import { ref } from 'vue';
import VuePdfEmbed from 'vue-pdf-embed';
import { baseURL, axiosApiInstance } from "@/utils/axios-api";
import { ref } from "vue";
defineProps(
{
formainpage: Object,
require:true
},
)
import VuePdfEmbed from "vue-pdf-embed";
import { saveAs } from "file-saver";
const urlschema=ref(null)
const burl = baseURL.slice(0,-1)
const openFirstPlan = ref(false)
const responsibility = ref([])
function openFirstPlan_opener(schema){
urlschema.value = burl + schema.url
openFirstPlan.value = true
defineProps({
formainpage: Object,
responsibility: Array,
commitee: Array,
require: true,
});
const downloadFile = (url, fileName) => {
axiosApiInstance.get(url, { responseType: "blob" }).then((response) => {
saveAs(response.data, fileName);
});
};
const urlschema = ref(null);
const burl = baseURL.slice(0, -1);
const openFirstPlan = ref(false);
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
})
}
getResponsibility()
</script>
<style>
.meheight {
max-height: 44vh;
max-height: 44vh;
}
</style>
</style>