P-29i Первая картинка

This commit is contained in:
iriska-gri committed 2024-05-22 08:44:17 +03:00
1 parent 56195d3881
commit 6691bdf251
1 file changed
+25 -22
@@ -1,10 +1,5 @@
<template> <template>
<v-row <v-row no-gutters class="h-100 gap">
no-gutters
class="h-100 gap"
>
<!-- v-if="Object.keys(docSections).length > 0" -->
<v-col class="d-flex"> <v-col class="d-flex">
<v-row no-gutters class="flex-column gap"> <v-row no-gutters class="flex-column gap">
<v-col lg="6" class="w100 d-flex flex-column"> <v-col lg="6" class="w100 d-flex flex-column">
@@ -127,17 +122,18 @@
</v-row> </v-row>
</v-col> </v-col>
<v-col class="d-flex flex-column"> <v-col class="d-flex flex-column">
<v-card class="flex-column h-100 d-flex rounded-0"> <v-card class="flex-column h-100 d-flex rounded-0">
<v-row no-gutters class="h-0 overflow-auto"> <v-row no-gutters class="h-0 overflow-auto">
<v-col class="align-self-center text-center"> <v-col>
<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-container> </v-container>
<!-- <span v-else v-show="!showFile">
{{ err }}
</span> -->
<VuePdfEmbed <VuePdfEmbed
v-show="showFile" v-show="showFile"
:source="pdfSource" :source="pdfSource"
width="720" width="720"
@@ -145,11 +141,10 @@
@loading-failed="handlePdfError" @loading-failed="handlePdfError"
/> />
{{err}}
</v-col> </v-col>
</v-row> </v-row>
<v-divider /> <v-divider />
<v-card-actions v-show="showFile"> <v-card-actions v-show="showFile">
<v-btn position="sticky" block @click="closeFile">Закрыть</v-btn> <v-btn position="sticky" block @click="closeFile">Закрыть</v-btn>
@@ -157,7 +152,6 @@
</v-card> </v-card>
</v-col> </v-col>
</v-row> </v-row>
<!-- <v-row v-else>{{ Object.keys(docSections).length > 0 }}</v-row> -->
</template> </template>
<script> <script>
@@ -180,14 +174,14 @@ export default {
VuePdfEmbed, VuePdfEmbed,
}, },
setup() { setup(props, { emit }) {
const loading = ref(false); const loading = ref(false);
const burl = baseURL.slice(0, -1);
const pdfSource = ref(""); const pdfSource = ref("");
const burl = baseURL.slice(0, -1); const showFile = ref(true);
const showFile = ref(false);
const filId = ref(null); const filId = ref(null);
const err = ref('s') const err = ref("");
const downloadItem = (url, fileName) => { const downloadItem = (url, fileName) => {
axiosApiInstance.get(url, { responseType: "blob" }).then((response) => { axiosApiInstance.get(url, { responseType: "blob" }).then((response) => {
@@ -212,8 +206,8 @@ export default {
}; };
const handlePdfError = (error) => { const handlePdfError = (error) => {
err.value = "Файл не найден" err.value = "Файл не найден";
loading.value = false loading.value = false;
// if (error.status === 404) { // if (error.status === 404) {
// console.error('PDF file not found'); // console.error('PDF file not found');
@@ -221,7 +215,16 @@ export default {
// } else { // } else {
// console.error('An error occurred while loading the PDF:', error); // console.error('An error occurred while loading the PDF:', error);
// } // }
} };
const firstFile = () => {
pdfSource.value =
burl + props.docSections.type_comm[0].comm.comitee_files[0].file_name;
filId.value = props.docSections.type_comm[0].comm.comitee_files[0].id;
console.log(pdfSource.value, "-------------------------------");
};
firstFile();
return { return {
downloadItem, downloadItem,
@@ -234,7 +237,7 @@ export default {
burl, burl,
showFile, showFile,
closeFile, closeFile,
err err,
}; };
}, },
}; };