P-29i Документация верстка
This commit is contained in:
1 parent
ddcbcb778a
commit
56195d3881
6 files changed
+367
-74
No files matched your search
@@ -76,6 +76,7 @@ class OrderResponsibilitySerializer(serializers.ModelSerializer):
|
|||||||
def get_respons(self, instance):
|
def get_respons(self, instance):
|
||||||
employee = [x.employee for x in instance.respons_users.filter(employee__deleted=0)]
|
employee = [x.employee for x in instance.respons_users.filter(employee__deleted=0)]
|
||||||
return CommeetePersonSerializer(employee,many=True, read_only=True).data
|
return CommeetePersonSerializer(employee,many=True, read_only=True).data
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = OrderResponsibility
|
model = OrderResponsibility
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|||||||
Generated
+4
-4
@@ -36,7 +36,7 @@
|
|||||||
"vue-cal": "^4.8.1",
|
"vue-cal": "^4.8.1",
|
||||||
"vue-chartjs": "^5.3.0",
|
"vue-chartjs": "^5.3.0",
|
||||||
"vue-jwt-decode": "^0.1.0",
|
"vue-jwt-decode": "^0.1.0",
|
||||||
"vue-pdf-embed": "^2.0.2",
|
"vue-pdf-embed": "^2.0.3",
|
||||||
"vue-router": "^4.0.0",
|
"vue-router": "^4.0.0",
|
||||||
"vue3-autocounter": "^1.0.6",
|
"vue3-autocounter": "^1.0.6",
|
||||||
"vuelidate": "^0.7.7",
|
"vuelidate": "^0.7.7",
|
||||||
@@ -19471,9 +19471,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/vue-pdf-embed": {
|
"node_modules/vue-pdf-embed": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/vue-pdf-embed/-/vue-pdf-embed-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/vue-pdf-embed/-/vue-pdf-embed-2.0.3.tgz",
|
||||||
"integrity": "sha512-Zxzv3DaNRj1NwJKIA/CMjvcA/Q0mlA8ASDBUVzYQ62o/s2WgF/Au/ZC4jlMr/P8CLznlyL8tIY7kqXHD7HLcAg==",
|
"integrity": "sha512-3kSBUBen/ZUezWtbby9J8FhmS8u3cgPoogeFZMge33keelJqZbUC3PvpJi5CDnrCLVuty/gtvSill+GQPnXDow==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pdfjs-dist": "^3.11.174"
|
"pdfjs-dist": "^3.11.174"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
"vue-cal": "^4.8.1",
|
"vue-cal": "^4.8.1",
|
||||||
"vue-chartjs": "^5.3.0",
|
"vue-chartjs": "^5.3.0",
|
||||||
"vue-jwt-decode": "^0.1.0",
|
"vue-jwt-decode": "^0.1.0",
|
||||||
"vue-pdf-embed": "^2.0.2",
|
"vue-pdf-embed": "^2.0.3",
|
||||||
"vue-router": "^4.0.0",
|
"vue-router": "^4.0.0",
|
||||||
"vue3-autocounter": "^1.0.6",
|
"vue3-autocounter": "^1.0.6",
|
||||||
"vuelidate": "^0.7.7",
|
"vuelidate": "^0.7.7",
|
||||||
|
|||||||
@@ -2,7 +2,13 @@
|
|||||||
<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 class="w100 h-100 flex-grow-0">
|
<v-col class="w100 h-100 flex-grow-0">
|
||||||
<v-card>
|
<v-card>
|
||||||
<v-tabs v-model="tab" bg-color="bg_tab" slider-color="slider_tab" selected-class="isActiveTab" :grow="true">
|
<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="mainInfo">Основная информация</v-tab>
|
||||||
<v-tab value="document">Документация</v-tab>
|
<v-tab value="document">Документация</v-tab>
|
||||||
<v-tab value="testings">Тестирование</v-tab>
|
<v-tab value="testings">Тестирование</v-tab>
|
||||||
@@ -12,36 +18,56 @@
|
|||||||
<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 :formainpage="safetyData.mainpage_file"></MainInfoSafety>
|
<MainInfoSafety
|
||||||
|
:formainpage="safetyData.mainpage_file"
|
||||||
|
></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 overflow-auto pb-1 ">
|
<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
|
||||||
|
class="overflow-y-auto flex-grow-1 flex-shrink-1 h-100"
|
||||||
|
>
|
||||||
<v-card-title>{{ safetyData.name }}</v-card-title>
|
<v-card-title>{{ safetyData.name }}</v-card-title>
|
||||||
<v-expansion-panels
|
<v-expansion-panels multiple flat>
|
||||||
multiple
|
<v-expansion-panel
|
||||||
flat>
|
elevation="0"
|
||||||
<v-expansion-panel elevation=0 v-for="category in safetyData.categories"
|
v-for="category in safetyData.categories"
|
||||||
:key="category.id" class="py-0">
|
:key="category.id"
|
||||||
|
class="py-0"
|
||||||
|
>
|
||||||
<v-expansion-panel-title class="font-weight-medium">{{
|
<v-expansion-panel-title class="font-weight-medium">{{
|
||||||
category.category__name }}</v-expansion-panel-title>
|
category.category__name
|
||||||
|
}}</v-expansion-panel-title>
|
||||||
<v-expansion-panel-text>
|
<v-expansion-panel-text>
|
||||||
<div v-for="file in category.files" :key="file.id"
|
<div
|
||||||
class="overflow-y-auto d-flex justify-space-between">
|
v-for="file in category.files"
|
||||||
<div class="cursor-pointer"
|
:key="file.id"
|
||||||
@click="openPDF(file.url), loading = true">
|
class="overflow-y-auto d-flex justify-space-between"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="cursor-pointer"
|
||||||
|
@click="openPDF(file.url), (loading = true)"
|
||||||
|
>
|
||||||
{{ file.name }}
|
{{ file.name }}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<v-btn variant="text" icon="mdi-file-pdf-box"
|
<v-btn
|
||||||
|
variant="text"
|
||||||
|
icon="mdi-file-pdf-box"
|
||||||
color="red"
|
color="red"
|
||||||
@click="openPDF(file.url), loading = true"></v-btn>
|
@click="openPDF(file.url), (loading = true)"
|
||||||
<v-btn variant="text"
|
></v-btn>
|
||||||
icon='mdi-file-download-outline' color="green"
|
<v-btn
|
||||||
@click="downloadItem(burl + file.url, file.name)"></v-btn>
|
variant="text"
|
||||||
|
icon="mdi-file-download-outline"
|
||||||
|
color="green"
|
||||||
|
@click="
|
||||||
|
downloadItem(burl + file.url, file.name)
|
||||||
|
"
|
||||||
|
></v-btn>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</v-expansion-panel-text>
|
</v-expansion-panel-text>
|
||||||
@@ -49,20 +75,45 @@
|
|||||||
</v-expansion-panels>
|
</v-expansion-panels>
|
||||||
</v-card>
|
</v-card>
|
||||||
</v-row>
|
</v-row>
|
||||||
<v-row class="ma-0 overflow-auto bg-yellow ">
|
<v-row class="ma-0 overflow-auto bg-yellow">
|
||||||
<v-card class="overflow-y-auto flex-grow-1 h-100">
|
<v-card class="overflow-y-auto flex-grow-1 h-100">
|
||||||
<v-card-title>{{ responsibilityData.name }}</v-card-title>
|
<v-card-title>{{ responsibilityData.name }}</v-card-title>
|
||||||
<v-container v-for="file in responsibilityData.files" :fluid="true" class="py-0">
|
<v-container
|
||||||
|
v-for="file in responsibilityData.files"
|
||||||
|
:fluid="true"
|
||||||
|
class="py-0"
|
||||||
|
>
|
||||||
<v-card-actions :key="file.id">
|
<v-card-actions :key="file.id">
|
||||||
<v-card-text class="cursor-pointer"
|
<v-card-text
|
||||||
@click="openPDF(checkNameFiles(file)), loading = true">
|
class="cursor-pointer"
|
||||||
{{ get_name(decodeURI(file.file_name.replace(/\.[^/.]+$/, ""))) }}
|
@click="
|
||||||
|
openPDF(checkNameFiles(file)), (loading = true)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
{{
|
||||||
|
get_name(
|
||||||
|
decodeURI(file.file_name.replace(/\.[^/.]+$/, ""))
|
||||||
|
)
|
||||||
|
}}
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
<v-btn icon="mdi-file-pdf-box" color="red"
|
<v-btn
|
||||||
@click="openPDF(checkNameFiles(file)), loading = true">
|
icon="mdi-file-pdf-box"
|
||||||
|
color="red"
|
||||||
|
@click="
|
||||||
|
openPDF(checkNameFiles(file)), (loading = true)
|
||||||
|
"
|
||||||
|
>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-btn icon='mdi-file-download-outline' color="green"
|
<v-btn
|
||||||
@click="downloadItem(burl + checkNameFiles(file), get_name(decodeURI(file.file_name)))">
|
icon="mdi-file-download-outline"
|
||||||
|
color="green"
|
||||||
|
@click="
|
||||||
|
downloadItem(
|
||||||
|
burl + checkNameFiles(file),
|
||||||
|
get_name(decodeURI(file.file_name))
|
||||||
|
)
|
||||||
|
"
|
||||||
|
>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
</v-container>
|
</v-container>
|
||||||
@@ -73,24 +124,35 @@
|
|||||||
<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"
|
<v-card
|
||||||
class="mr-2 flex-grow-1 flex-shrink-1 h-100 pa-2 overflow-auto">
|
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">
|
||||||
<v-progress-linear :rounded="5" indeterminate color="teal">
|
<v-progress-linear
|
||||||
|
:rounded="5"
|
||||||
|
indeterminate
|
||||||
|
color="teal"
|
||||||
|
>
|
||||||
</v-progress-linear>
|
</v-progress-linear>
|
||||||
</v-container>
|
</v-container>
|
||||||
<VuePdfEmbed :source="pdfSource" width="720" @rendered="loading = false" />
|
<VuePdfEmbed
|
||||||
|
:source="pdfSource"
|
||||||
|
width="720"
|
||||||
|
@rendered="loading = false"
|
||||||
|
/>
|
||||||
</v-card>
|
</v-card>
|
||||||
</v-row>
|
</v-row>
|
||||||
<v-card-actions v-show="showFile">
|
<v-card-actions v-show="showFile">
|
||||||
<v-btn position="sticky" block @click="showFile = false">Закрыть</v-btn>
|
<v-btn position="sticky" block @click="showFile = false"
|
||||||
|
>Закрыть</v-btn
|
||||||
|
>
|
||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
</v-card>
|
</v-card>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-window-item>
|
</v-window-item>
|
||||||
<v-window-item value="testings" no-gutters class="gap h-100 ">
|
<v-window-item value="testings" no-gutters class="gap h-100">
|
||||||
|
|
||||||
</v-window-item>
|
</v-window-item>
|
||||||
</v-window>
|
</v-window>
|
||||||
</v-col>
|
</v-col>
|
||||||
@@ -98,15 +160,15 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onBeforeMount } from 'vue';
|
import { ref, onBeforeMount } 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();
|
||||||
|
|
||||||
@@ -116,37 +178,38 @@ const showMore = ref(false);
|
|||||||
const showFile = ref(true);
|
const showFile = ref(true);
|
||||||
let pdfSource = ref("");
|
let pdfSource = ref("");
|
||||||
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/?chapter=${route.params.chapter}`).then(result => {
|
axiosApiInstance
|
||||||
safetyData.value = result.data
|
.get(`api/safety/?chapter=${route.params.chapter}`)
|
||||||
loading.value = true
|
.then((result) => {
|
||||||
|
safetyData.value = result.data;
|
||||||
|
loading.value = true;
|
||||||
// pdfSource.value = burl + safetyData.value.categories[0].files[0].url
|
// pdfSource.value = burl + safetyData.value.categories[0].files[0].url
|
||||||
console.log(safetyData.value);
|
console.log(safetyData.value);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onBeforeMount(() => getSafety());
|
onBeforeMount(() => getSafety());
|
||||||
|
|
||||||
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) {
|
||||||
pdfSource.value = burl + url
|
pdfSource.value = burl + url;
|
||||||
showFile.value = true
|
showFile.value = true;
|
||||||
};
|
}
|
||||||
|
|
||||||
function get_name(namestr) {
|
function get_name(namestr) {
|
||||||
let arr = namestr.split("/")
|
let arr = namestr.split("/");
|
||||||
return arr[arr.length - 1]
|
return arr[arr.length - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// function checkNameFiles(obj) {
|
// function checkNameFiles(obj) {
|
||||||
@@ -161,7 +224,7 @@ function get_name(namestr) {
|
|||||||
|
|
||||||
<style>
|
<style>
|
||||||
.isActiveTab {
|
.isActiveTab {
|
||||||
background-color: #E0F2F1;
|
background-color: #e0f2f1;
|
||||||
color: #004D40;
|
color: #004d40;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
></MainInfoSafety>
|
></MainInfoSafety>
|
||||||
</v-window-item>
|
</v-window-item>
|
||||||
<v-window-item class="gap h-100" value="document">
|
<v-window-item class="gap h-100" value="document">
|
||||||
<documentation-safety />
|
<documentation-safety :docSections = "safetyData" />
|
||||||
</v-window-item>
|
</v-window-item>
|
||||||
<v-window-item class="gap h-100" value="testings">
|
<v-window-item class="gap h-100" value="testings">
|
||||||
<TestSafety></TestSafety>
|
<TestSafety></TestSafety>
|
||||||
@@ -51,7 +51,7 @@ export default {
|
|||||||
console.log(safetyData.value, "-------------------------------");
|
console.log(safetyData.value, "-------------------------------");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
getSafety()
|
||||||
onUpdated(() => getSafety());
|
onUpdated(() => getSafety());
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -1,14 +1,243 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<v-row
|
||||||
|
no-gutters
|
||||||
|
class="h-100 gap"
|
||||||
|
|
||||||
<div>hello</div>
|
>
|
||||||
|
<!-- v-if="Object.keys(docSections).length > 0" -->
|
||||||
|
<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.file_name, file.id), (loading = true)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<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(
|
||||||
|
burl + file.file_name,
|
||||||
|
get_name(decodeURI(file.file_name))
|
||||||
|
)
|
||||||
|
"
|
||||||
|
/></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.file_name, file.id), (loading = true)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<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(
|
||||||
|
burl + file.file_name,
|
||||||
|
get_name(decodeURI(file.file_name))
|
||||||
|
)
|
||||||
|
"
|
||||||
|
/></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="align-self-center text-center">
|
||||||
|
<v-container v-if="loading">
|
||||||
|
<v-progress-linear :rounded="5" indeterminate color="teal">
|
||||||
|
</v-progress-linear>
|
||||||
|
</v-container>
|
||||||
|
<VuePdfEmbed
|
||||||
|
v-show="showFile"
|
||||||
|
:source="pdfSource"
|
||||||
|
width="720"
|
||||||
|
@rendered="loading = false"
|
||||||
|
@loading-failed="handlePdfError"
|
||||||
|
/>
|
||||||
|
|
||||||
|
{{err}}
|
||||||
|
</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>
|
||||||
|
<!-- <v-row v-else>{{ Object.keys(docSections).length > 0 }}</v-row> -->
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
import { ref } from "vue";
|
||||||
|
import { axiosApiInstance, baseURL } from "@/utils/axios-api";
|
||||||
|
import { saveAs } from "file-saver";
|
||||||
|
import VuePdfEmbed from "vue-pdf-embed";
|
||||||
|
|
||||||
}
|
export default {
|
||||||
|
props: {
|
||||||
|
docSections: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {
|
||||||
|
type_comm;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
components: {
|
||||||
|
VuePdfEmbed,
|
||||||
|
},
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
const loading = ref(false);
|
||||||
|
const pdfSource = ref("");
|
||||||
|
|
||||||
|
const burl = baseURL.slice(0, -1);
|
||||||
|
const showFile = ref(false);
|
||||||
|
const filId = ref(null);
|
||||||
|
const err = ref('s')
|
||||||
|
|
||||||
|
const downloadItem = (url, fileName) => {
|
||||||
|
axiosApiInstance.get(url, { responseType: "blob" }).then((response) => {
|
||||||
|
saveAs(response.data, fileName);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const openPDF = (url, id) => {
|
||||||
|
pdfSource.value = burl + url;
|
||||||
|
showFile.value = true;
|
||||||
|
filId.value = id;
|
||||||
|
};
|
||||||
|
|
||||||
|
const get_name = (namestr) => {
|
||||||
|
let arr = namestr.split("/");
|
||||||
|
return arr[arr.length - 1];
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeFile = () => {
|
||||||
|
showFile.value = false;
|
||||||
|
filId.value = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlePdfError = (error) => {
|
||||||
|
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);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
downloadItem,
|
||||||
|
openPDF,
|
||||||
|
get_name,
|
||||||
|
handlePdfError,
|
||||||
|
loading,
|
||||||
|
pdfSource,
|
||||||
|
filId,
|
||||||
|
burl,
|
||||||
|
showFile,
|
||||||
|
closeFile,
|
||||||
|
err
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style></style>
|
||||||
|
|
||||||
</style>
|
|
||||||
Reference in new issue
Block a user