P-40/refactoring safety

This commit is contained in:
Alex committed 2024-05-23 11:29:57 +03:00
1 parent 505fdd279c
commit ba33bfb69a
4 files changed
+66 -125

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@ class Settings():
'ENGINE': 'django.db.backends.mysql', 'ENGINE': 'django.db.backends.mysql',
'NAME': 'accounting', 'NAME': 'accounting',
'USER': 'root', 'USER': 'root',
'PASSWORD': 'ADMIN', 'PASSWORD': 'admin',
'HOST': '127.0.0.1', 'HOST': '127.0.0.1',
'PORT': '3306', 'PORT': '3306',
} }
@@ -11,9 +11,9 @@
<v-window-item class="gap h-100" value="document"> <v-window-item class="gap h-100" value="document">
<documentation-safety :docSections = "safetyData" /> <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>
</v-window-item> </v-window-item> -->
</template> </template>
</pattern-tabs> </pattern-tabs>
</template> </template>
@@ -49,8 +49,6 @@ export default {
.then((result) => { .then((result) => {
safetyData.value = result.data; safetyData.value = result.data;
loading.value = true; loading.value = true;
// pdfSource.value = burl + safetyData.value.categories[0].files[0].url
console.log(safetyData.value, "-------------------------------");
}); });
}; };
getSafety() getSafety()
@@ -63,7 +61,7 @@ export default {
tabs_items: [ tabs_items: [
{ title: "Основная информация", value: "mainInfo" }, { title: "Основная информация", value: "mainInfo" },
{ title: "Документация", value: "document" }, { title: "Документация", value: "document" },
{ title: "Тестирование", value: "testings" }, // { title: "Тестирование", value: "testings" },
], ],
}; };
}, },
@@ -3,65 +3,9 @@
<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">
<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 class="h-100 w-100 d-flex flex-column rounded-0">
<v-card-title> <v-card-title>
<span class="text-h4 text-wrap"> Ответсвенности </span> <span class="text-h6 text-wrap"> Ответственность </span>
</v-card-title> </v-card-title>
<v-row no-gutters class="h-0 overflow-auto flex-column flex-nowrap"> <v-row no-gutters class="h-0 overflow-auto flex-column flex-nowrap">
@@ -87,25 +31,62 @@
:active="filId == file.id" :active="filId == file.id"
color="primary" color="primary"
density="compact" density="compact"
@click=" @click="openPDF(file)">
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 pb-1 rounded-0">
<v-card-title>
<span class="text-h6 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"> <span class="text-body-2 text-wrap">
{{ {{ get_name(decodeURI(file.file_name.replace(/\.[^/.]+$/, ""))) }}
get_name(
decodeURI(file.file_name.replace(/\.[^/.]+$/, ""))
)
}}
</span> </span>
</v-list-item></v-col </v-list-item></v-col
> >
<v-col class="flex-grow-0 align-self-center"> <v-col class="flex-grow-0 align-self-center">
<v-icon <v-icon
icon="mdi-file-download-outline" icon="mdi-file-download-outline"
@click=" @click="downloadItem(file)"
downloadItem(file)
"
/></v-col> /></v-col>
</v-row> </v-row>
</v-list> </v-list>
@@ -117,29 +98,22 @@
</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="d-flex flex-column " <v-col class="d-flex flex-column "
:class="!loading?'align-center align-self-center':''"> :class="!loading?'align-center align-self-center':''">
<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-container> </v-container>
<VuePdfEmbed
<VuePdfEmbed
v-show="showFile" v-show="showFile"
:source="pdfSource" :source="pdfSource"
width="720" width="720"
@rendered="loading = false" @rendered="loading = false"
@loading-failed="handlePdfError" @loading-failed="handlePdfError"/>
/>
<v-card-text v-show="!showFile" > <v-card-text v-show="!showFile" >
<span class="text-h5 text-grey" <span class="text-h5 text-grey">
> {{ err }}
{{ err }}
</span> </span>
</v-card-text> </v-card-text>
@@ -160,7 +134,6 @@ import { ref, computed } from "vue";
import { axiosApiInstance, baseURL, spravURLBase } from "@/utils/axios-api"; import { axiosApiInstance, baseURL, spravURLBase } from "@/utils/axios-api";
import { saveAs } from "file-saver"; import { saveAs } from "file-saver";
import VuePdfEmbed from "vue-pdf-embed"; import VuePdfEmbed from "vue-pdf-embed";
import { triggerRef } from "vue";
export default { export default {
props: { props: {
@@ -194,20 +167,14 @@ export default {
}); });
}; };
const openPDF = (file) => { 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)}` 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){ if(source!=pdfSource.value){
loading.value = true loading.value = true
pdfSource.value = source pdfSource.value = source
} }
showFile.value = true; showFile.value = true;
filId.value = file.id; filId.value = file.id;
}; };
const development = computed({ const development = computed({
@@ -215,7 +182,6 @@ export default {
return process.env.NODE_ENV == "development" ? true : false; return process.env.NODE_ENV == "development" ? true : false;
} }
}) })
// process.env.NODE_ENV == "development" ? true : false;
const get_name = (namestr) => { const get_name = (namestr) => {
let arr = namestr.split("/"); let arr = namestr.split("/");
@@ -232,37 +198,21 @@ export default {
showFile.value=false showFile.value=false
err.value = "Файл не найден"; err.value = "Файл не найден";
loading.value = false; 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 = () => { const firstFile = () => {
let files = [] let files = []
props.docSections.type_comm.forEach(el => { props.docSections.type_comm.forEach(el => {
// console.log(el);
files.push(...el.comm.comitee_files) files.push(...el.comm.comitee_files)
}); });
props.docSections.type_resp.forEach(el => { props.docSections.type_resp.forEach(el => {
files.push(...el.resp.get_resp_files) 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)}`
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; filId.value = files[0].id;
console.log(pdfSource.value, "-------------------------------");
}; };
firstFile(); firstFile();
+6 -13
View File
@@ -28,13 +28,13 @@
<v-row no-gutters class="h-0 overflow-auto"> <v-row no-gutters class="h-0 overflow-auto">
<v-col> <v-col>
<v-col class="v-col-auto "> <v-col class="v-col-auto ">
<div class="text-h6 d-flex justify-center">Ответственные</div> <div class="text-h6 d-flex justify-center">Ответственность</div>
</v-col> </v-col>
<v-col class="v-col-auto"> <v-col class="v-col-auto">
<div v-if="responsibility != undefined && responsibility.length > 0" > <div v-if="responsibility != undefined && responsibility.length > 0" >
<v-expansion-panels> <v-expansion-panels variant="accordion">
<v-expansion-panel v-for="item in responsibility"> <v-expansion-panel v-for="item in responsibility">
<v-expansion-panel-title class="font-weight-medium"> <v-expansion-panel-title >
{{ item.resp.sphere_of_responsibility }} {{ item.resp.sphere_of_responsibility }}
</v-expansion-panel-title> </v-expansion-panel-title>
<v-expansion-panel-text> <v-expansion-panel-text>
@@ -56,9 +56,9 @@
</v-col> </v-col>
<v-col class="v-col-auto"> <v-col class="v-col-auto">
<div v-if="commitee != undefined && commitee.length > 0" > <div v-if="commitee != undefined && commitee.length > 0" >
<v-expansion-panels > <v-expansion-panels variant="accordion">
<v-expansion-panel v-for="item in commitee"> <v-expansion-panel v-for="item in commitee">
<v-expansion-panel-title class="font-weight-medium"> <v-expansion-panel-title>
{{ item.comm.name }} {{ item.comm.name }}
</v-expansion-panel-title> </v-expansion-panel-title>
<v-expansion-panel-text> <v-expansion-panel-text>
@@ -73,17 +73,10 @@
</div> </div>
<div v-else> <div v-else>
<div class="text-caption text-grey d-flex justify-center">Данные по комиссиям отсутствуют</div> <div class="text-caption text-grey d-flex justify-center">Данные по комиссиям отсутствуют</div>
</div> </div>
</v-col> </v-col>
</v-col> </v-col>
</v-row> </v-row>
<!-- <div class=" overflow-y-auto h-100 bg-orange">
</div> -->
</v-col> </v-col>
</v-row> </v-row>