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
+28 -25
@@ -1,10 +1,5 @@
<template>
<v-row
no-gutters
class="h-100 gap"
>
<!-- v-if="Object.keys(docSections).length > 0" -->
<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">
@@ -127,29 +122,29 @@
</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-col>
<v-container v-if="loading">
<v-progress-linear :rounded="5" indeterminate color="teal">
</v-progress-linear>
<v-progress-linear :rounded="5" indeterminate color="teal" />
</v-container>
<!-- <span v-else v-show="!showFile">
{{ err }}
</span> -->
<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>
@@ -157,7 +152,6 @@
</v-card>
</v-col>
</v-row>
<!-- <v-row v-else>{{ Object.keys(docSections).length > 0 }}</v-row> -->
</template>
<script>
@@ -180,14 +174,14 @@ export default {
VuePdfEmbed,
},
setup() {
setup(props, { emit }) {
const loading = ref(false);
const burl = baseURL.slice(0, -1);
const pdfSource = ref("");
const burl = baseURL.slice(0, -1);
const showFile = ref(false);
const showFile = ref(true);
const filId = ref(null);
const err = ref('s')
const err = ref("");
const downloadItem = (url, fileName) => {
axiosApiInstance.get(url, { responseType: "blob" }).then((response) => {
@@ -211,9 +205,9 @@ export default {
filId.value = null;
};
const handlePdfError = (error) => {
err.value = "Файл не найден"
loading.value = false
const handlePdfError = (error) => {
err.value = "Файл не найден";
loading.value = false;
// if (error.status === 404) {
// console.error('PDF file not found');
@@ -221,7 +215,16 @@ export default {
// } else {
// 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 {
downloadItem,
@@ -234,7 +237,7 @@ export default {
burl,
showFile,
closeFile,
err
err,
};
},
};