SPA-126 готово

This commit is contained in:
Alex committed 2025-01-29 12:56:38 +03:00
1 parent 8f9f49b8ee
commit ffe9142621
3 files changed
+22 -20

No files matched your search

+1 -1
View File
@@ -32,7 +32,7 @@ class DictCompetencesType(models.Model):
class DictDepartment(models.Model): class DictDepartment(models.Model):
id = models.PositiveIntegerField(primary_key=True, db_comment='╥рсхы№э√щ эюьхЁ') id = models.IntegerField(primary_key=True, db_comment='╥рсхы№э√щ эюьхЁ')
id_curator = models.ForeignKey('DictEmployee', models.DO_NOTHING, db_column='id_curator', blank=True, null=True, db_comment='╚─ ъєЁрЄюЁр юЄфхыр', related_name='deps_curator') id_curator = models.ForeignKey('DictEmployee', models.DO_NOTHING, db_column='id_curator', blank=True, null=True, db_comment='╚─ ъєЁрЄюЁр юЄфхыр', related_name='deps_curator')
id_chief = models.ForeignKey('DictEmployee', models.DO_NOTHING, db_column='id_chief', related_name='dictdepartment_id_chief_set', blank=True, null=True, db_comment='╚─ эрўры№эшър юЄфхыр') id_chief = models.ForeignKey('DictEmployee', models.DO_NOTHING, db_column='id_chief', related_name='dictdepartment_id_chief_set', blank=True, null=True, db_comment='╚─ эрўры№эшър юЄфхыр')
name = models.CharField(max_length=500, db_comment='═рчтрэшх юЄфхыр') name = models.CharField(max_length=500, db_comment='═рчтрэшх юЄфхыр')
@@ -16,7 +16,7 @@
<v-card v-for="cardValue in searchTest" :key="cardValue.id" class="my-2 border-sm"> <v-card v-for="cardValue in searchTest" :key="cardValue.id" class="my-2 border-sm">
<v-row class="pa-2"> <v-row class="pa-2">
<v-col cols="1"> <v-col cols="1">
<v-img height="125" :src="cardValue.file" /> <v-img height="125" :src="`${baseURL.slice(0, -1)}` + cardValue.file" />
</v-col> </v-col>
<v-col cols="auto" class="d-flex flex-grow-1"> <v-col cols="auto" class="d-flex flex-grow-1">
<div class="d-flex flex-column justify-center flex-grow-1"> <div class="d-flex flex-column justify-center flex-grow-1">
@@ -48,6 +48,7 @@
<script> <script>
import moment from 'moment'; import moment from 'moment';
import { declOfNum } from '@/utils/universal_functions' import { declOfNum } from '@/utils/universal_functions'
import { baseURL } from "@/utils/axios-api";
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
export default { export default {
@@ -140,7 +141,7 @@ export default {
return val return val
} }
return { search, searchTest, momenter, activeTabIcon } return { search, searchTest, momenter, activeTabIcon, baseURL }
} }
} }
+18 -17
View File
@@ -6,7 +6,7 @@
<v-tabs-window v-model="activeTab" class="border-t-thin"> <v-tabs-window v-model="activeTab" class="border-t-thin">
<!-- Вкладка назначенные --> <!-- Вкладка назначенные -->
<v-tabs-window-item class="my-2 "> <v-tabs-window-item class="my-2 ">
<CatalogTest title="Назначенные" :activeTab="activeTab" :testingCard="sortedTests"> <CatalogTest title="Назначенные" :activeTab="activeTab" :testingCard="getAllTests">
<template #buttons> <template #buttons>
<v-btn color="#00897B1F" class="mr-2 text-teal-darken-1" elevation="0"> <v-btn color="#00897B1F" class="mr-2 text-teal-darken-1" elevation="0">
Тренироваться Тренироваться
@@ -19,7 +19,7 @@
</v-tabs-window-item> </v-tabs-window-item>
<!-- Вкладка завершенных --> <!-- Вкладка завершенных -->
<v-tabs-window-item> <v-tabs-window-item>
<CatalogTest title="Завершенные" :activeTab="activeTab" :testingCard="sortedTests"> <CatalogTest title="Завершенные" :activeTab="activeTab" :testingCard="getAllTests">
<template #results> <template #results>
<div> <div>
<v-icon icon="mdi-calendar-clock" size="large" /> <v-icon icon="mdi-calendar-clock" size="large" />
@@ -44,7 +44,7 @@
</CatalogTest> </CatalogTest>
</v-tabs-window-item> </v-tabs-window-item>
</v-tabs-window> </v-tabs-window>
{{ sortedTests }} {{ getAllTests }}
</v-container> </v-container>
</template> </template>
@@ -52,7 +52,7 @@
import CatalogTest from "@/components/testing/CatalogTest.vue"; import CatalogTest from "@/components/testing/CatalogTest.vue";
import { axiosApiInstance } from "@/utils/axios-api"; import { axiosApiInstance } from "@/utils/axios-api";
import { ref, computed } from "vue" import { ref, computed, watch } from "vue"
export default { export default {
components: { components: {
@@ -60,37 +60,38 @@ export default {
}, },
setup() { setup() {
const activeTab = ref(0); const activeTab = ref(0);
const currentTest = ref('')
const getAllTests = ref([]) const getAllTests = ref([])
const getTestById = () => { const getTestById = () => {
axiosApiInstance.get('/api/tests/testlist/').then(resp => getAllTests.value = resp.data.results)
let status = activeTab.value == 0 ? '?status=active' : activeTab.value == 1 ? '?status=completed' : ''
axiosApiInstance.get(`/api/tests/testlistcreate/${status}`).then(resp => getAllTests.value = resp.data).finally(() => {
if (activeTab.value == 0) {
currentTest.value = getAllTests.value.length
}})
} }
getTestById() getTestById()
const sortedTests = computed(() => { watch (() => activeTab.value,
let sorted = [] () => {
return getAllTests.value.filter( test => { getTestById()
if (test.datesart !== test.dateend) { }
return sorted = test )
} else if (new Date() > test.dateend) {
return sorted = test
}
})
})
const tabs = computed(() => [ const tabs = computed(() => [
{ value: 0, title: `Назначенные (${getAllTests.value.length})`, }, { value: 0, title: `Назначенные (${currentTest.value})`, },
{ value: 1, title: 'Завершенные', }, { value: 1, title: 'Завершенные', },
{ value: 2, title: 'Каталог', }, { value: 2, title: 'Каталог', },
]) ])
return { return {
activeTab, activeTab,
tabs, tabs,
getAllTests, getAllTests,
sortedTests
} }
} }
} }