Merge remote-tracking branch 'origin/P-29I' into P-29
This commit is contained in:
commit
77f11e8ff3
9 files changed
+421
-218
No files matched your search
@@ -20,7 +20,8 @@ class InlineComiteePeople(admin.StackedInline):
|
|||||||
|
|
||||||
class Committee1Admin(admin.ModelAdmin):
|
class Committee1Admin(admin.ModelAdmin):
|
||||||
readonly_fields = ['id']
|
readonly_fields = ['id']
|
||||||
# list_display = ('name', 'num_start', 'date_start', 'num_finish', 'date_finish')
|
list_display = ( 'num_start', 'name',)
|
||||||
|
search_fields = ('num_start', 'name',)
|
||||||
inlines = [IlineComitteeFiles, InlineComiteePeople]
|
inlines = [IlineComitteeFiles, InlineComiteePeople]
|
||||||
|
|
||||||
class InlineRespFiles(admin.StackedInline):
|
class InlineRespFiles(admin.StackedInline):
|
||||||
@@ -38,6 +39,8 @@ class InlineRespEmp(admin.StackedInline):
|
|||||||
|
|
||||||
class OrderResponsibilityAdmin(admin.ModelAdmin):
|
class OrderResponsibilityAdmin(admin.ModelAdmin):
|
||||||
# model= OrderResponsibility
|
# model= OrderResponsibility
|
||||||
|
list_display = ( 'number', 'name')
|
||||||
|
search_fields = ('number', 'name',)
|
||||||
inlines=[InlineRespFiles,InlineRespEmp]
|
inlines=[InlineRespFiles,InlineRespEmp]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ from .models import *
|
|||||||
class MainpageInline(admin.StackedInline):
|
class MainpageInline(admin.StackedInline):
|
||||||
model = SafetyFile
|
model = SafetyFile
|
||||||
extra = 0
|
extra = 0
|
||||||
|
|
||||||
class ResponsFilesInline(admin.StackedInline):
|
class ResponsFilesInline(admin.StackedInline):
|
||||||
model = Safety_Responsib
|
model = Safety_Responsib
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ from django.db import models
|
|||||||
# return str(self.name)
|
# return str(self.name)
|
||||||
|
|
||||||
class SafetyType(models.Model):
|
class SafetyType(models.Model):
|
||||||
name = models.CharField(max_length=255)
|
name = models.CharField(max_length=255, verbose_name='Название подраздела')
|
||||||
path = models.CharField(max_length=255, null=True)
|
path = models.CharField(max_length=255, null=True, verbose_name='Путь')
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
||||||
verbose_name = 'Подраздел'
|
verbose_name = 'Подраздел'
|
||||||
|
|||||||
@@ -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,70 +1,104 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<!-- <my-helper :pretext="kl" /> -->
|
<my-helper :pretext="events" />
|
||||||
<v-btn @click="useICalReader"> ical</v-btn>
|
<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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// import {useICalReader} from '@/utils/universal_functions'
|
import { useDate } from 'vuetify'
|
||||||
import { baseURL, axiosApiInstance } from "@/utils/axios-api";
|
import myHelper from '../UI/my-helper.vue'
|
||||||
import { ref } from "vue";
|
|
||||||
import ical from "ical.js";
|
|
||||||
|
|
||||||
const burl = baseURL.slice(0, -1);
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
setup() {
|
components: { myHelper },
|
||||||
const participant = ref("");
|
data: () => ({
|
||||||
const calendar = ref("");
|
type: 'month',
|
||||||
const useICalReader = async () => {
|
types: ['month', 'week', 'day'],
|
||||||
const response = await fetch(`${burl}/media/ical/calendar.ics`);
|
weekday: [0, 1, 2, 3, 4, 5, 6],
|
||||||
const data = await response.text();
|
weekdays: [
|
||||||
const jcalData = ical.parse(data);
|
{ title: 'Sun - Sat', value: [0, 1, 2, 3, 4, 5, 6] },
|
||||||
const icalComponent = new ical.Component(jcalData);
|
{ title: 'Mon - Sun', value: [1, 2, 3, 4, 5, 6, 0] },
|
||||||
const name = icalComponent.getFirstPropertyValue("x-wr-calname");
|
{ title: 'Mon - Fri', value: [1, 2, 3, 4, 5] },
|
||||||
|
{ title: 'Mon, Wed, Fri', value: [1, 3, 5] },
|
||||||
const events = icalComponent
|
],
|
||||||
.getAllSubcomponents("vevent")
|
value: [new Date()],
|
||||||
.map((vevent) => new ical.Event(vevent));
|
events: [],
|
||||||
|
colors: ['blue', 'indigo', 'deep-purple', 'cyan', 'green', 'orange', 'grey darken-1'],
|
||||||
const calendarEvents = events.map((event) => {
|
titles: ['Meeting', 'Holiday', 'PTO', 'Travel', 'Event', 'Birthday', 'Conference', 'Party'],
|
||||||
let attendees = [];
|
}),
|
||||||
event.attendees.map((att) => {
|
mounted () {
|
||||||
attendees.push(att.jCal[1].cn);
|
const adapter = useDate()
|
||||||
});
|
this.getEvents({ start: adapter.startOfDay(adapter.startOfMonth(new Date())), end: adapter.endOfDay(adapter.endOfMonth(new Date())) })
|
||||||
|
|
||||||
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,
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
};
|
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>
|
</script>
|
||||||
|
|
||||||
<style></style>
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
import '@mdi/font/css/materialdesignicons.css'
|
import '@mdi/font/css/materialdesignicons.css'
|
||||||
import 'vuetify/styles'
|
import 'vuetify/styles'
|
||||||
|
import { VCalendar } from 'vuetify/labs/VCalendar'
|
||||||
|
|
||||||
import { createVuetify } from 'vuetify'
|
import { createVuetify } from 'vuetify'
|
||||||
import { ru } from 'vuetify/locale'
|
import { ru } from 'vuetify/locale'
|
||||||
@@ -10,6 +10,9 @@ export default createVuetify({
|
|||||||
locale: {
|
locale: {
|
||||||
messages: { ru },
|
messages: { ru },
|
||||||
},
|
},
|
||||||
|
components: {
|
||||||
|
VCalendar,
|
||||||
|
},
|
||||||
theme: {
|
theme: {
|
||||||
defaultTheme: 'light'
|
defaultTheme: 'light'
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,167 @@
|
|||||||
|
<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>
|
||||||
@@ -1,167 +1,78 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-row no-gutters class="flex-column h-100 gap pa-1">
|
<pattern-tabs :tabs="tabs_items">
|
||||||
<v-col class="w100 h-100 flex-grow-0">
|
<template v-slot:item>
|
||||||
<v-card>
|
<v-window-item class="gap h-100" value="mainInfo">
|
||||||
<v-tabs v-model="tab" bg-color="bg_tab" slider-color="slider_tab" selected-class="isActiveTab" :grow="true">
|
<MainInfoSafety
|
||||||
<v-tab value="mainInfo">Основная информация</v-tab>
|
:formainpage="safetyData.mainpage_file"
|
||||||
<v-tab value="document">Документация</v-tab>
|
></MainInfoSafety>
|
||||||
<v-tab value="testings">Тестирование</v-tab>
|
</v-window-item>
|
||||||
</v-tabs>
|
<v-window-item class="gap h-100" value="document">
|
||||||
</v-card>
|
<documentation-safety />
|
||||||
</v-col>
|
</v-window-item>
|
||||||
<v-col class="w100 h-100">
|
<v-window-item class="gap h-100" value="testings">
|
||||||
<v-window v-model="tab" class="h-100">
|
<TestSafety></TestSafety>
|
||||||
<v-window-item no-gutters class="gap h-100" value="mainInfo">
|
</v-window-item>
|
||||||
<MainInfoSafety :formainpage="safetyData.mainpage_file" :responsibility="safetyData.type_resp"></MainInfoSafety>
|
</template>
|
||||||
</v-window-item>
|
</pattern-tabs>
|
||||||
<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>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script>
|
||||||
import { ref, onBeforeMount } from 'vue';
|
import { ref } 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 { pagecounter } from "@/utils/universal_functions";
|
||||||
import TestSafety from './TestSafety.vue';
|
import PatternTabs from "@/components/UI/PatternTabs.vue";
|
||||||
import MainInfoSafety from './MainInfoSafety.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({});
|
setup() {
|
||||||
const responsibilityData = ref();
|
pagecounter();
|
||||||
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();
|
|
||||||
|
|
||||||
// Вынес запрос в отдельную функцию, чтобы избежать дублирования одного и того же запроса на сервер.
|
const safetyData = ref({});
|
||||||
function getSafety() {
|
const loading = ref(false);
|
||||||
axiosApiInstance.get(`api/safety/?chapter=${route.params.chapter}`).then(result => {
|
const route = useRoute();
|
||||||
safetyData.value = result.data
|
const getSafety = () => {
|
||||||
loading.value = true
|
axiosApiInstance
|
||||||
// pdfSource.value = burl + safetyData.value.categories[0].files[0].url
|
.get(`api/safety/?chapter=${route.params.chapter}`)
|
||||||
console.log(safetyData.value.type_resp);
|
.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());
|
getSafety();
|
||||||
|
|
||||||
const downloadItem = (url, fileName) => {
|
return {
|
||||||
axiosApiInstance.get(url, { responseType: 'blob' })
|
safetyData,
|
||||||
.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>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.isActiveTab {
|
.active-tab {
|
||||||
background-color: #E0F2F1;
|
background-color: #e0f2f1;
|
||||||
color: #004D40;
|
color: #004d40;
|
||||||
}
|
}
|
||||||
</style>
|
|
||||||
|
a {
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
<div>hello</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
Reference in new issue
Block a user